📄 polling.c
字号:
/*
** 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=%x\n",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=%d\n",resume_time_ourmind);
}
if(resume_time_ourmind>=6)
{
RsmInfo2Flash(0);
resume_time_ourmind=0;
//printf("resume_time_ourmind=%d\n",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=%d\n",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: %04x\n", regs0->dsp24_port[7]);
//ycwen 2004/12/15 Print video and audio buffer status if necessary
//printf("DSP3: %04x %x %x\n", 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 successfully\n",dbg_msg);
break;
case 0xC012:
printf(" %04x download dsp3rom.d16.ac3.5.1ch.16M successfully\n",dbg_msg);
break;
case 0xC031:
printf(" %04x download dsp3rom.d16.mp3.2ch successfully\n",dbg_msg);
break;
case 0xC032:
printf(" %04x download dsp3rom.d16.mp3.2ch.EQ.16M successfully\n",dbg_msg);
break;
case 0xC041:
printf(" %04x download dsp3rom.d16.lpcm.2ch successfully\n",dbg_msg);
break;
case 0xC042:
printf(" %04x download dsp3rom.d16.lpcm.2ch.EQ.16M successfully\n",dbg_msg);
break;
case 0xC061:
printf(" %04x download dsp3rom.d16.cd.2ch successfully\n",dbg_msg);
break;
case 0xC071:
printf(" %04x download dsp3rom.d16.wma.2ch successfully\n",dbg_msg);
break;
case 0xC091:
printf(" %04x download dsp3rom.d16.spdif.2ch successfully\n",dbg_msg);
break;
case 0xC0B1:
printf(" %04x download dsp3rom.d16.nes.2ch successfully\n",dbg_msg);
break;
case 0xD011:
printf(" %04x download dsp3rom.d16.ac3 successfully\n",dbg_msg);
break;
case 0xD012:
printf(" %04x download dsp3rom.d16.ac3.spi successfully\n",dbg_msg);
break;
case 0xD013:
printf(" %04x download dsp3rom.d16.945.ac3 successfully\n",dbg_msg);
break;
case 0xD021:
printf(" %04x download dsp3rom.d16.dts successfully\n",dbg_msg);
break;
case 0xD022:
printf(" %04x download dsp3rom.d16.dts.spi successfully\n",dbg_msg);
break;
case 0xD023:
printf(" %04x download dsp3rom.d16.dtscd successfully\n",dbg_msg);
break;
case 0xD024:
printf(" %04x download dsp3rom.d16.945.dts successfully\n",dbg_msg);
break;
case 0xD025:
printf(" %04x download dsp3rom.d16.108.dtscd successfully\n",dbg_msg);
break;
case 0xD026:
printf(" %04x download dsp3rom.d16.raw.dtscd successfully\n",dbg_msg);
break;
case 0xD031:
printf(" %04x download dsp3rom.d16.mp3 successfully\n",dbg_msg);
break;
case 0xD041:
printf(" %04x download dsp3rom.d16.lpcm successfully\n",dbg_msg);
break;
case 0xD042:
printf(" %04x download dsp3rom.d16.lpcm.fudo successfully\n",dbg_msg);
break;
case 0xD051:
printf(" %04x download dsp3rom.d16.ppcm successfully\n",dbg_msg);
break;
case 0xD061:
printf(" %04x download dsp3rom.d16.cd successfully\n",dbg_msg);
break;
case 0xD062:
printf(" %04x download dsp3rom.d16.cd.spi successfully\n",dbg_msg);
break;
case 0xD071:
printf(" %04x download dsp3rom.d16.wma successfully\n",dbg_msg);
break;
case 0xD081:
printf(" %04x download dsp3rom.d16.midi successfully\n",dbg_msg);
break;
case 0xD091:
printf(" %04x download dsp3rom.d16.spdif successfully\n",dbg_msg);
break;
case 0xD0A1:
printf(" %04x download dsp3rom.d16.noise successfully\n",dbg_msg);
break;
case 0xD0B1:
printf(" %04x download dsp3rom.d16.nes successfully\n",dbg_msg);
break;
case 0xD0C1:
printf(" %04x download dsp3rom.d16.tuner successfully\n",dbg_msg);
break;
case 0xCDEF:
printf(" %04x DSP PCM output underflow\n",dbg_msg);
break;
case 0xDEAD:
printf(" %04x bitstream error\n",dbg_msg);
break;
default:
printf(" %04x\n",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__" timeout\n");
#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);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -