?? w99av2.c
字號:
//////////////////////////////////////////////////////////////// ***** Big Modification History Area *****// LLY2.80a,// - remove the code while un-define "SUPPORT_48K_DAC",// ie. default go "48K DAC" path#include "winav.h"#include "cdinfo.h"#include "ucode.h"#include "w99av.h"#include "hal.h"#include "setup.h"#include "servo.h"#include "utl.h"#include "cc.h"#include "chips.h"#include "isr.h"#ifdef USE_INITIAL_FILE#include "readini.h"#endif#include "osd.h"// Chuan1.11, remove it to support RISC CheckSum function// Micky1.11b, fix BE auto upgrade fail. Can't use RISC_CHECKSUM// Reason is unknown// Micky1.24, enable checksum by RISC, the problem is the RISC codes can't locate at last address// Alex1.25,if Support CTMAN, it will use cross bank, risc checksum will error//alex1.26-1_Begin//Alex1.26-1 Remove NO_Risc_Checksum define for dvd_T , 1.26 support risc checksum//#ifdef SUPPORT_DVD_T//#define NO_RISC_CHECKSUM//#endif // #ifdef SUPPORT_DVD_T//alex1.26-1_End#define VALUE_DM7F2 0xFFF3 // ** TCH0.42a;static BYTE code aDummy; // Chuan1.00-2, Dummy ByteDWORD __dwW99AVECCBASE; // LLY.046, keep current ECCBASE usage// DVD_173Micky, add two variables for DRAM source and destination.DWORD __dwW99AV_SrcDRAM;DWORD __dwW99AV_DestDRAM;#ifdef SUPPORT_GZIP_COMPRESSION//Kevin1.20WORD __wW99AV_SizeDRAM; #endif// LLY.274p, move local variable to global variable and rename itDWORD *_pdwW99AVTmp; // *pdwTmp;// Chuan 276 2002/08/23: move local variable to global variable and rename itstatic DWORD _dwTemp1, _dwTemp2;// Brian0.84p, GDI also use 0x1C, but need more ACK timestatic DWORD dwCnt;static WORD wCnt;//TCC022, record the sp/ogt typeBYTE __bW99AVSpOgtType;BYTE __bW99AVABuf2Def; // Chuan0.86, '0'= Audio2 addresses same as Abuio1 Buffer. So if '0', just have only one Audio Buffer else has two Audio buffers.// Chuan 276 2002/08/23: move local variable to global variable and rename itstatic BYTE DATA bCnt;static BYTE _bTemp;static BYTE * _bIdx ;BIT _btW99AV1; // only used in W99AV module for record the EA valueBIT _btUcodeLoadFlag; // download ucode success:TRUE, failure:FALSEDWORD __dwReserveStart; // Brian1.21// Micky2.36, NV buffer address use variableDWORD __dwNVStart;#ifdef SUPPORT_AUTO_UPGRADE #ifdef INCLUDE_FLASH// Chuan 02/01/2002: Include Auto-Upgrade procedureBYTE code bFlashProgram[]={#include "flash.txt"};#endif// Chuan 172r 2002/03/15: REUse those variable. Enter Auto-Upgrade Mode, those variable all can free use.extern DWORD DATA __dwTimeNow; // Record the index of SRAMextern BYTE DATA _bNum; // Record the Sector Num of Flash.binextern BYTE DATA _bIdex; // Record the loop count.extern BYTE _bINITIALTemp; // Record the Sector Num of Flash.bin//LJY1.20, remove DIGEST for supporting 4M flash, use __btMute instead of __btDIGEST//extern BIT __btDIGEST; // Record whether skip sync or not. // Special Function Register#if IO == IO_8051sfr RUN_PROGRAM = 0xc3; // Chuan0.86, used to control PC to 4K SRAM#endif#endif //Kevin1.24a, MP3 bitrate//the 1st & last elements are avoid "divided by zero" & "array access out of range"//aMP2LSFBitrate = aMP3LSFBitrateBYTE code aMP3LSFBitrate[] = { 8, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 160}; WORD code aMP3Bitrate[] = { 32, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 320};WORD code aMP2Bitrate[] = { 32, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 384};WORD __wW99AVAudioBitrate; //Alex1.26,20050527 ,Seperate Speed / Bank to Support Sorting and Dram Test//alex_begin//-----------------------------------------//#if defined (SUPPORT_TEST_SINGLE_MUTI_RW_FOR_BANK) || defined (SUPPORT_DRAM_SCAN_POWERON) ////alex908 #define SPEED_NUM 3 //alex908#define BANK_NUM 4 //alex908extern BIT __btDramScan;extern BYTE __bRiscTestResult[SPEED_NUM][BANK_NUM]; //alex908#ifdef SUPPORT_DRAM_SORT //alex1.26-1extern BYTE gbDRAMType;#endif //#ifdef SUPPORT_DRAM_SORT //alex1.26-1#endif //#if defined (SUPPORT_TEST_SINGLE_MUTI_RW_FOR_BANK) || defined (SUPPORT_DRAM_SCAN_POWERON) ////alex908 //-----------------------------------------////alex_end// ************************************************************************// Function : W99AV_PowerOnInitial// Description : Issue some action once at initial time// 1.Issue total S/W reset// 2.Download micro-code and initialize chip// 3.Initial Video// 4.Inital Audio// Arguments : none// Return : none// Side Effect :// ************************************************************************// wyc1.24a, add parameter for W99AV_PowerOnInitial to decide if need to issuing W99AV_RESET_TOTAL.BIT W99AV_PowerOnInitial(BYTE bNeedHWReset){ // Chuan 276 2002/08/20: use _btUcodeLoadFlag instead of btRet // BIT btRet; // BYTE bCnt; // Step 7 : Download micro-code bCnt=0; _btUcodeLoadFlag=TRUE; // TCC048, end while ( 1 ) { if ( UCODE_Load() ) // ** 0.16;#ifdef CHECK_UCODE_LOAD if ( UCODE_Check() )#endif break; bCnt++;#ifdef SUPPORT_PRINTF printf("\nFailure : Load microcode #%u ...",bCnt);#endif if(bCnt>3) { _btUcodeLoadFlag=FALSE; // LLY.101-2 break; } }#ifdef SUPPORT_PRINTF printf("\nLoad microcode complete");#endif // Step 9 : Total s/w reset // wyc1.24a, code to decide doing W99AV_RESET_TOTAL or not. Add it is because now we will move display LOGO code to the place that before // W99AV_PowerOnInitial, so not need to H/W reset to avoid video become black. if (bNeedHWReset) W99AV_Reset(W99AV_RESET_TOTAL); //Brian2.32, decoding uses frame buffer // [0x15f]: 0x0 ==> FD mode (default) // [0x15f] : 0x10000 ==> HD mode #ifdef HD_ONLY // Brian2.30 W99AV_WriteDRAMData(0x15f, 0x10000); #else W99AV_WriteDRAMData(0x15f, 0);#endif // Step 10 : Initial Video and Audio W99AV_InitialVideo(); //Kevin2.37, move out of W99AV_InitialAudio() to be called once at H/W power on to fix AC3 NEXT pop noise //Kevin1.24, fix 1 bit shift between MICWS & PCMWS by reseting CLK circuit W99AV_WriteDM(W99AV_DM_DIV_CLK_REG, 0); W99AV_InitialAudio(TRUE);/*//Brian0.87, move from GDI.C#ifdef CT908_UI GDI_ClearRegion_By_RISC(0); GDI_ClearRegion_By_RISC(1); GDI_ClearRegion_By_RISC(2);#endif*/ return _btUcodeLoadFlag;}// ***********************************************************************// Function : W99AV_InitialVideo// Description : write DRAM and registers only to initail video// Arguments : none// Return : none// Side Effect :// ***********************************************************************void W99AV_InitialVideo(void){ extern DWORD _dwACR1, _dwACR2, _dwACR3; // LLY.045#ifdef USE_INITIAL_FILE#define MAX_COMMAND 10#define MAX_ARG 5 int pos, l, j, k, cmd_index, cmd_arg ; // pointer to current position in option file char str1[21],str2[21]; DWORD dwArg [MAX_ARG] ; // Read ini file and set the value /////////////////////////////////////// ///// Set register value if(!READINI_ParseFile(__strW99AVIni)) { printf("\nThe <%s> does not exist !!",__strW99AVIni); EXIT_APP_MACRO(); } else { // Write System Register if (!READINI_GoSection ("[SystemRegister]", &pos)) { printf("\nGoto Section System Register Error !") ; exit (0); } while (READINI_GetNext (&pos, str1, str2)) W99AV_WriteRegDW ((BYTE)READINI_Hex2Dec (str1), LOWORD (READINI_Hex2Dec(str2)), HIWORD (READINI_Hex2Dec (str2))) ; // Write Command for (l=0;l<MAX_COMMAND;l++) { // goto Command section sprintf (str1, "[Command%d]", l+1) ; if (!READINI_GoSection (str1, &pos)) { break ; } // Get the index value if (!READINI_GetEntryInt (str1, "INDEX", &cmd_index)) { printf("\nGet Entry Int INDEX Error !") ; exit (0); } // Get the command arg if (!READINI_GetEntryInt (str1, "ARG", &cmd_arg)) { printf("\nGet Entry Int ARG Error !") ; exit (0); } sprintf (str1, "[Command%d]", l+1) ; for (j=0;j<MAX_ARG;j++) { char strItem1 [20] ; sprintf (strItem1, "ARG%d", j+1) ; if (!READINI_GetEntryInt (str1, strItem1, &dwArg[j])) { //printf ("Get [%s] [%s] Error\n", str1, strItem1) ; break ; } } __dwW99AVCmdArg [0] = j +1 ; __dwW99AVCmdArg [1] = cmd_arg ; //printf("[CADD 0]:%08lx\n",(cmd_arg<<16|cmd_index)); for (k=0;k<j;k++) { __dwW99AVCmdArg [2+k] = dwArg [k] ; //printf("[CADD %d]:%08lx\n",k+1,dwArg[k]); } W99AV_CommandN ((BYTE)cmd_index) ; } } // LLY.023, for CDDA setting if(__bW99AVAudioType==0x3) W99AV_WriteRegDW(CICR, CICR_CDDA, 0x0); // CDDA else W99AV_WriteRegDW(CICR, CICR_VALUE, 0x0);#else // Brian2.36, VCD30 is not used, RISC code may remove the command to save code space#ifdef SUPPORT_VCD30_FEATURE // LLY.049, restore VCD3.0 feature's variable __dwW99AVCmdArg[0]=3; __dwW99AVCmdArg[1]=CMDARG_SBTAR; // command argument is 0x0009 __dwW99AVCmdArg[2]=((DWORD)__rcHALVCD30Area.wRight<<10) | (DWORD)__rcHALVCD30Area.wLeft; // ARG1 __dwW99AVCmdArg[3]=((DWORD)__rcHALVCD30Area.wBottom<<10) | (DWORD)__rcHALVCD30Area.wTop; // ARG2 W99AV_CommandN(COMMAND_SBTAR); // command index is 0x000e // LLY.275, give the arguments to global variables directly //HAL_VCD30_Color(__dwHALVCD30Color, __bHALVCD30CR); HAL_VCD30_Color();#endif __dwW99AVCmdArg [0] = 5 ; __dwW99AVCmdArg [1] = CMDARG_SPARCR ; __dwW99AVCmdArg [2] = MAKELONG (__wW99AVPARCTLRLow, __wW99AVPARCTLRHigh) ; __dwW99AVCmdArg [3] = MAKELONG (__wW99AVAVIDRLow, __wW99AVAVIDRHigh) ; __dwW99AVCmdArg [4] = MAKELONG (__wW99AVNVSUBIDRLow, __wW99AVNVSUBIDRHigh) ; __dwW99AVCmdArg [5] = __wW99AVBSFORMATR ; W99AV_CommandN (COMMAND_SPARCR) ;#endif // wyc1.22, test no video reset in Ritek 6/1 <-> 6/2 video become bigger then small problem.#if 0 __dwW99AVCmdArg [0] = 5 ; __dwW99AVCmdArg [1] = CMDARG_SVC1 ; // LLY2.81, split CT9928AF & CT908, because the bit meaning is different // CT908: bit[9:0]=VDW, bit[19:10]=VDS __dwW99AVCmdArg [2] = MAKELONG ((__dwW99AVVDRR&0x3FF), ((__dwW99AVVDRR>>10)&0x3FF)) ; __dwW99AVCmdArg [3] = MAKELONG (__wW99AVHDWR, __wW99AVHDSR) ; if(_btUcodeLoadFlag) // download ucode success then the border color is blue {#ifdef BORDER_BLUE __dwW99AVCmdArg [4] = 0x23d460 ; // blue border#else __dwW99AVCmdArg [4] = 0x008080 ; // black border#endif } else // download ucode failure then the border color is red#ifdef _DEBUG_INFO { __dwW99AVCmdArg [4] = 0x4164d4 ; // red border }#else // Chuan 276 2002/08/20: Give gray color when release mode. { __dwW99AVCmdArg [4] = 0xa08080 ; // gray border }#endif __dwW99AVCmdArg [5] = MAKELONG (__wW99AVSPHDS, __wW99AVSPVDS) ; //SP W99AV_CommandN (COMMAND_SVC1) ;#endif // __dwW99AVCmdArg [0] = 2 ; __dwW99AVCmdArg [1] = CMDARG_SVC2 ; __dwW99AVCmdArg [2] = MAKELONG (__wW99AVVCRLow, __wW99AVVCRHigh) ; W99AV_CommandN (COMMAND_SVC2) ; // TCC022, set RL command for SP/OGT _SetSpOgtType () ;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -