📄 isr.c
字号:
//DVD_043-1SEQUENCE
// DVD_102Micky, fix tigger movie will hang issue
// need check more.
//#define SUPPORT_UPDATE_SEQ
// ** TCH0.50; Don't define here, use RELEASE_SETTING to define in "winav.h"
//#define ERROR_CONCEAL
// The file "winav.h" must be included in first line
#include "winav.h"
#include "isr.h"
#include "cc.h"
#include "hal.h"
#include "servo.h"
#include "input.h"
#include "chips.h"
#include "vcd20.h"
#include "utl.h"
#include "panel.h"
#include "sysdebug.h"
#include "cdinfo.h"
//#ifdef SUPPORT_AVIN //yfxiao1215 ,for pdv288
#include "tft.h"
//#endif
#ifdef SUPPORT_PORTABLE_PROJECT
#include "initial.h" // Added for portable, KCHong, 20031118
#endif
// ** TCH1.72; begin... Total reserve 25(16+9) byte (From FF80h-FF98h/ each bank)
// ** TCH1.72; The code will move from INPUT and locate in Comon-Bank more.
// [1st] 25 bytes is dummy and conflict w/ Decoder IO.
BYTE code aDummy [25]= {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 80h~87h
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 88h~8fh
0x20, 0x00, 0x00, 0x00, 0x00, // 90h~94h
0x01, 0x00, 0x98, 0x00 // 95h~98h
};
// ** TCH1.72; end...
#ifdef SUPPORT_AV_SYSTEM
BYTE _bKeyGetCount; // Added for panel/IR performancement, 278b-Mustek
BYTE _bVolumeEncoder; // Added for panel/IR performancement, 278b-Mustek
#endif
#ifdef IR_CODE_CONTINUE // 1.08 KCHong, support H/W IR repeat mode
#ifdef W99132_IR
// wyc2.31, remove initial value.
BYTE bIRContinue;
#endif
#endif
//////////////////////////////////////////
BIT __btMultKey= FALSE ;
//extern BIT __btFreeze; // The status for CD-IF(open or close) in slow
extern DWORD __dwIFrames;
/////////////////////////////////////// 8 bytes
// LLY2.37p, remove __bISRKeyRead, because we will split IR and F/W key to __bISRKey and __bFWKey
// So, it's un-necessary to reference it to decide input key source
//BYTE __bISRKeyRead;
BYTE IDATA __bISRKey; // The Key that don't process now
DWORD __dwIER; // record now IER Value
// end ..
BYTE IDATA __bISRCount;
WORD IDATA __wTempPSR; // record PSR value in ISR module
////////////////////////////// 2 bytes
// Following variables is ISR MODULE usage, Other module should not use it
// wyc1.07a. remove this variale.
//BYTE __bKeyRepeat= 1; // The repeat time that same key push and don't process it
BYTE _bKeyGet; // ** TCH0.50; Read the key of PANEL or IR.
////////////////////////////////////// 5 bytes
// Declare in ISR_MonitorSystem
// indicate valid picture size(FALSE)
// LLY.161-2, remove "static" declare,
// because ISR_MonitorSystem() has moved to MONITOR.C temporality
//static BYTE _bISRGot; // isr global usage,
//static DWORD _dwDRAMValue; // read DRAM value for ISR
BYTE _bISRGot; // isr global usage,
DWORD _dwDRAMValue; // read DRAM value for ISR
////////////////////////////////////// 11 bytes
// Declare for _ISR_CheckHang ()
// ** TCH0.50; static WORD __wISRCountCheck= NULL; // increase 1 every 100 msec count
// ** TCH0.50; BIT _btHangCheck= TRUE; // TRUE if want to do Hang Check
// wyc1.20, initial the value in initial.c
DWORD __dwTimeHang; // The hnag time for checking Loader's failure
WORD __wMonitorLackIFD;
WORD __wMonitorIFDCount;
BYTE __bRecoverStage;
BYTE __bISRKeyPrev; // record the previous key, Key_Scan use
// end ..
// wyc2.31, move initial value to ISR_InitialVariables
DWORD __dwTimeISRKeyPrev; // The time the previous key enter
///////////////////////////////////// 9 bytes
// Declare for VCD 2.0 Auto-Pause and encounter error bitstream
// TRIGGET msg will be ignored if error bitstream is known within 10 sec (__dwTimeThreshold)
// wyc1.20, initial the value in initial.c
BYTE _bErrorSet;
DWORD __dwTimeError;
// end ..
// ** TCH0.50; DWORD __dwTimeThreshold=COUNT_10_SEC;
#define TIMETHRESHOLD_TRIGGER COUNT_10_SEC
/////////////////////////////////////
// Brian.276-5, for system hang control
extern DWORD __dwProgressCount;
#define MAIN_LOOP_HANG_TIME_OUT (COUNT_10_SEC*3L)
/////////////////////////////////////
// wyc1.21, CoCo's updated code for C3 retry.
//CoCo.C3-retry
extern BYTE __bDVDROM;
extern BYTE __bC3Retry;
extern BYTE IDATA __bMin, __bSec, __bFrame;
#if defined(KEY_RIGHT_LEFT_CHANGETO_SCF_SCB)||defined(KEY_NEXT_PREV_SCB_SCF_AS_KEY_DOWN_UP_LEFT_RIGHT) //yhtang_0809
BYTE flag1=0,flag2=0,flag3=0,flag4=0,flag5=0;// yhtang_0809
//flag1 means continuely pressed KEY_RIGHT or key_LEFT and count the times that KEY_RIGHT or prev pressed;
//flag2 means KEY_RIGHT or key_LEFT have been pressed continuely more than 10 times ;
//flag3 means once pressed KEY_RIGHT or key_scf, if no KEY_RIGHT or key_LEFT is pressed, this KEY_RIGHT or key_LEFT that presed before must recover;
//flag4 means KEY_RIGHT or key_LEFT have transfered to be key_scf or Key_scb;
//flag5 used to count the times between two key_scf or key_scb;
BYTE bKEY_KEEP; //keep key pressed before
#endif
void SRV_Timer0(void);
// wyc1.20, move some functions' prototype to other modules.
// protected functions
void _ISR_ErrorConcealment (void);
void _ISR_MonitorSystem (void);
void _ISR_CountOneSector(void);
// Function : ISR_Timer1; ET1(SFR, bit 3 of IE)
// *********************************************************************
// Function : ISR_Timer0; ET0(SFR, bit 1 of IE)
// Timer0, mode 1, 16 bits counter
// Description : 1. receive the internal timer counting(When up counter overflow)
// 2. Must re-load the TH1, TL1 value before end of this function
// 3. The Timer will scan Key, monitor system and Error-Concealment
// Arguments : NONE
// Return : NONE
// Side Effect :
// *********************************************************************
//DVD_037RECOVER
#ifdef SYSTEM_8051
void ISR_Timer0(void) interrupt 1 using 1
#else
void ISR_Timer0(void)
#endif
{
//DVD_037RECOVER
#ifdef SYSTEM_8051
// brian.276-5, system hang control
// wyc1.11a, support watch dog timer
// wyc1.22-MP3hang
__dwW99AVCmdArg = __dwW99AVCmdBuffer_ISR;
if (__dwCountSystem - __dwProgressCount > MAIN_LOOP_HANG_TIME_OUT)
{
// do nothing
// the main loop has been hanging for over 30 seconds
// and we will not clear the Watchdog timer,
// so it will timeout (after 2 sec on 33.25M turbo51) and reset uP
}
else
{
// Clear Watchdog Timer
// If the interrupt hangs and Timer0 ISR is not triggered, the watchdog will timeout and reset uP
TIMED_ACCESS(); // Brian1.10-3, add Time Access protection code
CLRWT = 1;
}
__dwCountSystem++;
__bISRCount++;
//DVD_051Micky
__bSystemTimer++;
SRV_Timer0();
#ifdef IR_CODE_CONTINUE // 1.08 KCHong, support H/W IR repeat mode
#ifdef W99132_IR
if(IRCON & 0x08)
{
if((__dwCountSystem-__dwTimeISRKeyPrev)>COUNT_150_MSEC)
{
// wyc1.20, update HKC and XuLi code for IR continue related code.
#ifdef CHECK_IR_CUSTOMER_CODE // 1.10 KCHong, support custom code in repeat mode.
IRCON=0x03;
#else
IRCON=0x01;
#endif
bIRContinue=0;
}
}
#endif
#endif
// ** TCH0.16; #ifdef _WINSVCD
//DVD_037RECOVER
// wyc2.81, remove it because this function is empty.
/*#ifdef INPUT_PATH_ATAPIIF
SERVO_ISR();
#endif*/
// ** TCH0.16; #endif
// COUNT_PER_SCAN=100ms.
// ** TCH0.16; It can save the time (__bISRCount <-> __dwCountSystem )
/// if ( ! (__dwCountSystem % COUNT_100_MSEC ) )
// wyc.278a, HKC code for PANEL
if ( ! (__bISRCount % COUNT_100_MSEC ) )
{
// each 100 ms do key scan
// You need to choose one of two conditions
#ifdef ENABLE_PANEL_KEYSCAN
// 1. Use it if your Key-Scan comes from VFD
#ifdef SERIAL_DEBUG
if (!_bAutoUpgrade) //CoCo.sd
#endif
_bKeyGet= PANEL_KeyScan ();
#else
// 2. Don't execute Key-Scan operation
_bKeyGet= KEY_NO_KEY;
#endif // ENABLE_PANEL_KEYSCAN
if ( _bKeyGet != KEY_NO_KEY )
{
// Add these code for preventing key-detect many times
#ifdef KEY_RIGHT_LEFT_CHANGETO_SCF_SCB //yhtang_0809
if((_bKeyGet==KEY_RIGHT)||(_bKeyGet==KEY_LEFT))
{
if ( _bKeyGet == bKEY_KEEP )
{
if(flag5)
{
if(_bKeyGet==KEY_RIGHT)
_bKeyGet=KEY_SCF;
else
_bKeyGet=KEY_SCB;
flag5=0;
flag4=1;
}
else
{
if(flag2)
{
if(!flag4)
{
if(_bKeyGet==KEY_RIGHT)
_bKeyGet=KEY_SCF;
else
_bKeyGet=KEY_SCB;
flag4=1;
}
else
{
_bKeyGet=KEY_NO_KEY;
}
}
else
{
flag1++;
flag3=1;
if(flag1>10)
{
flag1=0;
flag2=1; //transfered
flag3=0;
flag4=0;
flag5=0;
}
_bKeyGet=KEY_NO_KEY;
}
}
}
else
{
flag3=1;
flag1=0;
flag2=0; //transfered
flag4=0;
flag5=0;
bKEY_KEEP=_bKeyGet;
_bKeyGet=KEY_NO_KEY;
}
}
else
#endif
#ifdef KEY_NEXT_PREV_SCB_SCF_AS_KEY_DOWN_UP_LEFT_RIGHT
extern BYTE __bSetupMode;
if(((_bKeyGet==KEY_PREV)||(_bKeyGet==KEY_NEXT)||(_bKeyGet==KEY_SCB)||(_bKeyGet==KEY_SCF))&(!__bSetupMode))
{
if ( _bKeyGet == bKEY_KEEP )
{
if(flag5)
{
if(_bKeyGet==KEY_PREV)
_bKeyGet=KEY_UP;
if(_bKeyGet==KEY_NEXT)
_bKeyGet=KEY_DOWN;
if(_bKeyGet==KEY_SCB)
_bKeyGet=KEY_LEFT;
if(_bKeyGet==KEY_SCF)
_bKeyGet=KEY_RIGHT;
flag5=0;
flag4=1;
}
else
{
if(flag2)
{
if(!flag4)
{
if(_bKeyGet==KEY_PREV)
_bKeyGet=KEY_UP;
if(_bKeyGet==KEY_NEXT)
_bKeyGet=KEY_DOWN;
if(_bKeyGet==KEY_SCB)
_bKeyGet=KEY_LEFT;
if(_bKeyGet==KEY_SCF)
_bKeyGet=KEY_RIGHT;
flag4=1;
}
else
{
_bKeyGet=KEY_NO_KEY;
}
}
else
{
flag1++;
flag3=1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -