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

📄 initial.c

📁 车载电子影音系统dvd播放系统原程序代码
💻 C
📖 第 1 页 / 共 5 页
字号:

    if ( __wDiscType == NO_DISC_IN_DRIVE )
    {
        // LLY.277a-3, Initialize the audio DAC while no disc in drive
        // Otherwise, the speaker testing will fail while no disc in drive
        // Notice: Audio DAC will be set during _Check_CDROMStatus() in normal case
        // And, this action only need to done at 1st power-on
        HAL_SetAudioDAC(AUDIO_FREQ_48K);
    }

	/*
    // Micky0.87, default enable display 1 for CD-DA disc.
   // move this into INTIIAL_InitialState.
    /////////////////////////////////////
    // LLY.048-2, nobody to send MSG_DISPLAY while display mode on
    if(__bDisplay)
        OSD_OUTPUT_MACRO(MSG_DISPLAY, __bDisplay, 0xFF);
	*/

//DVD_049MickyPowerDown
#ifdef  AUTO_POWERDOWN
// support auto power down
// add for all disc for the cases that not AUTO_PLAY
    // set the initial time stamp for checking.
    __dwTimeWaitPowerDown =__dwCountSystem;
#endif  // #ifdef AUTO_POWERDOWN

#ifdef  SUPPORT_AV_SYSTEM    
#if AMP_VOLUME_SOURCE == DIGITAL_DDX8000
    // Initial DDX8000 here. -- wyc2.78b-3
    // Notice: Must check if we can initialize DDX8000 earily
    AMP_Initial();

    // LLY2.79, it's unnecessary to wake-up DDX8000 here
    // Because CHIPS_OpenAudio(TRUE) will handle it !!
#endif // #if AMP_VOLUME_SOURCE == DIGITAL_DDX8000

    //__bInitialStatus |= AMP_INITIAL_OK;

    // LLY2.78b-2, do channel remapping action after AMP initial ok
    // To fix "nobody to do it while playing MP3 title"
    // Becasue, F/W will play a little MP3 bitstream during Initial_CheckServo()
    // Thus, playing mode has set as PLAY_MP3
    // So, nothing will be done while F/W want to do 1st song formal playing by UTL_SetPlayMode()
    // And, nobody to call HAL_SetAudioType() -> _SetAudType() -> CHIPS_Channel_ReMapping()
    // Notice: it's unnecessary to do while do the AMP initial early
    CHIPS_Channel_ReMapping();

#endif // #ifdef  SUPPORT_AV_SYSTEM

    //Kevin1.00, H/W unmute
    HAL_HardwareMute(FALSE); //H/W unmute
		TFT_MUTE_ON(FALSE);//yhtang_117

    // Alex1.24a, Scan Dram ok at power on, skip the input key 
    // Because, previous action is to set __bISRKey=KEY_OPEN_CLOSE to skip disc loading
    // LLY2.37p, remove it, ie. let it do open/close after finish dram scan
/*    
#ifdef SUPPORT_DRAM_SCAN_POWERON
    __bISRKey = KEY_NO_KEY; 
#endif 
*/

}

//  *********************************************************************
//  Function    :   INITIAL_InitialState
//  Description :   Some steps for VCD Starter
//                  [1] Show LOGO [2] Check title [3] AUTOPLAY check
//  Arguments   :   NONE
//  Return      :
//  Side Effect : Now called by 1) Game Exit, 2) INITIAL_PowerONStatus(H/W or I/R)
//              : 3) 3 cases are called when multi-discs.
//  *********************************************************************
void INITIAL_InitialState(void)
{
    // DVD_172Micky, seems can be removed for case 1 and 2.
    // wyc1.24a, remark it because of no use.
    //OSD_Output (MSG_LOGO, NULL, 0xff);

    __bModePlay= MODE_PLAYUNKNOW;

    _INITIAL_gcShowStatus(FALSE);   // this will clear MSG_WAITING.???

    // Don't do disc initial, directly do KEY_OPEN
    if ( __bISRKey == KEY_OPEN_CLOSE )
        return;

    INITIAL_CheckServo ();
#if 0//yhtang_1112
	if(__wDiscType&BOOK_DVD) 
		{
		__wVolAudio=VOLUME_MAX;
		}
	else{
		__wVolAudio=0x3fff0;
		
		}
	 W99AV_WriteRegDW (PCMSCALER, LOWORD(__wVolAudio), HIWORD(__wVolAudio));            
               #if 0//def YHTANG_DEBUG
			   _printf("\n initial.c set __wvolaudio 0x%x",__wVolAudio);
                #endif
	#endif
 // Micky0.87, default enable display 1 for CD-DA disc.
    if ( __wDiscType & BOOK_CDDA )
    {
// CZ1.10-3
#ifndef SHOW_6_DISPLAY_MODE     
        __bDisplay = 1;
#else	//#ifndef SHOW_6_DISPLAY_MODE
{
	extern BYTE __bRootMenu;
	extern BYTE __bTitleMenu;
	__bRootMenu=0;
	__bTitleMenu=0;
	__bDisplay = 2; //Auto open one line display mode
	if (__bCDDA_DTS & CDDA_DISC_HDCD)//wendy1.07 for record HDCD disctype
		__bDiscHDCDType = TRUE;       //if removed, display will show CDDA except the first time
}
#endif	//#ifndef SHOW_6_DISPLAY_MODE
    }

    // Micky0.87, move from INITIAL_PowerONStatus
    /////////////////////////////////////
    // LLY.048-2, nobody to send MSG_DISPLAY while display mode on
    if(__bDisplay)
        OSD_OUTPUT_MACRO(MSG_DISPLAY, __bDisplay, 0xFF);

    _CC_ImmediateKey();

// DVD_172Micky, FLOW_CONTROL begin
// move from INITIAL_CheckServo
#ifdef  AUTO_POWERDOWN
    //DVD_099Micky, Open/Close no disc will check auto power down
    __dwTimeWaitPowerDown =__dwCountSystem;
#endif  //#ifdef  AUTO_POWERDOWN
// DVD_172Micky, FLOW_CONTROL end
}

//  *********************************************************************
//  Function    :   INITIAL_Variables
//  Description :   The initalization of all variables
//  Arguments   :   NONE
//  Return      :   NONE
//  Side Effect :   The effect will be the OPEN-CLOSE level
//  *********************************************************************
// DVD_172Micky, FLOW_CONTROL
// called when 1) H/W power on, 2) I/R power on, 3) I/R power off, 4) Open tray.
void INITIAL_Variables(void)
{
    //Kevin1.26, initialize _bSampleFreq
    extern BYTE    _bSampleFreq; 
    _bSampleFreq = 0xFF;

#ifdef PRESTOP_BEFORE_SETUP_AND_PROGRAM
	__bProgramStop=0;
	__bPreCountStop=0;
#endif
    __bDiscInfo= DISCINFO_NONE; // ** TCH1.70;

	__bScanLevel = 0; // Brian2.39-2

//DVD_049MickyPowerDown
#ifdef  AUTO_POWERDOWN
// support auto power down
    // reset the checking time
    __dwTimeWaitPowerDown =0xFFFFFFFF;
#endif  // #ifdef AUTO_POWERDOWN

// DVD_099Micky, clear repeat status as repeat none
    __bRepeat=REPEAT_NONE;
//    OSD_OUTPUT_MACRO(MSG_REPEAT, __bRepeat, NULL); //LJY1.00-4, update it later

    __bZoomFactor=VIEW_NORMAL;
    __wXStart=0;
    __wYStart=0;

    __bModeCmd= KEY_STOP;
    __btPlaying= FALSE;
    __btPause= FALSE;

    //Micky2.80, review global variables init.
    __dwTimeKey = 0;
    __wNumberPrevious = 0;
    __btBookMark = FALSE;
    // wyc1.24a-2, because this __bSearchMode will be reset in UTL_ModeInitial. So don't need to reset it here.
    //__bSearchMode = 0;

    // Micky1.10, support resume after power on for DVD/CDDA/VCD
    // must keep the __dwResumeTime value
// Ming2.36, support multi-disc resume from EEPROM.
#if defined(SUPPORT_RESUME_AFTER_POWERON) || defined(SUPPORT_RESUME_AFTER_OPENCLOSE)
    if ( !( __bFlowState & FLOW_KEEP_RESUME ) )
#endif  //#ifdef  SUPPORT_RESUME_AFTER_POWERON
    __dwResumeTime = 0;

// CZ1.10-3
#ifdef SHOW_6_DISPLAY_MODE
	__bDiscHDCDType=0;
#endif		
//LJY1.05, per CoCo's request for module testing
#ifdef AUTO_TEST
    CC_AutoTestInitial();
#endif
    // LLY.100a, reset audio L/R status to STEREO mode
    __bModeChannel= AUDIO_STEREO;
    __btMute= FALSE;
//    OSD_OUTPUT_MACRO(MSG_MUTE, FALSE, NULL); //LJY1.00-4, update it later

    // DVD_274pMicky, let CHIPS do initial.
    //__bVocal= VOCAL_ON; // ** TCH1.54; Re-Init the value
    CHIPS_Initial(CHIPS_INIT_AC3KOKMODE);
    
    //Kevin0.90, fix "KEY UP/DOWN for other tiles and then play MP3 => no audio & OSD fails"
    CHIPS_Initial(CHIPS_INIT_KEY);

    // wyc.170, initial the de-emohasis variable
    __bHAL1_Deemphasis = FALSE;

    __bAudioType = HAL_AUDIO_NONE;  //Kevin2.37-2

    // wyc.pro clear the program array and variables
    LINEAR_Program(LINEAR_PROGRAM_CLEAR,NULL);
    UTL_ModeInitial ( MODE_OPENCLOSE );

    __bModePlay= MODE_PLAYUNKNOW;
    // wyc1.25-2, initial this value
    __bLastModePlay= MODE_PLAYUNKNOW;
    __bScan= SCAN_NONE;
    __dwIER= NULL;       // suppose not need IRQ
//LJY1.20, support 4M flash, remove digest
#ifndef NO_DIGEST
    __btDIGEST= FALSE;
    //OSD_OUTPUT_MACRO ( MSG_DIGEST, NULL, NULL );    // clear Digest, LJY1.00-4, update it later
    __bDigestStyle= DIGEST_STYLE_END;       // let it come from first
#endif
    // LLY.275a, clear thumbnail mode
    __bThumbnailMode= FALSE;
//    OSD_OUTPUT_MACRO(MSG_THUMBNAIL_PAGE, 0, 0); //LJY1.00-4, upadte it later

    // ** S-TCH; Reset Some
    __bASTNO= __bASTN= __bASTID= NULL;          // ** TCH0.451;
    __bSPSTNO= __bSPSTN= __bSPSTID= NULL;       // ** TCH0.451;

    // ** TCH0.452; begin...
    __bDomain= STOP_DOM;
    // LLY.172q, fix "object that has been cast are not l-value" warning message of ARM
    //__bTitle= (BYTE)__wChapter= 1;
    __wChapter= 1;
    __bTitle= 1;
    // ** TCH0.452; end...
    __wDiscType= NO_DISC_IN_DRIVE; // ** LLY.043, remove from above code

    // LLY.161, clear CDDA format to unknown while open/close
    __bCDDA_DTS=CDDA_FORMAT_UNKNOWN;

//LJY1.00-4, call OSD_OUTPUT_MACRO after all variables were initialized to avoid pannel showing abnormal message.
//*** Begin ***
    OSD_OUTPUT_MACRO(MSG_REPEAT, __bRepeat, NULL);
    OSD_OUTPUT_MACRO(MSG_MUTE, FALSE, NULL);
//LJY1.20, support 4M flash, remove digest
#ifndef NO_DIGEST    
    OSD_OUTPUT_MACRO ( MSG_DIGEST, NULL, NULL );
#endif
    OSD_OUTPUT_MACRO(MSG_THUMBNAIL_PAGE, 0, 0);
//*** End ***

//DVD_050aMicky
// support double stop
// LLY2.79, it's unnecessary to reference "DOUBLE_STOP" define
// Becasue, the variable is always valid while define it or not
//#ifdef  DOUBLE_STOP
    // DVD_101bMicky, the initial CountStop shall be real stop
    __bCountStop=2;
//#endif  // #ifdef DOUBLE_STOP

// DVD_103Micky, turn on __bAutoVocal when defined is on
#ifdef  ENABLE_AUTOVOCAL
    __bAutoVocal=1;

    // Brian.170, SW MIC Detect
#ifdef  SUPPORT_MIC_DETECT_INV
    __sbMICDetect=0;
    _btPreMICDetect=0;
#else   // #ifdef SUPPORT_MIC_DETECT_INV
    __sbMICDetect = 1;
    _btPreMICDetect= 1;
#endif  // #ifdef SUPPORT_MIC_DETECT_INV
    __dwMICDectectInterval = 0;
    _bMICOffCount=0;

#endif  // #ifdef ENABLE_AUTOVOCAL

    // wyc.277a-1-AVSys, initial these two variables.
#ifdef  SUPPORT_AV_SYSTEM
    // LLY2.78b, clear volume control message if necessary
    if(__bAMPActive)
    {
        __bAMPActive = FALSE;
        OSD_OUTPUT_MACRO(MSG_VOLUME, CLEAR_MSG, NULL);
    }
    __bAUXChannel = AUX_CHANNEL_DVD;
#endif // #ifdef SUPPORT_AV_SYSTEM
    // wyc.278, move from CDINFO_DetectPictureCD function. 
    __bEXTAttr = 0;
    // wyc1.10-DVDR, default set to FALSE.
    __bDVDROM = FALSE;


// DVD_161Micky, fix SVCD-> can't pause
    {
    extern BYTE  __bStillTime;   // record the Still Time (0: NONE, 0xFF: Infinite; Other: seconds.)
    extern  BYTE __bVOBUStill;
    __bVOBUStill=FALSE;
    __bStillTime=0;
    }

    // Micky2.79-2, support FullScreen function
    // init. value 0 will be assigned within INITIAL_Variables.
    // 1: means full screen video on, 0: means full screen video off.
    __bFullScreen=0;

    // wyc1.07, rename some variables and initial their value in initial.c
    {
        extern void MONITOR_InitialValue(void);
        MONITOR_InitialValue();
    }
    
    HAL_AVSync (HAL_AVSYNC_VIDEOMASTER, NULL);    // ** TCH1.00-908; begin...     It's a default value for disable Video Master Mode.
    //W99AV_WriteDM ( W99AV_DM_SKIP_THRESHOLD, 0x1000 );          // ** TCH1.00-1-908; 
    W99AV_WriteDM ( W99AV_DM_SKIP_THRESHOLD, 0x1400 ); //Kevin2.37a, default __dwAOBuffer=3/4*ABUF=0x1800. Skip thres should be slightly small than it.
    
    {
        extern  BYTE    _bAPSType;
        _bAPSType=0; //Kevin1.07a, clear when open 
    }



//Alex1.21,20031210 support bookmark
//Clear _wBookMark Time and Title value
#ifdef SUPPORT_BOOKMARK
    __wBookMark[0]=1;
    for(__bTemp=0;__bTemp<BOOKMARK_NO;__bTemp++)
    {
        __wBookMark[__bTemp+1]=0;
        __bBookMark_Title[__bTemp+1]=0;
//        __wBookMark_Chapter[__bTemp+1]=0;
    }

#endif//#ifdef SUPPORT_BOOKMARK

    return ;
}

//  *********************************************************************

⌨️ 快捷键说明

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