📄 rsm_util.h
字号:
// UART0_puts(debug_buffer);
}
}
#endif//endif SUPPORT_TEN_DISC_RESUME
#ifdef TURN_OFF_POWER_RESUME //zxb 2005-8-3 23:19 when play_normal resumeMSF should be 0,
//but when turn_off_power_resume is defined,resumeMSF will not be 0 when play vcd,
//and when press stop ,system will stop directly not pre_stop.
if((play_state==VCD_STATE_NORMAL)
||(play_state== VCD_STATE_FASTFORWARD)
|| (play_state==VCD_STATE_FASTBACKWARD))
resumeMSF=0;
#endif
}
static inline void same_disc_LoadRsmInfo(void)
{
#ifdef SUPPORT_TEN_DISC_RESUME //linrc add for 10 disc resume play 2005-5-12 10:15
BYTE *p,v[4]; //if you have any problem,see DOC file
printf("reading...\n");
printf("--- Rsume_Disc_Index=%d ---\n",Rsume_Disc_Index);
p=(BYTE *)&pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM];
if(cd_type_loaded==CDDVD)
{
ReadFromI2cA0(MSF_I2C_ADDR[Rsume_Disc_Index],p, sizeof(pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM]));
ReadFromI2cA0(MSF_I2C_ADDR[Rsume_Disc_Index]+sizeof(pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM]),(BYTE *)&resumeMSF, sizeof(resumeMSF));
printf("pDSV->rsm_info[i].dRSM_TTN:%x\n",pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM].dRSM_TTN);
printf("pDSV->rsm_info[i].dRSM_PTTN:%x\n",pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM].dRSM_PTTN);
printf("pDSV->rsm_info[i].dRSM_AGLN:%x\n",pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM].dRSM_AGLN);
printf("pDSV->rsm_info[i].dRSM_ASTN:%x\n",pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM].dRSM_ASTN);
printf("Read resumeMSF:%x size %d %d\n",resumeMSF,sizeof(pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM]),sizeof(resumeMSF));
}else if(cd_type_loaded==CDROM)
{
resume_fsnav_dir = ReadFromI2cA0_32(MSF_I2C_ADDR[Rsume_Disc_Index],v, sizeof(resume_fsnav_dir));
resume_fsnav_trk = ReadFromI2cA0_32(MSF_I2C_ADDR[Rsume_Disc_Index]+sizeof(pFsJpeg->fsnav_dir_now),v, sizeof(resume_fsnav_trk));
myTime = ReadFromI2cA0_32(MSF_I2C_ADDR[Rsume_Disc_Index]+sizeof(pFsJpeg->fsnav_dir_now) + sizeof(resume_fsnav_trk),v, sizeof(myTime));
printf("resume_fsnav_dir:%d\n",resume_fsnav_dir);
printf("resume_fsnav_trk:%d\n",resume_fsnav_trk);
printf("myTime:%d\n", myTime);
}else
{
int pos;
pos = MSF_I2C_ADDR[Rsume_Disc_Index];
//if(cd_type_loaded==CDDA) pos = CDDA_INFO_BASE;
//else pos = VCD_INFO_BASE;
ReadFromI2cA0((UINT16)pos,(BYTE *)&resumeTRK, sizeof(resumeTRK));
printf("resumeTRK:%x\n",resumeTRK);
resumeMSF = ReadFromI2cA0_32(pos+sizeof(resumeTRK),v, sizeof(resumeMSF));
printf("resumeMSF:%x %x %x %x %x\n",resumeMSF,v[0],v[1],v[2],v[3]);
}
#else//#ifdef SUPPORT_TEN_DISC_RESUME //linrc add for 10 disc resume play 2005-5-12 10:09
BYTE *p,v[4];
printf("reading...\n");
#ifdef STOP_RESUME_DVD_VCD
if(cd_type_loaded==CDROM)
return;
if(!IS_DVD_VCD_DISC())
return;
#endif
p=(BYTE *)&pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM];
if(cd_type_loaded==CDDVD)
{
rsm_disc_type=0;
ReadFromI2cA0(DVD_INFO_BASE,p, sizeof(pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM]));
ReadFromI2cA0(DVD_INFO_BASE+sizeof(pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM]),(BYTE *)&resumeMSF, sizeof(resumeMSF));
//print_block(p,sizeof(pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM]));
#ifdef PARENT_PWD_DEFAULT_NULL
RSM_Flag = 1;
#endif
printf("pDSV->rsm_info[i].dRSM_TTN:%x\n",pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM].dRSM_TTN);
printf("pDSV->rsm_info[i].dRSM_PTTN:%x\n",pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM].dRSM_PTTN);
printf("pDSV->rsm_info[i].dRSM_AGLN:%x\n",pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM].dRSM_AGLN);
printf("pDSV->rsm_info[i].dRSM_ASTN:%x\n",pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM].dRSM_ASTN);
printf("Read resumeMSF:%x size %d %d\n",resumeMSF,sizeof(pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM]),sizeof(resumeMSF));
// psprintf(debug_buffer,"pDSV->rsm_info[i].dRSM_TTN:%x\n",pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM].dRSM_TTN);
// UART0_puts(debug_buffer);
// psprintf(debug_buffer,"pDSV->rsm_info[i].dRSM_PTTN:%x\n",pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM].dRSM_PTTN);
// UART0_puts(debug_buffer);
// psprintf(debug_buffer,"pDSV->rsm_info[i].dRSM_AGLN:%x\n",pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM].dRSM_AGLN);
// UART0_puts(debug_buffer);
// psprintf(debug_buffer,"pDSV->rsm_info[i].dRSM_ASTN:%x\n",pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM].dRSM_ASTN);
// UART0_puts(debug_buffer);
// psprintf(debug_buffer,"Read resumeMSF:%x size %d %d\n",resumeMSF,sizeof(pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM]),sizeof(resumeMSF));
// UART0_puts(debug_buffer);
}else if(cd_type_loaded==CDROM)
{
rsm_disc_type=1;
resume_fsnav_dir = ReadFromI2cA0_32(CDROM_INFO_BASE,v, sizeof(resume_fsnav_dir));
resume_fsnav_trk = ReadFromI2cA0_32(CDROM_INFO_BASE+sizeof(pFsJpeg->fsnav_dir_now),v, sizeof(resume_fsnav_trk));
myTime = ReadFromI2cA0_32(CDROM_INFO_BASE+sizeof(pFsJpeg->fsnav_dir_now) + sizeof(resume_fsnav_trk),v, sizeof(myTime));
printf("resume_fsnav_dir:%d\n",resume_fsnav_dir);
printf("resume_fsnav_trk:%d\n",resume_fsnav_trk);
printf("myTime:%d\n", myTime);
}else
{
int pos;
if(cd_type_loaded==CDDA)
{
pos = CDDA_INFO_BASE;
rsm_disc_type=2;
}
else
{
pos = VCD_INFO_BASE;
rsm_disc_type=3;
}
ReadFromI2cA0(pos,(BYTE*)&resumeTRK, sizeof(resumeTRK));
printf("resumeTRK:%x\n",resumeTRK);
resumeMSF = ReadFromI2cA0_32(pos+sizeof(resumeTRK),v, sizeof(resumeMSF));
printf("resumeMSF:%x %x %x %x %x\n",resumeMSF,v[0],v[1],v[2],v[3]);
}
#endif//endif SUPPORT_TEN_DISC_RESUME
}
void save_cmp_disc_info(UINT32 info1)
{
#ifdef SUPPORT_TEN_DISC_RESUME //linrc add for 10disc resume play 2005-5-12 10:11
int i; //if you have any problem,see DOC file
UINT32 Rom_Info;
printf("--- info1=0x%x ---\n",info1);
for(i=0;i<RESUME_DISC_NUMBER;i++)
{
ReadFromI2cA0(Info_I2C_ADDR[i],(BYTE *)&Rom_Info,sizeof(Rom_Info));
printf("--- Rom_Info=0x%x ---\n",Rom_Info);
if(info1==Rom_Info)
{
Rsume_Disc_Index = i;
same_disc_flag=1;
break;
}
else
{
resumeMSF=0;
same_disc_flag=0;
}
}
#else//#ifdef SUPPORT_TEN_DISC_RESUME //linrc add for 10 disc resume play 2005-5-12 10:09
UINT8 v[4];
UINT32 rom_info1;
int pos;
#ifdef DISC_ID_IN_FLASH
int i,j,index_match,first_empty_indx;
#endif
printf("save & compare disc info ,in\n");
printf("info1:%x\n",info1);
#ifdef DVD_5_DISC_RESUME//lijd 2005-6-16 15:56
if(cd_type_loaded!=CDDVD)
return;
#endif
if(cd_type_loaded==CDDVD) {
rsm_disc_type = 0;
pos = DVD_DISC_INFO;
}
else if (cd_type_loaded==CDDA){
rsm_disc_type = 2;
#ifdef ONLY_PRE_DISC_RESUME
pos = DVD_DISC_INFO;
#else
pos = CDDA_DISC_INFO;
#endif
}
else if (cd_type_loaded!=CDROM){
rsm_disc_type=3;
#ifdef ONLY_PRE_DISC_RESUME
pos = DVD_DISC_INFO;
#else
pos = VCD_DISC_INFO;
#endif
}
else return;
#ifndef DISC_ID_IN_FLASH
rom_info1 = ReadFromI2cA0_32(pos,v,sizeof(rom_info1));
//rom_info2 = ReadFromI2cA0_32(pos+sizeof(rom_info1),v,sizeof(rom_info2));
//if( (rom_info1==info1)&&(rom_info2==info2) )
if(rom_info1==info1)
{
same_disc_flag=1;
}else
{
resumeMSF=0;
same_disc_flag=0;
//Maoyong changed 2004.04.07. record disc info just in record action not after reading disc.
//#ifndef RECORD_KEY
//NOTE:
//must mask it,else cause record error.
//WriteToI2cA0(pos,(BYTE *)&info1,sizeof(info1));
//#endif
//WriteToI2cA0(pos+sizeof(info1),(BYTE *)&info1,sizeof(info2));
}
#else//#ifndef DISC_ID_IN_FLASH
current_resume = TOTAL_RESUME;
rom_info1 = ReadFromI2cA0_32(pos,v,sizeof(rom_info1));
#ifdef RW_NVMEM
/* swpong 2006 0320 */
ReadFromNVMEM(TYPE_DISC_ID, 0, disc_resume_index, sizeof(disc_resume_index));
#else //RW_NVMEM
memcpy(disc_resume_index,&disc_resume[current_resume].disc_id,sizeof(disc_resume_index));
#endif //RW_NVMEM
if ((disc_resume_index[0]==disc_resume_index[1]) || //swpong 2006 0417 (disc_resume_index[0]<0) ||
(disc_resume_index[0]>= TOTAL_RESUME))
{
for (i=0; i<TOTAL_RESUME; i++)
disc_resume_index[i] = 0xff;
}
index_match = 0;
first_empty_indx = -1;
current_resume = 0;
// find the current index to the disc resume information
for (i=0; i<TOTAL_RESUME; i++)
{
//empty index, use it to store resume information
//swpong 2006 0417 if ((disc_resume_index[i]<0) || (disc_resume_index[i]>= TOTAL_RESUME))
if (disc_resume_index[i]>= TOTAL_RESUME) //swpong 2006 0417
{
current_resume = i;
break;
}
//compare disc information with the current disc resume
current_resume = disc_resume_index[i];
rom_info1 = ReadFromI2cA0_32(pos,v,sizeof(rom_info1));
//disc information not matches the current disc resume, continue.
if(rom_info1==0)
{
if (first_empty_indx <0)
first_empty_indx = i;
continue;
}
//disc information mateces current disc resume
if(rom_info1==info1)
{
index_match = 1;
break;
}
}
//if none of the disc resume information matches the disc information,
// use first exmpty index as current resume index
if ((index_match ==0) && (first_empty_indx >=0))
{
i = first_empty_indx;
current_resume = disc_resume_index[i];
}
if (i==TOTAL_RESUME) --i;
// the first index in the disc resume points to the current resume
//shift the disc resume index up by 1.
if (i>0)
{
for (j=i;j>0;j--)
{
disc_resume_index[j]=disc_resume_index[j-1];
}
}
disc_resume_index[0]=current_resume;
if(rom_info1==info1)
{
same_disc_flag=1;
}
else
{
resumeMSF=0;
same_disc_flag=0;
}
#endif//#ifndef DISC_ID_IN_FLASH
#endif//endif SUPPORT_TEN_DISC_RESUME
}
#ifdef POLLING_10MS_SAVE_RESUME //Maoyong 2004.03.01
extern BYTE rsm_I2c_write_cnt;
//Note: Just for DVD Disc resume info save
#define RSM_INFO_SIZE sizeof(same_disc_vob11_pos)
#define RSM_MSF_SIZE sizeof(resumeMSF)
#define RSM_DSV_SIZE sizeof(pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM])
void polling_10ms_save_rsm(void)
{
if(rsm_I2c_write_cnt < DVD_RSM_WRITE_SIZE)
{
if( rsm_I2c_write_cnt < RSM_INFO_SIZE )
WriteToI2cA0(DVD_DISC_INFO + rsm_I2c_write_cnt,(BYTE *)&same_disc_vob11_pos + rsm_I2c_write_cnt, 1);
else if( rsm_I2c_write_cnt < (RSM_INFO_SIZE + RSM_DSV_SIZE))
WriteToI2cA0(DVD_INFO_BASE + rsm_I2c_write_cnt- RSM_INFO_SIZE,
(BYTE *)&pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM] + rsm_I2c_write_cnt - RSM_INFO_SIZE,
1);
else
WriteToI2cA0(DVD_INFO_BASE + rsm_I2c_write_cnt - RSM_INFO_SIZE,
(BYTE *) &resumeMSF + rsm_I2c_write_cnt - RSM_INFO_SIZE - RSM_DSV_SIZE,
1);
rsm_I2c_write_cnt++;
}
}
#endif //end ifdef POLLING_10MS_SAVE_RESUME
#else //else #if defined (POWER_RESUME)|| defined(SAME_DISC_RESUME)||defined (RECORD_KEY)
static inline void basic_RsmInfo2Flash(int clr)
{
BYTE *p;
printf("!!!run save_tuner_setup ,size:%d\n",sizeof(pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM]));
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
//we only support MP3, not contain JPEG/Game
resumeMSF = 0;
}
}else
{
resumeMSF = 1;
if(play_state!=VCD_STATE_STOP)//20021014
RSM_save(0xff,DVD_PRESTOP_RSM_ITEM); //chenzhao 2006-9-13 11:41 .
}
}
p=(BYTE *)&pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM];
WriteToI2cA0(128,p, sizeof(pDSV->rsm_info[DVD_PRESTOP_RSM_ITEM]));
WriteToI2cA0(128+sizeof(pDSV->rsm_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -