?? monitor.c
字號:
_bBrightnessDuration = 0;
}
}
// ** TCH0.65; begin...
#ifdef SUPPORT_ANTISHOCK
{
extern BYTE __bWrongPartNo;
W99AV_ReadDRAMData ( 0xc9, & __dwTemp );
if ( HIWORD(__dwTemp ) == 0x111)
{
__bWrongPartNo = TRUE;
printf ( "\n *** Wrong Part [%lx]", __dwTemp ); // ** TCH0.65;
}
}
#endif
// ** TCH0.65; end...
#ifdef NOT_SUPPORT_HWINT
ISR_Timer0();
//DVD_047-1
if (__btPlaying)
ISR_INT1();
#endif // #ifdef NOT_SUPPORT_HWINT
}
// *********************************************************************
// Function : MONITOR_AudioStream
// Description : Check audio bitrate for SVCD/MP3 title, and re-setting
// the correct value to audio DAC.
// Arguments : None
// Return : None
// Side Effect :
// *********************************************************************
void MONITOR_AudioStream(void)
{
// some SVCD is not 48K??(It don't rain..., it's 44.1K)
extern BYTE __bCheckAudioType;
// LLY.101, replace "dwAudioFreq" with "_dwMONITORTemp"
// monitor audio frequency and set DAC to correct freq.
// continue check 5 times.
if(__btPlaying)
{
if(__bCheckAudioType & CHECK_AUDIO_FREQ)
{
if ( HAL_Monitor(HAL_MONITOR_AUDIO_FREQ) )
{
// 1. read back audio frequency, and set audio DAC -- LLY.275a
W99AV_ReadInfo(W99AV_INFO_AUDIOFREQ, &_dwMONITORTemp); //Step 2: DSP reads the header for frequency and waits.
// LLY.101, re-adjust the control flow
HAL_SetAudioDAC((BYTE)_dwMONITORTemp); //Step3: Host reads the frequency DM and sets correct ACLK frequency & programs ADAC.
// 2. read back the audio's samples/frame value -- LLY.171
W99AV_ReadInfo(W99AV_INFO_SAMPLES_PER_FRAME, &_dwMONITORTemp);
__wW99AVSamplesPerFrame=(WORD)_dwMONITORTemp;
//Kevin1.23, Freq may change after changing track/file within 1 sec=> set prologic again
CHIPS_ProLogicControl();
//Kevin1.25, fix "SPDIF discont. while changing files" and "Freq wrong at file beginning" by programming ACLK & ADAC first
//Step4: host tells DSP to start decoding
#ifdef SUPPORT_WMA
if(__bAttrPlay==ATTR_WMA)
W99AV_WriteDM(W99AV_DM_WMA_FREQ_READ_FLAG, 1);
#endif
if(__bAttrPlay==ATTR_MP3)
W99AV_WriteDM(W99AV_DM_MP3_FREQ_READ_FLAG, 1);
__bCheckAudioType &= ~CHECK_AUDIO_FREQ;
}
}
// wyc.170-2, monitor the audio stream and if need to check LPCM de-emphasis, we check the de-emphasis information
// and set audio DAC in W6630.
#ifdef SUPPORT_AUDIO_DEEMPHASYS
if (__bCheckAudioType & CHECK_LPCM_DEEMPHASIS)
{
if (HAL_Monitor(HAL_MONITOR_LPCM_DEEMPHASIS))
{
// wyc.275a, enhance de-emphasis code.
W99AV_ReadInfo(W99AV_INFO_LPCM_DEEMPHASIS, &_dwMONITORTemp);
if (_dwMONITORTemp)
{
//Kevin2.37, add
__bHAL1_Deemphasis = TRUE; //referenced by _ProgramAudioDAC()
// Read back audio frequency, and re-setting audio DAC -- LLY.275a
W99AV_ReadInfo(W99AV_INFO_AUDIOFREQ, &_dwMONITORTemp);
HAL_SetAudioDAC((BYTE)_dwMONITORTemp);
}
__bCheckAudioType &= ~CHECK_LPCM_DEEMPHASIS;
}
}
#endif //
// end ..
// LLY.161-2, it's unnecessary by 20010928 DSP code
// because detecting CDDA method has modified
/*
// LLY.101, run time detect CDDA format
if(__bCheckAudioType & CHECK_CDDA_FORMAT)
{
if(HAL_Monitor(HAL_MONITOR_CDDA_FORMAT) )
{
W99AV_ReadInfo(W99AV_INFO_CDDA_FORMAT, &_dwMONITORTemp);
__bCDDA_DTS &= 0xF0; // clear bit[3:0] first
if(_dwMONITORTemp== W99AV_DTS_CDDA_FORMAT)
{
// LLY.103-1, don't control SPDIF_MUTE procedure by MONITOR module
// only let CHIPS to control this procedure : CHIPS_ControlSPDIFOutput()
//W99AV_WriteDM (W99AV_DM_SPDIF_MUTE, 1) ; // Turn-on SPDIF
// LLY.161, set CDDA bitstream format
__bCDDA_DTS |= CDDA_BITSTREAM_DTS;
}
else
{
// LLY.102-1, disable PARFIFOCTLR[7] to 0
// let parser know that the stream is pure CDDA format
__wW99AVPARFIFOCTLRLow &= 0xFF7F;
W99AV_WriteRegDW (PARFIFOCTLR, __wW99AVPARFIFOCTLRLow, __wW99AVPARFIFOCTLRHigh) ;
// LLY.104, tell dsp start to decode pure CDDA,
// othersise, dsp will hang
W99AV_WriteDM (0x705, 1) ;
// LLY.161, set CDDA bitstream format
__bCDDA_DTS |= CDDA_BITSTREAM_PURE;
}
// LLY.161, tell OSD to update disc type info.
OSD_Output(MSG_DISCTYPE, __wDiscType, 0x0);
__bCheckAudioType &= ~CHECK_CDDA_FORMAT;
// LLY.103-1, re-call HAL_SetAudioType() to let CHIPS
// issue W99AV_DM_SPDIF_MUTE control base on correct __bCDDA_DTS value
CHIPS_ControlSPDIFOutput();
}
}
*/
}
}
// ************************************************************************
// Function : MONITOR_CheckBuffer
// Description : Monitor buffer fullness or playing range for different
// playing mode. It also do the buffer control and check
// some info. : Repeat AB, GotoTime, NPF/ Freeze/ SF
// / SCB/ SCF
// Arguments : NULL
// Return : TRUE
// Side Effect :
// ************************************************************************
BIT MONITOR_CheckBuffer(void)
{
// REPEAT AB flow
// Set A poiint-> Set B point
// check reaching B point->Play from A point->check reaching B point...
if ( __bRepeatAB == REPEAT_AB )
{
#ifdef _WINDVD
if (__wDiscType & BOOK_DVD) // DVD title is controled by CELL module
return TRUE;
#endif // #ifdef _WINDVD
// If Current time already reach B point(__dwTimeB) must turn back
// to play A point(__dwTimeA)
//LJY1.22, LJY1.11b, update __dwTimeNow for repeatAB.
UTL_GetCurrentTime();
//LJY1.22, LJY1.11b, LJY1.21, fix VCD repeatAB time incorrect issue for anti-shock mode, need to re-calculate __dwTimeNow due to enlarged buffer.
//LJY1.24a, using UTL_EstimateBufferTime() for code refinement.
__dwTemp = UTL_EstimateBufferTime();
if((__dwTimeNow - __dwTemp) >= __dwTimeB)
{
// must jump data back to A point
// the action is the same as GOTOTIME
__dwGoToTime=__dwTimeA;
__btNewTime=TRUE; // flag indicate that need perform GOTOTIME
} // end checking B point
} // if ( __bRepeatAB == REPEAT_AB )
// next play must play from __dwGoToTime
if (__btNewTime) // GOTOTIME or REPEAT AB B->A
{
//DVD_049MickyGoTime
// the reset point shall be before starting A point
_Play_TimeA();
} // End of if (__btNewTime)
// wyc1.21, Update CoCo's code for C3 retry.
//CoCo.C3-retry
#if defined(SUPPORT_JPEG_C3) || defined(SUPPORT_MP3_C3)
if (W99AV_GetPSRDW() & INT_AINT)
{
//this sector have bad bits that C3 cannot fix and DSP will enter an infinite loop
//F/W needs to resend bitstream and set dm(crc_sync_en)[6] to zero and then DSP can exit an infinite loop
W99AV_ReadDM(W99AV_DM_CRC_ENABLE, &__dwTemp);
if (__dwTemp & 0x40)
{
__bC3Retry = TRUE;
HAL_CheckCDIFbyISR(HAL_CDIF_FREEZE_TIME, 0);
__dwIER &= ~INT_AINT;
}
}
if ((__bC3Retry) && (!__bDVDROM))
{
if ((__bAttrPlay == ATTR_MP3) || (__bAttrPlay == ATTR_JPG) || (__bAttrPlay == ATTR_MP2))
{
//Get the wrong M,S,F from DM (reported by DSP)
W99AV_ReadDM(W99AV_DM_HEADER_MIN, &__dwTemp);
__bMin = (BYTE)__dwTemp;
W99AV_ReadDM(W99AV_DM_HEADER_SEC, &__dwTemp);
__bSec = (BYTE)__dwTemp;
W99AV_ReadDM(W99AV_DM_HEADER_SECTOR, &__dwTemp);
__bFrame = (BYTE)__dwTemp;
__bMin= COMUTL_BCDtoDecimal ( __bMin );
__bSec= COMUTL_BCDtoDecimal ( __bSec );
__bFrame= COMUTL_BCDtoDecimal ( __bFrame );
//clear bit 6 to let DSP leave the inifinite loop.
W99AV_ReadDM(W99AV_DM_CRC_ENABLE, &__dwTemp);
__dwTemp &= 0xFFFFFFBF; //clear bit 6
W99AV_WriteDM(W99AV_DM_CRC_ENABLE, __dwTemp);
// convert the MSF value into HSG
__dwC3ResendSector = COMUTL_MSFtoHSG (MAKE_MSF(__bMin, __bSec, __bFrame));
// Jump to new time, and open CD-IF
if ((__dwC3ResendSector >= __dwTimeBegin ) && (__dwC3ResendSector <= __dwTimeEnd))
{
if (!UTL_PlayFromTime (__dwC3ResendSector))
{
SERVO_ReadSectors (__dwC3ResendSector - __dwTimeTorelence, __dwTimeEnd);
HAL_ControlCDIF(HAL_CDIF_OPEN);
}
#ifdef _DEBUG_INFO
__dwC3RetryTimes++;
#endif
}
__bC3Retry = FALSE;
}
}
#endif
//LJY2.30a, for checking AO in ISR
#ifdef CHECK_OVERFLOW_IN_ISR
if(__bAudioOverflow)
{
W99AV_ReadInfo ( W99AV_INFO_AUDIO_REMAIN , &_dwMONITORTemp );
if(_dwMONITORTemp < __dwAOBuffer) //LJY2.33, reference __dwAOBuffer instead of __dwAUBuffer
{
EX1 = 0 ; //LJY2.33, move EX1=0 here
__bAudioOverflow = FALSE;
W99AV_ClearInterrupt(INT_AO);
//EX1 = 0;
__dwIER |= (INT_AO);
W99AV_EnableInterrupt(__dwIER);
EX1 = 1 ;
}
}
#endif
// monitor buffer fullness/ empty procedure
switch ( __bModeCmd )
{
// ** S-TCH;
// must check if CD-IF is closed when buffer underflow interrupt
// occurred, then re-open CD-IF
// wyc.275-PicCD, add KEY_STOP in this switch and make KEY_STOP in thumbnail mode to do buffer control.
case KEY_STOP:
case KEY_FF:
case KEY_PLAY :
case KEY_SF :
// Micky2.78, fix VCD Step will hang and picture uncomplete(28C only)
// Found on title "Christmas Song", several steps(>60~70) will hang at UV ready
// modify the Step buffer control to be done by MONITOR_CheckBuffer.
case KEY_STEP:
// TCC277a, must re-enable servo running because SF cmd will close it.
// TCC278, add check KEY_STEP here as Micky moved the check here.
if ( __bServoAutoCtrl && (__bModeCmd==KEY_SF ||__bModeCmd==KEY_STEP ))
{
HAL_ControlCDIF(HAL_CDIF_OPEN); // ** TCH0.48P;
break;
}
// wyc.275e __bJPGVar BIT1 TRUE means play end.
// wyc2.85, rename to __bJPGVar
if (__bJPGVar & UTL_JPG_SMALL_SIZE)
__btPlayEnd = TRUE;
// wyc.275-PicCD, add KEY_STOP in this switch and make KEY_STOP in thumbnail mode to do buffer control.
//LJY277.3rd, enable checking for DIGEST mode
if ((__bModeCmd == KEY_STOP) && (!__bThumbnailMode)
#ifndef NO_DIGEST //LJY1.20, support 4M flash, remove digest
&& (!__btDIGEST)
#endif
)
//if ((__bModeCmd == KEY_STOP) && (!__bThumbnailMode))
break;
//DVD_046-1DVD_IF
if ( __bServoAutoCtrl)
break;
//DVD021, MICKY: in pause/ play_end, do not need open CD-IF
if (__btPause || __btPlayEnd)
break;
// Chuan 278 2002/10/23: Check DVDCTLR[0] = 1, specified sector MSF found flag.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -