📄 polling.c
字号:
#include "stdlib.h"
#include "regmap.h"
#include "config.h"
#include "global.h"
#include "memmap.h"
#include "avd.h"
#include "util.h"
#include "stc.h"
#include "audio.h"
#include "cd.h"
#include "cddsp.h"
#include "ringbuf.h"
#include "dsa.h"
#include "sig.h"
#include "func.h"
#include "hwsetup.h"
#include "iop.h"
#include "gpio.h"
#include "osd.h"
#include "set.h"
#include "servo.h"
#include "avapi.h"
#include "dma.h"
#include "cdfunc.h"
#include "ircmd.h"
#include "cpu.h"
#include "uart.h"
/*
static BYTE TimeCounter = 0; // ChenFu Test
*/
int polling_timeout()
{
if (timeout_playback) {
if ((get_rtc() >> 4) > timeout_playback) {
if (GetIntrMask() & INTR_TIMEOUT) {
SetIntrFlag(GetIntrFlag() | INTR_TIMEOUT);
}
AVD_SetMediaTimeout();
timeout_playback = 0;
}
}
return 0;
}
int polling(void)
{
UINT32 diff;
UINT32 timenow;
timenow = regs0->stc_15_0;
diff = timenow ^ stc_polling;
stc_polling = timenow;
#ifndef SUPPORT_COMBO
// polling_dsat(0);
#endif
#ifndef UNIX
if ((diff & 0x0000fff8) == 0)
return 0; /* mask by 0xffe0 */
#endif
#ifndef SUPPORT_COMBO
// polling_dsar(0);
#endif
#ifndef EMU_DEMO_BOARD
if (!(regs0->stamp & (1 << 14))) { /* for power down */
/* kevinlu 2002.5.6 */
for (timenow = 0; timenow < 5; timenow++) {
if (regs0->stamp & (1 << 14))
break;
else if (timenow == 4) {
int i;
#ifdef SUPPORT_DISCMAN
GPIO_O_SET(11, 1);
#else
GPIO_O_SET(38, 1);
#endif
// reset system
while (1) {
regs0->reset = 0x01;
for (i = 0; i < 0xfffff; i++);
}
}
}
return 0;
}
#endif
/* filter-entry (32 * 90kHz) */
#ifndef UNIX
if ((diff & 0x0000ffe0) == 0)
return 0; /* mask by 0xffe0 */
#endif
#ifdef SUPPORT_EPP_DBG
polling_epp();
#endif
if ((!IsRPicStart && IsVPicEnd) || (GetIntrFlag() & INTR_TRACK_CHANGE)) {
if (GetIntrMask() & INTR_TIMEOUT) {
polling_timeout();
if (IsAVDMediaTimeout()) {
AVD_SetMediaInterrupt();
if ((sys_cmd == 0) && (timeout_playback == 0))
PostCommand(CMD_FUNC | CMD_FUNC_TIMEOUT);
}
}
}
if (do_dec_video()) { /* try decoding video frame */
#if SUPPORT_OGT
// polling_ogt();
#endif
}
#if 0
PollingUartRecv();
#endif
#ifdef SUPPORT_DSA_DEVICE
PollingDSA();
#endif
#ifdef SUPPORT_BUS_DEVICE
PollingBUS();
#endif
#ifdef SUPPORT_WINBOND_VOICE
PollingVoice();
#endif
#ifdef SUPPORT_TOUCH_SCREEN
PollingTouchScreen();
#endif
#ifdef SUPPORT_TAXI_FUNCTION
PollingTaxiACC();
#endif
/* Timer check */
/* 1 ms polling intrval */
if (TimeUp_1MS()) {
/* 10 ms polling intrval */
if (TimeUp_10MS()) {
Clr_Timer_10MS();
SystemTimer10mS();
#ifdef SUPPORT_DSA_DEVICE
DSATimer10mS();
#endif
#ifdef SUPPORT_BUS_DEVICE
BUSTimer10mS();
#endif
#ifdef SUPPORT_VOICE
VoiceTimer10mS();
#endif
#ifdef SUPPORT_DBUS_FUNCTION
DBusTimer10mS();
#endif
#ifdef SUPPORT_WATCH_DOG
PollingWatchDog();
#endif
if (!(Timer10mS % 4)) {
polling_ir();
}
if (!(Timer10mS % 10)) {
GraphTimer100mS();
#if defined(SUPPORT_GPS_TR2000) || defined(SUPPORT_GPS_MOSUSS)
HostTimer100mS();
#endif
#ifdef SUPPORT_GPRS_FUNCTION
GSMTimer100mS();
#endif
#ifdef SUPPORT_DBUS_FUNCTION
DBusMenuTimer100mS();
#endif
}
Timer10mS++;
if (Timer10mS >= 100) {
Timer10mS = 0;
// TimeCounter++;
// psprintf(LineBuffer, "Timer : %02x", TimeCounter);
// MenuPrintMessage(1);
OSDTimer1S();
#ifdef SUPPORT_GPS_FUNCTION
NavigationTimer1S();
#endif
#ifdef TEST_DRAM_BUFFER
TestDramBuffer();
#endif
#ifdef TEST_UART_BUFFER
psprintf(LineBuffer, "TEST UART : %02x%02x-%02x-%02x",
UART_DIV_H, UART_DIV_L,
UartSend_rp, UartSend_wp);
MenuPrintMessage(2);
#endif
#ifdef TEST_GPIO_OUTPUT
TestOutputGPIO();
#endif
#ifdef SUPPORT_TOUCH_SCREEN
TouchStartTimer();
#endif
}
}
PollingUartSend();
#ifdef SUPPORT_DSA_DEVICE
if (DSABitTimer) DSABitTimer--;
PollingDSAComm();
#endif
#ifdef SUPPORT_BUS_DEVICE
if (BUSBitTimer) BUSBitTimer--;
PollingBUSComm();
#endif
#ifdef SUPPORT_VCD_HOST
PollingVCDComm();
#endif
Clr_Timer_1MS();
}
return 0;
}
void polling_Qtable(void)
{
UINT16 qmx0_data,qmx1_data,qmx2_data,qmx3_data;
regs0->qmx_par = (0 << 14) | (0 << 8) | 0; qmx0_data = regs0->qmx_par;
regs0->qmx_par = (1 << 14) | (0 << 8) | 0; qmx1_data = regs0->qmx_par;
regs0->qmx_par = (2 << 14) | (0 << 8) | 0; qmx2_data = regs0->qmx_par;
regs0->qmx_par = (3 << 14) | (0 << 8) | 0; qmx3_data = regs0->qmx_par;
// psprintf(linebuf, "q=%04x\n", qmx0_data);
// epp_write_wait(linebuf);
// psprintf(linebuf, "qtable_data=%04x\n", qtable0_data);
// epp_write_wait(linebuf);
if ((qmx0_data != qtable0_data) || (qmx1_data != qtable1_data) ||
(qmx2_data != qtable2_data) || (qmx3_data != qtable3_data)) {
quant_load_seq = 0x0f;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -