?? monitor.c
字號:
// The file "winav.h" must be included in first line
#include "winav.h"
#include "utl.h"
#include "hal.h"
#include "servo.h"
#include "input.h"
#include "chips.h"
#include "cdinfo.h"
#include "digest.h"
#include "navigate.h"
#include "cc.h"
#include "monitor.h"
#include "isr.h"
#include "osd.h"
#include "linear.h"
#include "cell.h"
#include "comutl.h" // LLY.042-2
#include "vcd20.h" // LLY.161-2
#include "thumb.h" //CoCo.jpeg
#include "setup.h" //Brian2.81
#include "avsys.h" //Kevin2.81-2
#include "ucode.h"
#ifdef SUPPORT_AVIN
#include "tft.h"
#endif
////////////////////////////////////////////////////////////////
// wyc2.80, default disable this define
//#define ENABLE_ALWAYS_CHECK_SEQUENCEHEADER
// wyc1.22, add define to issuing KEY_STOP to stop playing scratched title when KEY_NEXT several times.
// wyc1.24a, re-arrange the recover path when disc is scratched and hardly to recover it.
// #define SCRATCH_ENTER_STOP_MODE
#define RECOVER_NORMAL 0
#define RECOVER_ENTER_STOP 1
#define RECOVER_GO_MENU_TITLE 2
#define ERROR_RECOVER_MODE RECOVER_GO_MENU_TITLE
#if ERROR_RECOVER_MODE == RECOVER_GO_MENU_TITLE
BYTE __bGoMENU_TITLE;
#endif //
#ifdef SERIAL_DEBUG
// Chuan1.00-2, define it to dump debug information
#define DUMP_DEBUGINFO
#endif
// Some extern variable which are defined in other module
// *** MULTI_DISC;
extern BYTE __bMinActual, __bSecActual;
//GOTOTIME use
extern DWORD __dwGoToTime;
extern BIT __btNewTime;
extern BIT __btPlayFromBegin;
extern BIT __btFromStopMode;
//REPEATAB use
extern BYTE __bRepeatAB;
extern DWORD __dwTimeA, __dwTimeB; // record the times for repeatAB
//SLOW use
//extern BIT __btFreeze;
// The sectors to jump for each SCAN complete
// The sectors is defined in SCAN_GAP
extern WORD __wScanGap;
// recover stage usage
extern BYTE __bStillTime; // record the Still Time (0: NONE, 0xFF: Infinite; Other: seconds.)
// DVD_161aMicky, remove unused cell variable.
//extern BYTE __bVOBUWait;
extern BYTE __bVOBUStill;
// wyc1.20, extern some variables from ISR for reducing common back code size.
extern WORD IDATA __wTempPSR; // record PSR value in ISR module
extern DWORD _dwDRAMValue; // read DRAM value for ISR
// wyc1.24, extern variables for JPG recover mechanism.
extern BYTE __bFMJPGNext;
extern DWORD __dwFMJPGNextGap;
////////////////////////////////////////////////////////////////////////
// Some global variable
static BYTE __bCountCDDA2VCD;
//LJY1.23, LJY1.11b-2, for anti-shock error recovery
#ifdef SUPPORT_ANTISHOCK
DWORD __dwPrevTime;
BYTE __bSctErrCntr;
#endif
// TCC172r, this variable is not used in any module
//DWORD __dwServoTime;
WORD __wV_TEMP; // record V_TEMP value
//DVD_037RECOVER, Recover stage usage
DWORD __dwAudioFrames;
DWORD __dwTimeHalt;
// wyc1.07, rename some variables.
BYTE __bResetRecover;
// wyc1.23, modify __bTotalRecover to __bResetInitialCount for record the times of issuing function HAL_RealResetInitial
BYTE __bResetInitialCount;
//BYTE __bResetFailCount=0; // wyc1.23, remove this variable
BYTE __bTotalFailCount;
// wyc1.07, some new variables for new error concealment mechanism.
BYTE __bDoActionInStage;
BYTE __bSoftResetCount;
BYTE __bNEXTPREVCount;
BYTE __bJumpSectorCount;
WORD __wJumpTime ;
// wyc1.21, add this variable to record last time jump time. If jump time of last time and this time are the same, then we assume CELL provide same time to us because of status abnormal.
// So F/W jump same time because CELL provide same time every time. If FRAME_ID detected but system still hang then F/W will involve in infinite loop because of every time enter
// stage 2 will jump same time. So need to add this variable to break the infinite loop by checking.
// we need to break it. So record it to check the infinite loop status and break them if needed.
WORD __wPreJumpTime ;
// wyc1.10, because default now we will support soft reset when KEY_NEXT / KEY_PREV. So this variable need to modify to record if need to H/W reset. So rename it.
BYTE __bNextHWReset;
// kwd1.05-4th declare new variable for error concealment
BYTE _bSaveModeCmd;
// #define _DEBUG_INFO
////////////////////////////////////////////////////////////////////////
// Some internal global variable
//DVD_039-1, recover stage usage -- keep SCR value
static DWORD _dwTimeRecoverUsed;
// LLY.051, modify to fix linker error -- can't find ?CO?MONITOR
// while #define NO_SCREEN_SAVER
// LLY.050a, re-define for screen saver mode usage
#ifndef NO_SCREEN_SAVER
DWORD _dwTimeWaitSCR; // check time
int _iSCR_XGap; // the gap for horizontal moving, 4N
int _iSCR_YGap; // the gap for vertical moving
// LLY.100a-1, don't give the default value for SCR (X,Y) start point
// because it will be calculated base on VDS/ HDS
WORD _wSCRXPos; //=0x104L; // the horizontal start for screen saver, 4N
WORD _wSCRYPos; //=0x12L; // the vertical start for screen saver
#define SCRXOFFSET 0x4
#define SCRYOFFSET 0x2
DWORD _dwMoveCnt; // indicate the count for bitmap moving
#endif // #ifndef NO_SCREEN_SAVER
#ifdef SUPPORT_SCR_COLOR_CHANGE
#define COLOR_CHANGE_IDX 1 // define color change index
// LLY.102, indicate the next index of aRGBVal[] for color change usage
// 0x0 ~ 0xFE: means real index
// 0xFF: means the color of original bitmap
BYTE _bSCRRGBIdx;
// LLY.102, define aRGBVal[] total number for color change usage
#define MAXNO_COLOR_CHANGE_SEQUENCE 0xB
// specify the color change sequence
// 1st item: total number
// last item: the original color for color change action
// it can be get by read DRAM after OSD_ShowBitmap
DWORD code aRGBVal[]=
{
0x00000080, 0x000000FF, 0x00008000, 0x0000FF00,
0x00800000, 0x00FF0000, 0x00FF0080, 0x00FF00FF,
0x00FF8000, 0x00FFFF00, 0x00FFFF80,
};
// LLY.102, keep original RGB value
DWORD _dwOldRGBVal;
//CK.102, for screen saver color palette transition
// _bCurX means current RGB value
// _bNextX means current RGB value
BYTE _bCurR, _bCurG, _bCurB;
BYTE _bNextR, _bNextG, _bNextB;
#else // #ifdef SUPPORT_SCR_COLOR_CHANGE
DWORD code aRGBVal[]=
{
0
};
#endif // #ifdef SUPPORT_SCR_COLOR_CHANGE
// LLY.101, define some internal global variable
DWORD _dwMONITORTemp;
// wyc1.20, re-arrange the define of NO_SCREEN_SAVER
#ifndef NO_SCREEN_SAVER
// brian.155, for Multi-bitmap, mix ratio control
extern BYTE __bBitmapIndex; //brian, multiple bitmap screen saver
char _cStep=0;
BYTE __bFisrtLoad=TRUE;
DWORD __dwBitmapTBuffer, __dwBitmapBBuffer;
#endif
BYTE _bBrightnessDuration;
// wyc.160
DWORD _dwCDDAScanTime;
BYTE _bReadCDDA;
// wyc1.25, two variable to force reset DSP when it is abnormal.
// wyc2.31, remove this variable.
//BYTE __bNeedResetAudio;
WORD __wAudioResetCount;
// wyc1.21, update CoCo's code for C3 retry.
//CoCo.C3-retry
#if defined(SUPPORT_JPEG_C3) || defined(SUPPORT_MP3_C3)
BYTE __bC3Retry;
DWORD __dwC3ResendSector;
#ifdef _DEBUG_INFO
DWORD __dwC3RetryTimes;
#endif
extern BYTE IDATA __bMin, __bSec, __bFrame;
#endif
#ifdef SUPPORT_RISC_DETECT_ERROR //CoCo2.32
DWORD __dwErrorCount;
DWORD __dwErrorDisplay; // ** TCH2.37;
#endif
// wyc2.39, for martking non-playable MP3 file in FM mode.
void _FM_MP3CANNOTPLAY(void);
// wyc1.07, some new function to read the DM and SCRR for recover checked usage.
void _SetCheckedValue();
void _GetCheckedValue();
BYTE _GetStreamInputState(DWORD *pdwVal);
// wyc1.07, one function to initial value for intiial to reference.
void MONITOR_InitialValue(void);
// wyc1.20, move from ISR to reduce common bank code size.
void _ISR_CheckHang (void);
void _ISR_CountOneSector();
/////////////////////////////////////
// wyc1.07, add a new API to show debug information for error concealmernt.
#if defined (SERIAL_DEBUG) || defined(SUPPORT_PRINTF)
void MONITOR_ShowDebug();
#endif //
// wyc1.25, extern this function.
void OSD_RecoverOSD(void);
// ************************************************************************
// Function : MONITOR_VideoStream
// Description : Monitor the video stream info. It's used to detect if
// IC auto perform some kinds of actions
// Arguments : None
// Return : None
// Side Effect :
// ************************************************************************
void MONITOR_VideoStream(void)
{
// must check W9922QF about the title -- "It don't rain" !!
extern BIT __btCheckVideoType;
if (__btPlaying)
{
if ( __btCheckVideoType )
{
// one title playitem is encoded as motion
// but the segment play item content is encoded as High PAL still
// now the ucode(02.26) can auto detect this, and set DRAM to let
// F/W know this case.
// DVD.012, if (HAL_MonitorVideo()==HAL_VIDEO_MOTION)
if ( HAL_Monitor(HAL_MONITOR_VIDEO_STATUS_DONE) ) // not check yet
{
__bModePlay=MODE_PLAYMOTION;
__btCheckVideoType=FALSE;
}
}
}
// wyc2.80, add TCH modified code here.
#ifdef ENABLE_ALWAYS_CHECK_SEQUENCEHEADER
// ** TCH2.80; begin... Fix problem: One DVCD has two format @ 1 track. first is 352x288, 2nd is 352x240.
// The DVCD title name is "管㏑鋇牟" from SZ. The reaction is a little slow. If hope to accelerate, need ISR support.
if ( __wDiscType & (BOOK_2X|BOOK_VCD|BOOK_CDI) )
{
W99AV_ReadDRAMData (W99AV_DRAM_UPDATE_SEQ, &__dwTemp);
if ((__dwTemp& 0xFFFF0000) == NULL)
{
_wSCRYPos= __wPicVsize; // Keep it as temp variable as avoid to do HAL_AdjustTVMode each time.
if ( HAL_GetStreamInfo () )
{
if ( _wSCRYPos != __wPicVsize )
{
HAL_AdjustTVMode();
}
}
/// printf ( "V= %d, H=%d,,\n ", __wPicVsize, __wPicHsize );
W99AV_WriteDRAMData(W99AV_DRAM_UPDATE_SEQ, 0x10000); // mean re-do sequence header one time again.
}
} // check __wDiscType
#endif // ENABLE_ALWAYS_CHECK_SEQUENCEHEADER
// LLY.102-1, reset SPST while dis-continue
// [1] SCAN command
// [2] FAST command
// DVD_100aMicky, fix fast mode, subpicture buffer overflow, cause no DMA done
// on title Titantic(48:00)
//if (__bModeCmd==KEY_FF)
if(__bModeCmd==KEY_FF || __bModeCmd==KEY_SCF || __bModeCmd==KEY_SCB)
{
HAL_Reset(HAL_RESET_SPST);
// Chuan2.79, SCB/SCF <-> FAST, SCB <->SCF, System will hang.
// If can't detect IFD > 1 sec, the following code will force enter Recover Stage 2 when FAST/SCF/SCB
if ((__wMonitorLackIFD > 10) && (__wMonitorLackIFD < 80) && (__bAttrPlay!=ATTR_CDDA))
{
if (_bBrightnessDuration++ == 1)
{
__wMonitorLackIFD = MONITOR_RESETCHIP + 1;
// wyc1.11-2, should set to 1 because recover stage 1 will do soft reset RISC, not stage 2.
__bRecoverStage = 1;
//__bRecoverStage = 2;
__bResetRecover = 0;
}
}
else
{
// Chuan2.79, Clear _bScanHang count
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -