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

📄 w99av2.bak.c

📁 车载电子影音系统dvd播放系统原程序代码
💻 C
📖 第 1 页 / 共 5 页
字号:
        }        return TRUE;        break;        // wyc.275a, add LPCM de-emphasis code in read info function.    case    W99AV_INFO_LPCM_DEEMPHASIS:        W99AV_ReadDM (W99AV_DM_LPCM_FREQ, &_dwTemp1) ;        _dwTemp1 &= 0x40;        if (_dwTemp1)            *pdwData = TRUE;        else            *pdwData = FALSE;        return TRUE;        break;    default :        return FALSE;        break;    }}// **************************************************************************//      Function        :       W99AV_CommandN//      Description     :       It process the command that take N parameters !!!//                              Or the DSP argument is not DSP_NOCMD//                              And this function will not be called in ISR////                              The process of execute a macro command of W9926QF//                              1.Clear CACK bit of PSR//                              2.Write Command_index(15:0) and Command_arg(31:16)//                              3.Write Extended Command Argument ARG1(31:0)//                                ~ARG15(31:0) if nexessary//                              4.Set Command Interrupt bit//                              5.Waiting for Command acknowledge//      Arguments       :       bCommandID:the command ID to be executed//      Return          :       TRUE of FALSE//      Side Effect     :       When the command is called in ISR, should use//                      :       a special buffer.// *********************************************************************#pragma NOAREGS         // be called in ISR// Chuan2.80, Disable interrupt within whole function#pragma DISABLE // will disable all interrupt for the duration of function                // can't use when function return is BIT// Chuan0.86, merge the GXA and original into 1 function.BYTE W99AV_CommandN(BYTE bCommandID){    // Chuan 276 2002/08/20: directly return value    // BIT     btGenCmdErr;    BYTE    i;    BYTE    bArgNo; // record the number of arguments    if(bCommandID==0xFF)  // not define command        return FALSE;    //Kevin1.24, pause->step ?    //if (bCommandID==COMMAND_PAUSE)    //    bCommandID=COMMAND_STEP;    // Brian1.00, set Command RAM for GXA    bArgNo = (BYTE)__dwW99AVCmdArg[1]; // must assign Command_Arg to BYTE, so the 4-bit/8-bit flag is omitted.    if (bCommandID == COMMAND_GDI && (bArgNo == CMDARG_FILL_RECT || bArgNo == CMDARG_BMP_COPY))    {        extern void _GDI_SetCMDRam(void);        _GDI_SetCMDRam();    }    // following is the valid command    bArgNo=(BYTE)__dwW99AVCmdArg[0];  // get the number of command arguments    // Step 1 : clear CACK bit of PSR    // Chuan2.80p, move to W99AV_SetCommandEnable()    //W99AV_ClearInterrupt(INT_CACK);  //     set bit(5)--CACKC in ISR    // Step 2 : write ARG0(31:0)--Command index and arguments    __dwW99AVCmdArg[1]=__dwW99AVCmdArg[1]<<16;      // set ARG0(31:16)=Command_arg    //Kevin1.23, comment    //if (bCommandID==COMMAND_PAUSE)    //    __dwW99AVCmdArg[1]=__dwW99AVCmdArg[1] | (DWORD)(COMMAND_STEP); // set ARG0(15:0)=Command_index    //else        __dwW99AVCmdArg[1]=__dwW99AVCmdArg[1] | (DWORD)bCommandID; // set ARG0(15:0)=Command_index    W99AV_OutIndex(0x10000000);      //     AIR(31:0)=0x10000000    W99AV_OutData(__dwW99AVCmdArg[1]);    // Chuan2.80, Now COMMAND_PAUSE use COMMAND_STEP to implement. So directly use COMMAND_STEP instead of COMMAND_PAUSE by define    //W99AV_OutIndex(0x10000000);      //     AIR(31:0)=0x10000000    //W99AV_OutData(((__dwW99AVCmdArg[1]<<16)|(DWORD)bCommandID));#ifdef DUMP_INFORMATION	    if (__btDumpFlag)    {        if (__bDumpType&INFO_MISC)            printf("\nCMD: 0x%lx",__dwW99AVCmdArg[1]);    }#endif    // Step 3 : write Extended Command Argument    for(i=2;i<=bArgNo;i++)    {        W99AV_OutIndex (0x0FFFFFFF+i) ;        W99AV_OutData(__dwW99AVCmdArg[i]);#ifdef DUMP_INFORMATION        if (__btDumpFlag)        {            if (__bDumpType&INFO_MISC)                printf(", 0x%lx",__dwW99AVCmdArg[i]);        }#endif    }#ifdef ACK_FROM_OTHERS    // Chuan0.86, PSFB command/ JPEG command need wait BERR because system have unknown CACK when issue PSFB cmd/ JPEG cmd.    // So clear INT_BERR first.    if ( (bCommandID == COMMAND_DRAMCOPY)  ||        (bCommandID == COMMAND_JPEG) ||         (bCommandID == COMMAND_PSFB) )    {        // Brian0.86        // use BERR as ACK        W99AV_ClearInterrupt(INT_BERR);    }#endif    // Step 4 : set Command Interrupt bit    // TCC161, remove _WriteSysRegW function    W99AV_SetCommandEnable();        // Step 5 :     waiting for Command acknowledge    // Chuan 276 2002/08/20: CommandID 0x01~0x07 not to wait the acknowledge    if (bCommandID<0x01 || bCommandID>0x07)    {        dwCnt=0;        while(1)        {#ifdef ACK_FROM_OTHERS            // Brian0.83a GDI and DRAMCOPY all use 0x1C as index            // so we use command argument to identify whether it is GDI command (1~3)            // Chuan0.86, PSFB command need wait BERR because system have unknown CACK when issue PSFB cmd            if ( (bCommandID == COMMAND_DRAMCOPY)  ||                (bCommandID == COMMAND_JPEG) ||                 (bCommandID == COMMAND_PSFB) )              {                // Brian0.86                // Use BERR as ACK                if((W99AV_GetPSR() & INT_BERR)!=0)                    break;            }            else#endif            {                if((W99AV_GetPSR() & INT_CACK)!=0)                    break;            }            dwCnt++;            // LLY.276p-4, larger ACK Loop count for "preset frame buffer command"            // Chuan 277 2002/09/11: larger ACK Loop count for "DRAMCOPY"            // Chuan0.86, COMMAND_JPEG need wait larger ACK Loop count.            if( (dwCnt>ACKLOOP_PSFB) ||               ((dwCnt>ACKLOOP)&&(bCommandID!=COMMAND_PSFB)&&(bCommandID<COMMAND_DRAMCOPY)) )            {#if defined (SERIAL_DEBUG) || defined(SUPPORT_PRINTF)                printf("\n4 Wait no ACK! ");                for(i=1;i<=bArgNo;i++)                    printf("%lx, ", __dwW99AVCmdArg[i]);                //Show DSP/RISC PC, V-Rem, A-Rem                printf("DEBR:%lx V:%lx A:%lx", W99AV_ReadRegDW(DEBR), W99AV_ReadRegDW (VBRR), W99AV_ReadRegDW (ABRR));#endif                return FALSE;            }        }    }    if (bCommandID==COMMAND_PAUSE) #ifdef GLOBAL_BUS_IO        W99AV_WriteInternalRegDW (ADCMR, 0x6, 0x0000) ;      // Audio Command - Pause#else        _WriteInternalRegDW_IO (ADCMR, 0x6, 0x0000) ;      // Audio Command - Pause#endif    else if (bCommandID==COMMAND_STEP) #ifdef GLOBAL_BUS_IO        W99AV_WriteInternalRegDW (ADCMR, 0x3, 0x0000) ;      // Audio Command - Step#else        _WriteInternalRegDW_IO (ADCMR, 0x3, 0x0000) ;      // Audio Command - Step#endif                    else if(bCommandID>=COMMAND_PLAY && bCommandID<COMMAND_PAUSE)#ifdef GLOBAL_BUS_IO        W99AV_WriteInternalRegDW (ADCMR, 0x1, 0x0000) ;      // Audio Command - Play#else        _WriteInternalRegDW_IO (ADCMR, 0x1, 0x0000) ;      // Audio Command - Play#endif    return TRUE;}// **************************************************************************//      Function        :       W99AV_Command1//      Description     :       It process the command that only take 1 parameter !!!//                              And the DSP argument is DSP_NOCMD//                              And this function will be called in ISR////                              The process of execute a macro command of W9926QF//                              1.Clear CACK bit of PSR//                              2.Write Command_index(15:0) and Command_arg(31:16)//                              3.Write Extended Command Argument ARG1(31:0)//                                ~ARG15(31:0) if nexessary//                              4.Set Command Interrupt bit//                              5.Waiting for Command acknowledge//      Arguments       :       bCommandID:the command ID to be executed//                              wArg0:the command argument//      Return          :       TRUE of FALSE//      Side Effect     :       When the command is called in ISR, should use//                      :       a special buffer.// **************************************************************************#pragma NOAREGS // called in ISR#pragma DISABLE // will disable all interrupt for the duration of function                // can't use when function return is BITBYTE W99AV_Command1(BYTE bCommandID,WORD wArg0){    // Chuan 276 2002/08/20: directly return value    //BIT     btGenCmdErr;    ////////////////////////////////////////////    ///// general command procedure    if(bCommandID==0xFF)  // Not define     command        return FALSE;    //Kevin1.24, pause->step ?    //if (bCommandID==COMMAND_PAUSE)    //    bCommandID=COMMAND_STEP;    // Step 1 : clear CACK bit of PSR    // Chuan2.80p, move to W99AV_SetCommandEnable()    //W99AV_ClearInterrupt(INT_CACK);  // set bit(5)--CACKC in ISR    // Step 2 : write ARG0(31:0)--Command index and arguments    //_dwTemp1=(DWORD)wArg0;    // set ARG0(31:16)=Command_arg    // Chuan2.80, Now COMMAND_PAUSE use COMMAND_STEP to implement. So directly use COMMAND_STEP instead of COMMAND_PAUSE by define    _dwTemp1=((DWORD)wArg0)<<16;    //Kevin1.23, comment    //if (bCommandID==COMMAND_PAUSE)    //    _dwTemp1=_dwTemp1 | (DWORD)(COMMAND_STEP); // set ARG0(15:0)=Command_index    //else        _dwTemp1=_dwTemp1 | (DWORD)bCommandID;   // set ARG0(15:0)=Command_index    W99AV_OutIndex(0x10000000);  // AIR(31:0)=0x10000000    W99AV_OutData(_dwTemp1);    //W99AV_OutData(((__dwW99AVCmdArg[1]<<16)|(DWORD)bCommandID));#ifdef DUMP_INFORMATION    if (__btDumpFlag)    {        if (__bDumpType&INFO_MISC)            printf("\nCMD: 0x%lx",_dwTemp1);    }#endif    // Step 4 : set Command Interrupt bit    W99AV_SetCommandEnable();            // Step 5 : waiting for Command acknowledge    if (bCommandID<0x01 || bCommandID>0x07)    {        wCnt=0;        while(1)        {            if((W99AV_GetPSR() & INT_CACK)!=0)                break;            if(wCnt++>ACKLOOP)  // polling time out            {#if defined (SERIAL_DEBUG) || defined(SUPPORT_PRINTF)                printf("\n3 Wait no ACK! %lx",_dwTemp1);                printf(" DEBR:%lx V:%lx A:%lx", W99AV_ReadRegDW(DEBR), W99AV_ReadRegDW (VBRR), W99AV_ReadRegDW (ABRR));                #endif                return FALSE;                break;            }        }    }    //DVD016-1, combined audio command with micro command            if (bCommandID==COMMAND_PAUSE)       #ifdef GLOBAL_BUS_IO        W99AV_WriteInternalRegDW (ADCMR, 0x6, 0x0000) ;      // Audio Command - Pause#else        _WriteInternalRegDW_IO (ADCMR, 0x6, 0x0000) ;      // Audio Command - Pause#endif    else if (bCommandID==COMMAND_STEP) //Kevin1.23, DSP implement STEP command#ifdef GLOBAL_BUS_IO        W99AV_WriteInternalRegDW (ADCMR, 0x3, 0x0000) ;      // Audio Command - Step#else        _WriteInternalRegDW_IO (ADCMR, 0x3, 0x0000) ;      // Audio Command - Step#endif                    else if(bCommandID>=COMMAND_PLAY && bCommandID<COMMAND_PAUSE)#ifdef GLOBAL_BUS_IO        W99AV_WriteInternalRegDW (ADCMR, 0x1, 0x0000) ;      // Audio Command - Play#else        _WriteInternalRegDW_IO (ADCMR, 0x1, 0x0000) ;      // Audio Command - Play#endif    return TRUE;}// **************************************************************************//      Function        :       W99AV_SetBufferThreshold//      Description     :       Set the audio/video buffer overflow/underflow threshold//      Arguments       :       bType, specify audio/video buffer over/under//                      :       dwSize, the size of threshold (only 20 bit is valid), DWORD unit//      Return          :       None//      Side Effect     :// **************************************************************************void W99AV_SetBufferThreshold(BYTE bType, DWORD dwSize){    switch(bType)    {    case    W99AV_VOVERFLOW :        // Chuan1.10, Don't need multiply by 2 from 20031106 RISC code.        // dwSize<<=1;  // Chuan2.80p, VOVERSETR is word count        W99AV_WriteRegDW(VBOVERSETR, LOWORD (dwSize), HIWORD (dwSize));        break;    case    W99AV_VUNDERFLOW :        // Chuan1.10, Don't need multiply by 2 from 20031106 RISC code.        // dwSize<<=1;  // Chuan2.80p, VOVERSETR is word count              W99AV_WriteRegDW(VBUNDERSETR, LOWORD (dwSize), HIWORD (dwSize));        break;    case    W99AV_AOVERFLOW :        W99AV_WriteRegDW(ABOVERSETR, LOWORD (dwSize), HIWORD (dwSize));        break;    case    W99AV_AUNDERFLOW:        W99AV_WriteRegDW(ABUNDERSETR, LOWORD (dwSize), HIWORD (dwSize) );        break;    default :        break;    }}// DVD_173Micky, add a W99AV_DRAMCopy API.//  **********************************************************************//  Function    :   DVDW99AV_DumpCopy//  Description :   Move from one DRAM location to another DRAM location//  Arguments   :   __dwW99AV_SrcDRAM   : the source DRAM location//              :   __dwW99AV_DestDRAM  : The destination DRAM location//              :   dwLen                : DWORD to move//  Return      :   The data length of reading successfully in DWORD unit//  Side Effect ://  *********************************************************************WORD W99AV_DRAMCopy(DWORD dwLen){#ifdef NO_RISC_DRAMCOPY    //WORD    wOffset = 0; Chuan 

⌨️ 快捷键说明

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