block_aml_dbg.h

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

H
992
字号
                if ((i == (DMA_UNIT - 1)) && (nbuf))
                {
                    GetQSubCode_Ext(tempqsubcode, (unsigned) (sector_ptr), (unsigned) (nbuf->data), ls0s1_offset);
                }
                else
                {
                    GetQSubCode(tempqsubcode, (unsigned) (sector_ptr + ls0s1_offset));
                }

                if ((qch_crc_core(tempqsubcode) == 0xffff) && ((tempqsubcode[0] & 0xf) == 1))
                {
                    is_adr_error = 0;
                }
                else
                {
                    is_adr_error = 1;
                }

                p_adr1 = (MU * bcd2hex(tempqsubcode[7]) + SU * bcd2hex(tempqsubcode[8]) + bcd2hex(tempqsubcode[9]));
                if (cd_read_type > 1)
                {
                    p_adr1 += address_diff;
                }
            }

        Block_printf("%c%c%6x", is_adr_error ? '#' : ' ', is_sector_error ? '*' : ' ', p_adr1);
    }

    Block_printf("\n");
}

// =====================================================================================================================
// =======================================================================================================================
void Block_printf_decodebuf_state(THOM_BUF_HDR *tbuf)
{
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    int             i;
    unsigned        p_adr1;
    unsigned char   is_sector_error;
    unsigned char   is_adr_error;
    _VO unsigned char   *sector_ptr;
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    for (i = 0, sector_ptr = tbuf->data; i < (tbuf->max - tbuf->sector); i++, sector_ptr += SUNIT)
    {
        is_sector_error = (tbuf->errorflag >> i) & 0x1;
        msfbcd2adr(p_adr1, sector_ptr[0], sector_ptr[1], sector_ptr[2]);
        is_adr_error = 0;
        Block_printf("%c%c%6x", is_adr_error ? '#' : ' ', is_sector_error ? '*' : ' ', p_adr1);
    }

    Block_printf("\n");
}

// =====================================================================================================================
// =======================================================================================================================
void Block_printf_decodebuf_cdda_state(THOM_BUF_HDR *tbuf)
{
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    int             i, ii;
    unsigned        p_adr1;
    unsigned char   is_sector_error;
    unsigned char   is_adr_error;
    _VO unsigned char   *sector_ptr;
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    is_sector_error = 0;
    for (i = 0, sector_ptr = tbuf->data; i < (tbuf->max - tbuf->sector); i++, sector_ptr += SUNIT)
    {
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        _VO unsigned char   *buf = (_VO unsigned char *) (sector_ptr + 2352);
        unsigned char       tempqsubcode[14];
        unsigned char       jjj;
        int iii = 7;
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        jjj = 0;
        tempqsubcode[jjj] = 0;
        for (ii = 0; ii < 96; ii++)
        {
            tempqsubcode[jjj] |= (((*buf) >> 6) & 0x1) << iii;
            buf++;
            iii--;
            if (iii < 0)
            {
                iii = 7;
                jjj++;
                tempqsubcode[jjj] = 0;
            }
        }

        if ((qch_crc_core(tempqsubcode) == 0xffff) && ((tempqsubcode[0] & 0xf) == 1))
        {
            is_adr_error = 0;
        }
        else
        {
            is_adr_error = 1;
        }

        p_adr1 = (MU * bcd2hex(tempqsubcode[7]) + SU * bcd2hex(tempqsubcode[8]) + bcd2hex(tempqsubcode[9]));
        Block_printf("%c%c%6x", is_adr_error ? '#' : ' ', is_sector_error ? '*' : ' ', p_adr1);
    }

    Block_printf("\n");
}

typedef struct
{
    unsigned    buffer_empty_times;
    unsigned    error_times;
    unsigned    incontinual_address_times;
    unsigned    row_skip_ext_times;
    unsigned    row_insert_times;
    unsigned    edc_retry_times;
    unsigned    edc_retryfail_times;
    unsigned    not_seamless_times;
} CONCEALMENT_LOG;
CONCEALMENT_LOG blocklog;
#define CDDAEVENT_BUFFER_EMPTY          1
#define ERROR_OCCUR                     2
#define CDDAEVENT_INCONTINUAL_ADDRESS   3
#define CDDAEVENT_ROW_SKIP_EXT          4
#define CDDAEVENT_ROW_INSERT            5
#define VCDEVENT_EDC_RETRY              6
#define VCDEVENT_EDC_RETRYFAIL          7
#define CDDAEVENT_NOT_SEAMLESS          8

// =====================================================================================================================
// =======================================================================================================================
void blocklog_clear(void)
{
    memset(&blocklog, 0, sizeof(blocklog));
}

// =====================================================================================================================
// =======================================================================================================================
void blocklog_increase_event(unsigned char event)
{
    switch (event)
    {
    case CDDAEVENT_BUFFER_EMPTY:        blocklog.buffer_empty_times++; break;
    case ERROR_OCCUR:                   blocklog.error_times++; break;
    case CDDAEVENT_INCONTINUAL_ADDRESS: blocklog.incontinual_address_times++; break;
    case CDDAEVENT_ROW_SKIP_EXT:        blocklog.row_skip_ext_times++; break;
    case CDDAEVENT_ROW_INSERT:          blocklog.row_insert_times++; break;
    case VCDEVENT_EDC_RETRY:            blocklog.edc_retry_times++; break;
    case VCDEVENT_EDC_RETRYFAIL:        blocklog.edc_retryfail_times++; break;
    case CDDAEVENT_NOT_SEAMLESS:        blocklog.not_seamless_times++; break;
    }
}

#ifndef AVOS
extern unsigned Servo_Print_Flag;
unsigned        dbgconsole_enable = 0;
unsigned short  dbgconsole_curx, dbgconsole_cury, dbgconsole_width, dbgconsole_height;
unsigned short  dbg_each_pos[1024];
unsigned short  dbg_page_no[128];
unsigned char   *tempprintfbuf;

unsigned char   dbguopcode;
unsigned        logaddress = 0;
unsigned        dbgconsole_inputvalue;
unsigned        dbgconsole_upflag;

// =====================================================================================================================
// =======================================================================================================================
void DbgConsole(void)
{
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #ifdef MEMWATCH

    char        *buf = (char *) (&(dbg_each_pos[0]));
    unsigned    bx, by;
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    bx = 100;
    by = 100;
    if (dbgconsole_enable == 0)
    {
        return;
    }

    logaddress = 0;
    dbgconsole_width = 1000;
    dbgconsole_height = 560;
    Initialize_Setup_Menu(1);
    sprintf(buf, "Input with remoter controler:");
    asc_printf(bx, 50, 0, buf, 1);
    input_num = 0;
    while (1)
    {
        Process_Remote_Command();
        if (dbguopcode == UOP_STOP)
        {
            break;
        }
        else if (dbguopcode == UOP_UP)
        {
            dbgconsole_upflag = 10;
        }
        else if ((dbguopcode >= UOP_0 && dbguopcode <= UOP_9))
        {
            if (input_num >= 8)
            {
                goto NUM_CLEAR;
            }
            else
            {
                input_num++;
                dbgconsole_inputvalue = (dbgconsole_inputvalue << 4) + uopcode - UOP_0 + dbgconsole_upflag;
                dbgconsole_upflag = 0;
                sprintf(buf, "%08x", dbgconsole_inputvalue);
                #ifdef RCA_STYLE
                Clear_Rect(bx, by, 200, 30, 0, 1);
                asc_printf(bx, by, 0, buf, 1);
                #endif
                ARC_invalidate_dcache();
            }
        }
        else if (dbguopcode == UOP_ENTER)
        {
            input_num = 0;
            if ((dbgconsole_inputvalue >> 6) == 1)
            {
                dbgconsole_inputvalue = *((volatile unsigned *) dbgconsole_inputvalue);
            }
            else
            {
                dbgconsole_inputvalue = *((unsigned *) dbgconsole_inputvalue);
            }

            sprintf(buf, "%08x\n", dbgconsole_inputvalue);
            #ifdef RCA_STYLE
            Clear_Rect(bx, by, 200, 30, 0, 1);
            asc_printf(bx, by, 0, buf, 1);
            #endif
            ARC_invalidate_dcache();
            dbgconsole_inputvalue = 0;
        }
        else if (dbguopcode == UOP_END_PAUSE)
        {
            logaddress = dbgconsole_inputvalue;
            dbgconsole_inputvalue = 0;
            break;
        }
        else if (dbguopcode == UOP_FAST_FORWARD)
        {
            Block_Print_Flag = dbgconsole_inputvalue;
            dbgconsole_inputvalue = 0;
            break;
        }
        else if (dbguopcode == UOP_FAST_BACKWARD)
        {
            Servo_Print_Flag = dbgconsole_inputvalue;
            dbgconsole_inputvalue = 0;
            break;
        }
        else if (dbguopcode == UOP_CLEAR)
        {
NUM_CLEAR:
            input_num = 0;
            dbgconsole_inputvalue = 0;
            sprintf(buf, "%08x", dbgconsole_inputvalue);
            #ifdef RCA_STYLE
            Clear_Rect(bx, by, 200, 30, 0, 1);
            asc_printf(bx, by, 0, buf, 1);
            #endif
            ARC_invalidate_dcache();
        }

        dbguopcode = 0;
    }

    dbguopcode = 0;
    dbgconsole_enable = 0;
    MessageBox(0, 2, "", "Leave From DbgConsole!", "", "", "", "");
    #endif
}

// =====================================================================================================================
// =======================================================================================================================
void DbgConsoleDisplay(int ii, char *disp_content)
{
    //~~~~~~~~~~~~~~~~~~~~
    unsigned short  bx, by;
    unsigned short  pagno;
    int             i, j, k;
    //~~~~~~~~~~~~~~~~~~~~

    if (progressive_out && (hd_out_type != 0))
    {
        dbgconsole_width = 1000;
        dbgconsole_height = 560;
    }
    else
    {
        dbgconsole_width = 590;
        dbgconsole_height = 300;
    }

    dbgconsole_enable = 1;
    i = 0;
    pagno = 0;
    while (i < ii)
    {
        Initialize_Setup_Menu(1);
        bx = 0x20;
        by = 0x25;
        dbgconsole_cury = 0;
        dbg_page_no[pagno] = i;
        while (dbgconsole_cury < dbgconsole_height)
        {
            tempprintfbuf = &(Block_Delay_printf_buf[0]);
            j = dbg_each_pos[i];
            k = sprintf(tempprintfbuf, "%d>", i);
            while (j < dbg_each_pos[i + 1])
            {
                tempprintfbuf[k++] = disp_content[j++];
            }

            tempprintfbuf[k] = 0;
            if (tempprintfbuf[k - 1] == '\n')
            {
                tempprintfbuf[k - 1] = 0;
            }

            asc_printf(0x20, by, 0, tempprintfbuf, 1);
            by = dbgconsole_cury;
            i++;
        }

⌨️ 快捷键说明

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