📄 initial.~c
字号:
// *********************************************************************// Function : INITIAL_System// Description : Some steps for Player wake-up// [1] uP [2] Variables [3] PANEL/OSD [4] Servo// [5] MPEG Decoder [6] TV Encoder [7] Audio DAC// Arguments : NONE// Return :// Side Effect :// *********************************************************************// LLY.171-2, re-arrange the procedure for INITIAL_System()// Give the parameter, merge some procedure into HAL_PowerDown()void INITIAL_System(BYTE bMode){ // Micky2.11a BYTE bStatus; // uP and global variables initial action only need to do once time // while 1st H/W power on if(bMode & HARDWARE_SHUTDOWN) { // LLY1.01, remove "thread flag initial" procedure from INITIA_Variables_PowerON() to here // Because, servo thread will be create/ resume within _servo_source_init() // And, the flag will be set within it. OS_InitFlag (&__fThreadInit); // LLY2.18, initial the mutex for I2C and Expand GPIO share same pin issue. HAL_I2CSrc_Ctrl(MUTEX_ACTION_INIT);#ifdef SUPPORT_SERVO_SOURCE { // Brian0.69 // Step 0: Initialize Servo source // (a) dowlaod servo ucode ==> according to test, downlaod servo ucode (access DSSP reg 0xE8) may fail after Processor_2 is running // so, we do it here, before INITIAL_uProcessor // (b) Create and resume servo threads extern void _servo_source_init(void); extern void BMST_SetServoClock(BYTE bSrvClkTick, DWORD bSrvMlk); // LLY2.22, set system tick to servo // Notice: must set it before servo thread wake up. // LLY2.30, give mclk value @ 2nd parameter BMST_SetServoClock(SYSTEM_TICK, CPU_SPEED); _servo_source_init(); }#endif // #ifdef SUPPORT_SERVO_SOURCE //Micky_PORTING_OSWRAP OS_InitialTimer(); // LLY2.38, porting CoCo's code to initial RTC for CT951 system#ifdef CT950_STYLE RTC_Initial();#endif //CT950_STYLE // Micky2.11a, modify INITIAL_uProcessor into HAL_InitPlatForm. // Step 1: Initialize uP //DVD_051Micky, initial uP should be done first //INITIAL_uProcessor (); bStatus = HAL_InitPlatForm(); if ( !bStatus ) { DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_PRINTF, "\nINIT Platform error code :: %hx", bStatus); } // wyc0.95, initial the alarm interrupt for monitor and debug. MONITOR_AlarmInit(); // LLY2.15, config debug mode, and remove old DBG_Init() calling UTL_Config_DebugMode(UTL_DBG_INIT, 0); // LLY2.10, disable UART2 // LLY2.13, remove this procedure, since no reason to disable it. //HAL_UART_Disable(HAL_UART2); // LLY2.05, give NULL to set customer pre-selected IR INPUT_InitIR(NULL);#ifdef SUPPORT_SERVO_SOURCE { extern void _servo_init_alarm(void); _servo_init_alarm(); }#endif // #ifdef SUPPORT_SERVO_SOURCE // Step 2: Initialize all global variables // LLY2.80, Don't put this procedure too late !! // Otherwise, something maybe wrong if following API // must refer those variable within it !! _INITIAL_Variables_PowerON (); // LLY2.11, initialize serial flash as earily as possible // ie, it must be done before R/W serial flash action.#if (STORAGE_TYPE == SERIAL_FLASH) { extern void HAL_InitSerialFlash(void); HAL_InitSerialFlash(); }#endif // #if (STORAGE_TYPE == SERIAL_FLASH) } // Something need to do for 1st H/W power and total shutdown if( !(bMode & PSEUDO_SHUTDOWN) ) { // Step 3: Initialize some necessary pio pin // Need check if it's necessary for CT909 ?? // Step 4: Initial MPEG chip // Step 5: Power up all HW Block // Set MainVideo frame buffer // LLY2.17, collect frame buffer setting procedure into UTL_Config_FrameBuffer() UTL_Config_FrameBuffer(UTL_FRAMEBUF_MOTION); /*#ifdef SUPPORT_FBR_MODE // Frame buffer redundancy DISP_FrameBufferSet(DS_FRAMEBUF0_ADDR_ST_FBR, DS_FRAMEBUF1_ADDR_ST_FBR, DS_FRAMEBUF2_ADDR_ST_FBR, DS_FRAMEBUF0_ADDR_ST_FBR, Y_MAXSIZE_PAL_FBR * 8);#ifdef SUPPORT_BFR_MODE // B-Frame redundancy DISP_FrameBufferMode(TRUE, TRUE);#else // #ifdef SUPPORT_BFR_MODE DISP_FrameBufferMode(TRUE, FALSE);#endif // #ifdef SUPPORT_BFR_MODE#else // #ifdef SUPPORT_FBR_MODE DISP_FrameBufferSet(DS_FRAMEBUF0_ADDR_ST, DS_FRAMEBUF1_ADDR_ST, DS_FRAMEBUF2_ADDR_ST, DS_FRAMEBUF0_ADDR_ST, Y_MAXSIZE_PAL * 8); DISP_FrameBufferMode(FALSE, FALSE);#endif // #ifdef SUPPORT_FBR_MODE */ // Set VCR and border color DISP_BGColorSet(MainBGColor, DISP_MAIN_BG); DISP_MainVideoSet(&MainVideoInfo, __dwCoded_Picture_Width, __dwCoded_Picture_Height, DISP_NEXTVSYNC); // LLY1.02, set default PIP background and border color DISP_BGColorSet(PIPBGColor, DISP_PIP_BG); DISP_BGColorSet(PIPBorderColor, DISP_PIP_BORDER); // Step 5: detect chips version HAL_DetectChipVersion(); //Kevin0.85, I/O mute to avoid the H/W power-on bo noise // When outputing PCMWS to ADAC for the first time HAL_IOMute(TRUE);#ifndef SIMP_INITIAL#ifndef POWERON_STANDBY { extern STATUS gcShowStatus; gcShowStatus.bPowerDown= FALSE; // let PANEL can show information }#endif // POWERON_STANDBY // LLY2.76, porting SY's code to support power switch feature#ifdef SUPPORT_POWER_SWITCH if(!__bPowerSw_StandBy) { extern STATUS gcShowStatus; gcShowStatus.bPowerDown= FALSE; // let PANEL can show information }#endif //SUPPORT_POWER_SWITCH#endif // #ifndef SIMP_INITIAL#ifndef NO_PANEL // Step 6: Initial Panel ... // Micky0.91, panel is controlled by GPIO // must wait till detect base port OK. PANEL_Initial(); // KCHong 0.90#endif // #ifndef NO_PANEL // Step 7: Turn-off TV encoder to avoid "un-stable TV screen" appear // Must add after MPEG chip waking-up, // Otherwise, the action maybe fail if it use "GPIO" to control TV encoder // LLY1.50, HAL_TurnOffTVE() is rename as TVE_TurnOff() //HAL_TurnOffTVE(); HAL_TVE_Off(); // Step 8: Initial TFT related setting if support TFT -- Alan1.06#ifdef SUPPORT_TFT TFT_Init();#endif // #ifdef SUPPORT_TFT } // Step 8: Read-back some necessary setup info. while 1st H/W power on if(bMode & HARDWARE_SHUTDOWN) { SETUP_Initial();#ifdef CT950_STYLE //CoCo.38 ALARM_Initial(); AUTOPWR_Initial();#endif //CT950_STYLE // LLY1.50, check if switch to AP mode#ifdef POWERON_SWITCH_AP if(__SetupInfo.bAPMode != 0) {// DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_PRINTF, "AP Mode: %lx\n", __SetupInfo.bAPMode); if(AP_SwitchMode(__SetupInfo.bAPMode)==FALSE) { BYTE bMode=0; // Notice: need restore the AP mode to DVD mode while AP switch fail HAL_WriteStorage(SETUP_ADDR_AP_MODE, &bMode, 1); } }#endif // #ifdef POWERON_SWITCH_AP // LLY0.95, read-back all DRM related information.#ifndef NO_DRM PARSER_DRM_Config((DWORD)SETUP_ADDR_DIVX_BASE); PARSER_DRM_PowerOnInit();#endif // #ifndef NO_DRM } // Step 9: Merge the necessary thing to HAL_PowerDown() // Ex. MPEG chip, TV encoder, Audio DAC, Servo, SCART ... HAL_PowerDown(bMode);}// *********************************************************************// Function : INITIAL_PowerONStatus// Description :// Arguments : NONE// Return :// Side Effect :// *********************************************************************// DVD_100Micky, merge I/R power on sequence with h/w power on.void INITIAL_PowerONStatus(BYTE bPower){ DWORD dwThreadDone; // Create desired thread and let it to start !! // Notice: it only need for for 1st power on if (bPower==INITIAL_POWER_HARDWARE) { INITIAL_ThreadInit(THREAD_ATAPI); // wyc1.01, initial USB thread. INITIAL_ThreadInit(THREAD_USBSRC); INITIAL_ThreadInit(THREAD_INFO_FILTER); // LLY0.72, always create the MPEG thread for MPEG LOGO display INITIAL_ThreadInit(THREAD_MPEG_DECODER); INITIAL_ThreadInit(THREAD_PARSER); // LLY0.61, Source Filter is not defined a thread. //INITIAL_ThreadInit(THREAD_SRC_FILTER); } // Initial MPEG chip ... HAL_PowerOnInit(); // DVD_100Micky, only hardware power on need check power on standby mode if (bPower==INITIAL_POWER_HARDWARE) {#ifdef POWERON_STANDBY // Let F/W enter POWER-DOWN mode immediately __bFWKey= KEY_POWER; return;#else // #ifdef POWERON_STANDBY // LLY2.76, porting SY's code to support power switch feature#ifdef SUPPORT_POWER_SWITCH if (__bPowerSw_StandBy) { __bFWKey= KEY_POWER; return; }#endif // #ifdef SUPPORT_POWER_SWITCH#endif // #ifdef POWERON_STANDBY } if(bPower==INITIAL_POWER_HARDWARE) { // LLY1.01, calculate the desired thread done flag for different source while H/W power on dwThreadDone=INIT_POWER_ON_THREAD_X_SOURCE_DONE;#ifdef SUPPORT_ATAPI_SOURCE dwThreadDone |= INIT_SRC_THREAD_ATAPI_DONE;#endif // #ifdef SUPPORT_ATAPI_SOURCE#ifdef SUPPORT_SERVO_SOURCE dwThreadDone |= (INIT_SRC_THREAD_SERVO1_DONE | INIT_SRC_THREAD_SERVO2_DONE);#endif // #ifdef SUPPORT_SERVO_SOURCE // LLY1.10,remove code to polling USB thread done // Since, current F/W only create it, but don't resume it from 1.08#if 0//def SUPPORT_USB_SOURCE dwThreadDone |= (INIT_SRC_THREAD_USB_DONE);#endif // #ifdef SUPPORT_USB_SOURCE // LLY0.95, the waiting time is absolute time // LLY0.68, wait power-on necessary thread initial done or leave while time-out //cyg_flag_timed_wait( &__fThreadInit, INIT_POWER_ON_THREAD_DONE, CYG_FLAG_WAITMODE_AND, COUNT_50_MSEC); OS_TimedWaitFlag( &__fThreadInit, dwThreadDone, FLAG_WAITMODE_AND, (COUNT_50_MSEC) ); // LLY0.70, print-out the warning message while flag initial not complete. if( (OS_PeekFlag(&__fThreadInit) & dwThreadDone)!=dwThreadDone ) { DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_PRINTF, "Some thread not initial done. Desired: %lx, Current: %lx\n", dwThreadDone, OS_PeekFlag(&__fThreadInit)); } // Micky_PORTING_OSWRAP //MACRO_ECOS_VER(_dwINITIALECOSVer); //if (LOWORD(_dwINITIALECOSVer) < ECOS_PACKAGE_VERSION) if (!OS_Identify_Version() ) { // Micky2.11a, remove _dwINITIALECOSVer DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_PRINTF, "\nECOS Version Error");//, %lx!!",_dwINITIALECOSVer); OSD_LoadFontTable(FONTABLE_OSD); OSD_Initial(); OSD_Output(MSG_ERRCODE, 500, 0xFF); while(1); } } // Show logo earily. _INITIAL_ShowFirstLOGO(); // Load font table and do OSD initial first for power-on standby mode OSD_LoadFontTable(FONTABLE_OSD); OSD_Initial(); // Show looading message here after OSD_Initial() done ... // Notice: this message can't be show while tray is not close -- LLY2.00#ifdef SUPPORT_STB if( __bChooseMedia == MEDIA_SELECT_DVD && __bMediaSelected == TRUE)#endif if (SrcFilter_CheckTrayStatus () == SRC_TRAY_CLOSED) {#ifndef SUPPORT_POWERON_MENU //CoCo2.38 OSD_Output ( MSG_WAITING, 0, 0xFF );#endif //SUPPORT_POWERON_MENU }//LJY1.23, per KWD's request#ifdef SET_VIDEO_OUTPUT_WHEN_POWER_ON SETUP_AdjustSetting(SETUP_SCREEN_VIDEO_OUTPUT); //KWD-1.21c for Norcent to fix video output blue background color#endif // #ifdef SET_VIDEO_OUTPUT_WHEN_POWER_ON SrcFilter_Reset(FALSE); //not show loading status bar // LLY0.80, remove it since it's un-necessary for CT909 // Since all data will be read-back during 1st SETUP_Initial() //SETUP_Initial(SETUP_OTHERS_INITIAL); //CoCo.051 INITIAL_Variables (); // ** S-TCH; move from INITIAL_System CHIPS_Initial(CHIPS_INIT_ALL);#ifdef SIMP_INITIAL INITIAL_InitialState();#else // #ifdef SIMP_INITIAL#ifdef NO_DISC_MODE // Chuan2.77, add new case for power down Servo part if servo code isn't exist#ifndef SUPPORT_SERVO_SOURCE HAL_PowerControl(HAL_POWER_SERVO, HAL_POWER_SAVE);#endif // #ifndef SUPPORT_SERVO_SOURCE#else // #ifdef NO_DISC_MODE // the INITIAL_InitialState is removed // will let MEDIA_Management do it. // force tray closed at power on // Micky0.72, add for servo tray is opened when power on. begin __SF_SourceGBL[0].bSourceIndex = SOURCE_DISC; // wyc1.01, set _bOpen = 0 because power on will close tray in H/W and IR power on. // If not set to 0, then _MEDIA_MonitorServoStatus won't check tray closed status // and won't update __btDriveOpen to FALSE. // Then, INFOFTR will not parse information because of __btDriveOpen == TRUE. // Notice: must check where to clear _bOpen is better // since it maybe incorrect for Top Loader platform while power on w/o tray close _bOpen = 0 ; if (SrcFilter_CheckTrayStatus () != SRC_TRAY_CLOSED) { _dwTimeCheckTray = OS_GetSysTimer(); __btDriveOpen = TRUE; SrcFilter_CloseTray(); __bMediaServoState = MEDIA_SERVO_NONE;//CLOSED; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -