void main(void) { // XBYTE[0xB091]=0x01; // 1.8v/3.3v regulator turn on XBYTE[0xB092]=0x78; // 3.2V & 2.0V // XBYTE[0xB093]=0x00; // LVR=2.4V // DSP initial XBYTE[0xB010]&=0xFE; // Disable DSP clock, Jimi 080729 for pop noise as 1st time play XBYTE[0xB002]&=0xFE; // Release DSP Reset, Jimi 080729 for pop noise as 1st time play XBYTE[0xB08a]|=0x08; //(JC)MCU:audio DAC on XBYTE[0xB08a]|=0x10; //(JC)MCU:Headphone driver on XBYTE[0xB08a]|=0x20; //(JC)MCU:Headphone driver DD comm-mode bias o/p XBYTE[0xB0ED]|=0x02; //(Jimi 091027)Audio DA zero cross reset bypass on XBYTE[0xB0C1]=0xB0; //(Jimi 091027)Pre-mux , post-mux and internal XCK select XBYTE[0xB0C4]=2; //(Jimi 091027)LCH speaker volume(i.e LCH OP Gain) XBYTE[0xB0C5]=2; //(Jimi 091027)RCH speaker volume(i.e RCH OP Gain) //SAR ADC init XBYTE[0xB05E] = 0; // disable SAR FS clock XBYTE[0xB05F] = 0x5F; // SAR clock = 12MHz/16/6 = 125kHz = 8us //-------------------------------------------- // gbt_Force_USB_FullSpeed =FALSE; gbt_USB_Detected = 0; gc_CardDetect = 0x00 ; gc_CardExist = 0x00 ; // bit 0 : Nand Flash bit 1: SD_Card gc_CardType = 0x01 ; // default Flash Interface gc_CardChangeStage =0x00; // bit 0 : Nand bit 1 : SD_Card gw_FileSkipNumber=0; gb_TriggerFileSkip=0; gb_FindFile=0; gbt_Support_Dummy_Capacity =0; // default disable dummy capacity function gc_bCBWLUN=0; gbt_enableCDROM =0; //09/04/24,joyce gc_CDROM_Size=0 ; init_system(); USB_PlugDetect(); // Detect USB plug //----------------------------------------------// Initial Flash module Init_Flash_Reg(); Init_Flash_Variable(); //-------------- Need search Bank,Dsp ,hzk block info ,first---------// FDBP.cFDev = 0; XBYTE[0xB40F] = FDBP.cFDev; FlashReadID(); Flash_State_Initial(); Search_BankCode_Block(); InitFlash(); Timer0_init(); XBYTE[0xB09F]|=0x06;//(JC)Vref Fast setup mode 'n Internal reference voltage power control gc_Vrefinit_Timer=60; XBYTE[0xB421]=0x13; // dbprintf("tftinit\n"); TFT_init(); #ifdef CAR_48 XBYTE[0xB102]|=0x3C; #else XBYTE[0xB102] |= 0x01; #endif // dbprintf("tftinit end\n"); TFT_PowerOnlogo(); if(gbt_USB_Detected) { USB_Task(); } gb_Host_Exist=1; gb_SD_Exist=1; if(!Host_DetectDevice()) { if(!Host_Initial()) { gc_CurrentCard = CURRENT_MEDIA_HOST; gb_FindFlag = 0; } else { gc_CurrentCard=0; } } else { if(SD_Card_Detect()) { if(SD_Identification_Flow()) { gc_CardExist |=0x02; gc_CurrentCard=2; } else { gc_CurrentCard=0; gc_CardExist &=0xFD; gb_FindFlag = 0; } } else { gb_SD_Exist=0; gc_CurrentCard = 0; } } XBYTE[0xB400] =0x01; XBYTE[0xB010]&=0xFE; // Disable DSP clock, Jimi 080729 for pop noise as 1st time play XBYTE[0xB002]&=0xFE; // Release DSP Reset, Jimi 080729 for pop noise as 1st time play XBYTE[0xB08a]|=0x08;//(JC)MCU:audio DAC on XBYTE[0xB08a]|=0x10;//(JC)MCU:Headphone driver on XBYTE[0xB08a]|=0x20;//(JC)MCU:Headphone driver DD comm-mode bias o/p //SAR ADC init XBYTE[0xB05E] = 0; // disable SAR FS clock XBYTE[0xB05F] = 0x5f; // SAR clock = 12MHz/16/6 = 125kHz = 8us Get_LogData_PageIndex(); //chiayen0808 USER_LogFile_ReadWrite(0);//use reserveblock for log if((gw_FM_frequency<875) || (gw_FM_frequency>1080)) { gw_FM_frequency=875; } FM_initial(); FM_drive(); gc_SetNumber = gw_PagesPerBlock >> 2; //1set=4pages for dir management, Ching 080816 //20090107 chiayen add gc_SetIndex = 0; //Ching 080816 //20090107 chiayen add USER_GetUISetIndex(); //for DIR table index //20090107 chiayen add gb_FindFlag = 0; if (DOS_Initialize()) //20090803 chiayen modify { gdw_HOSTStartSectorRead=0xFFFFFFF0; if(gc_CurrentCard==CURRENT_MEDIA_HOST) { if(SD_Card_Detect()) { gb_SD_Exist=1; if(SD_Identification_Flow()) { gc_CardExist |=0x02; gc_CurrentCard=2; } else { DEVICE_REG[0x00]= 0x01; gc_CurrentCard=0; gc_CardExist &=0xFD; gb_FindFlag = 0; } } else { DEVICE_REG[0x00]= 0x01; gb_SD_Exist=0; gc_CurrentCard = 0; } } else { DEVICE_REG[0x00]= 0x01; //20090730 chiayen add gc_CurrentCard=0; gc_CardExist &=0xFD; gb_FindFlag = 0; InitFlash(); } DOS_Initialize(); } gc_CurrentCard_backup=gc_CurrentCard; //20090803 chiayen move here gs_File_FCB[0].dw_FDB_StartCluster = gdw_DOS_RootDirClus; DOS_Search_File(C_File_All|C_Cnt_FileNo, C_MusicFileType, C_CmpExtName|C_Next);//(JC)count music file no. in root ir_init(); EA = 1; gc_Task_Current=C_Task_Play; gc_Task_Next=C_Task_Play; gc_PhaseInx=0; gw_init_needed=0xffff; Detect_USB(); Polling_TaskEvents(); if(gc_Task_Current!=gc_Task_Next) { gc_Task_Current=gc_Task_Next; } while(1) { switch(gc_Task_Current) { case C_Task_Play: Play_Task(); break; case C_Task_USB: USB_Task(); break; case C_Task_Dir: //20090107 chiayen add Dir_Task(); break; case C_Task_Jpeg: //20090107 chiayen add Jpeg_Task(); break; case C_Task_Mjpeg: //20090107 chiayen add Mjpeg_Task(); break; case C_Task_PlayMenu: //20090107 chiayen add // PlayMenuProcess(); break; case C_Task_PlayMenu_IR: //20090107 chiayen add // PlayMenuProcess_IR(); break; case C_Task_Setting: //20090107 chiayen add SetupMenuProcess(); break; case C_Task_Menu: MainMenuProcess(); break; case C_Task_PowerOff: PowerOffProcess(); break; } } }
void PlayMenuProcess() { U8 tc_MenuItem=0xFF; gc_PlayMenu_Timeout=160; gc_PlayMenuLevel=0; gc_PlayMenuTotalNum=3; gc_TableOffset=0; gc_PhaseInx = 0; if(gc_DIRTimeOut_Flag==0) { gc_LCMDispIndex=0; } else { gc_LCMDispIndex=1; gc_DIRTimeOut_Flag=0; } LCM_clear(); Menu_Disp_Item_Play(gc_PlayMenuLevel,gc_LCMDispIndex,1); while(1) { if(gc_PhaseInx) { switch(gc_PhaseInx) { case C_FmFreqChg: tc_MenuItem = 2; break; case C_PlayNext: if(gc_LCMDispIndex==2) { gc_LCMDispIndex=0; } else { gc_LCMDispIndex++; } Menu_Disp_Item_Play(gc_PlayMenuLevel,gc_LCMDispIndex,1); gc_PlayMenu_Timeout=160; break; case C_PlayPrev: if(gc_LCMDispIndex==0) { gc_LCMDispIndex=2; } else { gc_LCMDispIndex--; } Menu_Disp_Item_Play(gc_PlayMenuLevel,gc_LCMDispIndex,1); ; gc_PlayMenu_Timeout=160; break; default: tc_MenuItem=0xFF; //20090216 chiayen add break; } if(tc_MenuItem==2) //enter child dir or confirm selected item { if(gc_LCMDispIndex==0) { gb_DirPlay_Flag=0; //20081224 chiayen test gc_PlayModeChange_Flag=1; gw_init_needed=0xFFFF; gb_FindFlag = 0; //20090513 chiayen add for play all gs_File_FCB[0].dw_FDB_StartCluster = gdw_DOS_RootDirClus; DOS_Search_File(C_File_All|C_Cnt_FileNo, C_MusicFileType, C_CmpExtName|C_Next);//(JC)count music file no. in root gc_Task_Next=C_Task_Play; } else if(gc_LCMDispIndex==1) { gc_Task_Next=C_Task_Dir; } else if(gc_LCMDispIndex==2) { gc_Task_Next=C_Task_Play; } } } else { if(gc_PlayMenu_Timeout==0) //TimeOut { gc_DIRTimeOut_Flag=1; gb_FindFlag = 1; gc_Task_Next=C_Task_Play; } } gc_PhaseInx=0; IR_Service_Process_Menu(); Polling_TaskEvents(); if(gc_Task_Current!=gc_Task_Next) { LCM_clear(); gc_LCM_Media=0xff; gc_DisplayEQIcon=0xFF; gw_DisplayBitRate=0xFFFF; gc_DisplayPlayMode=0xFF; gw_DispSongNum=0xFFFF; gw_DispFileName_ByteOffset=0; gc_Task_Current=gc_Task_Next; break; } } }