polling.c
上传用户:caisangzi8
上传日期:2013-10-25
资源大小:15756k
文件大小:68k
- /*
- ** FILE
- ** polling.c
- **
- ** DESCRIPTION
- ** polling hardware response.
- **
- **
- ** HISTORY terry, maintain
- ** 2003.03.07 reduce stack by inline function
- **
- **/
- #include "config.h"
- #include "global.h"
- #include "memmap.h"
- #include "memmap0.h"
- #include "avd.h"
- #include "util.h"
- #include "stc.h"
- #include "audio.h"
- #include "cd.h"
- #include "cddsp.h"
- #include "ringbuf.h"
- #include "sig.h"
- #include "user_init.h"
- #include "vfdfunc.h"
- #include "func.h"
- #include "cfont.h"
- #include "osd.h"
- #include "macro.h"
- #include "dsp3_if.h"
- #include "ircmd.h"
- #include "kernel.h"
- #include "fs96602.h"
- #include "fs.h"
- #include "nav.h"
- #include "polling.h"
- #include "fsnav.h"
- #include "kinf.h"
- #include "pinf.h"
- #include "gpio.h"
- #include "timer.h"
- #include "ircode.h"//terry 20030822
- #include "avi_if.h"
- #ifdef TTE_HOST_DVD
- #include "pca9564.c" //lijd for TTE PCA9564 2004-11-11 19:56
- #endif
- #ifdef UART_WITHOUT_DEBUG_MODE
- #include "io_uart0.h"
- #include "UartComm.h"
- #endif
- #ifdef UART_SWAP //axel swap uart0 and uar1 2004/10/29
- #include "io_uart1.h"
- #include "UartComm.h"
- #endif
- #ifdef QSI_PLATFORM //qsi: merge by johnson 20040712
- #include "drv.h"
- //sharon
- #endif
- #ifdef SUPPORT_MIDI
- #include "fsmidi.h"
- #ifdef SUPPORT_MIDI_MENU_SEL //by dtb in 20040225
- #include "fsMidiUI.h"
- #endif
- #endif
- #if defined(SUPPORT_TUNER_MV114) || defined(SUPPORT_TUNER_ALPS)
- #include "radio_mv114_kst.h"//xyy 2004-5-26
- #endif
- #ifdef SUPPORT_UART_UPGRADE
- #include "UartComm.h"
- #endif
- #ifdef SUPPORT_EXTERNAL_MIC
- #include "gpio.h"
- #endif
- #ifdef SUPPORT_MP4_SUBTITLE
- #include "Subtitle.h"
- #endif
- #ifdef SUPPORT_REP_READ
- #include "read.h"
- #endif
- #ifdef PROVIEW_GPIO_KEY //BRUCE ADD 2003/2/14 12:20PM
- #include ".\Customers\Conser\proviewkey.c"
- #endif
- #ifdef SUPPORT_SPI
- #include "spi.h"
- #endif
- #ifdef SUPPORT_DISPLAY_MENU
- #include "setup_def.h"
- #endif
- #ifdef SUPPORT_CD_TEXT
- #include "CDTextUtil.h"
- #endif
- //for support SWD //jslin //20041022
- #ifdef SUPPORT_PS2
- #include "polling_PS2.c"
- #endif
- #ifdef DVB1000_NON_OS //eric 2005-01-04 11:06
- #include "Sp_dtv.h"
- #endif
- #ifdef SUPPORT_PLAY_SWD
- extern void polling_SWD(void);
- #endif
- #ifdef HDMI
- //==========================kevin add for HDMI
- extern void HDCP_polling(void);
- //=============================================================
- #endif
- //=====================================================
- //* debug option
- //=====================================================
- #ifndef DVDRELEASE
- //#define POLLING_DBG 1
- #endif
- #ifdef POLLING_DBG
- //#define MONE_TIMEOUT
- //#define MONE_TIMEOUT_SRC
- //#define MONE_DSP24
- #endif
- #ifndef POLLING_DBG
- #undef printf
- #undef print_block
- #define printf(f, a...) do {} while (0)
- #define print_block(x,y) do {} while (0)
- #endif
- #ifdef TTE_HOST_DVD //lijd for TTE PCA9564 2004-11-11 19:56
- #define HDI_STATE_IDLE 0
- #define HDI_STATE_WAIT_CTL_RESERVED 1
- #define HDI_STATE_WAIT_CTL_CODE 2
- #define HDI_STATE_WAIT_SYS_RESERVED 3
- #define HDI_STATE_WAIT_SYS_CODE 4
- #define HDI_STATE_WAIT_INF_RESERVED 5
- #define HDI_STATE_WAIT_INF_CODE 6
- #define HDI_STATE_WAIT_SET_RESERVED 7
- #define HDI_STATE_WAIT_SET_CODE 8
- #endif
- //=====================================================
- //* extern function declare
- //=====================================================
- extern inline void PollingI2CPageWrite();
- extern inline void Score_Polling(); // in score.c
- extern void ircmd_pre_paser(BYTE rx);
- extern inline void dvd_hl_force_action(void);
- extern void update_vfd_data(void);
- extern inline void polling_dvd_timer(void);
- extern inline void recover_hl_color(void);
- extern void DisplayEq(void);
- extern void DispPolling(BYTE bReset);
- extern void tv_format_machine(void);
- extern inline void dsp_watchdog(void);
- extern void reset_vfd_again(void);
- extern void polling_vfdsw(void);
- extern void polling_phone(void); //////yangli 2004-10-12
- extern void AC3ShowReport();
- extern inline void polling_mp3(void);
- extern int ClockPolling(BYTE show);
- //extern void tuner_mute(int mute);
- extern void check_key_status(void);
- extern void check_key_status_ourmind();
- extern void check_ourmind_light_status();
- extern void check_keyboard_status();
- extern void check_keylight_status();
- #ifdef DVD_SERVO
- extern void ServoDecMainLoop(void);
- #endif
- extern void pollingUARTServo(void);
- extern void ircmd_play(void);
- extern inline void MPx_ChkSmpRate();
- extern UINT16 Is_JPEG_PLAY_STATE(void);
- extern void check_keyboard_status();
- #ifdef SUPPORT_CARD_STORAGE
- extern void polling_card_plug(void);
- #endif //SUPPORT_CARD_STORAGE
- #if defined(SUPPORT_USB)||defined(SPHE8202_CARD_STORAGE)
- extern void polling_storage(); //wthsin,2004/4/12 02:16pm
- #endif
- #ifdef PMP_DVD
- extern void PMP_PC_Usb_PlugInOut();
- #endif //#ifdef PMP_DVD
- #if defined(PCM1742)&&defined(CHECK_DAC_ZERO_FLAG_TO_GPIO_MUTE) //gerry,3-10-20 11:35
- extern void check_pcm1742_zero_flag();
- #endif
- #ifdef SETUP_DONT_PAUSE
- extern void polling_10ms_save(void);
- #endif
- #ifdef POLLING_10MS_SAVE_RESUME //Maoyong, 2004.03.01 10:02
- extern void polling_10ms_save_rsm(void);
- #endif
- #ifdef SHOW_STANDBY_TIMER//suqiaoli 2003-8-7
- extern void polling_setup_standby_timer(void);
- #endif
- #if defined(SUPPORT_FS_LONGNAME)
- extern void FS_ScrollDispFileName(void);
- #endif
- #ifdef SUPPORT_DSPMUTE
- extern UINT32 coding_mode_now; // benson add 2004-08-20 for receiver
- #endif
- #ifdef SUPPORT_UPGRADE_WHEN_RUNNING
- extern void polling_upgrade_info();
- #endif
- //=====================================================
- //* external var. decalare
- //=====================================================
- extern BYTE gAC3onoff;
- extern BYTE audioNotContinuous;
- extern BYTE tuner_mute_flag;
- extern BYTE polling_clock;
- extern BYTE bJpgVFDPause;
- extern UINT8 safe_on;
- #if defined(SUPPORT_BASS_TREBLE)
- extern BYTE flag_BassAdjust; //xulf
- extern BYTE flag_TrebleAdjust; //xulf
- #endif
- //============================kevin add for HDMI==============
- #ifdef HDMI
- extern void ResetAuthentStates();
- extern void AuthenticationHandler(); //authenticate the RX include all processes
- extern void DSIntegratyLinkCheck();
- #endif
- //===================================================
- //=====================================================
- //* define
- //=====================================================
- #define GET_RTC_15_0() (regs0->rtc_15_0)
- //=====================================================
- //* local var.
- //=====================================================
- #ifdef CHECKPHONE
- int phone_flag=0; /////////////////yangli add it for 5.1ch phone,2004-10-10
- int phone_flag_k=0;
- #endif
- #ifdef AUTO_CLOSE_LOADER
- UINT16 auto_close_timer=0;
- #endif
- #ifdef RECORD_PER_SECOND
- int resume_time_ourmind=0;
- #endif
- UINT8 polling_avoid_reentry=0;
- UINT8 dsp_delay=0;
- #ifdef AVOID_READDISC_WHEN_STARTUP //xyy add for Oritron
- UINT16 uStartCounter=0;
- UINT16 uCounterFlag=0;
- #endif
- #ifdef SUPPORT_EXTERNAL_MIC
- UINT16 auto_mute_extern_mic_timer=0;
- #endif
- #ifdef CD_PLAYER //liweihua 2003-9-3
- extern void DisplaycdEq(void);
- #endif
- #ifdef DVB1000_NON_OS //eric add 2005-01-04 13:53
- int progCount=0;
- stProgramInfo_t *progInfo;
- int nTimeCounter = 0;
- #endif
- //=====================================================
- //* static inline function
- //=====================================================
- //#include "line21.c"
- #include "polling_fun.h"
- //=====================================================
- //* Option function
- //=====================================================
- //terry,2004/2/11 04:44PM
- //move asv function to asv.c
- #ifdef AUTO_CLOSE_LOADER
- static inline void auto_close_fun(void)
- {
- if(auto_close_timer&0x8000)
- {
- auto_close_timer++;
- //printf("auto_close_timer=%xn",auto_close_timer);
- if(auto_close_timer>0x8040)
- {
- if(system_state == SYSTEM_OPEN)
- {
- auto_close_timer=0;
- ircmd_play();
- }
- else
- {
- auto_close_timer=0;
- }
- }
- }
- }
- #else
- #define auto_close_fun();
- #endif
- #ifdef RECORD_PER_SECOND
- static inline void auto_record_per_s(void)
- {
- if(play_state==VCD_STATE_NORMAL)
- {
- if(Is_MP3_STATE()||((cd_type_loaded!=CDROM)&&(!is_menu())))
- { if(resume_time_ourmind<6)
- {
- resume_time_ourmind++;
- //printf("resume_time_ourmind=%dn",resume_time_ourmind);
- }
- if(resume_time_ourmind>=6)
- {
- RsmInfo2Flash(0);
- resume_time_ourmind=0;
- //printf("resume_time_ourmind=%dn",resume_time_ourmind);
- }
- }
- }
- }
- #else
- #define auto_record_per_s();
- #endif
- #ifdef STB_2_0
- static inline void ethernet_access(void)
- {
- //for Ethernet Access test
- if (iIntCnt != pr0Cnt)
- {
- printf("cnt=%dn",iIntCnt);
- pr0Cnt=iIntCnt;
- }
- *pEth=0x01;
- p=*pEth;
- if (p!=0x01) printf("Eth Error!!n");
- }
- #else
- #define ethernet_access() ((void)(0))
- #endif //STB_2_0
- static inline void dsp_dbg_fun(void)
- {
- #ifndef MONE_DSP24
- regs0->dsp24_port[6] = 0;
- #else//#ifndef MONE_DSP24
- int dbg_msg;
- if (regs0->dsp24_port[6])
- {
- #ifndef MONE_DSP24_LONG //ycwen 2004/12/15 Printf short message to prevent from disturbing audio debugging
- printf("DSP: %04xn", regs0->dsp24_port[7]);
- //ycwen 2004/12/15 Print video and audio buffer status if necessary
- //printf("DSP3: %04x %x %xn", regs0->dsp24_port[7], get_vbv_free_exact(vbv_y), dsp3_get_rest_buf_size());
- #else//#ifndef MONE_DSP24_LONG //ycwen 2004/12/15 Printf short message to prevent from disturbing audio debugging
- dbg_msg=regs0->dsp24_port[7];//show DSP message
- printf("DSP3:");
- switch(dbg_msg)
- {
- case 0xC011:
- printf(" %04x download dsp3rom.d16.ac3.2ch successfullyn",dbg_msg);
- break;
- case 0xC012:
- printf(" %04x download dsp3rom.d16.ac3.5.1ch.16M successfullyn",dbg_msg);
- break;
- case 0xC031:
- printf(" %04x download dsp3rom.d16.mp3.2ch successfullyn",dbg_msg);
- break;
- case 0xC032:
- printf(" %04x download dsp3rom.d16.mp3.2ch.EQ.16M successfullyn",dbg_msg);
- break;
- case 0xC041:
- printf(" %04x download dsp3rom.d16.lpcm.2ch successfullyn",dbg_msg);
- break;
- case 0xC042:
- printf(" %04x download dsp3rom.d16.lpcm.2ch.EQ.16M successfullyn",dbg_msg);
- break;
- case 0xC061:
- printf(" %04x download dsp3rom.d16.cd.2ch successfullyn",dbg_msg);
- break;
- case 0xC071:
- printf(" %04x download dsp3rom.d16.wma.2ch successfullyn",dbg_msg);
- break;
- case 0xC091:
- printf(" %04x download dsp3rom.d16.spdif.2ch successfullyn",dbg_msg);
- break;
- case 0xC0B1:
- printf(" %04x download dsp3rom.d16.nes.2ch successfullyn",dbg_msg);
- break;
- case 0xD011:
- printf(" %04x download dsp3rom.d16.ac3 successfullyn",dbg_msg);
- break;
- case 0xD012:
- printf(" %04x download dsp3rom.d16.ac3.spi successfullyn",dbg_msg);
- break;
- case 0xD013:
- printf(" %04x download dsp3rom.d16.945.ac3 successfullyn",dbg_msg);
- break;
- case 0xD021:
- printf(" %04x download dsp3rom.d16.dts successfullyn",dbg_msg);
- break;
- case 0xD022:
- printf(" %04x download dsp3rom.d16.dts.spi successfullyn",dbg_msg);
- break;
- case 0xD023:
- printf(" %04x download dsp3rom.d16.dtscd successfullyn",dbg_msg);
- break;
- case 0xD024:
- printf(" %04x download dsp3rom.d16.945.dts successfullyn",dbg_msg);
- break;
- case 0xD025:
- printf(" %04x download dsp3rom.d16.108.dtscd successfullyn",dbg_msg);
- break;
- case 0xD026:
- printf(" %04x download dsp3rom.d16.raw.dtscd successfullyn",dbg_msg);
- break;
- case 0xD031:
- printf(" %04x download dsp3rom.d16.mp3 successfullyn",dbg_msg);
- break;
- case 0xD041:
- printf(" %04x download dsp3rom.d16.lpcm successfullyn",dbg_msg);
- break;
- case 0xD042:
- printf(" %04x download dsp3rom.d16.lpcm.fudo successfullyn",dbg_msg);
- break;
- case 0xD051:
- printf(" %04x download dsp3rom.d16.ppcm successfullyn",dbg_msg);
- break;
- case 0xD061:
- printf(" %04x download dsp3rom.d16.cd successfullyn",dbg_msg);
- break;
- case 0xD062:
- printf(" %04x download dsp3rom.d16.cd.spi successfullyn",dbg_msg);
- break;
- case 0xD071:
- printf(" %04x download dsp3rom.d16.wma successfullyn",dbg_msg);
- break;
- case 0xD081:
- printf(" %04x download dsp3rom.d16.midi successfullyn",dbg_msg);
- break;
- case 0xD091:
- printf(" %04x download dsp3rom.d16.spdif successfullyn",dbg_msg);
- break;
- case 0xD0A1:
- printf(" %04x download dsp3rom.d16.noise successfullyn",dbg_msg);
- break;
- case 0xD0B1:
- printf(" %04x download dsp3rom.d16.nes successfullyn",dbg_msg);
- break;
- case 0xD0C1:
- printf(" %04x download dsp3rom.d16.tuner successfullyn",dbg_msg);
- break;
- case 0xCDEF:
- printf(" %04x DSP PCM output underflown",dbg_msg);
- break;
- case 0xDEAD:
- printf(" %04x bitstream errorn",dbg_msg);
- break;
- default:
- printf(" %04xn",dbg_msg);
- }//switch(dbg_msg)
- #endif //#ifndef MONE_DSP24_LONG //ycwen 2004/12/15 Printf short message to prevent from disturbing audio debugging
- regs0->dsp24_port[6]=0;
- }// if (regs0->dsp24_port[6])
- #endif // #ifndef MONE_DSP24
- }
- #ifdef TURN_OFF_POWER_RESUME
- //wangap add 2004/4/21
- void polling_resume(void)
- {
- RsmInfo2Flash(0);
- }
- #endif
- //=====================================================
- //* function
- //=====================================================
- //
- // FUNCTION
- // polling_timeout()
- //
- // DESCRIPTION
- // check if timeout
- //
- void polling_timeout(void)
- {
- if( ( timeout_playback ) // 2004/12/29 yltseng
- #ifndef SETUP_DONT_PAUSE
- && ( full_scrn != SETUP )
- #endif
- #ifndef PROG_DONT_PAUSE
- && ( full_scrn != PROGRAM )
- #endif
- )
- {
- if (get_rtc() > timeout_playback)
- {
- //if (GetIntrMask()&INTR_TIMEOUT)
- // SetIntrFlag(GetIntrFlag()|INTR_TIMEOUT);
- #ifdef MONE_TIMEOUR_SRC
- printf(__FUNCTION__" timeoutn");
- #endif
- if(auto_pause)
- {
- timeout_playback=0;
- ircmd_play();
- }
- else
- AVD_SetMediaTimeout();
- }
- }
- }
- #ifdef SUPPORT_HEADPHONE //xyy 2004-10-9
- #define TEST_HEADPHONE_SENSE (regs0->gpio_in[HEADPHONE_SENSE/16]&(1<<(HEADPHONE_SENSE%16))) //pin71
- extern void ddx_masterMute(BYTE mute);
- extern void ddx_enableEPAD(void);
- extern void ddx_disableEPAD(void);
- extern void write_reg_bit(int addr,BYTE bit,BYTE val);
- BYTE bHpPlug; // 1: headphone plug in 0:headphone not plug in
- BYTE bCounter[2];
- void polling_headphone(void)
- {
- static BYTE bOldStas,bNewStas;
-
- if(TEST_HEADPHONE_SENSE)
- {
- bCounter[0]++;
- if(bCounter[0]<5 && !TEST_HEADPHONE_SENSE)
- bCounter[0] = 0;
- if(bCounter[0] == 5)
- {
- bHpPlug = 1;
- bCounter[0] = 0;
- }
- }
- else
- {
- bCounter[1]++;
- if(bCounter[1]<5 && TEST_HEADPHONE_SENSE)
- bCounter[1] = 0;
- if(bCounter[1] == 5)
- {
- bHpPlug = 0;
- bCounter[1] = 0;
- }
- }
- bNewStas = bHpPlug;
-
- if(bHpPlug && (bNewStas!=bOldStas))
- {
- ddx_masterMute(1);
- ddx_disableEPAD();
- write_reg_bit(0x04,6,1);//set channel 7/8 to binary mode
- write_reg_bit(0x04,7,1);
- ddx_masterMute(0);
- }
- else if((!bHpPlug) && (bNewStas!=bOldStas))
- {
- ddx_masterMute(1);
- write_reg_bit(0x04,6,0);//set channel 7/8 to ddx mode
- write_reg_bit(0x04,7,0);
- ddx_enableEPAD();
- ddx_masterMute(0);
- }
- bOldStas = bNewStas;
- }
- #endif
- void disp_fan_in(void)
- {
- extern BYTE osd0_state; //OSD0 state
- if (osd0_state>1)
- {
- #ifdef SUPPORT_FUNCTION_MENU
- if ((full_scrn!=SETUP) && (full_scrn!=SETUP_PLUS))
- #else
- if (full_scrn!=SETUP)
- #endif //end #ifdef SUPPORT_FUNCTION_MENU
- DispPolling(2);
- }
- }
- #ifdef QSI_PLATFORM//liulifeng add 2004-10-13////jhuang 2004/11/23
- enum {
- ERROR_CODE_N = 0x0,
- ERROR_CODE_1,
- ERROR_CODE_2,
- ERROR_CODE_3,
- ERROR_CODE_4
- };
- BYTE QSI_PIPO_error_code_station = ERROR_CODE_3;
- BYTE QSI_PIPO_error_code_time_flag=0;
- static inline void QSI_PIPO_error_code ( void )
- {
- if ( QSI_PIPO_error_code_station != 0 )//error occur
- {
- if ( QSI_PIPO_error_code_time_flag < 21)
- {
- if ( ( (QSI_PIPO_error_code_time_flag / 3) %2 )
- ||( QSI_PIPO_error_code_time_flag > ((QSI_PIPO_error_code_station - 1 )*6 + 3))
- )
- GPIO_O_SET(GPIO_IS_FOR_SYSTEM_LED,0); // led Off
- else
- GPIO_O_SET(GPIO_IS_FOR_SYSTEM_LED,1); // led On
- }
- else if ( QSI_PIPO_error_code_time_flag < 25 )
- {
- GPIO_O_SET(GPIO_IS_FOR_SYSTEM_LED,0); // led Off
- }
- else if ( QSI_PIPO_error_code_time_flag < 28 )
- {
- GPIO_O_SET(GPIO_IS_FOR_SYSTEM_LED,1); // led On
- }
- else if ( QSI_PIPO_error_code_time_flag < 50 )
- {
- GPIO_O_SET(GPIO_IS_FOR_SYSTEM_LED,0); // led Off
- }
- else
- QSI_PIPO_error_code_time_flag = 0xff;
- QSI_PIPO_error_code_time_flag++;
- }
- }
- #endif//#ifdef QSI_PLATFORM
-
- //#define SUPPORT_DEBUG_FOR_TRAY_IN_AND_HOME_SWITCH // 2004/12/17 yltseng
- static inline void DebugFuncForTrayInAndHomeSwitch()
- {
- #ifdef SUPPORT_DEBUG_FOR_TRAY_IN_AND_HOME_SWITCH
- // First parameter is TryIn, Second is HomeSwitch
- // TrayIn : Defined in sys_servo.c TRAY_IS_IN_GPIO
- // HomeSwitch : Fixed at GPIO 6
- psprintf( RegionValStr[REGION1], "%d %d", GPIO_I_GET(5), GPIO_I_GET(6) );
- PrintOsdMsg(STR_OS_SPACE, REGION1, 1, 1);
- #endif
- }
-
- //
- // FUNCTION
- // polling_100ms
- //
- extern BYTE keytimer; //chen edit 0512
- #ifdef FUNC_AUTO_RETURN_VOL_STATE
- extern BYTE func_key_set_flag;
- extern BYTE bFuncStep;
- #endif
- static inline void polling_100ms(void)
- {
- //--------- chen edit 0512---------
- if(keytimer!=0)
- {
- keytimer--;
- }
- #ifdef FUNC_AUTO_RETURN_VOL_STATE
- if(func_key_set_flag)
- {
- if(timeout_osd[1]==0)
- {
- func_key_set_flag=0;
- bFuncStep=0;
- }
- }
-
- #endif
- //-------------------
-
- DebugFuncForTrayInAndHomeSwitch();
-
- #ifdef QSI_PLATFORM//liulifeng add 2004-10-13//jhuang 2004/11/23
- QSI_PIPO_error_code ();
- #endif
- #ifdef PMP_MCU810
- if((GetCurrentFileType() != CDROM_JPEG )&&(GetCurrentFileType() != CDROM_DAT )
- &&(GetCurrentFileType() != CDROM_MPG) &&(GetCurrentFileType() != CDROM_MP4)
- ||(pFsJpeg->gifsState == FS_STATE_LIST||pFsJpeg->gifsState == FS_STATE_MP3))
- Show_PMP_Bat();
- #endif
- #ifdef SUPPORT_SPI
- polling_spi();
- spi_service();
- #endif
- #ifdef SUPPORT_MP4_SUBTITLE
- if (GetCurrentFileType() == CDROM_MP4) ///David add 2004-5-9, no need to polling subtitle except MP4 disc.
- {
- if( (full_scrn & SOUND) || (play_state == VCD_STATE_PAUSE) ) //David 2004-5-12
- return;
- if (IS_EXT_SUP_ACTIVATED())
- {
- extern ifunc polling_subtitle;
- if( polling_subtitle )
- {
- #ifdef SPHE8202_FAT_Write_Function
- if(!(full_scrn & PERIPHERAL)) //sunzhh add 2004-11-25
- #endif
- polling_subtitle();
- }
- }
- }
- #endif
- #ifdef PDVD_USE_IO_SCAN_KEY //Jack modified 04/06/03
- //#ifdef GBM_PORTABLE_DVD
- check_portable_key(); //rbhung for GBM Portable DVD
- #endif
- //freyman 2002-7-4 11:30
- #ifdef VFD_VOLUME_DISPLAY
- {
- int diff;
- //diff=timenow-rtc_100ms;
-
- polling_vfdtime(diff);
- }
- #endif
- #ifdef USE_GAMEPORT_TO_BUTTON//nono 20020824
- check_key_status();
- #elif defined(OURMIND_VFDPORT_TO_BUTTON)//nono 20020824
- check_key_status_ourmind();
- check_ourmind_light_status();
- #elif defined(USE_VFDPORT_TO_BUTTON)
- check_keyboard_status();
- #elif defined(USE_VFDPORT_TO_KEYLIGHT)
- check_keylight_status();
- #endif
- #if defined(FAT_Write_UI)||defined(CF_CARD_WRITE)//||defined(WRITE_USB)//liweihua 2003-10-29
- extern void polling_input_name(void);
- extern BYTE input_flag;
- if((full_scrn & PERIPHERAL) && (input_flag == 1))
- polling_input_name();
- #endif
- #ifdef AC3TEST
- if (gAC3onoff==1) {
- AC3ShowReport();
- }
- AC3CheckSampling();
- #endif
- if ( (audioNotContinuous>0) && (play_state==VCD_STATE_NORMAL) ) { //count it when STATE_NORMAL, Jeff 20021202
- audioNotContinuous--;
- if (audioNotContinuous==0) {
- if (!user_mute) {
- AUDIF_Demute();//2004AUDDRV AudioDemute();
- #ifdef CHANGE_DSP_SPDIF_OFF
- AUDIF_Set_SPDIF(setupGetSetting(14));//2004AUDDRV AudioSetSPDIF(setupGetSetting(14));
- #endif//#ifdef CHANGE_DSP_SPDIF_OFF
- }
- }
- }
- #ifdef NF_100
- if( (play_state!=VCD_STATE_PAUSE)&&(full_scrn!=SETUP) )
- {
- if( dvd_timer>0 )
- {
- //printf("polling_100ms play_state = %dn",play_state);
- polling_dvd_timer();
- }
- }
- #else
- if( ( P_frame == 0 ) // 2004/12/29 yltseng
- #ifndef SETUP_DONT_PAUSE
- && ( full_scrn != SETUP )
- #endif
- #ifndef PROG_DONT_PAUSE
- && ( full_scrn != PROGRAM )
- #endif
- )
- {
- if(!IsAVDPaused() && (dvd_timer>0) )
- polling_dvd_timer();
- }
- #endif
- if (hl_timer>0)
- recover_hl_color();
- if (auto_pause)
- polling_timeout();
-
- #ifdef SUPPORT_FUNCTION_MENU
- if(setup_menu_plus_timer)
- polling_setup_menu_plus();
- #endif //end #ifdef SUPPORT_FUNCTION_MENU
-
- #ifdef SUPPORT_REP_READ
- if(IsReadMode())
- PollingRecBufStatus();
- #endif
-
- #ifdef FS_BMP_GUI//zhaoyanhua add 2004-6-29 15:58
- if(cd_type_loaded == CDROM) // Robert 021004
- {
- if ((GetCurrentFileType() == CDROM) || (GetCurrentFileType() == CD_DA) || (GetCurrentFileType() == CDROM_WMA) || (GetCurrentFileType() == CDROM_AAC))
- polling_mp3();
- }
- #endif//#ifdef FS_BMP_GUI
-
- #ifdef BRIGHTNESS_COLOR_KEY
- polling_BCtimer();
- #endif
-
- #ifdef SUPPORT_HEADPHONE //xyy 2004-10-9
- polling_headphone();
- #endif
- #ifdef ALONE_GPIO_KEY//Jack 20041008
- polling_portable_akey();
- #endif
- #ifdef CONTINUOUS_NUM_KEY_SELECT
- if(ir_num_timer)
- polling_ir_num();
- #endif
- #ifdef DVB1000_NON_OS
- if(system_state == SYSTEM_TS)
- {
- CheckProgInterval();
- CheckDvbTunerStatus();
- }
- #endif
- }
- //
- //
- extern int gbm_gpio_led_flag;
- extern BYTE cd_type_loaded;
- #ifdef SunplusMoudleTest //axel 2004/4/2 11:55am while detected DVD, wait for 15 sec, tray out...
- UINT16 ModuleTicks=0;
- static inline void auto_modual_test(void)
- {
- if(cd_type_loaded==CDDVD)
- {
- if(ModuleTicks>=45)
- {
- ModuleTicks=0;
- ircmd_stop();
- delay_srv_10ms(100);
- //ircmd_power();
- /* delay_srv_10ms(500);
- ircmd_trayin();*/
- }
- else
- ModuleTicks++;
-
- }
- }
- #else
- #define auto_modual_test();
- #endif
- /*
- * polling_one_minute() wangap add 2004/4/26
- */
- static inline void polling_one_minute(void)
- {
- #ifdef TURN_OFF_POWER_RESUME //wangap 2004/4/21
- if(play_state!=VCD_STATE_STOP)
- polling_resume();
- #endif
- }
-
- #ifdef AUTO_ADJUST_TV_TYPE
- BYTE Adjust_TV_type =0;
- #endif
- #ifdef UART_WITHOUT_DEBUG_MODE //axelchen 2004/10/20
-
- void ReturnFromUart(void)
- {
- int d;
- if (!IsEPPRxEmpty())
- {
- d = EPP_GETC();
- UART0_putc(d);
- }
- }
- #endif
- #ifdef SLEEP_CONTROL_COUNTER //liumzh 2004-12-10 23:53
- UINT32 counter_sleep_control = 0;
- UINT32 sleep_time = 15;//seconds
- #endif
- #ifdef STOP_15M_AUTO_POWEROFF
- extern UINT8 STOP_15M_STATE;
- unsigned short int second_counter=0;
- unsigned short int sleep_counter=0;
- unsigned char one_second_flag=1;
- int timer_counter=0;
- unsigned char sleep_show_flags;
- #endif
- /*
- * polling_500ms()
- */
- static inline void polling_500ms(void)
- {
- /*#ifdef DVB1000_NON_OS
- int iHasTDT=0;
- iHasTDT=PollingTDT(5);//eric add 2004-12-16 15:12 use Demux channel 5
- if((full_scrn == PROGRAMINFO)&&iHasTDT)
- {
- printf("full_scrn == PROGRAMINFO)&&PollingTDT(5)n");
- DisplayProgramInfo(1);
- }
- #endif*/ //eric change polling TDT to 1SEC
- #ifdef PMP_KEYBOARD //xyy 2005-1-10
- extern polling_pmpkey(void);
- polling_pmpkey();
- #endif
- #ifdef EASTECH_SETUPMENU
- extern BYTE check_show_pscan_wait_time_mode;
- extern void pscan_change_time_out(void);
- extern void refresh_pscan_wait_time(BYTE wait_time);
- static BYTE wait_time=CHANGE_TO_PSCAN_WAIT_TIME_TOTAL;
- if(check_show_pscan_wait_time_mode==1){
- wait_time--;
- if(wait_time==0){
- pscan_change_time_out();
- wait_time=0;
- check_show_pscan_wait_time_mode=0;
- }
- else{
- refresh_pscan_wait_time(wait_time);
- }
- }
- else wait_time=CHANGE_TO_PSCAN_WAIT_TIME_TOTAL;
- #endif
- #ifdef UART_WITHOUT_DEBUG_MODE //axelchen 2004/10/20
- ReturnFromUart();
- #endif
- #ifdef SLEEP_CONTROL_COUNTER //liumzh 2004-12-10 23:53
- if(counter_sleep_control >= sleep_time *100*60)
- {
- counter_sleep_control = 0;
- sleep_time = 0;
- ircmd_power();
- }
- #endif
- #ifdef STOP_15M_AUTO_POWEROFF
- if(STOP_15M_STATE==1)
- {
- if((sleep_counter)/*&&(system_state== SYSTEM_STOP)*/)
- {
- sleep_show_flags--;
- if(!sleep_show_flags)
- ;//osd_sleep_disp(sleep_counter);
- second_counter++;
- if(second_counter>=60*2)
- { second_counter=0;
-
- sleep_counter--;
- if(sleep_counter==0)
- {
- if((system_state== SYSTEM_STOP)||(play_state==VCD_STATE_STOP))
- ircmd_power();
- }
- }
- }
- }
- #endif
- #ifdef SUPPORT_CD_TEXT //lizhx add 04/10/17
- if (cd_type_loaded == CDDA)
- {
- if(!((full_scrn & PROGRAM)||(full_scrn & SETUP)||(full_scrn & SOUND)))
- show_CDText_Title_Content(v11_trk_now);
- }
- #endif
- #ifdef MIDI_SCORE_TEST //modify by xlluo for test
- extern BYTE gb_showScore;
- #endif
- auto_modual_test();//terry,2004/4/2 04:49PM
- #ifdef AUTO_ADJUST_TV_TYPE
- if((play_state==VCD_STATE_NORMAL) && (Adjust_TV_type==1))
- {
- auto_adjust_tv_type();
- }
- #endif
- // mute mute
- if (is_dts_force_spdif_bitstream()) {
- regs0->aud_pcm_ramp_delta = 0xff;
- regs0->aud_pcm_ramp_cfg = 1;
- }
-
- #ifdef TEST_SERVO
- srv_mode_test_polling();//terry,2003/9/10 12:57AM
- #endif
- #ifdef RECORD_KEY//zhaoyanhua add 03-11-5 13:02
- if(same_disc_flag)
- same_disc_flag++;
- #endif
- auto_close_fun();
- auto_record_per_s();
- #ifdef SCRN_SAVER_WHEN_PAUSE
- if (full_scrn & SETUP)//4-3-5 23:24
- safe_srn_off();
- else if(play_state == VCD_STATE_PAUSE)
- #ifdef SUPPORT_MIDI //ouyang add for don't show saver in midi2005-1-12 19:22
- if(!gIsMidiSelMenu)
- #endif
- safe_srn_on();
- #endif
- #ifdef USE_PIN31_CONTROL_POWER_LED //gerry,2004-3-9 19:42
- if(gbm_gpio_led_flag<=4)
- gbm_gpio_led_flag++;
- else
- {
- GPIO_O_SET(4,1);
- }
- #endif//USE_PIN31_CONTROL_POWER_LED
- if (regs0->dsp24_port[4]==1)
- { //to check whether MIC is on or off, Jeff 20020904
- mic_on = 1;
- } else {
- mic_on = 0;
- }
- if ((full_scrn & SCORE)
- #ifdef MIDI_SCORE_TEST //modify by xlluo
- ||(gb_showScore)
- #endif
- #ifdef SUPPORT_SANJING_SCORE //xlluo for sjspical score ui 04 -10 -15
- ||(bIsSJScoreInvaild)
- #endif
- )
- { //Jeff 20020404
- Score_Polling();
- }
- // check mp2/mp3 sample-rate (reported from audio decoder)
- if(mpeg_audio) MPx_ChkSmpRate();
- if(auto_download_audio_chn)
- {
- if(AUDIF_AutoDownload_Codec(auto_download_audio_chn-1))//2004AUDDRV audif_auto_download_codec(auto_download_audio_chn-1)
- {//sucess
- auto_download_audio_chn=0;
- }
- }
- #ifndef FS_BMP_GUI//zhaoyanhua 2004-6-29 15:58
- if(cd_type_loaded == CDROM) // Robert 021004
- {
- if ((GetCurrentFileType() == CDROM) || (GetCurrentFileType() == CD_DA) || (GetCurrentFileType() == CDROM_WMA) || (GetCurrentFileType() == CDROM_AAC))
- polling_mp3();
- }
- #endif//#ifndef FS_BMP_GUI
- #ifdef REMAIN_TIME//nono 2-7-13 11:27
- // printf("polling:polling_clock=%dn",polling_clock);
- if(polling_clock<7)
- {
- if( (polling_clock==6)&&(t_disp) )
- t_disp+=10;
- polling_clock++;
- }
- #endif
- #if defined(SUPPORT_TUNER_MV114) || defined(SUPPORT_TUNER_ALPS) //xyy 2003-9-20 14:45
- if( system_state==SYSTEM_DOING_TUNER ) //huziqin 2004-2-26
- {
- if(tuner_mute_flag)
- tuner_mute_flag++;
- if(tuner_mute_flag>2) // mute 500mS
- {
- tuner_mute_flag=0;
- if(!user_mute)
- tuner_mute(0);
- }
- }
- #endif
- /*Here deleted by xyy 2004-8-5 */
- #ifdef SUPPORT_FS_LONGNAME //Maoyong 2004.06.24
- if( (play_state != VCD_STATE_PAUSE) && (play_state != VCD_STATE_STOP)
- &&(pFsJpeg->gifsState == FS_STATE_LIST||pFsJpeg->gifsState == FS_STATE_MP3))
- FS_ScrollDispFileName();
- #endif
- //nono add "&&defined(USE_GPIO_MUTE) "20040821
- #if defined(SUPPORT_DSPMUTE)&&defined(USE_GPIO_MUTE) //BENSON 2004/7/12 11:25