📄 rsm_util.h
字号:
// 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
}
#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[0])
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[0] + 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[0]));
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,0);
}
}
p=(BYTE *)&pDSV->rsm_info[0];
WriteToI2cA0(128,p, sizeof(pDSV->rsm_info[0]));
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("save rsm msf fail\n");
printf("fsnav_dir_now:%d\n", pFsJpeg->fsnav_dir_now);
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));
//Jeff 20020902
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));
}
static inline void basic_LoadRsmInfo(void)
{
BYTE *p,v[4];
printf("reading...\n");
p=(BYTE *)&pDSV->rsm_info[0];
ReadFromI2cA0(128,p, sizeof(pDSV->rsm_info[0]));
{
printf("pDSV->rsm_info[i].dRSM_TTN:%x\n",pDSV->rsm_info[0].dRSM_TTN);
printf("pDSV->rsm_info[i].dRSM_PTTN:%x\n",pDSV->rsm_info[0].dRSM_PTTN);
printf("pDSV->rsm_info[i].dRSM_AGLN:%x\n",pDSV->rsm_info[0].dRSM_AGLN);
printf("pDSV->rsm_info[i].dRSM_ASTN:%x\n",pDSV->rsm_info[0].dRSM_ASTN);
}
ReadFromI2cA0(128+sizeof(pDSV->rsm_info[0]),&resumeTRK, sizeof(resumeTRK));
{
printf("resumeTRK:%x\n",resumeTRK);
}
resumeMSF = ReadFromI2cA0_32(128+sizeof(pDSV->rsm_info[0])+sizeof(resumeTRK),v, sizeof(resumeMSF));
{
printf("resumeMSF:%x %x %x %x %x\n",resumeMSF,v[0],v[1],v[2],v[3]);
}
resume_fsnav_dir = ReadFromI2cA0_32(128 + sizeof(pDSV->rsm_info[0]) + sizeof(resumeTRK) + sizeof(resumeMSF),
v, sizeof(resume_fsnav_dir));
{
printf("resume_fsnav_dir:%d\n",resume_fsnav_dir);
}
resume_fsnav_trk = ReadFromI2cA0_32(128 + sizeof(pDSV->rsm_info[0]) + sizeof(resumeTRK) + sizeof(resumeMSF) + sizeof(pFsJpeg->fsnav_dir_now),
v, sizeof(resume_fsnav_trk));
{
printf("resume_fsnav_trk:%d\n",resume_fsnav_trk);
}
myTime = ReadFromI2cA0_32(128 + sizeof(pDSV->rsm_info[0]) + sizeof(resumeTRK) + sizeof(resumeMSF) + sizeof(pFsJpeg->fsnav_dir_now) + sizeof(resume_fsnav_trk),
v, sizeof(myTime));
{
printf("myTime:%d\n",myTime);
}
}
#endif //#if defined (POWER_RESUME)|| defined(SAME_DISC_RESUME)||(RECORD_KEY)
/*
record per second,we only recode the changed content!
and we also distinguish cd type
*/
void RsmInfo2Flash(int clr)
{
#ifdef RECORD_PER_SECOND //lijinhai 2-12-4 9:49
power_rsm_ps_RsmInfo2Flash(clr);
#elif defined(SAME_DISC_RESUME) || defined(POWER_RESUME) || defined(RECORD_KEY)
same_disc_RsmInfo2Flash(clr);
#else
basic_RsmInfo2Flash(clr);
#endif
}
void LoadRsmInfo(void)
{
//goto_active=1;//terry,2004/3/2 11:56AM
#if defined (SAME_DISC_RESUME) || defined(POWER_RESUME) || defined(RECORD_KEY)
same_disc_LoadRsmInfo();
#else
basic_LoadRsmInfo();
#endif
}
/*========================================================================
record resume util funcs for flow control in sysmain2.c SYSTEM_READ_TITLE
=========================================================================*/
#ifdef RECORD_KEY
/*
* FUNC Descrition:
* to check if user has entered "RECORD"
* only enter"RECORD" key,then play from the recorded point.
* else excute its corresponding function.
*
* RETURN:
* 1: entered RECORD
* 0: other key
*
* zhaoyanhua 2003-11-29 20:12
*
*/
static inline BYTE CheckRecordKey(void)
{
BYTE iRes = 0;
//NOTE:
// if you want change the RECORD_OSD_SHOW_TIME value,
// must change it in file ir_parser.c at the same time.
//zhaoyanhua 2003-12-12 15:18
#define RECORD_OSD_SHOW_TIME 14
//to avoid SPECTRUM effect OSD
#ifdef DYNAMIC_SPECTRUM
BYTE tempDisp = bEqDisplay;
#endif
//if the disc has recorded,Show OSD and do some operation.
//NOTE:
// use the flag "same_disc_flag" to calculate the time(6S)
// (14-2) *500ms = 6s
osd_init_record();
//show strings.
#ifdef NINTAUS_OSD_STR
psprintf(linebuf,"%s",_OsdMessegeFont1[osd_font_mode][STR_OS_RECORD_1]);
osd_DrawRegionString(2,0,linebuf,0x0a,0,0);//3-11-21 9:25张宇P
psprintf(linebuf,"%s",_OsdMessegeFont1[osd_font_mode][STR_OS_RECORD_2 ]);
osd_DrawRegionString(2,7,linebuf,0x0a,0,0);//3-11-21 9:25张宇P
psprintf(linebuf,"%s",_OsdMessegeFont1[osd_font_mode][STR_OS_RECORD_3]);
osd_DrawRegionString(2,14,linebuf,0x0a,0,0);//3-11-21 9:25张宇P
#else//NINTAUS_OSD_STR
psprintf(linebuf,"%s",_OsdMessegeFont1[osd_font_mode][STR_OS_RECORD_1SENTENCE]);
osd_DrawRegionString(2,0,linebuf,0x0a,0,0);//3-11-21 9:25张宇P
psprintf(linebuf,"%s",_OsdMessegeFont1[osd_font_mode][STR_OS_RECORD_2SENTENCE]);
osd_DrawRegionString(2,7,linebuf,0x0a,0,0);//3-11-21 9:25张宇P
psprintf(linebuf,"%s",_OsdMessegeFont1[osd_font_mode][STR_OS_RECORD_3SENTENCE]);
osd_DrawRegionString(2,14,linebuf,0x0a,0,0);//3-11-21 9:25张宇P
#endif//NINTAUS_OSD_STR
#ifndef MODIFY_RECORD_KEY//20040217
run_pause_setting();//pause
#endif//MODIFY_RECORD_KEY
while(same_disc_flag > 0)
{
polling();
if(same_disc_flag == RECORD_OSD_SHOW_TIME)
break;
}
#ifdef DYNAMIC_SPECTRUM//zhaoyanhua add 2003-12-2 22:25
bEqDisplay = tempDisp;
if(bEqDisplay)
Show3dspectrum();
else
#endif
osd_init();
#ifdef MODIFY_RECORD_KEY//20040217
//chg2normal_play(PAUSE2NORM,TRANSFER);
#else//MODIFY_RECORD_KEY
chg2normal_play(FAST2NORM|PAUSE2NORM|SLOW2NORM,REALPLAY);
#endif//MODIFY_RECORD_KEY
if(same_disc_flag == RECORD_OSD_SHOW_TIME)
{
same_disc_flag = 0;
iRes = 0;
}
else
iRes = 1;
return iRes;
}
#endif //end #ifdef REOCRD_KEY
#ifdef CHECK_RECORD_DISK_PARENT_LVL
/****************************************************************
* do DVD-VIDEO disk level control for a recorded disc.
* RETURN:
* 1: Disc not need do level control or Level is same as user set,
* or input a correct password
* 0: Level is not same as user set and input a incorrect password
* Maoyong 2004.02.20 16:38
****************************************************************/
BYTE CheckDiscParentLvl(void)
{
BYTE iRes = 1;
//check If no need to do Level Control
if(cd_type_loaded != CDDVD)
return iRes;
else
{
#ifdef DVD_AUDIO //do level check just for DVD video
if(dAMG_LSN != 0)
return iRes;
#endif
if(pDSV->rsm_info[0].dRSM_PTL_LVL <= UserSet.ParentalLvl)
return iRes;
}
UserSet.parental_ststus=0;
setup_CheckPasswd();
//password error!
if(UserSet.parental_ststus == 0)
{
printf("-------sys_cmd = %d, system_state = %d-------------\n", sys_cmd, system_state);
//Maoyong 2004.03.06, IRC_POWER/IRC_EJECT special process
if(user_input_pwd ==2)
{
user_input_pwd = 0;
//make not to change to SYSTEM_BRWOSE. In fact, ignore POWER key.
system_state = SYSTEM_OPEN;
sys_cmd = 0;
}
else
{ sys_cmd = 0;
system_state = SYSTEM_STOP;
play_state = VCD_STATE_STOP;
ircmd_stop();
}
iRes = 0;
}
return iRes;
}
#endif //end #ifdef CHECK_RECORD_DISK_PARENT_LVL 2004.02.20 maoyong
/****************************************************************
* check if recorded disc need to do record resume action.
* RETURN:
* 0: Not need,
* 1: Yes, need
* Maoyong 2004.02.20 16:38
***************************************************************/
BYTE CheckIfRealRsm(void)
{
#ifdef DVD_AUDIO//nono 2004-2-25 0:40
if( (cd_type_loaded==CDDVD) && (dAMG_LSN!=0) )
return 0;
#endif //DVD_AUDIO
#ifdef RECORD_KEY
if(CheckRecordKey())
return 1;
else
return 0;
#else
return 1; //No record key, direct do resume play
#endif //RECORD_KEY
}
/****************************************************************
* check if the disc is recorded and if need to do record resume.
* RETURN:
* 0: should not load rsm
* 1: need to load
* Maoyong 2004.02.20 16:38
****************************************************************/
BYTE CheckLoadRsmInfo(void)
{
#if !defined(POWER_RESUME)&& !defined(SAME_DISC_RESUME)&& !defined (RECORD_KEY)
return 0;
#endif
//for some customers, has eject record, but not need to choose if en/dis resume play
//in setup Menu, but this case is rarely used.
#if defined(NOT_SHOW_SAME_DISC_RESUME)&&defined(SAME_DISC_RESUME)
same_disc_onoff = 1;
#endif
#ifdef SAME_DISC_RESUME
same_disc_onoff = 1;
#endif
/*===========================================================================
The folling pre-compile condition is for basic usage.
(1)RECORD KEY: You need not to check same_disc_onoff. resume play is controlled
by user. It can be treated as highest level
(2)POWER_RESUME: you can add "same_disc_onoff" constrict by your own definiton
Please don't change sequence!
So, please use your owe definition to make combination of different resum func.
=============================================================================*/
#if defined(RECORD_KEY) //if has "Record" on IR Panel, control resume by "Record" Key
if(same_disc_flag)
#elif defined(POWER_RESUME) && defined(SAME_DISC_RESUME) //power+eject Out Record
if(same_disc_flag && same_disc_onoff)
#elif defined(POWER_RESUME) //just use power record. maybe seldom used dependently
if(same_disc_flag)
#elif defined(SAME_DISC_RESUME) //just use eject out record
if(same_disc_flag && same_disc_onoff)
#endif
{
if(CheckIfRealRsm())
return 1;
}
return 0;
}
void RecordRsmPlay(void)
{
if( (resumeMSF<0x3fffffff)&&(resumeMSF>0) )
{
//terry,2003/8/13 01:01AM
sys_cmd=CMD_FUNC|CMD_FUNC_RESUME;
#ifdef RECORD_KEY //fengjl add 3-12-7 15:03
PrintOsdMsg(STR_OS_RECORD_RESUME,REGION1,2,0);
#else
OSD1000ISP_STATUS(OSDISP_RESUME, OSDIR_GLOBAL);
PrintOsdMsg(STR_OS_RESUME,REGION1,2,0);
#endif
printf("======= system CMD_FUNC_RESUME========\n");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -