block_aml_dbg.h

来自「AMLOGIC DPF source code」· C头文件 代码 · 共 992 行 · 第 1/3 页

H
992
字号

        ARC_invalidate_dcache();
        while (1)
        {
            //~~~~~~~~~~~~~~~~
            unsigned char   ret;
            //~~~~~~~~~~~~~~~~

            Process_Remote_Command();
            if (dbguopcode == UOP_STOP)
            {
                goto display_end;
            }
            else if (dbguopcode == UOP_NEXT_CHAP)
            {
                if (i < ii)
                {
                    pagno++;
                    break;
                }
            }
            else if (dbguopcode == UOP_PREVIOUS_CHAP)
            {
                if (pagno > 0)
                {
                    pagno--;
                    i = dbg_page_no[pagno];
                    break;
                }
            }

            dbguopcode = 0;
        }

        dbguopcode = 0;
    }

display_end:
    dbguopcode = 0;
    dbgconsole_enable = 0;
}

unsigned    display_log_bx = 0x300;
unsigned    display_log_by = 65;

// =====================================================================================================================
// =======================================================================================================================
void Display_Log_InScreen(unsigned bufcount, unsigned chkbufcount)
{
    //~~~~~~~~~~~~~~~~~~~~~~~~~~
    #ifdef MEMWATCH

    char            buf[100];
    static unsigned value;
    static unsigned prevalue;
    static unsigned last_time = 0;;
    //~~~~~~~~~~~~~~~~~~~~~~~~~~

    if (Block_Print_Flag & 0x20000000)
    {
        value = bufcount;
    }
    else if (logaddress)
    {
        if ((logaddress >> 6) == 1)
        {
            value = *((volatile unsigned *) logaddress);
        }
        else
        {
            value = *((unsigned *) logaddress);
        }
    }

    if (((timer_jiffies - last_time) > 100) && (value != prevalue))
    {
        sprintf(buf, "%08x", value);
        #ifdef RCA_STYLE
        Clear_Rect(display_log_bx, display_log_by, 200, 40, 0, 2);
        asc_printf(display_log_bx + 5, display_log_by + 5, 0, buf, 2);
        #endif
        ARC_invalidate_dcache();
        prevalue = value;
        last_time = timer_jiffies;
    }
    #endif
}

// not AVOS
#endif

#else

// =====================================================================================================================
//    not _DEBUG_BLOCK
// =====================================================================================================================
int Block_printf(const char *fmt, ...)
{
}

// =====================================================================================================================
// =======================================================================================================================
void Display_Log_InScreen(unsigned bufcount, unsigned chkbufcount)
{
}
#endif
#if (defined _DEBUG_BLOCK) && (!(defined __ROM_))

// =====================================================================================================================
// =======================================================================================================================
void Display_Block_ID_ERROR(THOM_BUF_HDR *thombuf)
{
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    _VO unsigned char   *sector_ptr;
    int             i;
    unsigned        p_adr1;
    unsigned char   is_sector_error;
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Mini_printf("\n");
    for (i = 0, sector_ptr = thombuf->data; i < DMA_UNIT; i++, sector_ptr += SUNIT)
    {
        p_adr1 = Block_Adr((unsigned) sector_ptr, gheader_offset);
        is_sector_error = Block_Iserror((unsigned) sector_ptr);
        Mini_printf("%c%6x ", is_sector_error ? '*' : ' ', p_adr1);
    }
}

FILE            *raw_data_fp;
FILE            *data_fp;
FILE            *data_fp1;

FILE            *braw_data_fp;
FILE            *bdata_fp;
FILE            *bdata_fp1;

unsigned char   tempbufa[2 * 98 * 26];
unsigned char   temperror[2 * 98 * 26];

// =====================================================================================================================
// =======================================================================================================================
void Dump_CDDA_CONCEALMENT(unsigned sector_buf_raw, unsigned sector_buf_des)
{
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    int i, j, ie;
    volatile unsigned char  *sector_ptr = (volatile unsigned char *) sector_buf_raw;
    unsigned char           errorflag;
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    // extract error flag into another file
    errorflag = (*((volatile unsigned char *) (sector_ptr + 25))) >> 2;
    for (i = 0, ie = 0, j = 0; j < 98 * 26;)
    {
        if (errorflag & 0x1)
        {
            temperror[ie++] = 0x6f;
            temperror[ie++] = 0x6f;
            temperror[ie++] = 0x6f;
            temperror[ie++] = 0x6f;
        }
        else
        {
            temperror[ie++] = 0;
            temperror[ie++] = 0;
            temperror[ie++] = 0;
            temperror[ie++] = 0;
        }

        tempbufa[i++] = *((volatile unsigned char *) sector_ptr);
        sector_ptr++;
        tempbufa[i++] = *((volatile unsigned char *) sector_ptr);
        sector_ptr++;
        tempbufa[i++] = *((volatile unsigned char *) sector_ptr);
        sector_ptr++;
        tempbufa[i++] = *((volatile unsigned char *) sector_ptr);
        sector_ptr++;

        j += 4;
        errorflag >>= 1;
        if (((j + 2) % 26) == 0)
        {
            j += 2;
            sector_ptr += 2;
            errorflag = (*((volatile unsigned char *) (sector_ptr + 25))) >> 2;
        }
    }

    ARC_invalidate_dcache();
    fwrite(tempbufa, i, 1, braw_data_fp);
    fwrite(temperror, i, 1, bdata_fp);
    fwrite((unsigned char *) sector_buf_des, i, 1, bdata_fp1);
}

#define BUF_LOG_DEPTH                   500
#define BUF_PROCESS_RESET               0
#define BUF_PROCESS_ALLOC               1
#define BUF_PROCESS_DEALLOC             2
#define BUF_PROCESS_INTO_CHKBUF         3
#define BUF_PROCESS_OUT_CHKBUF          4
#define BUF_PROCESS_INTO_BUF            5
#define BUF_PROCESS_OUT_BUF             6
#define BUF_PROCESS_OTHER               7

#define COMMENT_THOMBUF0_SCH_READY      1
#define COMMENT_THOMBUF1_SCH_READY      2
#define COMMENT_THOMBUF0_SAVE           3
#define COMMENT_THOMBUF1_SAVE           4
#define COMMENT_THOMBUF0_EXCHANGE       5
#define COMMENT_PRETHOMBUF0_EXCHANGE    6
#define COMMENT_THOMBUF1_EXCHANGE       7
#define COMMENT_PRETHOMBUF1_EXCHANGE    8
#define COMMENT_ONLYTHOMBUF0_SCH_SEND   9
#define COMMENT_THOMBUF0_SCH_SEND       10
#define COMMENT_THOMBUF1_SCH_SEND       11
#define COMMENT_THOMBUF0_CHK_READY      12
#define COMMENT_THOMBUF0_CHK_SEND       13
#define COMMENT_PRETHOMBUF0_SEND        14
#define COMMENT_PRETHOMBUF1_SEND        15
#define COMMENT_FAILDATA_SEND           16
#define COMMENT_RETURN_BACK_BUF         17
#define COMMENT_USING_BUF               18
#define COMMENT_EMPTY_BUF               19
#define COMMENT_EMPTY_CHKBUF            20
#define COMMENT_FREE_PRETHOMBUF0        21
#define COMMENT_FREE_PRETHOMBUF1        22

typedef struct
{
    unsigned        pmsg;
    unsigned int    task;
    unsigned int    id;
    unsigned char   process;
    unsigned char   comment;
} BUF_LOG;
#if 0
static BUF_LOG          buf_log[BUF_LOG_DEPTH];
static int              cur_log_msg = 0;
static unsigned char    buf_log_comment[][30] =
{
    "standard",
    "thombuf0 sch ready",
    "thombuf1 sch ready",
    "thombuf0->pre_thombuf0",
    "thombuf1->pre_thombuf1",
    "(thombuf0)<->pre_thombuf0",
    "thombuf0<->(pre_thombuf0)",
    "(thombuf1)->pre_thombuf1",
    "thombuf1->(pre_thombuf1)",
    "sch half1 send thombuf0",
    "sch send thombuf0",
    "sch send thombuf1",
    "thombuf0 chk ready",
    "chk send thombuf0",
    "send prethombuf0",
    "send prethombuf1",
    "send fail data",
    "return back buf",
    "using buf",
    "empty buf",
    "empty chk buf",
    "free prethombuf0",
    "free prethombuf1"
};
#endif

// =====================================================================================================================
// =======================================================================================================================
void _LogBuf(unsigned pmsg, unsigned char process, unsigned char comment)
{
    #if 0   // ndef AVOS
    buf_log[cur_log_msg].pmsg = pmsg;
    buf_log[cur_log_msg].task = Mini_CurrentTask();
    buf_log[cur_log_msg].process = process;
    buf_log[cur_log_msg].comment = comment;
    buf_log[cur_log_msg].id = ((THOM_BUF_HDR *) pmsg)->sector;
    cur_log_msg++;
    if (cur_log_msg == BUF_LOG_DEPTH)
    {
        cur_log_msg = 0;
    }
    #endif
}

// =====================================================================================================================
// =======================================================================================================================
void _DisplayBufLog(void)
{
    //~~~~~
    #if 0   // ndef AVOS
    int i, j;
    //~~~~~

    gprintf("buf	     task         id	process     		comment\n");
    for (i = cur_log_msg; i < BUF_LOG_DEPTH; i++)
    {
        gprintf("%8x   %3x   %8x	 %20s  %30s",
                buf_log[i].pmsg,
                buf_log[i].task,
                buf_log[i].id,
                (buf_log[i].process == BUF_PROCESS_RESET) ? "reset" :
                    (buf_log[i].process == BUF_PROCESS_ALLOC) ? "alloc" :
                    (buf_log[i].process == BUF_PROCESS_DEALLOC) ? "dealloc" :
                    (buf_log[i].process == BUF_PROCESS_INTO_CHKBUF) ? "into chkbuf" :
                    (buf_log[i].process == BUF_PROCESS_OUT_CHKBUF) ? "out chkbuf" :
                    (buf_log[i].process == BUF_PROCESS_INTO_BUF) ? "into buf" :
                    (buf_log[i].process == BUF_PROCESS_OUT_BUF) ? "out buf" : "other",
buf_log_comment[buf_log[i].comment]);
        gprintf("\n");
    }

    for (i = 0; i < cur_log_msg; i++)
    {
        gprintf("%8x   %3x   %8x	 %20s  %30s",
                buf_log[i].pmsg,
                buf_log[i].task,
                buf_log[i].id,
                (buf_log[i].process == BUF_PROCESS_RESET) ? "reset" :
                    (buf_log[i].process == BUF_PROCESS_ALLOC) ? "alloc" :
                    (buf_log[i].process == BUF_PROCESS_DEALLOC) ? "dealloc" :
                    (buf_log[i].process == BUF_PROCESS_INTO_CHKBUF) ? "into chkbuf" :
                    (buf_log[i].process == BUF_PROCESS_OUT_CHKBUF) ? "out chkbuf" :
                    (buf_log[i].process == BUF_PROCESS_INTO_BUF) ? "into buf" :
                    (buf_log[i].process == BUF_PROCESS_OUT_BUF) ? "out buf" : "other",
buf_log_comment[buf_log[i].comment]);
        gprintf("\n");
    }
    #endif
}
#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?