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

📄 ucode4.c

📁 车载电子影音系统dvd播放系统原程序代码
💻 C
📖 第 1 页 / 共 2 页
字号:
#include "winav.h"
#include "w99av.h"
#include "ucode.h"
#include "cc.h"

/////////////////////////////////////////////////////////////////////
// ***** Big Modification History Area *****
// Chuan 278 2002/10/28: The PRAM/ERAM must download together, else DSP will run at wrong 
// code after release audio. For example: The first instruction is jump to ERAM for JPGPRAM. 
// But at that time, JPGERAM is not ready. If it jump to critical point, it may make DSP crash.
// UCODE_PMRAM_XXX / UCODE_ERAM_XXX -> UCODE_DSPRAM_XXX
#ifdef SUPPORT_GZIP_COMPRESSION
WORD code _wIRAMData[]=
{
#include "iram.txt"
};


//Kevin2.37, modify
void _Unzip_IRAM(void)
{
    W99AV_FillDataToIABFIFO(_wIRAMData[1], &_wIRAMData[5]);
}


#else


#ifdef SYSTEM_8051
/*
DWORD code _dwTONPRAM[]=
{
    #include "tonpram.inc"
};
DWORD code _dwTONERAM[]=
{
    #include "toneram.inc"
};
*/

DWORD code _dwDVDPRAM[]=
{
//Kevin108, modify
//#include "dvdpram.inc"
0
};
DWORD code _dwDVDERAM[]=
{
//Kevin1.08, modify
//#include "dvderam.inc"
0
};

//Kevin1.08
#ifdef SUPPORT_WMA
DWORD code _dwWMAPRAM[]= 
{
#include "wmapram.inc"    
};
DWORD code _dwWMAERAM[]= 
{
#include "wmaeram.inc"
};
#endif

// Chuan1.10, Move Parser Code to UCODE4
// include the micro-code of PRAM
DWORD code _dwDVDPAR[]=
{
#include "dvdpar.inc"
};

// Chuan 278 2002/10/30: The code related to CSS key management in DVDPRAM.INC has been moved out.
DWORD code _dwKEYPAR[]=
{
#include "keypar.inc"
};

DWORD code _dwALLPAR[] =
{
#include "allpar.inc"
};

// wyc1.10, new parser code.
DWORD code _dwDATPAR[] =
{
#include "datpar.inc"
};

// include the micro-code of MP3's PRAM
DWORD code _dwCDROMPAR[]=
{
#include "cdrompar.inc"
};

#endif //#ifdef SYSTEM_8051

// ********************************************************************
//  Function    :   UCODE4_LoadCode
//  Description :   Download the desired micro-code
//  Arguments   :   bRam, the desired ucode;
//  Return      :   TRUE or FALSE
//  Side Effect :
// ********************************************************************
#pragma DISABLE
BYTE UCODE4_LoadCode(BYTE bRam, BYTE bCode)
{
   bRet = TRUE ;

    switch (bRam)
    {
    // Chuan1.10, Move Parser Code to UCODE4
    case UCODE_PRAM :
        // Depending on the desired subtype to load ucode
        switch (bCode)
        {
        case UCODE_DVDPRAM :
#ifdef SYSTEM_8051
            dwRAM = _dwDVDPAR ;
#else
            bRet = _OpenUCODE ("dvdpar.inc");  
#endif
            break ;
        // Chuan 278 2002/10/30: The code related to CSS key management in DVDPRAM.INC has been moved out.
        case UCODE_KEYPRAM :
#ifdef SYSTEM_8051
            dwRAM = _dwKEYPAR ;
#else
            bRet = _OpenUCODE ("keypar.inc"); 
#endif
            break ;
        case UCODE_CDROMPRAM :
#ifdef SYSTEM_8051
            dwRAM = _dwCDROMPAR ;
#elif defined(BITSTREAM_WITHOUT_SYNC)
            bRet = _OpenUCODE ( "dosall.inc" ); // Chuan2.80p, DosTest - Host path w/o SYNC
#else
            bRet = _OpenUCODE ( "cdrompar.inc" ); // Chuan2.80p, Emulator ATAPIIF/CDIF only
#endif
            break ;
        case UCODE_ALLPRAM :
#ifdef SYSTEM_8051
            dwRAM = _dwALLPAR ;
#elif defined(BITSTREAM_WITHOUT_SYNC)
            bRet = _OpenUCODE ( "dosall.inc" ); // Chuan2.80p, DosTest - Host path w/o SYNC
#else
            bRet = _OpenUCODE ( "allpar.inc" ); // Chuan2.80p, Emulator ATAPIIF/CDIF only
#endif
            break ;

        // wyc1.10, new parser code for playing DVD-DAT / CD-DAT files.
        case UCODE_DATPRAM:
#ifdef SYSTEM_8051
            dwRAM = _dwDATPAR ;
#else
            bRet = _OpenUCODE ( "datpar.inc" ); // Chuan2.80p, Emulator ATAPIIF/CDIF only
#endif
            break;

#ifdef BITSTREAM_WITHOUT_SYNC
        case UCODE_DOSJPEG:
            bRet = _OpenUCODE ( "dosjpeg.inc" ); // Chuan2.80p, DosTest - Host path w/o SYNC
            break ;
#endif

        default :
#ifdef SUPPORT_PRINTF
            printf ("\nWrong Parser Ramcode specified !") ;
#endif
            return FALSE ;
        }

        // LLY.0411, using HAL_Reset(HAL_RESET_PARSER), becasue it will
        // issue disable parser and parser reset.
        // Must call HAL_ControlParser(HAL_PARSER_ENABLE, NULL)
        // LLY.043, fix recursive call -- expand HAL_Reset(HAL_RESET_PARSER) procedure
        // LLY.050-1, push 16 DWORD zero to vcfifo before parser reset
        __dwW99AVCmdArg[0]=2;
        __dwW99AVCmdArg[1]=0xFFFF;  // don't care commnad argument
        __dwW99AVCmdArg[2]=0x00102000; // [31:16]: data cnt; [15:0] specify fifo
        W99AV_CommandN(COMMAND_FFIFO);  // Chuan2.80p, Use define instead of number
        __wW99AVPCRLow &= 0xDFFF ;  //(Bit 13, Parser Disable)
        // LLY.041-3 begin ....
        W99AV_WriteRegDW (PCR, __wW99AVPCRLow, __wW99AVPCRHigh) ;
        // LLY.041-3 end ...
        // Soft Reset Parser
        __wW99AVPCRLow |= 0x1000 ;  //(Bit 12, Parser Reset)
        W99AV_WriteRegDW (PCR, __wW99AVPCRLow, __wW99AVPCRHigh) ;
        // LLY.043 end ...

        // download parser ram
        for (_UCODEIndex=0; _UCODEIndex<dwRAM[1]; _UCODEIndex++)
        {
            // Chuan DVD_171 12/11/2001: use simple way
            W99AV_OutIndex (W99AV_AIRID_PARRAM | _UCODEIndex) ;
            W99AV_OutData (dwRAM [_UCODEIndex+START]) ;            
        }

        // LLY.043, fix recursive call -- expand HAL_ControlParser(HAL_PARSER_ENABLE, NULL) procedure
        // Restore previous state
        __wW99AVPCRLow &= 0xEFFF ;  //(Bit 12, Parser Reset)
        // LLY.0411 begin ....
        W99AV_WriteRegDW (PCR, __wW99AVPCRLow, __wW99AVPCRHigh) ;
        // LLY.0411 end ...
        // DVD016, not enable parser
        //DVD016MICKY
        __wW99AVPCRLow |= 0x2000 ;  //(Bit 13, Parser Enable)
        W99AV_WriteRegDW (PCR, __wW99AVPCRLow, __wW99AVPCRHigh) ;
        // LLY.043 end ...
        break ;
        
    case    UCODE_DSPRAM :
        // Chuan 278 2002/10/28: Load DSP PRAM first.
        if (_bDSPramCur == bCode)
        {
            // TCC040, let upper level know that code not changed
            bRet = UCODE_LOAD_NONE ;
            break ;
        }

        _bDSPramCur = bCode ;
        switch (bCode)
        {
/*
        case UCODE_DSPRAM_TONE:
    #ifdef SYSTEM_8051
            dwRAM = _dwTONPRAM ;
    #else
            bRet = _OpenUCODE ( "tonpram.inc" );
    #endif
            break ;
*/
        case UCODE_DSPRAM_DVD:
    #ifdef SYSTEM_8051
            dwRAM = _dwDVDPRAM ;
    #else
            bRet = _OpenUCODE ( "dvdpram.inc" );
    #endif
            break ;
#ifdef SUPPORT_WMA
        case UCODE_DSPRAM_WMA:  //Kevin1.08
    #ifdef SYSTEM_8051
            dwRAM = _dwWMAPRAM ;
    #else
            bRet = _OpenUCODE ( "wmapram.inc" );
    #endif
            break ;
#endif
        }
        // Chuan 278 2002/10/28: Keep A_RST high
        W99AV_WriteRegDW (PCR,(WORD)(__wW99AVPCRLow|0x20), __wW99AVPCRHigh) ;
        _UCODEIndex = (WORD)dwRAM[1];
        dwRAM += START;
        for (__wTemp=0; __wTemp<_UCODEIndex; __wTemp++)
        {
            // Chuan DVD_171 12/11/2001: use simple way
#if  IO == IO_PCI
            W99AV_OutIndex (W99AV_AIRID_DSPMEM | 0x00010000L | __wTemp) ;
#else
            // Chuan1.00, Don't use function in order to reduce load code time.
            OUTB(AIR3, HIBYTE(HIWORD(W99AV_AIRID_DSPMEM))) ;
            OUTB(AIR2, LOBYTE(HIWORD(W99AV_AIRID_DSPMEM|0x00010000L))) ;
            OUTB(AIR1, HIBYTE(__wTemp)) ;
            OUTB(AIR0, LOBYTE(__wTemp)) ;
#endif
            W99AV_OutData (dwRAM [__wTemp]) ;
        }
#ifndef SYSTEM_8051
        if (pdwUcode)
        {
            _hfree(pdwUcode);
            pdwUcode = NULL;

⌨️ 快捷键说明

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