📄 rsm_util.h
字号:
#else
result = WriteToI2c(0xa0,iAddr,bData,len) ;
#endif
}
if( result < 0 )
{//write fail
printf("!!!! ======== write flash error ======== !!!!!\n");
}
#ifdef DVD_SERVO //ycwen 2004/08/10
ClearServoCacheBuffer();
#endif
#endif//#ifndef DISC_ID_IN_FLASH
}
#ifdef RECORD_PER_SECOND //Maoyong add pre-def condition 2004.02.20
/*
* power resume function for record every secode
*/
static inline void power_rsm_ps_RsmInfo2Flash(int clr)
{
static BYTE savetemparry[50];
BYTE *p;
//printf("!!!run save_tuner_setup ,size:%d\n",sizeof(pDSV->rsm_info[0]));
#ifdef SUPPORT_FILE_SYSTEM_MODE
if ((cd_type_loaded == CDROM) && (GetCurrentFileType() == CDROM_MPG))
return ;
#endif
if( is_menu() || clr )
{
resumeMSF = 0;
resumeTRK = 0;
pFsJpeg->fsnav_dir_now = 0;
pFsJpeg->fsnav_trk_now = 0;
myTime=0;
}else
{
if(cd_type_loaded!=CDDVD)
{
resumeMSF = s_msf&0x00ffffff;
resumeTRK = cd_trk_now;
if( (cd_type_loaded==CDROM)&&( !Is_MP3_STATE() ) )
{ //Jeff 20021114//nono 20021123 modified
resumeMSF = 0; //we only support MP3, not contain JPEG/Game
}
}
else
{
resumeMSF = 1;
if(play_state!=VCD_STATE_STOP)//20021014
RSM_save(0xff,0);
}
}
if(cd_type_loaded==CDDVD)
{
int k;
int changlen=0;
BYTE first_flag=1;
p=(BYTE *)&pDSV->rsm_info[0];
for(k=(sizeof(pDSV->rsm_info[0])-1);k>=0;k--)
{
if(savetemparry[k] != p[k])
{
if(first_flag)
{
first_flag=0;
changlen=k;
}
}
savetemparry[k]=p[k];
}
WriteToI2cA0(128,p,changlen+1);
//printf("len=%d\n",changlen+1);
first_flag=(BYTE)resumeMSF; //in dvd mode resumeMSF only use flag!
WriteToI2cA0(128+sizeof(pDSV->rsm_info[0])+sizeof(resumeTRK),(BYTE *)&first_flag, sizeof(first_flag));
}
else
{
printf("resumeTRK=%d\n",resumeTRK);
WriteToI2cA0(128+sizeof(pDSV->rsm_info[0]),(BYTE *)&resumeTRK, sizeof(resumeTRK));
printf("resumeMSF:%x\n",resumeMSF);
WriteToI2cA0(128+sizeof(pDSV->rsm_info[0])+sizeof(resumeTRK),(BYTE *)&resumeMSF, sizeof(resumeMSF));
printf("fsnav_dir_now:%d\n", pFsJpeg->fsnav_dir_now);
//it only cdrom need record
if(cd_type_loaded==CDROM)
{
WriteToI2cA0(128 + sizeof(pDSV->rsm_info[0]) + sizeof(resumeTRK) + sizeof(resumeMSF),
(BYTE *)&(pFsJpeg->fsnav_dir_now), sizeof(pFsJpeg->fsnav_dir_now));
printf("fsnav_trk_now:%d\n", pFsJpeg->fsnav_trk_now);
WriteToI2cA0(128 + sizeof(pDSV->rsm_info[0]) + sizeof(resumeTRK) + sizeof(resumeMSF) + sizeof(pFsJpeg->fsnav_dir_now),
(BYTE *)&(pFsJpeg->fsnav_trk_now), sizeof(pFsJpeg->fsnav_trk_now));
printf("myTime:%d\n", myTime);
WriteToI2cA0(128 + sizeof(pDSV->rsm_info[0]) + sizeof(resumeTRK) + sizeof(resumeMSF) + sizeof(pFsJpeg->fsnav_dir_now) + sizeof(pFsJpeg->fsnav_trk_now),
(BYTE *)&myTime, sizeof(myTime));
}
}
}
#endif //end #ifdef RECORD_PER_SECOND
#ifndef DISC_ID_IN_FLASH //put them at the beginning
/*========================================================================
record resume play func's save and load realized functions prototypes
=========================================================================*/
/*
* last memory function
*/
/*
#define SETUP_MENU_BASE 0
#define DVD_INFO_BASE 128
#define CDROM_INFO_BASE 180
#define CDDA_INFO_BASE 200
#define VCD_INFO_BASE 220
//Maoyong 2004.04.07 for all resume use
#define DVD_DISC_INFO 244
#define CDDA_DISC_INFO 248
#define VCD_DISC_INFO 252
*/
//nono according to yltseng's suggestion.20050812
#define SETUP_MENU_BASE 0
#define DVD_INFO_BASE 110//128
#define CDROM_INFO_BASE 162//180
#define CDDA_INFO_BASE 182//200
#define VCD_INFO_BASE 187//220
#define DVD_DISC_INFO 192//244
#define CDDA_DISC_INFO 196//248
#define VCD_DISC_INFO 200//252
#define DRM_INFO 208
#endif //#ifndef DISC_ID_IN_FLASH
#if 0//def POWER_RESUME//mp3 power resume needto be fixed later.
/**********************************************************************************************
Function : To identify whether the current MP3 disc is the one played last time
return 1 : yes
0 : no
Created by caiyh , 17:03 , Nov 5th , 2004
**********************************************************************************************/
UINT8 IsTheSameMP3 ( void )
{
UINT32 fsnav_dir_now = 0 ,
fsnav_trk_now = 0 ,
first_mp3_entry = 0 ,
MSFFlag = 0 ,
msf = 0 ;
BYTE v [ 4 ] ;
fsnav_dir_now = ReadFromI2cA0_32 ( CDROM_INFO_BASE , v , sizeof( pFsJpeg -> fsnav_dir_now ) ) ;
fsnav_trk_now = ReadFromI2cA0_32 ( CDROM_INFO_BASE + sizeof( pFsJpeg -> fsnav_dir_now ) ,
v , sizeof( pFsJpeg -> fsnav_trk_now ) ) ;
MSFFlag = ReadFromI2cA0_32 ( CDROM_INFO_BASE + sizeof( pFsJpeg -> fsnav_dir_now )
+ sizeof( pFsJpeg -> fsnav_trk_now ) , v , sizeof( MSFFlag ) ) ;
/* read the information recorded from i2c ,
annotated by caiyh , 17:03 , Nov 5th , 2004 */
first_mp3_entry = pFsJpeg -> Dir_entry [ fsnav_dir_now ] ;
fsnav_trk_now += first_mp3_entry ;
msf = iso9660_file [ fsnav_trk_now ] . loc ;
if ( msf == MSFFlag )
return 1 ;
else
return 0 ;
/* according to the dir and trk recorded in i2c, to find the msf specified ,
and compare the current msf with the one read from i2c ,
annotated by caiyh , 17:03 , Nov 5th , 2004 */
}
/**************************************************************
Function : read the parameters about MP3 resume
para = 0 : dir
1 : trk
2 : msf
3 : myTime
return : the value of dir trk msf or myTime
Created by caiyh , 09:24 , Nov 22nd , 2004
**************************************************************/
UINT32 ReadSameMP3Para ( UINT8 para )
{
UINT32 result = 0 ;
BYTE v [ 4 ] ;
if ( para <=2 )
result = ReadFromI2cA0_32 ( CDROM_INFO_BASE + para * 2 , v , 2 ) ;
else if ( para == 3 )
result = ReadFromI2cA0_32 ( CDROM_INFO_BASE + 8 , v , 4 ) ;
// read parameter of mp3 resume from i2c , annotated by caiyh , 09:24 , Nov 22nd , 2004
return result ;
}
/*********************************************************
Function : clear msf about MP3 resume
Created by caiyh , 09:34 , Nov 22nd , 2004
*********************************************************/
void ClrSameMP3Flag ( void )
{
UINT32 MSFFlag = 0 ;
WriteToI2cA0 ( CDROM_INFO_BASE + 4 , ( BYTE * ) & MSFFlag , sizeof ( MSFFlag ) ) ;
// clear msf of mp3 resume in i2c , annotated by caiyh , 09:34 , Nov 22nd , 2004
}
#endif // POWER_RESUME
#if defined (POWER_RESUME)|| defined(SAME_DISC_RESUME)|| defined(RECORD_KEY)
void clr_rsm_info(void)
{//terry,2003/8/13 01:21AM
#ifdef DVD_5_DISC_RESUME//LIJD 2005-6-30 20:12
if( is_cdg_disc(0) ||(cd_type_loaded==CDROM) || ((disp_trk_now==0)&&(cd_type_loaded!=CDDVD)) )
#else
if( is_menu() || is_cdg_disc(0) || (pe_run==0) ||(cd_type_loaded==CDROM) || ((disp_trk_now==0)&&(cd_type_loaded!=CDDVD)) )
#endif
{
printf("clr rsm info: %d %d %d %d\n",is_menu(),is_cdg_disc(0),pe_run,disp_trk_now);
resumeMSF = 0;
resumeTRK = 0;
pFsJpeg->fsnav_dir_now=0;
pFsJpeg->fsnav_trk_now=0;
myTime=0;
}
}
static inline void same_disc_RsmInfo2Flash(int clr)
{
#ifdef SUPPORT_TEN_DISC_RESUME //linrc add for 10 disc resume play 2005-5-12 10:09
UINT32 info1; //if you have any problem,see DOC file
BYTE *p;
UINT32 MSFFlag = 0 ;
UINT16 pos;
BYTE Resume_Now;
BYTE Resume_Index;
BYTE i;
UINT32 Rom_Info1;
if(clr){};
if(cd_type_loaded==CDUNKNOWN) return;
#ifdef DVD_5_DISC_RESUME//lijd 2005-6-16 15:56
if(cd_type_loaded!=DVD) return;
#endif
resumeMSF = s_msf&0x00ffffff;
resumeTRK = cd_trk_now;
#ifdef POWER_RESUME
if(Is_MP3_STATE()==0) // don't clear the resume info of mp3 , added by caiyh , 10:53 , Nov 2nd , 2004
#endif // POWER_RESUME
clr_rsm_info();
if(cd_type_loaded!=CDDVD)
{
info1=M2I(gettrkmsf_leadout());
}
else
{
info1 = same_disc_vob11_pos;
}
#ifdef TEN_DISC_RESUME_DEBUG
printf("--- info1=0x%x ---\n",info1);
#endif
ReadFromI2cA0(TEN_DISC_INFO_ADDR,&Resume_Index, sizeof(Resume_Index));
if(Resume_Index==RESUME_DISC_NUMBER)
{
Resume_Index = 0;
}
Resume_Now = Resume_Index;
for(i=0;i<RESUME_DISC_NUMBER;i++)
{
ReadFromI2cA0(Info_I2C_ADDR[i],(BYTE *)&Rom_Info1,sizeof(Rom_Info1));
if(info1==Rom_Info1)
{
#ifdef TEN_DISC_RESUME_DEBUG
printf("--- Have Save Disc Resume zone ---\n");
#endif
Resume_Now = i;
if(Resume_Index!=0)
{
if(Resume_Now!=Resume_Index)
{
Resume_Index--;
}
}
else
{
Resume_Index = (RESUME_DISC_NUMBER-1);
if(Resume_Now==0)
{
Resume_Index = 0;
}
}
break;
}
}
#ifdef TEN_DISC_RESUME_DEBUG
printf("\n\n--- Disc->Resume_Now=%d ---\n",Resume_Now);
printf("--- Disc->Resume_Index=%d ---\n",Resume_Index+1);
printf("--- Info_I2C_ADDR[%d]=%d ---\n",Resume_Now,Info_I2C_ADDR[Resume_Now]);
#endif
WriteToI2cA0(Info_I2C_ADDR[Resume_Now],(BYTE *)&info1,sizeof(info1));
Resume_Index++;
WriteToI2cA0(TEN_DISC_INFO_ADDR,&Resume_Index,sizeof(Resume_Index));
/*ReadFromI2cA0(TEN_DISC_INFO_ADDR,&Resume_Now, sizeof(Resume_Now));
printf("--- Disc->Resume_Now=%d ---\n",Resume_Now);
Resume_Now--;
ReadFromI2cA0(Info_I2C_ADDR[Resume_Now],(BYTE *)&info1,sizeof(info1));
printf("--- info1=0x%x ---\n",info1);*/
p = (BYTE *)&pDSV->rsm_info[0];
printf("--- Disc->Resume_Now=%x ---\n",Resume_Now);
pos = MSF_I2C_ADDR[Resume_Now];
//printf("--- Disc->Record_Now=%d ---\n",Disc->Record_Now);
printf("--- pos=%d ---\n",pos);
if(cd_type_loaded!=CDDVD)
{
if(cd_type_loaded==CDROM)
{//we only support MP3, not contain JPEG/Game
if(Is_MP3_STATE()==0) resumeMSF = 0;
printf("fsnav_dir_now:%d\n",pFsJpeg->fsnav_dir_now);
printf("fsnav_trk_now:%d\n",pFsJpeg->fsnav_trk_now);
printf("myTime:%d\n", myTime);
WriteToI2cA0(pos,(BYTE *)&pFsJpeg->fsnav_dir_now, sizeof(pFsJpeg->fsnav_dir_now));
WriteToI2cA0(pos+sizeof(pFsJpeg->fsnav_dir_now),(BYTE *)&pFsJpeg->fsnav_trk_now, sizeof(pFsJpeg->fsnav_trk_now));
MSFFlag = mp3_file_msf ( pFsJpeg -> fsnav_trk_now ) ;
// get the msf of current trk , added by caiyh , 15:55 , Nov 5th , 2004
WriteToI2cA0 ( pos + sizeof(pFsJpeg->fsnav_dir_now)
+ sizeof ( pFsJpeg -> fsnav_trk_now ) , ( BYTE * ) & MSFFlag ,
sizeof(MSFFlag));
// write the msf of current trk to i2c , added by caiyh , 15:55 , Nov 5th , 2004
WriteToI2cA0 ( pos + sizeof ( pFsJpeg -> fsnav_dir_now )
+ sizeof ( pFsJpeg -> fsnav_trk_now ) + sizeof ( MSFFlag ) ,
( BYTE * ) & myTime , sizeof ( myTime ) ) ;
// write the myTime of current trk to i2c , modified by caiyh , 17:57 , Nov 16th , 2004
printf("MSFFlag:%d\n", MSFFlag);
}
else
{
printf("resumeMSF:%x\n",resumeMSF);
WriteToI2cA0(pos,(BYTE *)&resumeTRK, sizeof(resumeTRK));
WriteToI2cA0(pos+sizeof(resumeTRK),(BYTE *)&resumeMSF, sizeof(resumeMSF));
}
}
else
{
//resumeMSF = 1;//terry 2003-8-12 14:20
if(play_state!=VCD_STATE_STOP)
RSM_save(0xff,0);
clr_rsm_info();//terry,2003/8/13 01:21AM
printf("sizeof(pDSV->rsm_info[0])=%d\n",sizeof(pDSV->rsm_info[0]));
printf("sizeof(resumeMSF)=%d\n",sizeof(resumeMSF));
printf("resumeMSF:%d\n",resumeMSF);
WriteToI2cA0(pos,p, sizeof(pDSV->rsm_info[0]));
WriteToI2cA0(pos+sizeof(pDSV->rsm_info[0]),(BYTE *)&resumeMSF, sizeof(resumeMSF));
}
#else//#ifdef SUPPORT_TEN_DISC_RESUME //linrc add for 10 disc resume play 2005-5-12 10:09
BYTE *p;
#if defined(POWER_RESUME) || defined(SAME_DISC_RESUME)
UINT32 MSFFlag = 0 ;
#endif // POWER_RESUME , added by caiyh , 15:55 , Nov 5th , 2004
if(clr){}//freyman just for warning message
if(cd_type_loaded==CDUNKNOWN) return;
#ifdef DVD_5_DISC_RESUME//lijd 2005-8-1 11:04
if(cd_type_loaded!=CDDVD)
return;
#endif
#ifndef DVD_5_DISC_RESUME//lijd 2005-6-30 22:55
resumeMSF = s_msf&0x00ffffff;
#endif
resumeTRK = cd_trk_now;
#ifdef POWER_RESUME
if(Is_MP3_STATE()==0) // don't clear the resume info of mp3 , added by caiyh , 10:53 , Nov 2nd , 2004
#endif // POWER_RESUME
clr_rsm_info(); //terry,2003/8/13 01:21AM
//#ifdef RECORD_KEY//zhaoyanhua 03-11-2 18:56 //Mark by maoyong 2004.04.07
//write DISC INFO to I2C
UINT32 info1;
int pos= 0;
if(cd_type_loaded==CDDVD)
pos = DVD_DISC_INFO;
else if (cd_type_loaded==CDDA)
#ifdef ONLY_PRE_DISC_RESUME
pos = DVD_DISC_INFO;
#else
pos = CDDA_DISC_INFO;
#endif
else if (cd_type_loaded!=CDROM)
#ifdef ONLY_PRE_DISC_RESUME
pos = DVD_DISC_INFO;
#else
pos = VCD_DISC_INFO;
#endif
#ifdef POWER_RESUME
else if(Is_MP3_STATE()==0) /* to add the function of mp3 power resume ,
added by caiyh , 11:05 , Nov 2nd , 2004 */
#else
else
#endif // POWER_RESUME
return;
//Res=check_cdtype();
if(cd_type_loaded!=CDDVD)
info1=M2I(gettrkmsf_leadout()); //get from sysmain2.c
else//CDDVD
info1 = same_disc_vob11_pos; //search_file("VTS_01_1.VOB"); //get from atapi_if728.c
WriteToI2cA0(pos,(BYTE *)&info1,sizeof(info1));
//#endif
{
printf("save rsm info\n");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -