⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cc1.c

📁 车载电子影音系统dvd播放系统原程序代码
💻 C
📖 第 1 页 / 共 3 页
字号:
// Micky2.36, use UTL_GetSysTimer() instead of __dwCountSystem
// ** TCH1.24a; Move Some APIs to this files. It's a extenstion of CC Module

#ifndef  SYSTEM_8051
//ccc
BOOL CC_Initial ()
{
    // LLY.171-1, merge I/R and H/W power on sequence
    //INITIAL_System ();
    INITIAL_System(INITIAL_SYSTEM | HARDWARE_SHUTDOWN);
//alex1.26-2,move CC_ScanDramPowerOn before INITIAL_PowerONStatus to reduce time in emulator
//-------------------------------------//
#if defined (SUPPORT_TEST_SINGLE_MUTI_RW_FOR_BANK) || defined (SUPPORT_DRAM_SCAN_POWERON) ////alex908
    CC_ScanDramPowerOn();
#endif //#ifdef SUPPORT_TEST_SINGLE_MUTI_RW_FOR_BANK
//-------------------------------------//

    // DVD_100Micky, merge I/R power on sequence with h/w power on.
    INITIAL_PowerONStatus(INITIAL_POWER_HARDWARE);
    return TRUE ;
}
void    CC_SendKey ( BYTE bKey )
{
    // LLY2.37p, remove __bISRKeyRead, because we will split IR and F/W key to __bISRKey and __bFWKey
    // So, it's un-necessary to reference it to decide input key source 
    //__bISRKeyRead=TRUE;
    __bISRKey= bKey;
}
#endif  //#ifndef  SYSTEM_8051

/////////////////////////////   DEBUG Usage //////////////////////////////
// Micky1.10, Let sysdebug.c share use the _ShowDebug function.
// As the printf only support printf hex value.
// So the display information will be all hex output under emulator or system.
#if defined(SUPPORT_PRINTF) || defined(SERIAL_DEBUG)
void    _ShowDebug ()
{
    DWORD   dwPC, dwTemp;
    WORD    wTemp;

    printf("\n !!! All information below are output by HEX format !!!");
    printf("\n------- DECODER Status-----------");
    W99AV_ReadInfo (W99AV_INFO_RISC_PC, &dwPC) ;
    printf ("\n** RISC PC=[0x%lx]; ", dwPC) ;
    W99AV_ReadInfo (W99AV_INFO_DSP_PC, &dwPC) ;
    printf ("DSP PC=[0x%lx]; ", dwPC) ;
    W99AV_ReadInfo (W99AV_INFO_VIDEO_REMAIN, &dwPC) ;
    printf ("V-REM=[0x%lx]; ", dwPC) ;
    //Kevin1.25, separate A1-Rem & A2-Rem
    //W99AV_ReadInfo (W99AV_INFO_AUDIO_REMAIN, &dwPC) ;
    W99AV_ReadInfo (W99AV_INFO_AUDIO1_REMAIN, &dwPC) ;
    printf ("A1-REM=[0x%lx]; ", dwPC) ;    
    W99AV_ReadInfo(W99AV_INFO_AUDIO2_REMAIN, &dwPC) ;
    printf ("A2-REM=[0x%lx]; ", dwPC) ;

    wTemp=W99AV_ReadRegW(PARSTATUSR);  // Chuan2.80, use mnemonic instead number
    printf("\nParser-Status=0x%x; ", wTemp);

    wTemp=W99AV_ReadRegW(BSFORMATR);
    printf("BSFORMATR=0x%x; ", wTemp);

    dwTemp=W99AV_ReadRegDW(PARCTLR);
    printf("PARCTLR=0x%lx; ", dwTemp);

    dwTemp=W99AV_ReadRegDW(VCR);
    printf("VCR=0x%lx; ", dwTemp);

    // DVD_155Micky, for 9928
//    dwTemp=W99AV_ReadRegDW(AVIDR);
    dwTemp=W99AV_ReadInternalRegDW(AVIDR);
    printf("AVIDR=0x%lx; ", dwTemp);

    dwTemp=W99AV_ReadRegDW(PCR);
    printf("PCR=0x%lx ;", dwTemp);

    W99AV_ReadInfo(W99AV_INFO_AFIFO_REMAIN, &dwTemp);
    printf("\nIABFIFO Rem=0x%lx; ",dwTemp);

    W99AV_ReadInfo(W99AV_INFO_IFIFO_REMAIN, &dwTemp);
    printf("IBFIFO Rem=0x%lx; ",dwTemp);

    // LLY.274p-3, add some extra debug info.
    __dwTemp=W99AV_ReadRegDW(PARFIFOCTLR);
    printf("PARFIFOCTLR=0x%lx; ", __dwTemp);

    __dwTemp=W99AV_ReadRegDW(BSFIFOREMR);
    printf("BSFIFOREMR=0x%lx; ", __dwTemp);

    __dwTemp=W99AV_ReadRegDW(PARFIFOREMR);
    printf("PARFIFOREMR=0x%lx; ", __dwTemp);

    dwTemp=W99AV_GetPSRDW();
    printf("\nPSR=0x%lx; ", dwTemp);

    // Issue command debug 1 to readback SP buffer count
    W99AV_Command1(COMMAND_RDEBUGINFO,CMDARG_RDEBUGINFO);  // Chuan2.80p Use define instead of number
// ** TCH0.62;     W99AV_OutIndex(0x10000000);
// ** TCH0.62;     __dwTemp=W99AV_InData();
    printf("Cmd_Debug1= ");
    for ( wTemp= 0; wTemp< 5; wTemp++ )         // Dump more data for debug
    {
        W99AV_OutIndex(0x10000000+ wTemp);
        __dwTemp=W99AV_InData();
        printf("%lx; ", __dwTemp);
    }
    // ** TCH0.62; end... 

    // ** TCH1.00-1-908; begin... 
    W99AV_ReadDM (W99AV_DM_VIDEO_MASTER, & __dwTemp );
    printf("V-Ma=0x%lx; ", __dwTemp);
    W99AV_ReadDM (W99AV_DM_RISC_UPDATE_STC, & __dwTemp );
    printf("Up_STC=0x%lx; ", __dwTemp);    
    // ** TCH1.00-1-908; end... 

//DVD_037RECOVER
{
extern BYTE    _bCheckNVData;
extern DWORD   __dwVOBUStart;      // it records the logical sector for VOBU start
extern DWORD   __dwVOBUEnd;        // it records the logical sector for VOBU end
extern DWORD   gdwNextLBA;
extern BYTE    __bResetRecover;  // wyc1.07, rename because of MONIITOR have rename it.
extern  BYTE    __bTotalFailCount;
extern  BYTE    _bNVRecover;
void    _ShowServoDebug(void);

// Micky0.85, display below information only when DVD title
if (__wDiscType & BOOK_DVD)
{
    printf("\n------- CELL Status--------------");
    printf("\n_bCheckNVData=0x%hx; __bCellState=0x%hx",_bCheckNVData, __bCellState);
    printf("_bNVRecover=0x%hx; ",_bNVRecover);
    printf("\n__dwVOBUStart-__dwVOBUEnd=0x%lx-0x%lx; ", __dwVOBUStart, __dwVOBUEnd);
    // Micky1.10, print SECIDR
    __dwTemp=W99AV_ReadRegDW(SECIDR);
    printf("SECIDR-0x30000 = 0x%lx;", (__dwTemp & 0x00FFFFFF)-0x30000);
//DVD_038NVRECOVER
}
    printf("\n------- Hang Status--------------");
    printf("\ngdwNextLBA=0x%lx;",gdwNextLBA);
    printf("\n__bRecoverStage=0x%hx; ", __bRecoverStage);
    printf("__wMonitorLackIFD=0x%x; ", __wMonitorLackIFD);
    printf("__bResetRecover=0x%hx; ", __bResetRecover);  // wyc1.07, rename because of MONIITOR have rename it.
    printf("__bTotalFailCount=0x%hx; ", __bTotalFailCount);
    printf("\n------- SERVO Status-------------");
    _ShowServoDebug();
}
}
#endif  //#if defined(SUPPORT_PRINTF) || defined(SERIAL_DEBUG)

//  LLY.275b-2 create ...
//  *****************************************************************
//  Function    :   _CC_DebugInfo
//  Description :   Use to show the debug info. by OSD/ PANEL
//                  In hex unit for OSD mode; in dec unit for PANEL mode
//  Return      :   None
//  Side Effect :
//  *****************************************************************
#ifdef  _DEBUG_INFO
void _CC_DebugInfo(DWORD dwVal, BYTE bSec)
{
    // Always return while in non-debug mode
    if(!_bDebugMode)
        return;

    __bMsgString[0]='0';
    __bMsgString[1]='x';
    // Convert DWORD value to hex string
    COMUTL_DWORD2HexStr(&__bMsgString[2], dwVal);
    __bMsgString[10]=NULL;  // end of string
    OSD_Output(MSG_STRING, NULL, bSec);
    PANEL_Output(MSG_VERSION, HIWORD(dwVal));
    UTL_DelayTime((WORD)COUNT_1_SEC, FALSE);
    PANEL_Output(MSG_VERSION, LOWORD(dwVal));
    UTL_DelayTime((WORD)COUNT_1_SEC, FALSE);
}
#endif  //  #ifdef _DEBUG_INFO

// Brian.170
//  *********************************************************************
//  Function    :   _AutoVocal()
//  Description :   Accoding to the __sbMICDetect to turn on/off the vocal
//  Arguments   :   bValidKey
//  Return      :   bValidKey
//  Side Effect :
//  *********************************************************************
// This part of code is moved from the main loop, to simplify the flow and for easy reading
#ifdef  ENABLE_AUTOVOCAL
BYTE _AutoVocal(BYTE bValidKey)
{
    // DVD_104Micky, check mic control only when karaoke is on.
    if (__SetupInfo.bAudioKaraoke == SETUP_AUDIO_KARAOKE_ON)
    {
    if (UTL_GetSysTimer() - __dwMICDectectInterval> COUNT_100_MSEC)
    {
#ifdef  SW_MIC_DETECT
        CHIPS_MICDetect();
#endif
        __dwMICDectectInterval = UTL_GetSysTimer();

        if (__sbMICDetect ==_btPreMICDetect)
        {
#ifdef  SUPPORT_MIC_DETECT_INV
            if ( ! __sbMICDetect )
#else
            if ( __sbMICDetect )
#endif
                    _bMICOffCount++;
        }
        else
        {
            _bMICOffCount = 0;
        }
    if ( __bAutoVocal )
    {
#ifdef  SUPPORT_MIC_DETECT_INV      // ** TCH1.54; Active= HIGH. Mic has I/P.
        if ( ! __sbMICDetect )  // ** TCH1.54; Active= 1.
#else
        if ( __sbMICDetect )  // ** TCH1.54; Active= 0.
#endif
        {   // NO MIC Input
            if ( __bVocal == VOCAL_OFF && _bMICOffCount > 10)
            {
                // DVD_103Micky, fix auto vocal won't have effect
                {
                    // LLY2.37p, assign KEY_VOCAL from F/W key. 
                    // To avoid IR and F/W key conflict issue
                    //__bISRKey = KEY_VOCAL;
                    __bFWKey = KEY_VOCAL;
                    __bKeyMessage=MSG_VOCAL;    // force the message to display
                    _bMICOffCount = 0;
                }
            }
        }
        else
        {
            if ( __bVocal == VOCAL_ON)
            // DVD_103Micky, fix auto vocal won't have effect
            {
                // LLY2.37p, assign KEY_VOCAL from F/W key. 
                // To avoid IR and F/W key conflict issue
                //__bISRKey = KEY_VOCAL;
                __bFWKey = KEY_VOCAL;
                __bKeyMessage=MSG_VOCAL;    // force the message to display
            }
        }
    } // end if ( __bAutoVocal )

        _btPreMICDetect = __sbMICDetect; // keep the previous detect result
    } // end if (__dwCountSystem - __dwMICDectectInterval> COUNT_100_MSEC)

    } // end if (__SetupInfo.bAudioKaraoke == SETUP_AUDIO_KARAOKE_ON)

    return bValidKey;
}
#endif  // ENABLE_AUTOVOCAL
// Micky2.81, put show IR map codes into a function.
#ifdef  _SHOW_IR_MAP
void _CC_ShowIRMap()
{
    if ( _bIRGet )
    {
        _bIRGet= FALSE;
        COMUTL_BYTE2HexStr ( (__bMsgString ), _bIRMap[0] );
        COMUTL_BYTE2HexStr ( (__bMsgString +3), _bIRMap[1] );
        COMUTL_BYTE2HexStr ( (__bMsgString +6), _bIRMap[2] );
        COMUTL_BYTE2HexStr ( (__bMsgString +9), _bIRMap[3] );
        __bMsgString[2]= '-';
        __bMsgString[5]= '-';
        __bMsgString[8]= '-';
        __bMsgString [11]= NULL;
        OSD_Output ( MSG_STRING, NULL, 1 );
        UTL_DelayTime ( COUNT_1_SEC, TRUE );
    }
}
#endif  //#ifdef  _SHOW_IR_MAP

// Micky1.05, add auto test for IC sorting by CoCo
#ifdef AUTO_TEST
void _CC_AutoTest(void)
{
    if (__bAutoTest)
    {        
        if (__wDiscType != NO_DISC_IN_DRIVE)
        {
            if (__wDiscType & BOOK_DVD)
                _wpRule = aDVDRule;
            else if (__wDiscType & BOOK_CDROM)
                _wpRule = aCDROMRule;
            else
                __bAutoTest = FALSE;
            
            if (__bAutoTest)
            {
                if ((UTL_GetSysTimer() - __dwAutoTestTime) > (DWORD)_wpRule[__bRuleIndex])
                {
                    if ((_wpRule[__bRuleIndex] == 0) && (_wpRule[__bRuleIndex+1] == 0))
                    {                    
                        __bAutoTest = FALSE;
                    }   
                    else
                    {      
                        if (__bKey == KEY_NO_KEY)
                        {
                            __bRuleIndex++; 

⌨️ 快捷键说明

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