📄 utl.c
字号:
// CD-ROM decoding finished flag
W99AV_ClearInterrupt(INT_ECC);
}
// ** 0.20; Notify OSD Module that Reset LOGO.
// ** 0.20; May cancel if CDROM Decode don't need to destroy Video display
OSD_Output ( MSG_CDROM_DECODE, NULL, NULL );
// LLY.022, splite HAL_CDROMDecode() into two function:
// HAL_PrepareCDROMDecode() & HAL_CDROMDecode()
// the control follow is : HAL_PrepareCDROMDecode() --> SERVO_ReadSectors()
// --> HAL_CDROMDecode()
// DVD018, must set the desired sector format for CDROM decoding before
// call the HAL_PrepareCDROMDecode()
HAL_SetSectorFormat(bSectorFormat);
//HAL_CDROMDecode ( hsgTime, NOofSector );
HAL_PrepareCDROMDecode ( hsgTime, NOofSector );
// ** S-TCH; // jump CDROM new time
if ( ! SERVO_ReadSectors ( dwHSG, SERVO_END_TIME ) )
{
__bError= ERR_SERVO;
return ERR_ERROR; // 1996.9
}
// LLY.022, issue actual CDROM decoding action
HAL_CDROMDecode();
for(bRet=0; bRet<10; bRet++)
{
_dwUTLTemp= UTL_GetCurrentTime ();
if ( _dwUTLTemp )
break;
}
if ( _dwUTLTemp > (dwHSG+1000) )
break; // give-up
if ( _dwUTLTemp < hsgTime)
break;
#if 0
// DVD_172Micky, use _dwUTLTemp/_dwUTLTemp1 for temporary variable use.
_dwUTLTemp= UTL_GetCurrentTime ();
if ( _dwUTLTemp > (dwHSG+1000) )
{
_dwUTLTemp= UTL_GetCurrentTime ();
if ( _dwUTLTemp > (dwHSG+1000) )
break; // give-up
}
if ( _dwUTLTemp < hsgTime )
break;
#endif
_dwUTLTemp1= _dwUTLTemp- hsgTime+ SERVO_LEADING;
if ( dwHSG> _dwUTLTemp1 )
dwHSG-= _dwUTLTemp1;
else
dwHSG= NULL;
// TCC276, update torelence here so that it won't do twice every time
__dwTimeTorelence = _dwUTLTemp - dwHSG + SERVO_LEADING ;
/*
dwTemp= UTL_GetCurrentTime ();
if ( dwTemp > (dwHSG+1000) )
{
dwTemp= UTL_GetCurrentTime ();
if ( dwTemp > (dwHSG+1000) )
break; // give-up
}
if ( dwTemp < hsgTime )
break;
dwCount= dwTemp- hsgTime+ SERVO_LEADING;
if ( dwHSG> dwCount )
dwHSG-= dwCount;
else
dwHSG= NULL;
*/
}
bRet = FALSE; // TCC276
// time needed for input NOofSector plus decoding time
// DVD_172Micky, use dwTimeStart/wTimeOutCount for use.
// as __dwTemp can't be used for cross function.
_wTimeOutCount= (WORD)((COUNT_PER_SEC* ((WORD)NOofSector))/ 75+ COUNT_PER_SEC);
// DVD_172Micky, use UTL_GetSysTimer instead of __dwCountSystem
_dwTimeStart= UTL_GetSysTimer();
while ( ( UTL_GetSysTimer()- _dwTimeStart ) < _wTimeOutCount )
{
// LLY2.37p, using general abort mainflow API instead of checking POWER/ OPEN_CLOSE key
//if ( ( __bISRKey == KEY_OPEN_CLOSE ) || (__bISRKey==KEY_POWER) )
if(UTL_QueryCapability(QUERY_ABORT_MAINFLOW))
break;
// first check all the sectors are input
if (HAL_CheckCDIF(HAL_CDIF_DONE, NULL) )
{
bRet= TRUE;
break;
}
SERVO_Monitor (); // ** S-TCH;
}
//DVD021LLY
#ifdef _LLYTEST
/////////////////////////////////////////
// check sector control correctly
if(bRet)
{
if(HAL_GetSectorID()==(hsgTime+NOofSector))
bRet=TRUE;
else
bRet=FALSE;
}
#endif // #ifdef _LLYTEST
/////////////////////////////////////////
// all sectors are input
if ( bRet )
{
if (bECCEnable)
{
// QF only to check ECC Finish
// DVD_172Micky, use dwTimeStart/wTimeOutCount for use.
// as __dwTemp can't be used for cross function.
_wTimeOutCount=( COUNT_PER_SEC*((WORD)NOofSector)* 5) / 75+ COUNT_500_MSEC; //TCH
bRet= FALSE;
// DVD_172Micky, use UTL_GetSysTimer instead of __dwCountSystem
_dwTimeStart= UTL_GetSysTimer();
while ( ( UTL_GetSysTimer()- _dwTimeStart ) < _wTimeOutCount )
{
if (HAL_CheckInterrupt(INT_ECC))
{
//clear the status bit
bRet= TRUE;
break;
}
} // while ()
}
else
{ // check Header
dwHSG= UTL_GetCurrentTime ();
if ( (BYTE)( dwHSG- hsgTime+ 1) != (NOofSector+ 1) )
bRet= FALSE;
}
} // bRet
// ** TCH0.25; begin...
if ( bRet )
{
__dwSectorCDROMBegin= hsgTime;
__dwSectorCDROMEnd= __dwSectorCDROMBegin+ NOofSector- 1;
#ifdef _DUMP_CDINFO
PRINTF ( "--> Real [%ld-%ld]...", __dwSectorCDROMBegin, __dwSectorCDROMEnd );
#endif // _DUMP_CDINFO
}
// wyc2.79-2, Add define to enable/disable DSP auto detection.
#ifndef AUTO_DETECTION_SECTOR_FORMAT_BY_DSP
else
{
// wyc2.78b-3, when disc is M2F1 we need to check if the sector is M2F2 when ECC error. If ECC error sectors are all M2F2
// we will ignore the ECC error cases.
if ( bSectorFormat == (HAL_SECTOR_FORMAT_CDXAM2F1 | HAL_WITH_SYNC) )
{
W99AV_ReadDM(0x700, &_dwUTLTemp1);
for (__bTemp=0; __bTemp < NOofSector; __bTemp++)
{
if ( (_dwUTLTemp1>>__bTemp) & 0x1 )
{
_dwUTLTemp = 0x45 + 0xA56*__bTemp + 0x14; // 0xA56 is compute from sector number + C2PO => 2353+ (2352/16)*2, 0x14 is the offset of Form 1/2 byte.
W99AV_ReadDRAMData(((W99AV_ADDR_ABUFF & 0xFFFF) << 8) + _dwUTLTemp/4, &__dwTemp);
__dwTemp = ( __dwTemp >> ((3 - (_dwUTLTemp%4))*8) ) & 0xFF;
if (__dwTemp & 0x20)
{
__dwSectorCDROMBegin= hsgTime;
__dwSectorCDROMEnd = __dwSectorCDROMBegin + __bTemp - 1;
bRet = TRUE;
}
break;
}
}
}
}
#endif //
// ** TCH0.25; end...
// Brian2.79 Call HAL_CDROMDecodeDone() here to clear DMs after CD-ROM decoding
// this could prevent "bo" noise after DSP reset
HAL_CDROMDecodeDone();
// Micky1.10, fix JVC-> play CD-DA track_>power down-> power on resume will show 65000
// SERVO_Monitor will keep sending data from last CDROM sectors.
// But _bAttrPlay is CDROM, so it will issue digital read commnad
// but servo won't return STATUS_PLAYBACK for digital data
// so it will be time out.
SERVO_EnableRunning (FALSE) ;
return bRet;
}
#endif //#ifdef SUPPORT_CDIF
///INPUT_PATH_ATAPIIF
{
OSD_Output ( MSG_CDROM_DECODE, NULL, NULL );
HAL_SetSectorFormat(bSectorFormat);
// LLY.022, splite HAL_CDROMDecode() into two function:
// HAL_PrepareCDROMDecode() & HAL_CDROMDecode()
// the control follow is : HAL_PrepareCDROMDecode() --> SERVO_ReadSectors()
// --> HAL_CDROMDecode()
//HAL_CDROMDecode ( hsgTime, NOofSector );
HAL_PrepareCDROMDecode ( hsgTime, NOofSector );
if ( ! SERVO_ReadSectors ( hsgTime, hsgTime+NOofSector) )
{
if ( ! SERVO_ReadSectors ( hsgTime, hsgTime+NOofSector) ) // ** DVD-TCH0.20;
{ // ** DVD-TCH0.20; Try more
__bError= ERR_SERVO;
return ERR_ERROR; // 1996.9
} // ** DVD-TCH0.20;
}
// LLY.022
HAL_CDROMDecode();
// DVD_172Micky, use dwTimeStart/dwTimeOutCount for use.
// as __dwTemp can't be used for cross function.
_wTimeOutCount= (WORD)((COUNT_PER_SEC* ((WORD)NOofSector))/ 75+ COUNT_PER_SEC);
// DVD_172Micky, use UTL_GetSysTimer instead of __dwCountSystem
_dwTimeStart= UTL_GetSysTimer();
while ( ( UTL_GetSysTimer()- _dwTimeStart ) < (DWORD)_wTimeOutCount )
{
SERVO_Monitor();
SERVO_GetCurrentPos(&__dwTimeNow);
// LLY.038, decrease the dummy time, because it's impossible that
// __dwTimeNow > (hstTime+NOofSector).
// It only true that __dwTimeNow == (hsgTime+NOofSector) after finish sending data
// if (__dwTimeNow > (hsgTime+NOofSector) )
if (__dwTimeNow >= (hsgTime+NOofSector) )
break;
}
// ** TCH1.60a; begin... Using the method to distinguish
{
extern BYTE _bSERVOLastSectorCnt;
extern BYTE _bSERVOSectorReq;
if ( _bSERVOLastSectorCnt < _bSERVOSectorReq ) // VCD is 12 sector/ unit, 20= 12+ 8.
{
#ifdef _DUMP_CDINFO
PRINTF ( "\n *** Err and reject by new SERVO code..." );
getch ();
#endif // _DUMP_CDINFO
#ifdef _DEBUG_INFO
OSD_Output ( MSG_VERSION, 105, 1 );
#endif // #ifdef _DEBUG_INFO
return FALSE;
}
}
// ** TCH1.60a; end...
// ** TCH1.60a; begin...
#ifdef _USE_DEBUG_CMD
W99AV_Command1(COMMAND_RDEBUGINFO,CMDARG_RDEBUGINFO); // Chuan2.80p, Use define instead of number
W99AV_OutIndex ( 0x10000000 ); // set AIR(31:0)=0x10000000
__dwTemp= W99AV_InData ();
dwPtr_SP= __dwTemp- dwPtr_SP;
if ( dwPtr_SP < (NOofSector* 512 ) )
{
#ifdef SUPPORT_PRINTF
PRINTF ( "\n *** Err by SP_Ptr [%ld],,", dwPtr_SP );
#endif // SUPPORT_PRINTF
#ifdef _DEBUG_INFO
OSD_Output ( MSG_VERSION, 103, 1 );
#endif // #ifdef _DEBUG_INFO
return FALSE;
}
#ifdef _DUMP_CDINFO
{
DWORD dwTCH, dwTCH1;
W99AV_Command1(COMMAND_RDEBUGINFO,CMDARG_RDEBUGINFO); // Chuan2.80p, Use define instead of number
for ( dwTCH=0; dwTCH<2; dwTCH++)
{
W99AV_OutIndex(0x10000000+dwTCH); // set AIR(31:0)=0x10000000
dwTCH1=W99AV_InData();
PRINTF ( "\n **** COM_DEBUG [%ld]= [%lx]..", dwTCH, dwTCH1 );
}
// LLY.276p, push data unit has changed : BYTE --> DWORD
HAL_PushFIFOData(HAL_PUSHDATA_IFIFO, 1); // 4);
W99AV_Command1(COMMAND_RDEBUGINFO,CMDARG_RDEBUGINFO); // Chuan2.80p, Use define instead of number
for ( dwTCH=0; dwTCH<2; dwTCH++)
{
W99AV_OutIndex(0x10000000+dwTCH); // set AIR(31:0)=0x10000000
dwTCH1=W99AV_InData();
PRINTF ( "\n **** COM_DEBUG [%ld]= [%lx]..", dwTCH, dwTCH1 );
}
dwTCH= 0;
if ( dwTCH == 1 )
{
extern void _CC_DumpDRAM(char* strFile, DWORD dwStart, DWORD dwEnd); // LLY.046OSD
_CC_DumpDRAM ( "CDROM.TXT", 0x4800, 0x7200 );
}
if ( dwTCH == 2 )
{
extern void _CC_DumpDRAM(char* strFile, DWORD dwStart, DWORD dwEnd); // LLY.046OSD
_CC_DumpDRAM ( "CDRRR.TXT", 0x4800, 0x7200 );
}
/// getch ();
}
#endif // _DUMP_CDINFO
#endif // _USE_DEBUG_CMD
// ** TCH1.60a; end...
// ** TCH0.25; begin...
__dwSectorCDROMBegin= hsgTime;
__dwSectorCDROMEnd= __dwSectorCDROMBegin+ NOofSector- 1;
#ifdef _DUMP_CDINFO
PRINTF ( "--> Real [%ld-%ld]...", __dwSectorCDROMBegin, __dwSectorCDROMEnd );
#endif // _DUMP_CDINFO
// ** TCH0.25; end...
HAL_CDROMDecodeDone(); // LLY.038, recover to normal state after finish CDROM decoding
return TRUE;
}
#endif //#ifdef INPUT_PATH_ATAPIIF
}
// *********************************************************************
// Function : UTL_MStoSectors
// Description : Convert the time format from mm:ss:ff into sectors
// Arguments : msftime : 0f:sm
// Return : the converted HSG value
// Side Effect :
// *********************************************************************
//DVD_050Micky
// Gototime calculation overflow
//DWORD UTL_MStoSectors ( BYTE bMin, BYTE bSec )
DWORD UTL_MStoSectors ( BYTE bHour, BYTE bMin, BYTE bSec )
{
//DVD_050SRAM
// DWORD dwTemp;
// HSG = mm*75L*60L + ss*75L + ff - 150L
// Sectors = mm*75L*60L + ss*75L + ff
//DVD_050Micky
// Gototime calculation overflow
// _dwUTLTemp= (bMin* 60L+ bSec) * 75L;
_dwUTLTemp= (bHour*3600L+bMin* 60L+ bSec) * 75L;
if ( __wDiscType & BOOK_2X )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -