📄 initial.c
字号:
//////////////////////////////////////////////////////////// ****** Big modification History Area ******// LLY0.60, remove un-necessary item for CT909// - MSG_THUMBNAIL_PAGE// - SHOW_6_DISPLAY_MODE// - SUPPORT_AV_SYSTEM// - Replace NULL with '0'// - MSG_AUTOUPGRADE// - _CheckUpgradeCD()// - SUPPORT_DVD_T// - CT908_UI// LLY0.62, remove the un-necessary item// - __bISRKeyRead: since we will use __bISRKey & __bFWKey two variables now// LLY1.15, remove un-necessary item for Code Reduce// - __dwTimeError: since don't support bitstream error report mechanism now.// - _bCountDVD_Initial: since don't support DVD_Initial fail recover mechanism now// - __bISRKeyPrev: since it was rename to _bISRKeyPrev, and initial it within Interrupt.c now.// - __bColorMode: since it will be done within GDI_Initial// - __bDigestStyle: since current digest mode is kept @ __DigestUIAttr.bDigestMode// LLY2.04, remove the un-necessary variables, ex.// - temp global variables: _bINITIALTemp, _dwINITIALTemp, _wINITIALTemp// - _dwResourceNeedProtect// - __bInitialStatus//////////////////////////////////////////////////////////////// Global define for INITIAL module// if define it, only support simple INITIAL MODULE -- LLY0.61#ifdef ECOS909#define SIMP_INITIAL#endif // #ifdef ECOS909//////////////////////////////////////////////////////////////// ***** Include header file Area *****// The file "winav.h" must be included in first line#include "winav.h"#include "hal.h"#include "chips.h"#include "initial.h"#include "utl.h"#include "SrcFilter.h"#include "input.h"#include "cc.h"#include "infofilter.h"#include <string.h>#include "ctkav.h"#include "jpegdec.h"#include "comdec.h"#include "parser.h"//#include "mpeg2dec.h"#include "disp.h"#include "subpict.h"#include "int_gbl.h"#include "atapi.h"#include "digest.h"#ifndef SIMP_INITIAL#include "navigate.h"#include "setup.h"#include "linear.h"#include "dvdinfo.h"#include "osd.h"#include "thumb.h"#include "gdi.h"#include "panel.h" // LLY0.60, since using PANEL_Output()#include "media.h"#include "osdfont.h"// wyc0.95, need to include monitor.h#include "monitor.h"#include "aploader.h" // LLY1.50, for using AP related information.#include "cell.h"#ifdef CT950_STYLE //CoCo.38#include "rtcdrv.h"#include "alarm.h"#endif //CT950_STYLE#ifdef SUPPORT_POWERON_MENU //CoCo2.56#include "poweronmenu.h"#endif //SUPPORT_POWERON_MENU//Alan1.10, support char-based subpicture#ifdef SUPPORT_CHAR_SUBPICTURE#include "char_subpict.h"#endif// wyc1.01, include usbsrc header files.#ifdef SUPPORT_USB_SOURCE#include "usbsrc.h"#endif // #ifdef SUPPORT_USB_SOURCE#ifndef NO_MP3#include "Mmanager.h"#endif // #ifndef NO_MP3#endif // #ifndef SIMP_INITIAL//CoCo1.02, add OSD game from XuLi's code#ifdef SUPPORT_OSDGAME#include "GameMain.h"extern EN_GAME_ID __enGameID;#endif// LLY0.61, define the un-support APIs as null for SIMP_INITIAL#ifdef SIMP_INITIAL#include "ecoscc.h"// HAL modlue// LLY0.81, define it as null since it was removed to INFOFILTER module, and it's not included for eCos909.#define HAL_DetectChipVersion();// SETUP module#define SETUP_Initial() // LLY0.81, don't give parameter since it was remove from DVD_080.BYTE __bSetupMode;// OSD module#define OSD_LoadFontTable(a)#define OSD_Initial()#define OSD_Output(a, b, c)// Source Filter module#define DISCINFO_NONE 0x00#define DISCINFO_ENCRYPT 0x01#define DISCINFO_REGION_ERROR 0x02#define DISCINFO_DAMAGED 0x04#define DISCINFO_UNRECOGNIZE 0x08#define DISCINFO_UNPLAYABLE 0x0F#define ID_ENDLIST 0x04BYTE __bEXTAttr;// LINER Module#define LINEAR_Program(a, b)#define LINEAR_PROGRAM_CLEAR 0// UTL module#define UTL_ModeInitial(a)#define UTL_GetCDDAFormat(a)#define UTL_GETCDDAFORMAT_INITIAL 0#define UTL_QueryCapability(a) 0// THUMB moduleBYTE __bThumbnailMode;// NAVIGATE moduleBYTE __bDomain;WORD __wChapter;BYTE __bTitle;#define STOP_DOM 0// PANEL module#define PANEL_Initial()#define PANEL_Output(a, b) // LLY0.91// INITIAL module#define _INITIAL_ShowFirstLOGO() UTL_ShowLogo()#define _INITIAL_gcShowStatus(a)// VCD20 moduleWORD __wListType;BIT __btJumpTiming;#endif // #ifdef SIMP_INITIAL/*cyg_handle_t __RTC;cyg_handle_t __ClockHandle;*/// LLY0.63, define a cyg_flag to keep every thread initial actionFLAG_T __fThreadInit;THREAD_INFO ThreadCTKDVD;THREAD_INFO ThreadDec;THREAD_INFO ThreadPARSER;THREAD_INFO ThreadInfoFilter;// LLY0.95, only define ATAPI thread stack while support ATAPI interface#ifdef SUPPORT_ATAPI_SOURCETHREAD_INFO ThreadATAPI;#endif // #ifdef SUPPORT_ATAPI_SOURCE// wyc1.01, for USB thread.#ifdef SUPPORT_USB_SOURCETHREAD_INFO ThreadUSBSRC;#endif // #ifdef SUPPORT_ATAPI_SOURCEWIN_PARAMETER PIPVideoInfo;WIN_COLOR MainBGColor;WIN_COLOR PIPBGColor;WIN_COLOR PIPBorderColor;#if (DRAM_CONFIGURATION_TYPE_DVD == DRAM_SIZE_16)// wyc2.75-909P, enlarge the usbsrc stack size#define CTKDVD_THREAD_STACK_SIZE (4096)#define PARSER_THREAD_STACK_SIZE (2560)// wyc2.22-909s, the stack size 2560 is not safe in infofilter,// check the size and will use about 2600 in one disc.// So set to 3072 for safer.#define INFO_FILTER_THREAD_STACK_SIZE (3072)//(2560)#else // #if (DRAM_CONFIGURATION_TYPE_DVD == DRAM_SIZE_16)#define CTKDVD_THREAD_STACK_SIZE (8192)#define PARSER_THREAD_STACK_SIZE (4096)#define INFO_FILTER_THREAD_STACK_SIZE (4096)#endif // #if (DRAM_CONFIGURATION_TYPE_DVD == DRAM_SIZE_16)// LLY2.31, porting Chuan's code to reduce stack size// since we will allocation any space for AVI decoding// Notice: must co-work w/ >= v2.31 decoder and DRAM layout table#define DECODER_THREAD_STACK_SIZE (8192)#define ATAPI_THREAD_STACK_SIZE (2048)// wyc2.71-portusb// wyc2.75-909P, reduce the usbsrc stack size#if (USB_SYSTEM == USB2_0_JUNGO)// wyc2.78-909P, enlarge the usbsrc stack because moving the usb init from cc to usbsrc thread.//#define USBSRC_THREAD_STACK_SIZE (3500) // when support Jungo USB#define USBSRC_THREAD_STACK_SIZE (5120) // when support Jungo USB#else#define USBSRC_THREAD_STACK_SIZE (2048)#endif //CHAR __cCTKDVDStack[CTKDVD_THREAD_STACK_SIZE];CHAR __cDecStack[DECODER_THREAD_STACK_SIZE];CHAR __cPARSERStack[PARSER_THREAD_STACK_SIZE];CHAR __cInfoFilterStack[INFO_FILTER_THREAD_STACK_SIZE];// LLY0.95, only define ATAPI thread stack while support ATAPI interface#ifdef SUPPORT_ATAPI_SOURCECHAR __cATAPIStack[ATAPI_THREAD_STACK_SIZE];#endif // #ifdef SUPPORT_ATAPI_SOURCE// wyc1.01, define the stack array for USB thread#ifdef SUPPORT_USB_SOURCECHAR __cUSBSRCStack[USBSRC_THREAD_STACK_SIZE];#endif // #ifdef SUPPORT_ATAPI_SOURCE// LLY0.61, Reserve a buffer for SP paletteBYTE __bSPPaletteBuffer[64];// LLY2.14, porting Aron's code to support STB mode#ifdef SUPPORT_STB#include "usb.h"#include "sysmenu_op.h"extern BYTE __bMediaSelected;extern BYTE __bPreMediaMode;extern void _ResetSuspendMedia(void);#endif // #ifdef SUPPORT_STB/////////////////////////////////////////////////////////////// Extern other module's global variable Areaextern BYTE __bLOGO;// wyc1.01, extern variable.extern BYTE _bOpen;////////////////////////////////////////////////////////////// ***** Define some global variable Area *****//// [1] Tolerance time for reading sector// In CDIF path: must give the tolerance value for servo seeking, ex 5 sector// In ATAPI path: it's unnecessary, the value alwasy "zero"// LLY2.80, it's necessary to give the default value, because it will be set// within ReadTOC() & UTL_ReadSector()// [G-4bytes]//DWORD __dwTimeTorelence; //= 0;//DWORD _dwINITIALECOSVer;////////////////////////////////////////////////////////////// ***** Extern other module's global variable Area ***** //// Brian.170, for SW detect MIC & auto vocal#ifdef ENABLE_AUTOVOCALextern DWORD __dwMICDectectInterval;extern bit _btPreMICDetect;extern BYTE _bMICOffCount;#ifdef SW_MIC_DETECTextern bit __sbMICDetect;#endif // #ifdef SW_MIC_DETECT#endif // #ifdef ENABLE_AUTOVOCAL// wyc2.02-909S,extern DWORD __dwMMJPGBuffEmptyTime;// Micky1.24, make sure that servo send correct dvdinfo data// used for DVDINFO reference// bit 4=0, ISO_9660 must be correct// bit 0=0, DVDINFO must be correctBYTE __bDataRequest;// Ming0.80, support multi-disc resume.#if defined( SUPPORT_MULTI_DISC_RESUME)//||defined(SUPPORT_STB)BYTE __pbDiscUID[3]; // Use __pbDiscUID to save the unique ID for every VCD and DVD.BYTE __fSaveResumeInfo; // Do not save the RESUME info. if it is in the password input mode.// LLY1.00, it's un-necessary to keep if restore resume information flag//BYTE __fRestoreResumeInfo;Multi_Resume_Info __Resume_Info;#endif // #ifdef SUPPORT_MULTI_DISC_RESUME#ifdef AUTO_TESTvoid _INITIAL_ShowPNO(void);void _INITIAL_Clear_PNO_Region(void);#endif// Eric20070518, print startup time#ifdef SUPPORT_SERVO_SOURCEextern void SRVQA_MpegCallServoPrint(BYTE bMode);#endif //#ifdef SUPPORT_POWER_ON_DISPLAY_LOGOBYTE _bPowerOnFlag=TRUE;#endif// ***********************************************************************// Function : INITIAL_RunSystem// Description : The first thing for to do when system running up.// Now, only creat and start the CTKDVD thread// Argument : None// Return : None// ***********************************************************************//Micky_PORTING_OSWRAPvoid INITIAL_RunSystem(void){ // Micky2.11a HAL_StartSystem(); /* // LLY2.04, porting Chuan's code REG_PLAT_PRESCALER_RELOAD = 132/2; // LLY1.05, always enable cache power saving feature REG_PLAT_CACHE_CONTROL |= CACHE_DCACHE_POWER_SAVING; // J500CSC_111, clear the semaphore at first start MACRO_PLAT_KEY_UNLOCK( ); */#ifdef STACK_OVERFLOW_DETECTION _INITIAL_ClearStack();#endif // #ifdef STACK_OVERFLOW_DETECTION // LLY0.60, Check with CSC if put this statement into eCos system // LLY1.05, remove data control burst fetch control // Since it will be done within eCoS system //REG_PLAT_CACHE_CONTROL |= CACHE_DATA_BURST_FETCH; ThreadCTKDVD.priority = 5; // WinDVD thread should be Thread_CTKDVD that declared in CC. ThreadCTKDVD.priority = 5; ThreadCTKDVD.fpThreadEntry= Thread_CTKDVD; ThreadCTKDVD.dwEntryData = 0; ThreadCTKDVD.ThreadName = "WinDVD"; ThreadCTKDVD.StackBase = (void *)__cCTKDVDStack; ThreadCTKDVD.StackSize = CTKDVD_THREAD_STACK_SIZE; OS_CreateThread(&ThreadCTKDVD); OS_ResumeThread(ThreadCTKDVD.handle);}#ifdef STACK_OVERFLOW_DETECTION// ***********************************************************************// Function : _INITIAL_ClearStack// Description : Clear each stack w/ the magic number// Arguments : None// Return : None// ***********************************************************************void _INITIAL_ClearStack(void){ memset(__cCTKDVDStack, STACK_MAGIC_NUMBER, CTKDVD_THREAD_STACK_SIZE); memset(__cDecStack, STACK_MAGIC_NUMBER, DECODER_THREAD_STACK_SIZE); memset(__cPARSERStack, STACK_MAGIC_NUMBER, PARSER_THREAD_STACK_SIZE); memset(__cInfoFilterStack, STACK_MAGIC_NUMBER, INFO_FILTER_THREAD_STACK_SIZE);#ifdef SUPPORT_ATAPI_SOURCE memset(__cATAPIStack, STACK_MAGIC_NUMBER, ATAPI_THREAD_STACK_SIZE);#endif // #ifdef SUPPORT_ATAPI_SOURCE#ifdef SUPPORT_USB_SOURCE memset(__cUSBSRCStack, STACK_MAGIC_NUMBER, USBSRC_THREAD_STACK_SIZE);#endif // #ifdef SUPPORT_USB_SOURCE#ifdef SUPPORT_SERVO_SOURCE { extern char stack[2][4096]; memset(stack[0], STACK_MAGIC_NUMBER, 4096); memset(stack[1], STACK_MAGIC_NUMBER, 4096); }#endif // #ifdef SUPPORT_SERVO_SOURCE}#endif // #ifdef STACK_OVERFLOW_DETECTION
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -