rsm_util.h
资源名称:8202s.rar [点击查看]
上传用户:poi891205
上传日期:2013-07-15
资源大小:9745k
文件大小:41k
源码类别:
DVD
开发平台:
C/C++
- /*
- * Terry,2003/8/7 12:23AM
- * reduce function
- * Maoyong,2004.02.20 15:41PM
- To divide POWER_RESUME, RECORD_KEY, SAME_DISC_RESUME for no confusion
- POWER_RESUME: when power down, record the current playing pos.
- RECORD_KEY: when push RECORD, record the current playing pos
- SAME_DISC_RESUME: when TRAY OUT, record the current playing pos
- Maoyong, 2004.03.05 13:22
- To move record resume relative functions from "sysmain2.c" to this file
- Maoyong 2004.03.18 for combinaton usage
- Maoyong 2004.04.07 fix bug: When shut down power supply, the next same type disc not recorded will do resume play,
- which is wrong.
- */
- #ifdef DISC_ID_IN_FLASH
- //#include "io_uart0.h"
- //#include "UartComm.h"
- //static char debug_buffer[64]; //for debugging purpose
- extern int FlashRead(UINT32 iStartAddr, BYTE *pBuf, UINT32 iLen);
- extern int FlashWrite(UINT32 iStartAddr, BYTE *pBuf, UINT32 iLen);
- #define TOTAL_RESUME 20 //Number of disc resume
- #define SIZE_PER_ID 64 // Number of bytes storage reserved for disc resume
- #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
- #define DVD_DISC_INFO 244
- #define CDDA_DISC_INFO 248
- #define VCD_DISC_INFO 252
- typedef struct {
- BYTE disc_id[4];
- BYTE disc_info[SIZE_PER_ID];
- }DISC_RESUME_INFO;
- //index table of the disc resume. It will store the latest TOTAL_RESUME disc
- BYTE disc_resume_index[TOTAL_RESUME];
- //store the information to flash for resume together with
- //array[TOTAL_RESUME+1] stores the disc resume index table.
- //array[TOTAL_RESUME+2] and array[TOTAL_RESUME+3] stores the setup information
- #ifdef SETUP_IN_FLASH
- DISC_RESUME_INFO disc_resume[TOTAL_RESUME+3];
- #else
- DISC_RESUME_INFO disc_resume[TOTAL_RESUME+1];
- #endif
- //current index
- int current_resume = 0;
- #endif
- #ifdef CHECK_RECORD_DISK_PARENT_LVL //Maoyong 2004.03.04
- extern void setup_CheckPasswd(void);
- extern int user_input_pwd;
- extern void ShowPasswordGUI(void);
- #ifdef NEW_PARENTAL_GUI//zhaoyanhua add 2003-11-28 19:50
- extern void ExitParentalGUI(void);
- #endif
- #endif
- #ifdef RECORD_KEY//zhaoyanhua add 03-11-6 15:27
- extern void osd_DrawRegionString(BYTE xStart, BYTE yStart, const BYTE *str, BYTE fontColor, BYTE bkColor, BYTE r);
- extern void osd_init_record(void);
- extern void osd_init(void);
- #define FAST2NORM 0x01<<0
- #define PAUSE2NORM 0x01<<1
- #define SLOW2NORM 0x01<<2
- #define REALPLAY 1
- //#define TRANSFER 0//nono 2004-2-17 18:05
- extern void chg2normal_play(UINT8 md,UINT8 realplay);
- extern void run_pause_setting(void);
- #endif
- #ifdef DYNAMIC_SPECTRUM //zhaoyanhua add 03-11-6 15:26
- extern void Show3dspectrum(void);
- #endif
- #ifdef SAME_DISC_RESUME
- extern BYTE same_disc_onoff;
- #endif
- /*
- #ifndef DVDRELEASE
- //#define RSM_DBG 1
- #endif
- #ifndef RSM_DBG
- #undef printf
- #undef print_block
- #define printf(f, a...) do {} while (0)
- #define print_block(x,y) do {} while (0)
- #endif*/
- int is_cdg_disc(int show)
- {
- #ifdef SUPPORT_CDG
- if( (cd_type_loaded==CDDA) && (cd_subtype==CD_DA) && bReadSubChannel && CDG_IsCDGNow())
- {
- if(show) invalid_key();
- return 1;
- }else
- #endif
- return 0;
- }
- /*
- Maoyong changed for resume function define, compile will not give error message
- */
- #if !defined(SAME_DISC_RESUME) && !defined(POWER_RESUME) && !defined(RECORD_KEY)
- void save_cmp_disc_info(UINT32 info1){ if(info1){} }//terry,2004/4/8 05:36PM
- #endif
- /*========================================================================
- basic I2C read and write function for public use in this file
- =========================================================================*/
- /*
- * i2c device addr : a0
- */
- void ReadFromI2cA0(UINT16 iAddr,BYTE *bBuffer,UINT16 len)
- {
- #ifndef DISC_ID_IN_FLASH
- memset(bBuffer,0,len);
- if(ReadFromI2c(0xa0, iAddr,bBuffer, len) >=0 )
- {//sucess
- printf("read flash data:n");
- print_block(bBuffer,len);
- }else
- {
- printf("read flash errorn");
- }
- #else//#ifndef DISC_ID_IN_FLASH
- int result,i,j,k;
- BYTE *p;
- // memset(bBuffer,0,len);
- i = sizeof(disc_resume);
- if (iAddr >= DVD_INFO_BASE)
- {
- if ((iAddr >= DVD_INFO_BASE) && (iAddr <DVD_DISC_INFO))
- {
- if ((iAddr >= DVD_INFO_BASE) && (iAddr <CDROM_INFO_BASE))
- j = iAddr - DVD_INFO_BASE;
- else if ((iAddr >= CDROM_INFO_BASE) && (iAddr <CDDA_INFO_BASE))
- j = iAddr - CDROM_INFO_BASE;
- else if ((iAddr >= CDDA_INFO_BASE) && (iAddr <VCD_INFO_BASE))
- j = iAddr - CDDA_INFO_BASE;
- else if ((iAddr >= VCD_INFO_BASE) && (iAddr <DVD_DISC_INFO))
- j = iAddr - VCD_INFO_BASE;
- result = FlashRead(FLASH_START_ADDR,disc_resume,i);
- p= &disc_resume[current_resume].disc_info;
- p+= j;
- for (k=0; k<len;k++) *bBuffer++ = *p++;
- //memcpy(bBuffer,&disc_resume[current_resume].disc_info+j,len);
- }
- else
- {
- result = FlashRead(FLASH_START_ADDR,disc_resume,i);
- p= &disc_resume[current_resume].disc_id;
- for (k=0; k<len;k++) *bBuffer++ = *p++;
- // memcpy(bBuffer,&disc_resume[current_resume].disc_id,len);
- }
- }
- else
- {
- #ifdef SETUP_IN_FLASH
- result = FlashRead(FLASH_START_ADDR, disc_resume,i);
- for (k=0; k<len;k++)
- {
- j=iAddr+k;
- p=&disc_resume[TOTAL_RESUME+1].disc_info;
- if (j>=(SETUP_MENU_BASE+SIZE_PER_ID))
- //Wrap around for the next 64 (SIZE_PER_ID) bytes for setup
- {
- j-= SIZE_PER_ID;
- p=&disc_resume[TOTAL_RESUME+2].disc_info;
- }
- *bBuffer++ = *(p+j);
- }
- #else
- result = ReadFromI2c(0xa0, iAddr,bBuffer, len);
- #endif
- }
- if(result >=0 )
- {//sucess
- printf("read flash data:n");
- print_block(bBuffer,len);
- }else
- {
- printf("read flash errorn");
- }
- #endif//#ifndef DISC_ID_IN_FLASH
- }
- /*
- * i2c device addr : a0 , read UINT32 parameter
- */
- int ReadFromI2cA0_32(UINT16 iAddr,BYTE *bBuffer,UINT16 len)
- {
- UINT32 v=0;
- #ifndef DISC_ID_IN_FLASH
- if(ReadFromI2c(0xa0, iAddr,bBuffer, len) >=0 )
- {//sucess
- printf("read flash data:n");
- print_block(bBuffer,len);
- if(len == 4) v = getUINT32_li(bBuffer);
- else v = getUINT16_li(bBuffer);
- }else
- {
- printf("read flash errorn");
- }
- #else//#ifndef DISC_ID_IN_FLASH
- int result, i,j,k;
- BYTE *p;
- // memset(bBuffer,0,len);
- if (iAddr >= DVD_INFO_BASE)
- {
- i = sizeof(disc_resume);
- if ((iAddr >= DVD_INFO_BASE) && (iAddr <DVD_DISC_INFO))
- {
- if ((iAddr >= DVD_INFO_BASE) && (iAddr <CDROM_INFO_BASE))
- j = iAddr - DVD_INFO_BASE;
- else if ((iAddr >= CDROM_INFO_BASE) && (iAddr <CDDA_INFO_BASE))
- j = iAddr - CDROM_INFO_BASE;
- else if ((iAddr >= CDDA_INFO_BASE) && (iAddr <VCD_INFO_BASE))
- j = iAddr - CDDA_INFO_BASE;
- else if ((iAddr >= VCD_INFO_BASE) && (iAddr <DVD_DISC_INFO))
- j = iAddr - VCD_INFO_BASE;
- result = FlashRead(FLASH_START_ADDR,disc_resume,i);
- p= &disc_resume[current_resume].disc_info;
- p +=j;
- for (k=0; k<len;k++) *(bBuffer+k) = *p++;
- // memcpy(bBuffer,&disc_resume[current_resume].disc_info+j,len);
- }
- else
- {
- result = FlashRead(FLASH_START_ADDR,disc_resume,i);
- p= &disc_resume[current_resume].disc_id;
- for (k=0; k<len;k++) *(bBuffer+k) = *p++;
- // memcpy(bBuffer,&disc_resume[current_resume].disc_id,len);
- }
- }
- else
- {
- result = ReadFromI2c(0xa0, iAddr,bBuffer, len);
- }
- if(result >=0 )
- {//sucess
- printf("read flash data:n");
- print_block(bBuffer,len);
- if(len == 4) v = getUINT32_li(bBuffer);
- else v = getUINT16_li(bBuffer);
- }else
- {
- printf("read flash errorn");
- }
- #endif//#ifndef DISC_ID_IN_FLASH
- return v;
- }
- /*
- * i2c device addr : a0 , write function
- */
- void WriteToI2cA0(int iAddr,BYTE *bData,int len)
- {
- #ifndef DISC_ID_IN_FLASH
- //printf("i2c,iAddr:%d len:%dn",iAddr,len);
- if( WriteToI2c(0xa0,iAddr,bData,len) < 0 )
- {//write fail
- printf("!!!! ======== write flash error ======== !!!!!n");
- }
- #else//#ifndef DISC_ID_IN_FLASH
- int result,i,j,k;
- BYTE *p, *q;
- i = sizeof(disc_resume);
- if (iAddr >= DVD_INFO_BASE)
- {
- if ((iAddr >= DVD_INFO_BASE) && (iAddr <DVD_DISC_INFO))
- {
- if ((iAddr >= DVD_INFO_BASE) && (iAddr <CDROM_INFO_BASE))
- j = iAddr - DVD_INFO_BASE;
- else if ((iAddr >= CDROM_INFO_BASE) && (iAddr <CDDA_INFO_BASE))
- j = iAddr - CDROM_INFO_BASE;
- else if ((iAddr >= CDDA_INFO_BASE) && (iAddr <VCD_INFO_BASE))
- j = iAddr - CDDA_INFO_BASE;
- else if ((iAddr >= VCD_INFO_BASE) && (iAddr <DVD_DISC_INFO))
- j = iAddr - VCD_INFO_BASE;
- FlashEraseSector(FLASH_ERASE_SECTOR);
- // memcpy(&disc_resume[current_resume].disc_info+j,bData,len);
- p= &disc_resume[current_resume].disc_info;
- p += j;
- for (k=0; k<len;k++) *p++ = *bData++;
- result = FlashWrite(FLASH_START_ADDR,disc_resume,i);
- }
- else
- {
- FlashEraseSector(FLASH_ERASE_SECTOR);
- p= &disc_resume[current_resume].disc_id;
- for (k=0; k<len;k++) *p++ = *bData++;
- // memcpy(&disc_resume[current_resume].disc_id,bData,len);
- //update disc_resume_index;
- p= &disc_resume[TOTAL_RESUME].disc_id;
- q= disc_resume_index;
- for (k=0; k<sizeof(disc_resume_index);k++) *p++ = *q++;
- // memcpy(&disc_resume[TOTAL_RESUME].disc_id,disc_resume_index,sizeof(disc_resume_index));
- result = FlashWrite(FLASH_START_ADDR,disc_resume,i);
- }
- }
- else
- {
- #ifdef SETUP_IN_FLASH
- FlashEraseSector(FLASH_ERASE_SECTOR);
- for (k=0; k<len;k++)
- {
- j=iAddr+k;
- p=&disc_resume[TOTAL_RESUME+1].disc_info;
- if (j>=(SETUP_MENU_BASE+SIZE_PER_ID))
- //Wrap around for the next 64 (SIZE_PER_ID) bytes for setup
- {
- j-= SIZE_PER_ID;
- p=&disc_resume[TOTAL_RESUME+2].disc_info;
- }
- *(p+j)=*bData++;
- }
- result = FlashWrite(FLASH_START_ADDR,disc_resume,i);
- #else
- result = WriteToI2c(0xa0,iAddr,bData,len) ;
- #endif
- }
- if( result < 0 )
- {//write fail
- printf("!!!! ======== write flash error ======== !!!!!n");
- }
- #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:%dn",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=%dn",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=%dn",resumeTRK);
- WriteToI2cA0(128+sizeof(pDSV->rsm_info[0]),(BYTE *)&resumeTRK, sizeof(resumeTRK));
- printf("resumeMSF:%xn",resumeMSF);
- WriteToI2cA0(128+sizeof(pDSV->rsm_info[0])+sizeof(resumeTRK),(BYTE *)&resumeMSF, sizeof(resumeMSF));
- printf("fsnav_dir_now:%dn", 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:%dn", 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:%dn", 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
- #endif //#ifndef DISC_ID_IN_FLASH
- #ifdef POWER_RESUME
- /**********************************************************************************************
- 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
- if( is_menu() || is_cdg_disc(0) || (pe_run==0) ||(cd_type_loaded==CDROM) || ((disp_trk_now==0)&&(cd_type_loaded!=CDDVD)) )
- {
- printf("clr rsm info: %d %d %d %dn",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)
- {
- 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;
- 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(); //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 infon");
- p=(BYTE *)&pDSV->rsm_info[0];
- 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:%dn",pFsJpeg->fsnav_dir_now);
- printf("fsnav_trk_now:%dn",pFsJpeg->fsnav_trk_now);
- printf("myTime:%dn", myTime);
- WriteToI2cA0(CDROM_INFO_BASE,(BYTE *)&pFsJpeg->fsnav_dir_now, sizeof(pFsJpeg->fsnav_dir_now));
- WriteToI2cA0(CDROM_INFO_BASE+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 ( CDROM_INFO_BASE + 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 ( CDROM_INFO_BASE + 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:%dn", MSFFlag);
- }else
- {
- int pos;
- if(cd_type_loaded==CDDA) pos=CDDA_INFO_BASE;
- else pos=VCD_INFO_BASE;
- printf("resumeMSF:%xn",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("resumeMSF:%dn",resumeMSF);
- WriteToI2cA0(DVD_INFO_BASE,p, sizeof(pDSV->rsm_info[0]));
- WriteToI2cA0(DVD_INFO_BASE+sizeof(pDSV->rsm_info[0]),(BYTE *)&resumeMSF, sizeof(resumeMSF));
- // psprintf(debug_buffer,"pDSV->rsm_info[i].dRSM_TTN:%xn",pDSV->rsm_info[0].dRSM_TTN);
- // UART0_puts(debug_buffer);
- // psprintf(debug_buffer,"pDSV->rsm_info[i].dRSM_PTTN:%xn",pDSV->rsm_info[0].dRSM_PTTN);
- // UART0_puts(debug_buffer);
- // psprintf(debug_buffer,"pDSV->rsm_info[i].dRSM_AGLN:%xn",pDSV->rsm_info[0].dRSM_AGLN);
- // UART0_puts(debug_buffer);
- // psprintf(debug_buffer,"pDSV->rsm_info[i].dRSM_ASTN:%xn",pDSV->rsm_info[0].dRSM_ASTN);
- // UART0_puts(debug_buffer);
- // psprintf(debug_buffer,"resumeMSF:%xn",resumeMSF);
- // UART0_puts(debug_buffer);
- }
- }
- }
- static inline void same_disc_LoadRsmInfo(void)
- {
- BYTE *p,v[4];
- printf("reading...n");
- p=(BYTE *)&pDSV->rsm_info[0];
- if(cd_type_loaded==CDDVD)
- {
- ReadFromI2cA0(DVD_INFO_BASE,p, sizeof(pDSV->rsm_info[0]));
- ReadFromI2cA0(DVD_INFO_BASE+sizeof(pDSV->rsm_info[0]),(BYTE *)&resumeMSF, sizeof(resumeMSF));
- printf("pDSV->rsm_info[i].dRSM_TTN:%xn",pDSV->rsm_info[0].dRSM_TTN);
- printf("pDSV->rsm_info[i].dRSM_PTTN:%xn",pDSV->rsm_info[0].dRSM_PTTN);
- printf("pDSV->rsm_info[i].dRSM_AGLN:%xn",pDSV->rsm_info[0].dRSM_AGLN);
- printf("pDSV->rsm_info[i].dRSM_ASTN:%xn",pDSV->rsm_info[0].dRSM_ASTN);
- printf("Read resumeMSF:%x size %d %dn",resumeMSF,sizeof(pDSV->rsm_info[0]),sizeof(resumeMSF));
- // psprintf(debug_buffer,"pDSV->rsm_info[i].dRSM_TTN:%xn",pDSV->rsm_info[0].dRSM_TTN);
- // UART0_puts(debug_buffer);
- // psprintf(debug_buffer,"pDSV->rsm_info[i].dRSM_PTTN:%xn",pDSV->rsm_info[0].dRSM_PTTN);
- // UART0_puts(debug_buffer);
- // psprintf(debug_buffer,"pDSV->rsm_info[i].dRSM_AGLN:%xn",pDSV->rsm_info[0].dRSM_AGLN);
- // UART0_puts(debug_buffer);
- // psprintf(debug_buffer,"pDSV->rsm_info[i].dRSM_ASTN:%xn",pDSV->rsm_info[0].dRSM_ASTN);
- // UART0_puts(debug_buffer);
- // psprintf(debug_buffer,"Read resumeMSF:%x size %d %dn",resumeMSF,sizeof(pDSV->rsm_info[0]),sizeof(resumeMSF));
- // UART0_puts(debug_buffer);
- }else if(cd_type_loaded==CDROM)
- {
- 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:%dn",resume_fsnav_dir);
- printf("resume_fsnav_trk:%dn",resume_fsnav_trk);
- printf("myTime:%dn", myTime);
- }else
- {
- int pos;
- if(cd_type_loaded==CDDA) pos = CDDA_INFO_BASE;
- else pos = VCD_INFO_BASE;
- ReadFromI2cA0(pos,&resumeTRK, sizeof(resumeTRK));
- printf("resumeTRK:%xn",resumeTRK);
- resumeMSF = ReadFromI2cA0_32(pos+sizeof(resumeTRK),v, sizeof(resumeMSF));
- printf("resumeMSF:%x %x %x %x %xn",resumeMSF,v[0],v[1],v[2],v[3]);
- }
- }
- void save_cmp_disc_info(UINT32 info1)
- {
- 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 ,inn");
- printf("info1:%xn",info1);
- 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
- 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;
- //just to read in the disc_resume_index table store in disc_resume[TOTAL_RESUME]
- rom_info1 = ReadFromI2cA0_32(pos,v,sizeof(rom_info1));
- memcpy(disc_resume_index,&disc_resume[current_resume].disc_id,sizeof(disc_resume_index));
- // reset disc_resume_index for the first time usage
- if ((disc_resume_index[0]==disc_resume_index[1]) ||
- (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
- if ((disc_resume_index[i]<0) || (disc_resume_index[i]>= TOTAL_RESUME))
- {
- 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
- }
- #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:%dn",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:%xn",resumeMSF);
- WriteToI2cA0(128+sizeof(pDSV->rsm_info[0])+sizeof(resumeTRK),(BYTE *)&resumeMSF, sizeof(resumeMSF));
- printf("save rsm msf failn");
- printf("fsnav_dir_now:%dn", 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:%dn", 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:%dn", 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:%xn",pDSV->rsm_info[0].dRSM_TTN);
- printf("pDSV->rsm_info[i].dRSM_PTTN:%xn",pDSV->rsm_info[0].dRSM_PTTN);
- printf("pDSV->rsm_info[i].dRSM_AGLN:%xn",pDSV->rsm_info[0].dRSM_AGLN);
- printf("pDSV->rsm_info[i].dRSM_ASTN:%xn",pDSV->rsm_info[0].dRSM_ASTN);
- }
- ReadFromI2cA0(128+sizeof(pDSV->rsm_info[0]),&resumeTRK, sizeof(resumeTRK));
- {
- printf("resumeTRK:%xn",resumeTRK);
- }
- resumeMSF = ReadFromI2cA0_32(128+sizeof(pDSV->rsm_info[0])+sizeof(resumeTRK),v, sizeof(resumeMSF));
- {
- printf("resumeMSF:%x %x %x %x %xn",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:%dn",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:%dn",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:%dn",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");
- }
- }