setup_tab.c
上传用户:caisangzi8
上传日期:2013-10-25
资源大小:15756k
文件大小:181k
源码类别:

DVD

开发平台:

C/C++

  1. //
  2. // FILE
  3. // setup_tab.c
  4. //
  5. //--------------------------------------
  6. //Modefied by wangfeng, 2003-08-29 15:18
  7. //For new setup menu 
  8. //--------------------------------------
  9. #include "user_init.h"
  10. extern int user_input_pwd;
  11. #ifdef NEW_SETUP_OSD    // majinping 2002-05-02 for new setup menu
  12. #error
  13. #include "setup_new.c"
  14. #elif defined(KONKA_DVD)    // 2-7-16 14:44 for new setup menu
  15. #include "setup_konka.c"
  16. #else
  17. /*****************************************************
  18. Creater: Terry
  19. Date   : 2001/5/11 12:49PM
  20. Description: Setup menu using
  21. *****************************************************/
  22. //#define USE_MIC_ECHO_PARAM
  23. #include "global.h"
  24. #include "osd.h"
  25. #include "func.h"
  26. #include "navdata.h"
  27. #include "kernel.h"
  28. #include "vpp.h"
  29. #include "user_if.h"
  30. #include "dsp3_if.h"
  31. #include "cchar.h"
  32. #include "ircmd.h"
  33. #include "auddrv.h" //2004AUDDRV oliver 20041004 for using audio driver purpose
  34. //#include "audif.h"
  35. #include "tvif.h"
  36. #include "memmap.h"
  37. #include "stdlib.h"
  38. #include "kinf.h"
  39. #include "gpio.h"//nono 2004-4-26 20:57
  40. #ifdef SUPPORT_MIDI  //ouyang 2004-10-18 22:44
  41. #include "fsmidi.h"
  42. #endif
  43. #ifdef SUPPORT_DISPLAY_MENU
  44. #include "ircode.h"
  45. #include "irconfig.h"
  46. #endif//end #ifdef DISPLAY_MENUs
  47. #ifdef TAS3001_AMP //Ti3001_OSD_UI_2  // TAS3001_AMP use setup menu control /jsaon 2-8-30 21:30
  48. #include "ti3001.h"
  49. #endif
  50. #ifdef SUPPORT_APOGEE_AMP//xyy 2004-1-12 17:40
  51. #include "ddx8000.h"
  52. #endif
  53. #ifdef SUPPORT_SPI
  54. #include "spi.h"
  55. #endif
  56. #ifdef DVB_MENU_SETUP_STYLE
  57. #include "dvbmenu.h"
  58. #endif
  59. #ifndef DVDRELEASE
  60. #define SETUP_DBG        1
  61. //#define MONE_SETUP
  62. #endif
  63. #ifndef SETUP_DBG
  64. #undef printf
  65. #undef print_block
  66. #define printf(f, a...) do {} while (0)
  67. #define print_block(x,y) do {} while (0)
  68. #endif
  69. #if defined (YI_XIAN_TONG)||defined (TONIC_DVD)//zhaoyanhua add 03-11-3 22:20
  70. #include "gpio.h"
  71. #endif
  72. extern UINT16 echo_para_tbl[9][2];//echo_para[9][2]; for using audio driver purpose
  73. #ifdef VGA_CTRL_FORMAT//wangfeng 2003-12-18 16:12
  74. BYTE    temp_format=0; 
  75. #endif
  76. #ifdef MIC_FUNCTION_KEY 
  77. extern BYTE bFuncStep;//nono 20040107 
  78. #endif//MIC_FUNCTION_KEY 
  79. //wangap add for downmix off volume
  80. #ifndef AC3_BASS_MANAGEMENT
  81.   BYTE    cspk_volume;
  82.   BYTE    fspk_volume;
  83.   BYTE    sspk_volume;
  84. #endif
  85. #ifdef USE_PROLOGIC_II_KEY
  86. BYTE    prologic_val;//clead 2003-8-7
  87. #endif 
  88. #if defined(GBM_DVD)&&!defined(GBM_FULL_FUNCTION)&&!defined(USER_MPEG_LOGO)
  89. #undef SAME_DISC_RESUME
  90. BYTE    same_disc_onoff = 1;
  91. #endif
  92. #ifdef   DYNAMIC_SPECTRUM       //fengjl  3-10-21 20:38 
  93. #undef SAME_DISC_RESUME
  94. BYTE   band_onoff = 0;//inital value must be 0.zhaoyanhua modify 2004-1-12 15:01
  95. #endif
  96. #if defined(BBK_NEW_SETUP)&&defined(BBK_DV961_DVD)    //fengjl add for bbk's new setup  3-11-12 16:17
  97. extern void osd_init_bbk_setup(void);  
  98. BYTE    one_key_pass_flag = 0;
  99. BYTE    main_setup = 0;
  100. #elif defined(BBK_DSS_555_DVD)||defined(BBK_DV911S)
  101. BYTE    main_setup = 0;
  102. #endif
  103. #ifdef VIDEO_SETUP_NEW_GUI//zhaoyanhua add 2004-1-7 17:18
  104. extern int GetVideoSetValue(int id);
  105. #endif//end VIDEO_SETUP_NEW_GUI
  106. #ifdef AUDIO_2CH_5_1CH//zhaoyanhua add 03-11-1 17:33
  107. extern BYTE ChannelFlag;
  108. #endif
  109. #ifdef  KARAOKE_MENU//wangfeng 
  110. BYTE    KARAOKE_MENU_FLAG=0;
  111. #endif
  112. //#define MONE_SETUP
  113. //=======================
  114. #ifdef NEW_STYLE_SETUP
  115. #define BUTTON_COLOR   7
  116. //zhaoyanhua add 3-7-14 17:49
  117. //a flag decide to operate setupmenu or not.
  118. //if 0,only show setup menu, now at level 0, can not operate.
  119. //if 1,now at level 1, can operate setup menu with UP/DOWN/LEFT/RIGHT/SELECT key.
  120. int   GBM_run_setupmenu_flag = 0;
  121. #endif
  122. //define setup pages(including MAX_SETUP_PAGE+MAX_CUSTM_SETUP_PAGE)
  123. #include "setup_def.h"
  124. const BYTE OSD_LANG_MAP[8] = OSD_LANG_SETUP_MAP; //Jeff 20030217
  125. const BYTE upgrade_file_name[] = UPGRADE_FILE_NAME;//nono 3-6-17 14:03
  126. extern void RsmInfo2Flash(int);
  127. extern void audif_set_SPDIF_BITSTREAM();
  128. //extern void ircmd_stop(void);
  129. #ifdef SAME_DISC_RESUME
  130. BYTE    same_disc_onoff;
  131. #endif 
  132. extern UINT8 ap_tv_out_id;//nono 2003-8-1 18:08
  133. #ifdef USER_MPEG_LOGO
  134. BYTE    mpeg_logo_onoff=0;
  135. BYTE    need_show_logo=0;
  136. extern void Change_User_Logo();
  137. #endif
  138. #ifdef DVB_MENU_SETUP_STYLE
  139. extern const char * osd_str_dvb_submenu[N_OSD_LANGS][5];
  140. #endif
  141. #if defined(NEW_PARENTAL_GUI)||defined(MODIFY_PARENTAL_GUI)//zhaoyanhua add 2003-11-28 10:46
  142. #if defined(NEW_PARENTAL_GUI)
  143. extern void osd_init_parental_gui(void);
  144.     BYTE   new_parental_gui = 0;
  145. #endif
  146. #if defined(MODIFY_PARENTAL_GUI)
  147.     BYTE    parental_gui_flag = 0;
  148. #endif//#if defined(MODIFY_PARENTAL_GUI)
  149. void check_parent_password(void);
  150. void ExitParentalGUI(void);
  151. #endif
  152. //osd related function
  153. extern void osd_init_setup(void);
  154. extern void osd_disable(void);
  155. extern void osd_DrawLine(UINT32 xStart, UINT32 yStart, UINT32 xEnd, UINT32 yEnd, BYTE color, BYTE lineWidth);
  156. extern void osd_draw_rect(UINT32 xStart, UINT32 yStart, UINT32 xLen, UINT32 yLen, BYTE bkColor);
  157. extern void osd_draw_setup_button(BYTE xStart, BYTE yStart, BYTE xLen, BYTE color, BYTE bDown);
  158. extern void setVPP_OffsetX(int X);
  159. extern void setVPP_OffsetY(int Y);
  160. //3D sound(EQ, Surround) related setting
  161. extern BYTE soundGetSurroundType();
  162. //misc functions
  163. extern void set_aud_buf_size(void);
  164. void setup_DrawItem(BYTE level, BYTE yStart, BYTE updowngray);
  165. const char * setup_SetItemString(void);
  166. void run_save_tv_cmd(UINT8 item,UINT8 sel);
  167. UINT16 run_save_unChk_cmd(UINT8 save);
  168. void set_video_aspect(void);
  169. int is_aspect_menu(void);
  170. void run_save_sel_cmd(BYTE page,BYTE index);
  171. void run_save_total_sel(void);
  172. void rep_run_the_menu(void);
  173. void show_lock(int s,int mode);
  174. void setup_ShowAC3Config();
  175. void setup_CookScaleItem(UINT8 id, UINT8 dir);
  176. void setup_PrepareScaleItem(BYTE id, BYTE up1down);
  177. void setup_ShowVolCtrlConfig();
  178. void ShowPasswordGUI();
  179. void setup_ShowAC3DynamicRange(void);
  180. void set_AC3DynamicRange(void);
  181. void reset_passwd_cnt(void);
  182. void setup_func_return_main(void);
  183. int IsOSDChinese();
  184. //void SetSharpness(BYTE nVal);
  185. void SetBrightness(BYTE nVal);
  186. void SetContrast(BYTE nVal);
  187. void setup_save_exit(void);
  188. #ifdef IR_KEY_SET_VIDEO_MODE
  189. void SetBrightnessAdjust(BYTE nVal, BYTE nVal2);
  190. void SetContrastAdjust(BYTE nVal, BYTE nVal2);
  191. #endif//IR_KEY_SET_VIDEO_MODE
  192. void SetHUE(BYTE nVal);
  193. void SetSaturation(BYTE nVal);
  194. #ifdef DIP_CFG_ENABLE
  195. void SetDeInterlace(BYTE nVal);
  196. #endif
  197. #ifdef BBK_DVD//zhaoyanhua add 03-10-19 10:43
  198. void AudioSet2chOutput(void);
  199. void AudioSet5_1chOutput(void);
  200. void AudioSetPrologic_IIOutput(void);
  201. #endif//end BBK_DVD
  202. #ifdef SHOW_STANDBY_TIMER        //suqiaoli add 2003-8-2
  203. #define STANDBY_TIMER_ITEM         3
  204. void polling_setup_standby_timer(void);
  205. #endif
  206. extern void search_ap_tv_out_id(void);
  207. extern void update_tv_format_sel(void);
  208. /***********   Item description  **********************
  209.   BYTE    function
  210.   0       mode(MSB 4bits)  ==>show direction picture
  211.   0x0:no effect
  212.   0x1:basic select function
  213.   0x2:can enter number
  214.   0x3:need run function by osd id
  215.   0x4:left/right shift only
  216.   0x5:only show text,can't move to this area
  217.   1       title       ---sw region 1
  218.   2~6     select item ---sw region 2
  219. ******************************************************/
  220. enum
  221. {
  222.     SET_NE=0,
  223.     SET_BS=0x1,
  224.     SET_NM=0x2,
  225.     SET_FUNC=0x3,
  226.     SET_SH=0x4,
  227.     SET_SHOW=0x5,
  228.     SET_SCALE=0x6,
  229.     SET_SPACE=0x7,
  230. };
  231. UINT8   setup_page,setup_id,setup_sel_item;
  232. #define page    setup_page
  233. #define id  setup_id
  234. #define sel     setup_sel_item
  235. UINT8   id,sel,page;
  236. #ifdef SETUP_6_DIGIT_PASSWORD//zhaoyanhua add 03-10-14 14:22
  237. UINT32  tmp_passwd;
  238. #else
  239. UINT16  tmp_passwd;
  240. #endif
  241. UINT32  romCheckSum;
  242. #ifdef Ti3001_OSD_UI_2
  243.     INT8  amp_volume_level;
  244.     INT8  amp_fspk_level;
  245.     INT8  amp_fspk_balance_level;
  246.     INT8  amp_sspk_level;
  247.     INT8  amp_sspk_balance_level;
  248.     INT8  amp_cspk_level;
  249.     INT8  amp_subwoofer_level;
  250.     INT8  amp_bass_level;
  251.     INT8  amp_tremble_level;
  252.     INT8  amp_dynamic_level;
  253. #endif
  254. BYTE    index_y=0;          //item index for 1st-level page, 2nd-level page
  255. BYTE    index_y2=0;         //item index for 3rd-level page
  256. BYTE    index_y_start=0;
  257. BYTE    index_y2_start=0;
  258. #ifdef EASTECH_SETUPMENU
  259. BYTE    index_pscan_ok=0;
  260. #endif
  261. BYTE    submenuStart=SETUP_MENU_YSTART;
  262. BYTE    setupLevel=0;       //0:main menu, 1:sub-menu, 2:selection-menu(menu of sub-menu)
  263. BYTE    setupItemNum[3] = { //max item num in every sub-menu
  264.     MAX_PAGE_ITEM,          //main menu items count
  265.     MAX_PAGE_ITEM,          //second-level menu items count
  266.     MAX_PAGE_ITEM           //third-level menu
  267. };
  268. //define setup page 
  269. #include "setup_page.h"
  270. //PS:this command line doesn't be used in macro define
  271. //run_save_sel_cmd(0, 5);
  272. #ifdef Ti3001_OSD_UI_2
  273.     const UINT8 setup_MainP[][2] =
  274.     {
  275.         {STR_OS_SYS_SETUP, 0},
  276.         {STR_OS_LANG_SETUP, 1},
  277.         {STR_OS_AUD_SETUP, 2},
  278.         //{STR_OS_SPK_SETUP, 3},
  279.         {STR_OS_SPK_SETUP, 3},
  280.         {STR_OS_DIGTAL_SETUP, 4},
  281.         {STR_OS_AMP_SETUP1,5},       //S:"功放设定1"
  282.         {STR_OS_AMP_SETUP2,6},       //S:"功放设定2"
  283.         {STR_OS_EXIT_MENU, 7},
  284.     };
  285. #elif defined(DVB_MENU_SETUP_STYLE)
  286.     const UINT8 setup_MainP[][2] =
  287.     {
  288. {STR_OS_INSTALL_SETUP, 0},
  289. {STR_OS_CHANNEL_SETUP, 1},
  290. {STR_OS_SYS_SETUP, 2},
  291. {STR_OS_LANG_SETUP, 3},
  292. {STR_OS_AUD_SETUP, 4},
  293.         {STR_OS_VIDEO_SETUP, 5},
  294.         {STR_OS_SPK_SETUP, 6},
  295.         {STR_OS_DIGTAL_SETUP, 7},
  296.         {STR_OS_SPACE, 0},
  297.         {STR_OS_EXIT_MENU, 8},
  298.         {STR_OS_NO, 0},
  299.     };
  300. #else//take off SOFT_MENU special setup_MainP,share with old setup_MainP.chenzhao on 2004-11-15 11:3   
  301.     const UINT8 setup_MainP[][2] =
  302.     {
  303.         {STR_OS_SYS_SETUP, 0},
  304.         {STR_OS_LANG_SETUP, 1},
  305.         {STR_OS_AUD_SETUP, 2},
  306.         #ifdef QSI_SETUP_MENU//liweihua 2004-6-15
  307.         {STR_OS_KARAOKE_SETUP,3},
  308.         #else
  309.         #ifndef BBK_SIMPLE_SETUP
  310.          #ifndef SETUP_DONGLI459//20040206
  311.         {STR_OS_VIDEO_SETUP, 3},
  312.         {STR_OS_SPK_SETUP, 4},
  313.         {STR_OS_DIGTAL_SETUP, 5},
  314.        #else
  315.        {STR_OS_SPK_SETUP, 3},
  316.         {STR_OS_DIGTAL_SETUP, 4},
  317.        #endif        
  318.         {STR_OS_SPACE, 0},
  319.         #else//#ifndef BBK_SIMPLE_SETUP
  320.         {STR_OS_VIDEO, 0},
  321.         #endif//#ifndef BBK_SIMPLE_SETUP
  322.         #endif//#ifdef QSI_SETUP_MENU
  323. #if defined(BBK_NEW_SETUP)&&defined(BBK_DV961_DVD) //axel 2004/1/26 04:01 DSS555 need not OENKEYPASSPAGE         
  324.         {STR_OS_ONEKEY_SETUP, 7},
  325.         {STR_OS_EXIT_MENU,8},
  326. #else        
  327.         {STR_OS_EXIT_MENU, 7},
  328. #endif     
  329.         {STR_OS_NO, 0},
  330.     };
  331. #endif
  332. //
  333. // If you change the sequence of the menu items, please check up the following definition
  334. // and
  335. // set_default_value()
  336. // run_set_variable()
  337. // setup_func_down()
  338. // setup_SetAC3Config()
  339. //
  340. UINT8 setup_sel[MAX_SETUP_PAGE + MAX_CUSTM_SETUP_PAGE][MAX_PAGE_ITEM];//Item number
  341. #ifdef SUPPORT_FUNCTION_MENU
  342. UINT8 setup_sel_plus[MAX_SETUP_PAGE_PLUS][MAX_PAGE_ITEM_PLUS];
  343. #endif 
  344. //const UINT8 setup_item[MAX_SETUP_PAGE + MAX_CUSTM_SETUP_PAGE][MAX_PAGE_ITEM][MAX_ITEM_SEL]
  345. //exe_setup_function,terry,2004/2/10 03:36PM
  346. //take off SOFT_MENU special setup_item,share with old setup_item.chenzhao on 2004-11-15 11:3   
  347. #include "setup_item.c"
  348. #include "setup_exe.c"
  349. #include "setup_if.c"
  350. #ifdef SUPPORT_FUNCTION_MENU
  351. #include "setup_plus.c"
  352. #endif
  353. int setup_IsSpkSubwooferOn(void)
  354. {
  355.     int res;
  356.     if(SETUP_SPK_SUBWOOFER==3)
  357.         res=1;
  358.     else
  359.         res=0;
  360.     return res;
  361. }
  362. int WillKeyShiftNotDo(void)//nono 2-5-12 20:54
  363. {
  364.     int res=0;
  365. #ifndef SETUP_ALL_VALID//nono 2003-9-25 16:54
  366.     if( ((SETUP_SPK_DOWNMIX==AC3DOWNMIXOFF)||(coding_mode_now==AUDIF_CODING_MODE_LPCM) )&&(cd_type_loaded==CDDVD) )
  367.         res=1;
  368.     else if( (SETUP_SPK_DOWNMIX==AC3DOWNMIXOFF)&&(coding_mode_now==AUDIF_CODING_MODE_DTSCD) )
  369.         res=1;
  370. #endif
  371.     return res;
  372. }
  373. #ifdef USER_MPEG_LOGO
  374. UINT8 setup_GetMPEGLogoItem(void)
  375. {
  376.     return (SETUP_MPEG_LOGO);
  377. }
  378. void setup_SetMPEGLogo(void)//nono 2-5-16 18:05
  379. {
  380.     //setup_sel[SysNextPage][MPEG_LOGO_ITEM]=3;
  381.     SETUP_MPEG_LOGO = MPEG_LOGO_ON;//3
  382.     //exe_setup_function(STR_OS_SELECT_LOGO,STR_OS_DEFAULT_SETUP,0);  // alan, 2003/9/16 05:03PM
  383.     exe_setup_function(STR_OS_SELECT_LOGO,STR_OS_MPEG_LOGO,0);  //NONO 2004-2-17 17:02
  384.     //setup_sel[7][2]=3;
  385.     run_save_sel_cmd(SysNextPage, MPEG_LOGO_ITEM);//nono 2004-2-17 17:02
  386.     
  387. }
  388. #ifdef YUXING_MIDI_DVD        //nono 2004-10-28 14:34
  389. void setup_SetDefaultLogo(void)//nono 2-5-16 18:05
  390. {
  391.     SETUP_MPEG_LOGO = 2;//3
  392.     exe_setup_function(STR_OS_SELECT_LOGO,STR_OS_DEFAULT_SETUP,0);  // alan, 2003/9/16 05:03PM
  393.     run_save_sel_cmd(SysNextPage, MPEG_LOGO_ITEM);//nono 2004-2-17 17:02
  394. }
  395. #endif
  396. #endif//USER_MPEG_LOGO
  397. int setup_IsSpkDownmixOff(void)//nono 2-5-16 18:05
  398. {
  399.     if(SETUP_SPK_DOWNMIX==AC3DOWNMIXOFF)
  400.         return 1;
  401.     else
  402.         return 0;
  403. }
  404. void setup_Showredframe(UINT8 page_val)
  405. {
  406. #ifndef SETUPMENU_16Mb_NO_ICON
  407.         UINT16 line=SETUP_MAX_WIDTH*16-20;
  408.         if(page_val==7) page_val=0;
  409.         osd_DrawLine(line*page_val/6+30,14,line*page_val/6+80,14,SANTIBGCOLOR,1);
  410.         osd_DrawLine(line*page_val/6+30,50,line*page_val/6+80,50,SANTIBGCOLOR,1);
  411.         osd_DrawLine(line*page_val/6+30,14,line*page_val/6+30,50,SANTIBGCOLOR,1);
  412.         osd_DrawLine(line*page_val/6+80,14,line*page_val/6+80,50,SANTIBGCOLOR,1);
  413. #endif
  414. }
  415. void setup_ShowAC3DynamicRange(void)
  416. {
  417.     BYTE    buf[40];
  418.     BYTE    fontColor;
  419.     if ( (page!=AC3DIGITALPAGE) ||
  420.         (setupLevel!=2) ||
  421.         (index_y!=AC3OUTMODEITEM)
  422.         )
  423.     {
  424.         return;
  425.     }
  426.     if ( (SETUP_AC3DIGITAL_OUTMODE==AC3DYNAMICITEM2) && 1
  427. //      (SETUP_SPK_DOWNMIX==AC3DOWNMIXOFF)
  428.         )
  429.     {
  430.         fontColor = SFONTCOLOR;
  431.     } else {
  432.         fontColor = SGRAYCOLOR;
  433.     }
  434.     id = setup_item[page][AC3DYNAMICITEM1][1];
  435.     psprintf(buf, "%s", _OsdMessegeFont1[osd_font_mode][id]);
  436.     osd_DrawString(SETUP_MENU_XSTART+1, AC3DYNAMICITEM1+SETUP_MENU_YSTART, buf, fontColor, SBGCOLOR);
  437. }
  438. void set_AC3DynamicRange(void)
  439. {
  440.     if (ac3_dynarange) {
  441.         AUDIF_Set_OutputMode(OUT_CustomModeB_DigitalDialnormK1, ac3_dynarange * 0x2020 - 0x0101);//2004AUDDRV AudioSetOutputMode(0x80, ac3_dynarange * 0x2020 - 0x0101);
  442.     } else {
  443.         AUDIF_Set_OutputMode(OUT_CustomModeB_DigitalDialnormK1, 0);//2004AUDDRV AudioSetOutputMode(0x80, 0);
  444.     }
  445. }
  446. #ifdef AUDIO_2CH_5_1CH
  447. int setup_IsSpkStereo(void)
  448. {
  449.     if(SETUP_SPK_DOWNMIX == DOWNMIXSTEREO)
  450.         return 1;
  451.     else
  452.         return 0;
  453. }
  454. /*
  455.  * to set 5.1 channel output mode
  456.  *
  457.  */
  458. void AudioSet5_1chOutput(void)
  459. {
  460.     exe_setup_function(STR_OS_DOWNMIX_SETUP,STR_OS_OFF,0);//turn off mix off
  461.     SETUP_SPK_DOWNMIX = AC3DOWNMIXOFF;  
  462.     
  463. #ifdef YI_XIAN_TONG//zhaoyanhua add 2003-12-17 9:51
  464.         Gpio5ChOutput();
  465. #endif
  466. }
  467. /*
  468.  * to set PROLOGIC_II channel output mode
  469.  *
  470.  */
  471. #ifdef SUPPORT_PROLOGIC_II  //axel 2004/1/28 10:30
  472. void AudioSetPrologic_IIOutput(void)
  473. {
  474.     //abstract from setup_tab_ui.c  
  475.     //NOTE:
  476.     // can not change the order.
  477.     //zhaoyanhua note 03-11-1 18:58 
  478.     exe_setup_function(STR_OS_PROLOGIC,STR_OS_PL_MUSIC,0);
  479.     SETUP_PROLOGIC_II= 3;//STR_OS_PL_MUSIC  to update SETUP in time.
  480.     //set AUDIO output SIMULATE
  481.     //because BBK need SIMULATE and DIGITAL ouput at the same time
  482.     //so we must mask the following sentences.
  483.     //zhaoyanhua mask 2003-11-29 20:29
  484.     #if 0
  485.     SETUP_SPDIF=2;
  486.     exe_setup_function(STR_OS_AUD_OUT,STR_OS_SIMULATE,0);
  487.     #endif
  488.     //set DOWNMIX OFF 
  489.     SETUP_SPK_DOWNMIX = AC3DOWNMIXOFF;  
  490.     exe_setup_function(STR_OS_DOWNMIX_SETUP,STR_OS_OFF,0);
  491.     
  492. }
  493. #endif //SUPPORT_PROLOGIC_II //axel 2004/1/28 10:30
  494. #endif// AUDIO_2CH_5_1CH
  495. //terry,2004/2/5 12:08PM
  496. void setup_SetTV_format(UINT8 id)
  497. {//terry,2004/2/5 12:02PM
  498. #ifndef NO_TV_FORMAT    
  499.    #ifndef FUSS_TV_DVD//nono 2-8-20 12:55
  500.    int i;
  501.    
  502.    for(i=2;i<MAX_ITEM_SEL;i++)
  503.    {
  504.       if(setup_item[SYSPAGE][TV_FORMAT][i]==id)
  505.       {
  506.     SETUP_TV_FORMAT=i;
  507.     run_save_sel_cmd(SYSPAGE,TV_FORMAT);//terry,2004/2/3 03:35PM
  508.     break;
  509.       }
  510.    }
  511.    #endif
  512. #endif    
  513. }
  514. #ifdef FORCE_RETURN_TO_DEFAULT_TV_FORMAT//nono 20030913
  515. void setup_SetTV_default_format(void)
  516. {
  517.     SETUP_TV_FORMAT = MIN_ITEM_SEL+DEFAULT_TV_SYS;
  518.     //setup_tv_format(DEFAULT_TV_SYS); // Robert 020919
  519.     //exe_setup_function(STR_OS_TV_SYS,STR_OS_NTSC,0);
  520. //modefied by wangfeng,2004-2-9 17:39
  521. #if defined(TV_FORMAT)&& !defined(FORCE_RETURN_TO_DEFAULT_TV_FORMAT)//terry,2004/2/3 01:34PM
  522.     
  523.     exe_setup_function(STR_OS_TV_SYS,setup_item[SYSPAGE][TV_FORMAT][SETUP_TV_FORMAT],1);            
  524. #else
  525.         //exe_setup_function(STR_OS_TV_SYS,STR_OS_NTSC,1);
  526.         #ifdef FORCE_RETURN_TO_FORMAT_PAL
  527.         tv_format=MODE_PAL;//MODE_NTSC;
  528.         #elif defined(FORCE_RETURN_TO_FORMAT_AUTO)   //fengjl  add 2004-03-09 15:47
  529.         tv_format=MODE_AUTO;
  530.         #else
  531.         tv_format=MODE_NTSC;
  532.         #endif
  533.         update_tv_format_sel();
  534.         setup_tv_format(tv_format);
  535.         #ifdef FORCE_RETURN_TO_FORMAT_PAL
  536.         setup_SetTV_format(STR_OS_PAL);
  537.         #elif defined(FORCE_RETURN_TO_FORMAT_AUTO)
  538.         setup_SetTV_format(STR_OS_AUTO);
  539.         #else
  540.         setup_SetTV_format(STR_OS_NTSC);
  541.         #endif
  542.          //exe_setup_function(STR_OS_TV_SYS,STR_OS_PAL,1);
  543. #endif  
  544. }
  545. #endif//FORCE_RETURN_TO_DEFAULT_TV_FORMAT
  546. #ifdef USE_PROLOGIC_II_KEY//clead 2003-8-7 
  547. void set_prologic_val(BYTE prologic_mode)
  548. {
  549.     BYTE type=0x23;
  550.     switch (prologic_mode)
  551.     {
  552.         case 0:
  553.             pl2_init_val|=(1<<20);      // set prologic-II enable
  554.             pl2_init_val|=(1<<16);      // set init-val to movie mode                       
  555.             //DSP set prologic-II enable
  556.             AUDIF_Set_ProLogicII(0x11);//2004AUDDRV AudioIOControl(PROLOGIC,0x11,0);
  557.             type=0x23; //Oliver : prologic-II Decoder Mode - Movie/Standard Mode
  558.             printf("<MOVIE>, pl2_init_val=0x%06xn",pl2_init_val);
  559.             break;
  560.         case 1:     
  561.             pl2_init_val|=(1<<20);      // set prologic-II enable
  562.             pl2_init_val&=(~(1<<16));   // set init-val to music mode
  563.             //DSP set prologic-II enable
  564.             AUDIF_Set_ProLogicII(0x11);//2004AUDDRV AudioIOControl(PROLOGIC,0x11,0);
  565.             type=0x22; //Oliver : prologic-II Decoder Mode - Music Mode
  566.             printf("<MUSIC>, pl2_init_val=0x%06xn",pl2_init_val);
  567.             break;
  568.         case 2:                 
  569.             //pl2_init_val&=(~(1<<20)); // set prologic-II disable
  570.             pl2_init_val=0x037300;
  571.             //DSP set prologic-II disable
  572.             AUDIF_Set_ProLogicII(0x10);//2004AUDDRV AudioIOControl(PROLOGIC,0x10,0);
  573.             printf("<OFF>, pl2_init_val=0x%06xn",pl2_init_val);
  574.             break;
  575.     }
  576.     //DSP set prologic-II Decoder Mode Select
  577.     AUDIF_Set_ProLogicII(type);//2004AUDDRV AudioIOControl(PROLOGIC,type,0);
  578.     SETUP_PROLOGIC_II=prologic_mode+2;
  579.     exe_setup_function(STR_OS_PROLOGIC, setup_item[AUDPAGE][PROLOGIC_II][SETUP_PROLOGIC_II], 1);
  580.     //clead 2003-10-21 
  581.     run_save_sel_cmd(AUDPAGE,PROLOGIC_II);//clead 2003-10-21 
  582. }
  583. #endif //clead_prologic
  584. void setup_SetPScan(void)
  585. {
  586.     #ifndef FUSS_TV_DVD//nono 2-8-20 12:55
  587.     SETUP_VIDEO_FORMAT = ap_tv_out_id+2;
  588. #if defined(SCART_TV)||defined(KSD_SCART_TV)||defined(SCART_TV_2)||defined(SCART_TV_4)||defined(SCART_TV_5)//wangfeng 2003-12-2 23:03
  589.         //if(tv_out_id==PC_VGA||tv_out_id==TV_RGB)
  590.         if(tv_out_id==TV_RGB)//nono 2003-8-24 21:08
  591.         SET_SCART_RGB(1);
  592.         else
  593.         SET_SCART_RGB(0);   
  594. #elif defined(SCART_TV_3)
  595.     if(tv_out_id==TV_RGB)
  596.         SET_SCART_RGB(0);
  597.     else
  598.         SET_SCART_RGB(1);
  599. #endif
  600.    
  601. #ifdef SUPPORT_SCART_TV//SPHE8202//nono 4-3-27 21:35
  602.     if(tv_out_id==TV_RGB)
  603.     {
  604.         SET_SCART_GPIO_SFT_CFG_CTRL();
  605.         SET_SCART_TO_RGB();
  606.     }
  607.     else
  608.     {
  609.         SET_SCART_GPIO_SFT_CFG_CTRL();
  610.         SET_SCART_TO_CVBS();
  611.     }
  612. #endif//SPHE8202
  613.    
  614.     //run_save_cmd();
  615.     run_save_sel_cmd(SYSPAGE,2);
  616.     #endif
  617. }
  618. //////////////////////////////////
  619. #if 0//def IR_KEY_SET_VIDEO_MODE
  620. void set_video_val(BYTE video_mode)
  621. {
  622.     int i=0;
  623.         UINT8 parm[6][3] = { {8,8,8},//0
  624.                              {7,9,6},//1
  625.                              {9,8,10},//2
  626.                              {8,9,9},//3
  627.                              {11,10,9},//4
  628.                              {7,5,7},//5
  629.                            };
  630.         if(video_mode<6)
  631.         {
  632.                 SETUP_BRIGHTNESS=parm[video_mode][0];
  633.                 SETUP_CONTRAST=parm[video_mode][1];
  634.                 SETUP_HUE=parm[video_mode][2];
  635.         }else
  636.         {
  637.             ReadFromI2c(0xa0, 240,(BYTE *)&SETUP_BRIGHTNESS,1);
  638.             ReadFromI2c(0xa0, 241,(BYTE *)&SETUP_CONTRAST,1);
  639.             ReadFromI2c(0xa0, 242,(BYTE *)&SETUP_HUE,1);
  640.         }
  641.         SetBrightness(SETUP_BRIGHTNESS - 2);
  642.         SetContrast(SETUP_CONTRAST - 2);
  643.         SetHUE(SETUP_HUE - 2);
  644.         //SetSaturation(SETUP_SATURATION - 2);
  645.         do{
  646.         run_save_sel_cmd(VIDEOPAGE,i);
  647.         i++;
  648.         }while(i<4);
  649. }
  650. #endif
  651. //
  652. //
  653. #ifdef IR_KEY_SET_VIDEO_MODE
  654. void set_video_val(BYTE video_mode)
  655. {
  656.         UINT8 b,c,h,s;
  657.     //b:SETUP_BRIGHTNESS
  658.     //c:SETUP_CONTRAST
  659.     //h:SETUP_HUE
  660.     UINT8 parm[6][3] = { {8,8,8},//0
  661.                          {7,9,6},//1
  662.                          {9,8,10},//2
  663. #ifndef SET_4_VIDEO_MODE
  664.                          {8,9,9},//3
  665.                          {11,10,9},//4
  666.                          {7,5,7},//5
  667. #endif//SET_4_VIDEO_MODE
  668.                        };
  669. #ifdef SET_4_VIDEO_MODE
  670.     if(video_mode<3)
  671. #else//SET_4_VIDEO_MODE
  672.     if(video_mode<6)
  673. #endif//SET_4_VIDEO_MODE
  674.     {
  675.         b=parm[video_mode][0];
  676.         c=parm[video_mode][1];
  677.         h=parm[video_mode][2];
  678.                 s=2;
  679.                 SetBrightnessAdjust(b - 2,c);
  680.                 SetContrastAdjust(c - 2,b);
  681.     }else
  682.     {
  683.         b=SETUP_BRIGHTNESS;
  684.             c=SETUP_CONTRAST;
  685.             h=SETUP_HUE;
  686.                 s=SETUP_SATURATION;
  687.                 SetBrightness(b - 2);
  688.                 SetContrast(c - 2);
  689.     }
  690.     
  691.         //SetBrightness(SETUP_BRIGHTNESS - 2);
  692.         //SetContrast(SETUP_CONTRAST - 2);
  693.     //SetSaturation(SETUP_SATURATION - 2);
  694.         //SetHUE(SETUP_HUE - 2);
  695.         //SetSaturation(SETUP_SATURATION - 2);
  696.         SetHUE(h - 2);
  697.         SetSaturation(s - 2);
  698.         //if(video_mode_val==6)
  699. }
  700. #endif 
  701. //
  702. #ifdef  AUTO_ADJUST_TV_TYPE  //lijd 2004-9-15 13:33
  703. void auto_adjust_tv_type(void)
  704. {
  705.     int  mode;
  706.     mode=(pDSV->dV_ATR>>8)&0x0f;
  707.     switch(mode)
  708.     {
  709.          case 0x0e:  //16:9
  710.                    SETUP_TV_TYPE=4;                
  711.                    exe_setup_function(STR_OS_TV_RATIO,STR_OS_16_9,1);
  712.                    run_save_sel_cmd(0,3);
  713.                    ExitSetupPage(1);
  714.                    break;
  715.          case 0x0d:  //4:3LB
  716.                    SETUP_TV_TYPE=3;  
  717.                    exe_setup_function(STR_OS_TV_RATIO,STR_OS_4_3LB,1);
  718.                    run_save_sel_cmd(0,3);
  719.                    ExitSetupPage(1);
  720.                    break;
  721.          case 0x03:  //4:3PS
  722.                    SETUP_TV_TYPE=2;          
  723.                    exe_setup_function(STR_OS_TV_RATIO,STR_OS_4_3PS,1);
  724.                    run_save_sel_cmd(0,3);
  725.                    ExitSetupPage(1);
  726.                    break;
  727.          default:
  728.                     
  729.                    break;
  730.                    
  731.      }
  732.     
  733. }
  734. #endif
  735. //
  736. //
  737. #ifdef ADD_DVI311_SETUP
  738. #include "spv301.h"
  739. extern void scaler_main(void);
  740. void set_default_value_dvi(void)
  741. {
  742.     if(getVPP_TVsystem())
  743.      dvi311_tv_mode = 0x84; //0x85:NTSC, 0x86:PAL60, 0x84:PAL, 0x7a:AUTO
  744. else
  745.         dvi311_tv_mode = 0x85; //0x85:NTSC, 0x86:PAL60, 0x84:PAL, 0x7a:AUTO
  746. dvi311_format = STR_OS_DIGIT_OUTPUT; //output format:0xb7:模拟输出, 0xb8:数字输出 //for default digital output.Modifed by ChenZhao on 2004-10-19 11:15  
  747.     #ifdef DVI311_NO_PC_MODE
  748.         dvi311_mode = Mode_480P;
  749.     #else
  750.         dvi311_mode =Mode_XGA;// 3; //output mode:0:720P, 1:576P, 2:480P, 3:SXGA, 4:XGA, 5:SVGA, 6:VGA
  751.     #endif
  752.     SETUP_DVI_MODE=dvi311_mode+2;
  753. Power_off_311=1;   //kevin0710
  754. }
  755. #endif
  756. void set_default_value(void)
  757. {
  758.     int     i,j;
  759.     #ifdef SUPPORT_FUNCTION_MENU
  760.     {
  761.           for(i=0;i<MAX_PAGE_ITEM_PLUS;i++) 
  762.           {
  763.             
  764.             if(setup_item_plus[0][i][1] == STR_OS_BRIGHTNESS)
  765.             {
  766.                 setup_sel_plus[0][i] = DEFAULT_BRIGHTNESS;
  767.             }
  768.             else if(setup_item_plus[0][i][1] == STR_OS_TV_RATIO)
  769.             {
  770.                 setup_sel_plus[0][i] = MIN_ITEM_SEL_PLUS;
  771.             }
  772.             else
  773.             {
  774.                 setup_sel_plus[0][i] = MIN_ITEM_SEL_PLUS;
  775.             }
  776.           }
  777.         }  
  778.     #endif //end #ifdef SUPPORT_FUNCTION_MENU
  779.     
  780.     for(i=0;i<(MAX_SETUP_PAGE+MAX_CUSTM_SETUP_PAGE);i++) {
  781.         for(j=0;j<MAX_PAGE_ITEM;j++) {
  782.         #if defined(BBK_NEW_SETUP)&&defined(BBK_DV961_DVD)//zhaoyanhua add 2003-11-29 20:52
  783.             if(i == ONEKEYPASSPAGE)
  784.                 continue;
  785.         #endif
  786.         
  787.             //rating and password
  788.             if((setup_item[i][j][1]==STR_OS_RATING)||(setup_item[i][j][1]==STR_OS_PASSWORD)||(setup_item[i][j][1]==STR_OS_REGION_CODE))//nono 20031122
  789.                 continue; //grade item need not load default value
  790. #ifdef SUPER_DEFAULT_OSD_LANG
  791.             if(i==CUSTMPAGEINDEX)
  792.             {
  793.                 if(setup_item[i][j][1]==STR_OS_OSD)
  794.                     continue;
  795.             }
  796. #endif 
  797.             #ifndef ARGUS_PORTABLE_DVD
  798.             if(setup_item[i][j][1]==STR_OS_TV_SYS)
  799.             {
  800.                 setup_sel[i][j]=MIN_ITEM_SEL+DEFAULT_TV_SYS;
  801.                 //setup_tv_format(DEFAULT_TV_SYS); // Robert 020919
  802.                 exe_setup_function(STR_OS_TV_SYS,setup_item[SYSPAGE][TV_FORMAT][setup_sel[i][j]],1);//terry.2004/2/3 01:41PM
  803.             }
  804.             else
  805.             #endif
  806.             if(setup_item[i][j][1] == STR_OS_SUBTITLE_LANG_SETUP) {  //Jeff 20021007
  807.                 setup_sel[i][j] = DEFAULT_SUBT_LANG;
  808.             }
  809.             #ifdef SETUP_MENU_TWO_BUTTON_SELECT_TWO_SUBTITLE  //added by wangwei,2004-10-25 0:13
  810.             else if(setup_item[i][j][1] == STR_OS_SUBTITLE_LANG_2ND_SETUP) {
  811.                 setup_sel[i][j] = DEFAULT_SUBT_LANG_2ND;
  812.             }
  813.             #endif 
  814.             else if(setup_item[i][j][1] == STR_OS_AUDIO_LANG_SETUP) {   //Jeff 20021007
  815.                 setup_sel[i][j] = DEFAULT_AUDIO_LANG;
  816.             }
  817.             else if(setup_item[i][j][1] == STR_OS_MENU_LANG_SETUP) {   //Jeff 20021007
  818.                 setup_sel[i][j] = DEFAULT_MENU_LANG;
  819.             } 
  820.             
  821. //gerry mark it,2003-12-23 15:59
  822. /*
  823. #ifdef DEFAULT_S_VIDEO_OUTOUT           //gerry for panda dvd,3-8-23 18:30
  824.             else if(setup_item[i][j][1] == STR_OS_VIDEO) {   
  825.                 setup_sel[i][j] = MIN_ITEM_SEL+4;
  826.             }
  827. #endif
  828. */
  829. #ifdef EASTECH_DEFAULT_S_VIDEO_OUTOUT           
  830.             else if(setup_item[i][j][1] == STR_OS_VIDEO) {   
  831.                 setup_sel[i][j] = MIN_ITEM_SEL+1;
  832.             }
  833. #endif
  834. #ifdef SETUP_ITEM_NO_DOWNSAMPLE_AND_DEFAULT_96K           
  835.             else if(setup_item[i][j][1] == STR_OS_FREQ_MASK) {   
  836.                 setup_sel[i][j] = MIN_ITEM_SEL+1;
  837.             }
  838. #endif
  839. #ifdef SETUP_ITEM_NO_DOWNMIX_AND_DEFAULT_STEREO           
  840.             else if(setup_item[i][j][1] == STR_OS_DOWNMIX_SETUP) {   
  841.                 setup_sel[i][j] = MIN_ITEM_SEL+1;
  842.             }
  843. #endif
  844. #ifdef GBM_PORTABLE_DVD
  845. #ifdef USE_RGB_TFT
  846.             else if(setup_item[i][j][1] == STR_OS_VIDEO) {   
  847.                 setup_sel[i][j] = MIN_ITEM_SEL+3;
  848.             }
  849. #endif
  850. #endif
  851. #if defined(DEFAULT_MIC_OFF)            //gerry for panda dvd,3-9-2 18:06
  852.             else if(setup_item[i][j][1] == STR_OS_MIC_ONOFF) {   
  853.                 setup_sel[i][j] = MIN_ITEM_SEL+1;
  854.             }
  855. #endif
  856. #ifdef SOUND_EFFECT_MENU   //sunzhh add  2004-4-28 13:56
  857.         else if(setup_item[i][j][1] == STR_OS_EQ){
  858.                     setup_sel[i][j] = MIN_ITEM_SEL+0;
  859.             }
  860.         else if(setup_item[i][j][1] == STR_OS_SURR){
  861.                     setup_sel[i][j] = MIN_ITEM_SEL+5;
  862.             }
  863. #endif                          //#ifdef SOUND_EFFECT_MENU
  864. #ifdef  JIEKE_DVD
  865.         else if(setup_item[i][j][1] == STR_OS_SSAVER_SETUP){
  866.                     setup_sel[i][j] = MIN_ITEM_SEL+1;
  867.             }
  868.         else if(setup_item[i][j][1] ==STR_OS_AUD_OUT){
  869.                     setup_sel[i][j] = MIN_ITEM_SEL+1;
  870.             }
  871. #endif
  872. #if defined(BBK_NEW_SETUP)||defined(BBK_SIMPLE_SETUP)   //fengjl  add 3-11-28 23:08
  873.         else if(setup_item[i][j][1] == STR_OS_TV_RATIO){
  874.                     setup_sel[i][j] = MIN_ITEM_SEL+1;
  875.             }
  876. #endif
  877. #if defined(SSAVER_DEFAULT_OFF)
  878.         else if(setup_item[i][j][1] == STR_OS_SSAVER_SETUP){
  879.                     setup_sel[i][j] = MIN_ITEM_SEL+1;
  880.             }
  881. #endif           
  882. #if defined(SLEEP_DEFAULT_OFF)
  883.         else if(setup_item[i][j][1] == STR_OS_SLEEP_SETUP){
  884.                     setup_sel[i][j] = MIN_ITEM_SEL+6;
  885.             }
  886. #endif           
  887. #ifdef  GBM_SAME_DISC_RESUME_DEFAULT_ON         //gerry,2004-1-30 20:45
  888.         else if(setup_item[i][j][1] == STR_OS_RESUME){
  889.                     setup_sel[i][j] = MIN_ITEM_SEL+1;
  890.             }
  891. #endif      
  892. #if defined(ADD_P_SCAN_ONOFF)
  893.         else if(setup_item[i][j][1] == STR_OS_P_SCAN_YUV){
  894.                     setup_sel[i][j] = MIN_ITEM_SEL+1;
  895.             }
  896. #endif
  897.         #if defined(ADD_DVI311_SETUP)//for default digital output.Added by ChenZhao on 2004-10-19 11:18  
  898.         else if(setup_item[i][j][1] == STR_OS_DVI311_FORMAT){
  899.                     setup_sel[i][j] = MIN_ITEM_SEL+1;//+0 analog/+1 digital
  900.             }
  901.     #endif                
  902.         #ifdef HDMI
  903.         else if(setup_item[i][j][1] ==STR_OS_AUD_OUT){
  904.             setup_sel[i][j] = MIN_ITEM_SEL+2;//for default spdif PCM output for HDMI output.Modifed by ChenZhao on 2004-10-21 10:51  
  905.             }
  906. #endif     
  907. else if(setup_item[i][j][1] ==STR_OS_AUD_OUT){
  908.             setup_sel[i][j] = MIN_ITEM_SEL+1;//for default spdif RAW output 
  909.             }
  910.             else {
  911.                 setup_sel[i][j]=MIN_ITEM_SEL;
  912.             }
  913.         } //for(j=0;j<MAX_PAGE_ITEM;j++) {
  914.     } //for(i=0;i<(MAX_SETUP_PAGE+MAX_CUSTM_SETUP_PAGE);i++) {
  915. #ifdef TONIC_DVD   
  916.     SETUP_BASS_MODE = 2;        //dingzhy  for tonic   2004-2-11 13:24
  917. #endif
  918. #if 0//def BASS_MODE_ONOFF //yaowh add 2005-4-5 10:34
  919. SETUP_BASS_MODE = 3; 
  920. #endif
  921. #ifdef SUPER_DEFAULT_OSD_LANG
  922.     SETUP_OSD_LANG = UserSet.setup_default_osd_lang + 2;
  923. #else
  924.     SETUP_OSD_LANG = DEFAULT_OSD_LANG+2;
  925. #endif
  926.     
  927. #ifdef SUPPORT_PROLOGIC_II  //axel 2004/1/26 11:43 
  928. #ifdef DEFAULT_PROLOGIC_MUSIC     //HIMAGE1251   //fengjl add 2004-02-25 09:39
  929.     SETUP_PROLOGIC_II=3;//4;    // alan, 3-8-8 18:30
  930. #else
  931.     SETUP_PROLOGIC_II=4;//4;    // alan, 3-8-8 18:30
  932. #endif
  933.     //assign default value for special items(such as scaleable items, echo, key...)
  934. #endif
  935. #ifdef NOT_SHOW_MIC_SETUP_DAFAULT_AUTO
  936.     AUDIF_Set_MICStatus(STATUS_AUTO, 0);//2004AUDDRV AudioSetMIC(2, 0); //Set MIC auto detect(the second parameter:unsed now)    
  937. #endif//NOT_SHOW_MIC_SETUP_DAFAULT_AUTO
  938. #ifdef DIG_AND_AUD//2004-7-2 1:57
  939.     AUDIF_Set_OutputMode(OUT_51DownmixLtRt, 0);//2004AUDDRV AudioSetOutputMode(0x08, 0); //Set Output mode(8:AC3 downmix Lt/Rt)
  940.                         if (full_scrn & SETUP)
  941.                             setup_ShowAC3Config();
  942.     AUDIF_Set_FSPKGain(8);//2004AUDDRV AudioSetFSPKGain(8);
  943. #endif
  944.     //echo
  945. #ifdef KSD_DVD  //wangap 03/08/13
  946.     #ifdef NO_MIC   // liweihua add 03-8-8 21:09
  947.     SETUP_ECHO = 2;
  948.     #else
  949.     SETUP_ECHO = 8;
  950.     #endif
  951.     echo_level = 6;
  952. #elif defined(VTREK_DVD)
  953.     #ifdef NO_MIC   
  954.     SETUP_ECHO = 2;
  955.     #else
  956.     SETUP_ECHO = 6;
  957.     #endif
  958.     echo_level = 0;
  959. #elif defined(HUAJIA_DVD)
  960.     #ifdef NO_MIC   
  961.     SETUP_ECHO = 2;
  962.     #else
  963.     SETUP_ECHO = 9;
  964.     #endif
  965.     echo_level = 7;
  966. #elif defined(NINTAUS_DVD)
  967.     #ifdef NO_MIC   
  968.     SETUP_ECHO = 2;
  969.     #else
  970.     SETUP_ECHO = 9;
  971.     #endif
  972.     echo_level = 7;
  973. #elif defined(INIT_MAX_ECHO)//axel 2004/2/6 10:04PM
  974.     #ifdef NO_MIC   
  975.     SETUP_ECHO = 2;
  976.     #else
  977.     SETUP_ECHO = 10;
  978.     #endif
  979.     echo_level = 8;
  980. #elif defined(SUPPORT_EXT_AD_SHOW_MIC_AUTO_SING)  //ouyang add for extern AD achieve AUTO sing 2004-12-10 19:15
  981.     #ifdef NO_MIC   
  982.     SETUP_ECHO = 2;
  983.     #else
  984.     SETUP_ECHO = 2;
  985.     #endif
  986.     echo_level = 0;
  987. #else
  988.     #ifdef NO_MIC   
  989.     SETUP_ECHO = 2;
  990.     #else
  991.     SETUP_ECHO = 8;
  992.     #endif
  993.     echo_level = 6;
  994. SETUP_MIC_ONF = 3; //chen edit 0430
  995. #endif    
  996. #ifndef BBK_DVD    //fengjl  add 3-12-3 21:10
  997. #ifdef DELETE_VIDEO_ITEM
  998.         setup_tv_out(TV_SVIDEO);
  999.         //ap_tv_out_id=TV_SVIDEO;//nono 2003-8-1 18:05
  1000.         search_ap_tv_out_id();//terry,2003/8/19 03:21PM
  1001. #endif//DELETE_VIDEO_ITEM
  1002. #endif
  1003. #ifdef SET_RETURN_TO_DEFAULT_TV_FORMAT_PAL
  1004.     setup_tv_format(MODE_PAL);
  1005. #endif//SET_RETURN_TO_DEFAULT_TV_FORMAT_PAL
  1006.     #ifdef  Ti3001_OSD_UI_2
  1007.         SETUP_AMP_VOLUME = 8;
  1008.         amp_volume_level = 6;
  1009.         SETUP_AMP_FSPK = 8;
  1010.         amp_fspk_level = 6;
  1011.         SETUP_AMP_FSPK_BALANCE = 8;
  1012.         amp_fspk_balance_level = 6;
  1013.         SETUP_AMP_SSPK = 8;
  1014.         amp_sspk_level = 6;
  1015.         SETUP_AMP_SSPK_BALANCE = 8;
  1016.         amp_sspk_balance_level = 6;
  1017.         SETUP_AMP_CSPK = 8;
  1018.         amp_cspk_level = 6;
  1019.         SETUP_AMP_SUBWOOFER = 8;
  1020.         amp_subwoofer_level = 6;
  1021.         SETUP_AMP_BASS = 8;
  1022.         amp_bass_level = 6;
  1023.         SETUP_AMP_TREMBLE = 8;
  1024.         amp_tremble_level = 6;
  1025.         SETUP_AMP_DYNAMIC= 8;
  1026.         amp_dynamic_level = 12;//6
  1027.     #endif //#ifdef  Ti3001_OSD_UI_2
  1028.     // Video related
  1029.     //SETUP_SHARPNESS = 1 + 2;
  1030. #if 1//!defined(IR_KEY_SET_VIDEO_MODE)
  1031.     SETUP_BRIGHTNESS = 6 + 2;
  1032.     SETUP_CONTRAST = 6 + 2;
  1033.     SETUP_HUE = 6 + 2;
  1034.     SETUP_SATURATION = 0 + 2;
  1035.     
  1036. #endif
  1037. #ifdef IR_KEY_SET_VIDEO_MODE
  1038.     //video_mode_val=ReadFromI2c(0xa0, 220,(BYTE *)&video_mode_val,1);
  1039.     video_mode_val=0;
  1040.     set_video_val(video_mode_val);
  1041. #endif
  1042. #ifdef CNTR_5SPK_VOLUME
  1043.     {
  1044.         int volume;
  1045.         int i,read_volume;
  1046.         for (i=0; i<7; i++){
  1047.             read_volume=ReadFromI2c(0xa0,ADDR_I2C_VOLUME+i,(BYTE *)&audio_volume,sizeof(audio_volume));
  1048.             volume_5SPK[i]      = audio_volume;//VOL_VALUE; //set to maximum volume
  1049.             if(i==0)
  1050.             idVolume_5SPK[i]    = Volume_Font_ID;
  1051.             else
  1052.             idVolume_5SPK[i]    = VOL_FL_ID+i-1;
  1053.             //DSPReset();
  1054.         }
  1055.     }
  1056. #endif//#ifdef CNTR_5SPK_VOLUME
  1057.     #ifdef DIP_CFG_ENABLE
  1058.     SETUP_DE_INTERLACE = 3 + 2;//2 + 2;//0 + 2;
  1059.     #endif//#ifdef DIP_CFG_ENABLE
  1060.     //key
  1061.     SETUP_KEY = 8;
  1062.     audio_key = 0;
  1063. SETUP_DOWN_SAMPLE = 2;
  1064.     //mic-volume
  1065.     #ifdef NO_MIC_VOL       //gerry for EXT MIC default volume is max,3-10-6 9:31
  1066.     SETUP_MIC_VOL = 10;
  1067.     mic_volume = 8; 
  1068.     #else
  1069.         #ifdef HUAJIA_DVD    //HIMAGE1251//wangfeng 2004-2-11 21:49  //fengjl edit 2004-02-25 10:42
  1070.                 SETUP_MIC_VOL = 9;
  1071.         #else
  1072.      SETUP_MIC_VOL = 10;
  1073.                 #endif
  1074.     #ifdef  MIC_2CHANNEL    //wangfeng 2003-09-12 22:20
  1075.      SETUP_MIC_VOL_2 = 10;
  1076.     #endif
  1077.         #if defined( HUAJIA_DVD )  //HIMAGE1251//wangfeng 2004-2-11 21:49  //fengjl edit 2004-02-25 10:42
  1078.              mic_volume = 7;
  1079.         #elif defined( SUPPORT_EXT_AD_SHOW_MIC_AUTO_SING )    //ouyang add for extern AD achieve AUTO sing 2004-12-10 19:15
  1080.              mic_volume = 0;
  1081.         #else
  1082.     mic_volume = 8;
  1083.     #endif
  1084.     #endif
  1085.     //AC3 setting
  1086.     #if defined(FUSS_TCHINESE_CUSTOMER_DEF_STEREO)||defined(DOWNMIX_DEFAULT_STEREO)
  1087.         //SETUP_SPK_DOWNMIX = 3;              //hq marked, 2004-3-21 15:21 
  1088.         SETUP_SPK_DOWNMIX = DOWNMIXSTEREO;
  1089.     #elif defined(DOWNMIX_DEFAULT_LR)         //hq, 2004-3-10 16:16
  1090.         SETUP_SPK_DOWNMIX = DOWNMIXLTRT;      //2004-3-21 15:34  
  1091.     #elif defined(DOWNMIX_DEFAULT_OFF)
  1092.         //SETUP_SPK_DOWNMIX = 5;              //hq marked, 2004-3-21 15:21 
  1093.         SETUP_SPK_DOWNMIX = AC3DOWNMIXOFF;    //had better use macro-define. hq, 2004-3-21 15:23        
  1094.     #elif defined(JIEKE_DVD)
  1095.         SETUP_SPK_DOWNMIX = 3;
  1096.     #elif defined(DOWNMIX_DEFAULT_DOWNMIXVSRND)
  1097.         //SETUP_SPK_DOWNMIX = 4;//axel 2004/1/19 05:14   4--->DOWNMIXVSRND
  1098.         SETUP_SPK_DOWNMIX = DOWNMIXVSRND;     //hq, 2004-3-21 15:37 
  1099.     #elif defined(TONIC_DVD)  //oujx
  1100.         SETUP_SPK_DOWNMIX = 2;  
  1101.     #else
  1102.         SETUP_SPK_DOWNMIX = 4;
  1103.     #endif
  1104. #ifdef DEFAULT_SPDIF_RAW
  1105.     #if defined(BBK_NEW_SETUP)||defined(EASTECH_NEW_SETUP_MENU)||defined(EASTECH_DP3240_SETUP_MENU)
  1106.         SETUP_SPDIF = 2;
  1107.     #else//BBK_NEW_SETUP
  1108.         SETUP_SPDIF = 3;
  1109.     #endif//BBK_NEW_SETUP
  1110. #if defined(DIVIDE_AC3_DTS_SPDIF_OUTPUTS)&&defined(DEFAULT_SPDIF_PCM_ON)
  1111.     SETUP_SPDIF_PCM=3;
  1112. #endif
  1113. #elif defined(DEFAULT_SPDIF_PCM)
  1114.         SETUP_SPDIF = 4;
  1115. #endif
  1116.     #ifndef AC3_BASS_MANAGEMENT
  1117.         SETUP_SPK_FRONT = 10;               //0 ~ 8
  1118.         SETUP_SPK_CENTER = 10;              //0 ~ 8
  1119.         SETUP_SPK_SURROUND = 10;            //0 ~ 8
  1120.         cspk_volume=SETUP_SPK_CENTER-4;
  1121.         sspk_volume=SETUP_SPK_SURROUND-4;
  1122.         fspk_volume=SETUP_SPK_FRONT-4;
  1123.     #elif defined(BASS_MODE_DEFAULT_SM_SPK)   //fengjl add 2004-03-30 21:54
  1124.         SETUP_BASS_MODE=3;
  1125.     #endif
  1126.     SETUP_SPK_SUBWOOFER = 3;            //0:off, 1:on
  1127.     SETUP_SPK_CENTER_DELAY = 2;         //0 ~ 5, 2:0 ms
  1128.     SETUP_SPK_SURROUND_DELAY = 4;       //0 ~ 5, 4:6 ms
  1129.     //Dolby Digital Setup
  1130.     #if defined(DUAL_MONO_DEFAULT_STEREO)//fengjl  add 2004-03-12 19:21
  1131.         SETUP_AC3DIGITAL_LnR = 5-3;    //stero, nono 2-8-26 21:06
  1132.     #else
  1133.         SETUP_AC3DIGITAL_LnR = 5;    //Mixed channel, Jeff 20020513
  1134.     #endif
  1135.     #ifdef DVB_MENU_SETUP_STYLE //Maoyong 2004-12-23 11:41
  1136.     SETUP_DVB_LANG = DEFAULT_OSD_LANG + 2;
  1137.     SETUP_DVB_TIME_ZONE = DEFAULT_TIME_ZONE + 2;
  1138.     #endif
  1139. //gerry move it,2004-2-6 13:47
  1140. /*
  1141.     #if 1//defined(VTREK_DVD)||defined(MINTON_DVD)//nono 20031117
  1142.     SETUP_AC3DIGITAL_DYNA = 2; //Jeff 20020604
  1143.     #else 
  1144.     SETUP_AC3DIGITAL_DYNA = 10; //Jeff 20020604
  1145.     #endif 
  1146. */
  1147.     #ifdef FUSS_TV_DVD//nono 2-8-20 12:55
  1148.         UserSet.P_V_CFG = 0x0d00;
  1149.     #endif
  1150.     //SETUP_CUSTM_REGION = REGION_NUM+2;   //Jeff 20021012//nono marked 2003-11-21 10:46
  1151. /*
  1152. #if 1//def MINTON_DVD//nono 20031117
  1153.     ac3_dynarange = 0; //hq,3-11-10 20:11
  1154.     SETUP_AC3DIGITAL_DYNA = 2;
  1155. #else    
  1156.     ac3_dynarange = 8;
  1157.     SETUP_AC3DIGITAL_DYNA = 10;
  1158. #endif
  1159. */
  1160. #ifdef HUAJIA_DVD //wangfeng 2004-2-18 14:34
  1161.     ac3_dynarange = 8;
  1162.     SETUP_AC3DIGITAL_DYNA = 10;
  1163. #elif defined(SETUP_DONGLI459)//||defined(EASTECH_NEW_SETUP_MENU)
  1164.     ac3_dynarange = 8;
  1165.     SETUP_AC3DIGITAL_DYNA = 10;
  1166. #else
  1167.     ac3_dynarange = 0; 
  1168.     SETUP_AC3DIGITAL_DYNA = 2;
  1169. #endif
  1170. #ifdef ADD_DVI311_SETUP
  1171. set_default_value_dvi();
  1172. #endif
  1173.     if (audio_channel!=0) { //Jeff 20030919
  1174.         AUDIF_Set_OutputMode(0+1, 0);//2004AUDDRV AudioSetOutputMode(0+1, 0); //set to audio_channel default
  1175.     }
  1176.     audio_channel = 0; // Robert 021008
  1177. //#if (defined(SAME_DISC_RESUME)&&!defined(GBM_FULL_FUNCTION))||defined(SHOW_STANDBY_TIMER)
  1178. #if defined(NEXTPAGE_SYS)       //freyman 2004-3-25 23:59
  1179.     page = SysNextPage;
  1180.     #ifdef SAME_DISC_RESUME
  1181.     same_disc_onoff = 0;
  1182.     #endif
  1183. #else
  1184.     page = 0;
  1185. #endif     
  1186. #ifdef USE_FREQ_MASK    //default output 48K fengjl add  3-12-1 22:38
  1187. SETUP_FREQ_MASK   = 2;  
  1188. #endif
  1189. #ifdef TUNR_OFF_PARENTAL_LVL
  1190.     bTurnOffParentalLVL=0;//zhaoyanhua 2003-12-1 20:10
  1191. #endif
  1192.   
  1193. #if defined(ONLY_DOWNMIX)
  1194.     #ifdef USE_4334_OR_4344_DAC //caoh 2005-1-5 13:12
  1195.     AUDIF_Reset_DSP();
  1196.     #endif
  1197.     exe_setup_function(STR_OS_BASS_MANAGEMENT,STR_OS_BASS_MODE_1,0);//nono 4-3-11 18:34
  1198. #endif
  1199.     
  1200. #ifdef  DYNAMIC_SPECTRUM  //fengjl   3-10-27 21:08
  1201.  SETUP_BAND=3;   
  1202.  bEqDisplay = 0;  
  1203. #endif
  1204.     #ifdef SETUP_DONGLI459  
  1205.     if(GPIO_I_GET(36)==0)
  1206.     setup_tv_out(P_SCAN);
  1207.     else    
  1208.     setup_tv_out(INTERLACE);
  1209.     search_ap_tv_out_id();
  1210.     #endif  //#ifdef SETUP_DONGLI459    
  1211. //xyy deleted 2004-3-8 
  1212. //the amp default status setting is moved to amp_gui.c 
  1213.  #ifdef SUPPORT_DEFAULT_CHANGE_REGION
  1214.     SETUP_CUSTM_REGION=REGION_NUM+2;
  1215.     UserSet.P_RCD = REGION_NUM;
  1216.  #endif
  1217.  
  1218. //#ifdef MINTON_YILI_LCD1003_6CH         //hq,2004-4-22 17:35
  1219. #if defined(MINTON_YILI_LCD1003_6CH)||defined(QSI_SETUP_MENU)//liweihua mod for QSI 2004-6-17
  1220.     SetBrightness(SETUP_BRIGHTNESS - 2);
  1221.     SetContrast(SETUP_CONTRAST - 2);
  1222.     SetHUE(SETUP_HUE - 2);
  1223.     SetSaturation(SETUP_SATURATION - 2);
  1224. #endif//DELETE_VIDEO_ITEM
  1225.     //added by wangwei,2004-9-17 16:05
  1226.     //(when press "DEFAULT" button in SETUP MENU,3D sound will be restored.)
  1227.     #ifdef SETUP_RESTORE_ALSO_RESTORE_3D
  1228.     restore_3Dsound();
  1229. #endif
  1230. #ifdef SET_AMP_VOL_DEFAULT  //xyy add for Oritron 2004-11-11 
  1231. extern void set_amp_default_vol(void);
  1232. set_amp_default_vol();
  1233. #endif
  1234. #ifdef DEFAULT_VIDEO_SVIDEO // chen edit 0428
  1235.    setup_sel[0][2]=2+2;
  1236. #endif
  1237. #ifdef NO_USE_PASSWORD_RATING
  1238. SETUP_GRADE=RATE_DEFAULT;
  1239.  SETUP_GRADE = SETUP_CUSTM_GRADE;
  1240.         run_save_sel_cmd(SYSPAGE, GRADEITEM);
  1241. UserSet.ParentalLvl=8;//adult level
  1242.  #endif
  1243.  
  1244. }
  1245. //    xyy deleted 2004-3-8 
  1246. //the amp default status settint is moved to amp_gui.c
  1247. //void set_ampsetup_default(void)
  1248. void run_set_variable(void)
  1249. {
  1250.     int     i,j;
  1251. //freyman 2004-3-26 0:00, for when next page used MAX_SETUP_PAGE is defined 7 in setup_def.h
  1252. //#if (defined(SAME_DISC_RESUME)&&!defined(GBM_FULL_FUNCTION))||defined(SHOW_STANDBY_TIMER)//for the next sys-page is P.7,wangfeng 2003-12-1 17:49 
  1253. //    for(i=0;i<MAX_SETUP_PAGE+1;i++)       
  1254. //#else
  1255.     for(i=0;i<MAX_SETUP_PAGE;i++)
  1256. //#endif
  1257.         for(j=0;j<MAX_PAGE_ITEM;j++)
  1258.         {
  1259.         #if defined(BBK_NEW_SETUP)&&defined(BBK_DV961_DVD)
  1260.             if(i == ONEKEYPASSPAGE)
  1261.             {
  1262.                 SETUP_SPK_DOWNMIX = DOWNMIXSTEREO;
  1263.                 //TV format
  1264.                 SETUP_TV_FORMAT = 2;//NTSC;
  1265.                 exe_setup_function(setup_item[i][0][1],setup_item[i][0][DOWNMIXSTEREO],1);
  1266.                 exe_setup_function(setup_item[i][1][1],setup_item[i][1][2],1);    
  1267.                 continue;
  1268.             }
  1269.         #endif
  1270.             
  1271.             sel=setup_sel[i][j];
  1272.             if (setup_item[i][j][1]!=STR_OS_SSAVER_SETUP)
  1273.             {
  1274.              #ifdef SELECT_MEDIA_IN_SETUPMENU //Maoyong 2004/8/11 run default setting should ignore media selection item
  1275.              if(setup_item[i][j][1] ==STR_OS_MEDIA_TYPE)
  1276.              continue;
  1277.              #endif
  1278.             
  1279.                 //only setting variable ,not run function...
  1280.                 //printf("i:%d  j:%d sel:%d",i,j,sel);
  1281.                 
  1282.                 if(setup_item[i][j][1]==STR_OS_RATING)
  1283.                 {
  1284.                     if( (sel<RATE_LOW)||(sel>RATE_HIGH) )
  1285.                     {
  1286.                         sel = RATE_DEFAULT;
  1287.                         setup_sel[i][j]=sel;
  1288.                     }
  1289.                 }
  1290. #ifdef GBM_DVD
  1291.                 if (setup_item[i][j][1]==STR_OS_TV_SYS)
  1292.                 {
  1293.                     exe_setup_function(setup_item[i][j][1],setup_item[i][j][sel],1);
  1294.                 }
  1295.                 else
  1296. #endif
  1297.                 exe_setup_function(setup_item[i][j][1],setup_item[i][j][sel],0);
  1298.             }
  1299.         }
  1300.         //added by wangwei,2004-9-17 16:05
  1301.         //(when press "DEFAULT" button in SETUP MENU,3D default set will be saved and loaded.)
  1302. #ifdef REMB_3DSOUND  
  1303.         run_sound_save(sound_sel);
  1304.         load_3Dsound(sound_sel,user_osd_set);
  1305.         sound_set_EQ_again();  //(after restore SETUP MENU,when comeback to play and don't show 3D menu,there will be no sound effect,so add it here.)
  1306.         #endif
  1307.         
  1308. }
  1309. #ifdef SUPPORT_PASSWD3
  1310. extern UINT8 setup_audio_mode;
  1311. void chg_audio_default_mode(void)
  1312. {
  1313.    WriteToI2c(0xa0, 0,(BYTE *)&setup_audio_mode,1);//audio mode
  1314. }
  1315. #endif
  1316. void init_mode_val(void)
  1317. {
  1318. #ifdef VOLUME_RECODE
  1319. {
  1320.    int r;
  1321.    int i;
  1322.    
  1323.    #ifdef CNTR_5SPK_VOLUME//wangfeng 2003-11-11 21:27   
  1324.    for (i=0; i<7; i++) 
  1325.    {    
  1326.     #ifdef SW_VOL_63
  1327.       if(i==6) audio_volume  = SUB_DEFAULT;
  1328.           else audio_volume = DEFAULT_VOL;
  1329.         #else
  1330.           audio_volume = DEFAULT_VOL;
  1331.         #endif    
  1332.    
  1333.         //audio_volume = VOL_VALUE;       //set to max volume  at the first time  gerry 2-11-6 9:24
  1334.         r=WriteToI2c(0xa0, ADDR_I2C_VOLUME+i, (BYTE *)&audio_volume,sizeof(audio_volume));   
  1335.    }//for
  1336.     
  1337.    audio_volume=DEFAULT_VOL;
  1338.    volume_Switch=0;
  1339.    
  1340.    #else//CNTR_5SPK_VOLUME//wangfeng 2003-11-11 21:27   
  1341.     audio_volume = DEFAULT_VOL;       //set to max volume when we default gerry 2-11-6 9:26;   
  1342.     r=WriteToI2c(0xa0, ADDR_I2C_VOLUME+i, (BYTE *)&audio_volume,sizeof(audio_volume));
  1343.    #endif
  1344. }
  1345. #endif//#ifdef VOLUME_RECODE
  1346.     
  1347. #ifdef IR_KEY_SET_VIDEO_MODE
  1348.    video_mode_val=0;
  1349.    WriteToI2c(0xa0, VIDEO_MODE_I2C_ADDRESS,(BYTE *)&video_mode_val,1);
  1350. #endif   
  1351. #ifdef SUPPORT_PASSWD3
  1352.    setup_audio_mode=0;
  1353.    chg_audio_default_mode();
  1354. #endif
  1355.    
  1356. }
  1357. void read_record_val(void)
  1358. {
  1359. #ifdef VOLUME_RECODE     //read volume from I2C    gerry  2-11-5 16:47
  1360.     int i,r; 
  1361.   #ifdef CNTR_5SPK_VOLUME
  1362.   for (i=0; i<7; i++) 
  1363.   {  
  1364.     r=ReadFromI2c(0xa0,ADDR_I2C_VOLUME+i,(BYTE *)&audio_volume,sizeof(audio_volume));    
  1365.     //printf("%%%%%%^^^^^^r==<%d>:audio_volume=====>%dn",r,audio_volume);
  1366.     
  1367.     if(r<=0) audio_volume = DEFAULT_VOL;       //set to max volume when we default gerry 2-11-6 9:26;   
  1368.     volume_5SPK[i] = audio_volume;//VOL_VALUE; //set to maximum volume
  1369.     if(i==0) idVolume_5SPK[i]    = Volume_Font_ID;
  1370.     else     idVolume_5SPK[i]    = VOL_FL_ID+i-1;
  1371.   } //for
  1372.   
  1373.   audio_volume  = volume_5SPK[0] ;
  1374.   volume_Switch = 0;     //set to main volume
  1375.   #else
  1376.   r=ReadFromI2c(0xa0,ADDR_I2C_VOLUME+i,(BYTE *)&audio_volume,sizeof(audio_volume));  
  1377.   audio_volume = (audio_volume <= DEFAULT_VOL)?audio_volume:DEFAULT_VOL;
  1378.   //printf("%%%%%%^^^^^^r==<%d>:audio_volume=====>%dn",r,audio_volume);
  1379.   #endif
  1380. #endif //VOLUME_RECODE
  1381. #ifdef IR_KEY_SET_VIDEO_MODE
  1382.   int r;
  1383.   r=ReadFromI2c(0xa0, VIDEO_MODE_I2C_ADDRESS,(BYTE *)&video_mode_val,1);
  1384.   //printf("%%%%%%^^^^^^r==<%d>:video_mode_val=====>%dn",r,video_mode_val);
  1385.   if(r<=0) video_mode_val=0;  
  1386.   set_video_val(video_mode_val);
  1387. #endif  
  1388. #ifdef SUPPORT_PASSWD3
  1389.   ReadFromI2c(0xa0,0,(BYTE *)&setup_audio_mode,1);
  1390. #endif
  1391.   
  1392. }        
  1393. void init_val_by_record(void)
  1394. {
  1395.     //echo: shift to 0 ~ 8
  1396.         #ifdef NOT_REWRITE_MIC_VALUE  //axel 2004/2/8 10:05PM
  1397.         echo_level = 8;
  1398.         #else
  1399.         echo_level = SETUP_ECHO - 2;
  1400.         #endif  //NOT_REWRITE_MIC_VALUE                
  1401.         //key: shift to -6 ~ 6
  1402.         #ifdef NOT_REWRITE_MIC_VALUE  //axel 2004/2/8 10:05PM
  1403.         audio_key = 0;
  1404.         #else
  1405.         audio_key = SETUP_KEY - 2 - 6;
  1406.         #endif  //NOT_REWRITE_MIC_VALUE
  1407.         //mic-volume: shift to 0 ~
  1408.         #ifdef  MIC_2CHANNEL    //wangfeng 2003-09-12 22:20
  1409.         if(id==STR_OS_MIC_VOL_1)
  1410.         #endif
  1411.         #ifdef NOT_REWRITE_MIC_VALUE  //axel 2004/2/8 10:05PM
  1412.         mic_volume = 6;
  1413.         #else
  1414.         mic_volume = SETUP_MIC_VOL - 2;
  1415.         #endif //NOT_REWRITE_MIC_VALUE
  1416.         #ifdef  MIC_2CHANNEL
  1417.         else if(id==STR_OS_MIC_VOL_2)
  1418.         mic_volume = SETUP_MIC_VOL_2 - 2;
  1419.         #endif
  1420.         ac3_dynarange = SETUP_AC3DIGITAL_DYNA - 2;
  1421. #ifdef DYNAMIC_SPECTRUM       //zhaoyanhua add  2003-12-3 11:42     
  1422.        if(SETUP_BAND == 2)
  1423.        {
  1424.             band_onoff = 1;
  1425.             bEqDisplay = 1; 
  1426.        }
  1427. #endif
  1428. }
  1429. #ifdef MONE_SETUP
  1430. void dump_setup_val(void)
  1431. {
  1432.   int i, j;
  1433.   printf("read eeprom setup menu,ok!!n");
  1434.   for (i=0; i<MAX_SETUP_PAGE+MAX_CUSTM_SETUP_PAGE; i++) {
  1435.     for (j=0; j<7; j++) {
  1436.         printf("setup_sel[%d][%d]=%dn", i, j, setup_sel[i][j]);
  1437.     }
  1438.   }
  1439. }
  1440. #else
  1441. #define dump_setup_val();
  1442. #endif
  1443. #ifdef FORCE_REWRITE_WHEN_UPGRADE//terry,2004/1/8 05:28PM
  1444. void load_user_setup(UINT8 force_update)
  1445. #else
  1446. void load_user_setup(void)
  1447. #endif
  1448. {
  1449. //    int     i,j;
  1450.     int     iRts;
  1451.     UINT16  unChksum,unTmp;
  1452.     BYTE    *p;
  1453.     UINT32      romSum=0;
  1454.     #ifdef MONE_SETUP
  1455.     printf("load setup menu,inn");
  1456.     #endif
  1457.     //get ROM-code-checksum from ROM(20th ~ 23th Byte)
  1458.     {
  1459.         UINT32  *pSum;
  1460.         pSum = (UINT32 *)(ROM_BASE_UNCACHED+0x40);
  1461.         romCheckSum = *pSum &0xffffff;
  1462.     }
  1463.     //read ROM-code-checksum from setup EEPROM(flash)(0-th Byte)
  1464.     p = (BYTE *)(&romSum);
  1465.     iRts = ReadFromI2c(0xa0, 1, p, 3);    
  1466.     WriteToI2c(0xa0, 1, (BYTE *)&romCheckSum,3);//save rom check sum        
  1467.     printf("romCheckSum:%x %xn",romCheckSum,romSum);
  1468. #ifdef FORCE_REWRITE_WHEN_UPGRADE//terry,2004/1/8 05:28PM
  1469.     if(force_update==1)
  1470.     {
  1471.         romSum = 0;     
  1472.     setup_sel[SYSPAGE][GRADEITEM]=RATE_DEFAULT;
  1473.         NP_PTL_LVL = 8;//zhaoyanhua  2004-3-9 11:32 after UPGRADE, must set parent level is 8.
  1474.     }
  1475. #endif    
  1476.     #ifdef SELECT_MEDIA_IN_SETUPMENU //Maoyong always default as Disc 2004-8-9 15:33
  1477.     SETUP_MEDIA_TYPE = DISC_ITEM + 2;
  1478.     #endif
  1479.     if (iRts > 0) 
  1480.     {//read ok
  1481.         if (romSum==romCheckSum) 
  1482.         {//read setup setting from setup EEPROM(2-th Byte)
  1483.              #ifdef Ti3001_OSD_UI_1
  1484.               load_amplifier_setup();   // jason add 2-10-5 15:59
  1485.              #endif             
  1486.             p=(BYTE *)setup_sel;
  1487.             iRts=ReadFromI2c(0xa0, sizeof(UINT32), p, sizeof(setup_sel));
  1488.             //yanlb added 2004/07/07
  1489.          #ifdef  REMB_3DSOUND 
  1490.         load_3Dsound(sound_sel,user_osd_set);
  1491.         #endif
  1492.         } else 
  1493.         {//flash upgrade
  1494.             iRts = -1;
  1495.             //if rom0-check-sum is not equal, set to default password, Jeff 20020703
  1496.             #ifdef SUPER_DEFAULT_OSD_LANG
  1497.             UserSet.setup_default_osd_lang = DEFAULT_OSD_LANG;
  1498.             #endif
  1499.             UserSet.parent_passwd = DEFAULT_PASSWORD;
  1500.             WriteToI2c(0xa0, sizeof(UINT32)+sizeof(setup_sel)+2, (BYTE *)&UserSet, sizeof(t_USER_SET));
  1501. /*
  1502. Here not used deleted by xyy 2004-8-5
  1503. */
  1504. #if defined(SUPPORT_TUNER_MV114) || defined(SUPPORT_TUNER_ALPS)//xyy 2004-5-26
  1505.             init_tuner_var();
  1506. #endif
  1507.             //init mode
  1508.             init_mode_val();
  1509.         } //if (romSum==romCheckSum) {
  1510.     } //if (iRts > 0) {
  1511.     //read audio/video mode
  1512.     read_record_val();
  1513.     
  1514.     if(iRts>0)
  1515.     {
  1516.         init_val_by_record();       
  1517.         dump_setup_val();        
  1518.         //read setup checksum from setup EEPROM
  1519.         iRts=ReadFromI2c(0xa0, sizeof(UINT32)+sizeof(setup_sel), (BYTE *)&unChksum, 2);
  1520.         if (iRts>0)
  1521.         {
  1522.             printf("read eeprom setup check successn");            
  1523.             //count setup checksum
  1524.             unTmp = run_save_unChk_cmd(0);
  1525.             //check setup checksum and counted checksum
  1526.             if (unTmp!=unChksum) 
  1527.             {                
  1528.                 printf("check sum error, uTmp=%d unCkhsum=%dn",unTmp,unChksum);                
  1529.                 iRts=-2;
  1530.             }
  1531.             else 
  1532.             {
  1533.                 printf("check sum successn");
  1534. #ifdef EASTWIN                
  1535.                 if(SETUP_VIDEO_FORMAT==5)//jhuang eastwin 2004/8/16
  1536.                 {                
  1537.                  SETUP_VIDEO_FORMAT = MIN_ITEM_SEL;
  1538.                  run_save_sel_cmd(SYSPAGE,2);               
  1539.                  setup_tv_out(INTERLACE);
  1540.                 
  1541.                 }
  1542. #endif                
  1543.             }
  1544.             
  1545.         }
  1546.         else 
  1547.         {
  1548.             printf("read eeprom setup check errorn");
  1549.         }
  1550.         
  1551.         #ifdef MONE_SETUP
  1552.         printf("chksum=%02xn",unChksum);
  1553.         #endif
  1554.     }
  1555.     if (iRts < 0)
  1556.     {
  1557.         //set to default, when
  1558.        // //1. different ROM-code-checksum(setup-EEPROM vs. ROM)
  1559.         ////2. counted setup-checksum != stored in setup EEPROM
  1560.         #ifdef MONE_SETUP
  1561.         printf("read eeprom setup menu,fail!!n");
  1562.         #endif
  1563.         SETUP_CUSTM_REGION = REGION_NUM+2; //nono 20031121
  1564.         UserSet.P_RCD = REGION_NUM;
  1565.         set_default_value();
  1566.         run_save_total_sel();
  1567.         safe_srn_forceOFF();
  1568.         
  1569.         #ifdef Ti3001_OSD_UI_1    // jason 2-10-5 15:30
  1570.     reset_amplifier_default_setup();
  1571.         #endif
  1572.         #ifdef POWER_RESUME
  1573.         RsmInfo2Flash(1); //clear resume flash memory, Jeff 20020928
  1574.         #endif
  1575.     }
  1576.     //read UserSet for DVD-related
  1577.     //if (iRts>0)
  1578.     iRts=ReadFromI2c(0xa0, sizeof(UINT32)+sizeof(setup_sel)+2, (BYTE *)&UserSet, sizeof(t_USER_SET));
  1579.     if(iRts>0)
  1580.     {
  1581.         printf("read eeprom system menu,ok!!n");        
  1582.         UserSet.P_RCD = SETUP_CUSTM_REGION - 2;
  1583.     } else 
  1584.     {
  1585.         printf("read eeprom system menu,fail!!n");
  1586.         
  1587.         SETUP_CUSTM_REGION = REGION_NUM+2; //Jeff 20021012
  1588.         UserSet.P_RCD = REGION_NUM;
  1589.     }
  1590.     SETUP_CUSTM_REGION = UserSet.P_RCD+2;
  1591.     #ifdef SUPER_DEFAULT_OSD_LANG
  1592.     SETUP_CUSTM_OSDLANG = UserSet.setup_default_osd_lang + 2;
  1593.     #endif
  1594.     run_set_variable();
  1595. //David added 2003-12-17 23:01 temp
  1596. //Syber required: No need switch video output, only YUV default
  1597. #if defined(YUV_DEFAULT_OUTPUT) && defined(DELETE_VIDEO_ITEM)
  1598.         #ifdef S_VIDEO_OUT
  1599.        regs0->emu_cfg[1]|=0x100;
  1600.         #endif //#ifdef S_VIDEO_OUT
  1601.         setup_tv_out(INTERLACE);//set S-video output(composited+component)(0x00:D0-D1-D2-D3=CVBS-V-Y-U)
  1602.         search_ap_tv_out_id();//terry,2003/8/19 03:21PM
  1603. #endif
  1604.     //UserSet.M_LCD = 'z' * 256 + 'h';
  1605.     //china zh ,taiwan tw
  1606.     //china
  1607.     UserSet.CTY_CD=('C'<<8)|('N');
  1608.     UserSet.P_A_CFG=0xffff;// should be config//uinted states:US ,china:CN , taiwan:TW
  1609.     if (SETUP_PASSWORD == (MIN_ITEM_SEL+1) ) {
  1610.         UserSet.parental_ststus=C_UNLOCK;
  1611.     } else {
  1612.         UserSet.parental_ststus=C_LOCK;
  1613. //#ifndef   NO_USE_PASSWORD_RATING //chen edit 905
  1614. SETUP_PASSWORD = MIN_ITEM_SEL;
  1615. //#endif
  1616.     }
  1617.     #ifdef MONE_SETUP
  1618.     printf("load setup menu,outn");
  1619.     #endif
  1620.     //check password and grade
  1621.     #ifdef RATING_8
  1622.         if ( (SETUP_GRADE<2) || (SETUP_GRADE>9) ) {
  1623.             SETUP_GRADE = 9;
  1624. //            UserSet.parent_passwd = 0;//NONO mark it.3-11-23 22:17
  1625. //            UserSet.parental_ststus = C_UNLOCK;//NONO mark it.3-11-23 22:17
  1626.             UserSet.parent_passwd = DEFAULT_PASSWORD; //Jeff 20020703
  1627.         }
  1628.     #else
  1629.         if ( (SETUP_GRADE<2) || (SETUP_GRADE>4) ) {
  1630.             SETUP_GRADE = 4;
  1631.             UserSet.parent_passwd = 0;
  1632.             UserSet.parental_ststus = C_UNLOCK;
  1633.             UserSet.parent_passwd = DEFAULT_PASSWORD; //Jeff 20020703
  1634.         }
  1635.     #endif
  1636. #ifdef SETUP_6_DIGIT_PASSWORD//zhaoyanhua add 03-10-14 14:10
  1637.     if (UserSet.parent_passwd > 999999) 
  1638. #else //4 digit 
  1639.     if (UserSet.parent_passwd > 9999) 
  1640. #endif   //end   SETUP_6_DIGIT_PASSWORD
  1641.     {    
  1642.         UserSet.parent_passwd = 0;
  1643.         UserSet.parental_ststus = C_UNLOCK;
  1644.     }
  1645.     setupLevel = 0;
  1646.     
  1647.     #if defined(SAME_DISC_RESUME)&&defined(NEXTPAGE_SYS)//freyman 2004-3-26 0:01 alan, 3-9-30 18:59
  1648.     if(setup_sel[SysNextPage][SAME_DISC_RESUME_ITEM]==3)
  1649.     same_disc_onoff=1;
  1650.     else
  1651.     same_disc_onoff=0;//CLEAD 2003-9-29
  1652.     printf("nn====same_disc_onoff:%d====n",same_disc_onoff);
  1653. #endif
  1654.     
  1655. #ifdef BBK_DVD   //fengjl add 3-11-25 22:09  for YUV output when next power on
  1656.     #define   VIDEO_OUTPUT_OFFSET   240
  1657.     int res = ReadFromI2c(0xa0, VIDEO_OUTPUT_OFFSET,(BYTE *)&tv_out_id,sizeof(tv_out_id));
  1658.     if(res < 0)    tv_out_id = INTERLACE;
  1659.     setup_tv_out(tv_out_id);
  1660.     //audio key set default value.zhaoyanhua add 2003-12-4 11:44
  1661.     audio_key = 0;
  1662. #endif
  1663.     
  1664. #ifdef VGA_CTRL_FORMAT//wangfeng 2003-12-18 18:55
  1665.     int res = ReadFromI2c(0xa0, ADDR_I2C_VGA,(BYTE *)&temp_format,sizeof(temp_format));
  1666.     if(res)
  1667.         if(temp_format) 
  1668.         {
  1669.             exe_setup_function(STR_OS_TV_SYS,temp_format,1);//terry,2004/2/3 01:34PM            
  1670.         }
  1671. #endif
  1672. }
  1673. void show_main_title(int id)
  1674. {
  1675.     #ifndef SPE_SETUP   //2004-4-22 06:51张宇P
  1676.     const char *str;
  1677.     int start,len;
  1678. #ifdef DVB_MENU_SETUP_STYLE
  1679.     extern const char *osd_str_dvb_mainmenu[N_OSD_LANGS][2];
  1680. if(system_state == SYSTEM_TS)
  1681. {
  1682. if((page == INSTALLPAGE))
  1683. {
  1684.      osd_DrawString(2, 2, osd_str_dvb_mainmenu[osd_font_mode][0], 7,SBLACKCOLOR/*SWHITECOLOR, SBLACKCOLOR*/);
  1685.      return;
  1686. }
  1687. else if((page == CHANNELPAGE))
  1688. {
  1689.      osd_DrawString(2, 2, osd_str_dvb_mainmenu[osd_font_mode][1], 7,SBLACKCOLOR/*SWHITECOLOR, SBLACKCOLOR*/);
  1690.      return;
  1691. }
  1692.     }
  1693.     
  1694. #endif
  1695.     //count main menu title string length
  1696.     str   = _OsdMessegeFont1[osd_font_mode][id];
  1697.     len = strlen(str);
  1698.     if ( IsOSDChinese() ) {
  1699.         len = len*2;
  1700.     }
  1701.     start = SETUP_MAX_WIDTH/2-len+2;
  1702.     #ifdef  SETUP_COLOR_TYPE1       //wangfeng 2003-08-29 17:16
  1703.     osd_DrawString(3, 2, (char *)str, 7,SBLACKCOLOR/*SWHITECOLOR, SBLACKCOLOR*/);
  1704.     #elif defined( QSI_SETUP_MENU_DESIGN)//liweihua 2004-7-2 18:02
  1705.         if(id == STR_OS_SYS_SETUP)
  1706.         osd_DrawRegionString(2, 13, (char *)str, 12,SBLACKCOLOR,0);
  1707.         else if(id == STR_OS_LANG_SETUP)
  1708.         osd_DrawRegionString(8, 13, (char *)str, 12,SBLACKCOLOR,0);
  1709.         else if(id == STR_OS_AUD_SETUP)
  1710.         osd_DrawRegionString(16, 13, (char *)str, 12,SBLACKCOLOR,0);
  1711.         else if(id == STR_OS_KARAOKE_SETUP)
  1712.         osd_DrawRegionString(22, 13, (char *)str, 12,SBLACKCOLOR,0);
  1713.     #else
  1714.     osd_DrawString(2, 2, (char *)str, 7,SBLACKCOLOR/*SWHITECOLOR, SBLACKCOLOR*/);
  1715.     #endif
  1716.     #endif
  1717. }
  1718. void draw_3rd_menu()
  1719. {
  1720.     int i;
  1721.     BYTE    fontColor, bgColor;
  1722.     BYTE    upDown;
  1723.     const char   *str;
  1724.     //draw ">" between sub-mean and it's corresponding selection area
  1725.     #ifdef QSI_SETUP_MENU_DESIGN//liweihua 2004-7-4 17:12
  1726.     osd_DrawString(SETUP_SUB_XSTART-1, index_y+SETUP_MENU_YSTART+1, Ch_arrorR, SANTIFONTCOLOR, SBGCOLOR);
  1727.     #else
  1728.     osd_DrawString(SETUP_SUB_XSTART-1, index_y+SETUP_MENU_YSTART+1, Ch_arrorR, SFONTCOLOR, SBGCOLOR);
  1729.     #endif// QSI_SETUP_MENU_DESIGN
  1730.     
  1731. #ifdef VIDEO_SETUP_NEW_GUI//zhaoyanhua add 2004-1-7 17:15
  1732.     if(page == VIDEOPAGE) 
  1733.     {           
  1734.         for(i = 0; i < (setupItemNum[1]); i++ )
  1735.         {
  1736.             
  1737.             if(setup_item[page][i][0] == SET_SCALE)//"EXIT" item, return
  1738.             {   
  1739.                 if(index_y == i)
  1740.                     fontColor = 4;
  1741.                 else
  1742.                     fontColor = SFONTCOLOR;
  1743.                 
  1744.                 setup_VideoItemValue(i, fontColor,SBGCOLOR);
  1745.             }
  1746.         }
  1747.         return;
  1748.     }   
  1749. #endif      
  1750.     //show first selection menu of third-level menu
  1751.     for (i=2; i<MAX_ITEM_SEL; i++)
  1752.     {
  1753.         //get select item
  1754. #ifdef BBK_NEW_SETUP//zhaoyanhua add 2003-11-18 17:15
  1755.         #if !defined(BBK_DSS_555_DVD)&&!defined(BBK_DV911S) //axel 2004/1/26 04:01 DSS555 need not OENKEYPASSPAGE
  1756.         if(one_key_pass_flag)//OENKEYPASSPAGE
  1757.         {
  1758.             sel = GetOneKeyPageSel(index_y);
  1759.         }
  1760.         else
  1761.         #endif
  1762.             sel=setup_sel[page][index_y];
  1763. #else       
  1764.         sel = setup_sel[page][index_y+index_y_start];
  1765. #endif
  1766.         id = setup_item[page][index_y+index_y_start][i];
  1767.         if (id==0)
  1768.         {
  1769.             if (setup_item[page][index_y+index_y_start][0]==SET_SCALE)
  1770.                 setup_PrepareScaleItem(setup_item[page][index_y+index_y_start][1], 0);
  1771.             break;
  1772.         }
  1773.         str = setup_SetItemString();
  1774.         
  1775.         #ifdef  SETUP_COLOR_TYPE1       //wangfeng 2003-08-29 17:16
  1776.         if (sel == i)
  1777.         {
  1778.             fontColor = SDEFAULTCOLOR;//4; //SFONTCOLOR;
  1779.             bgColor =   SBGCOLOR; // SANTIBGCOLOR;
  1780.             upDown = 1;
  1781.         } else {
  1782.             fontColor = 2;//SFONTCOLOR;
  1783.             bgColor = SBGCOLOR;
  1784.             upDown = 0;
  1785.         }
  1786.     #elif defined( QSI_SETUP_MENU_DESIGN)//liweihua 2004-7-4 16:52
  1787.         if (sel == i)
  1788.         {
  1789.             fontColor = SDEFAULTCOLOR;//4; //SFONTCOLOR;
  1790.             bgColor =   SBGCOLOR; // SANTIBGCOLOR;
  1791.             upDown = 1;
  1792.     } 
  1793.     else {
  1794.             fontColor = SFONTCOLOR;
  1795.             bgColor = SBGCOLOR;
  1796.             upDown = 0;
  1797.         }
  1798.     #else
  1799.     if (sel == i)
  1800.     {
  1801.             fontColor = 4; //SFONTCOLOR;
  1802.             bgColor =   SBGCOLOR; // SANTIBGCOLOR;
  1803.             upDown = 1;
  1804.         } else {
  1805.             #ifdef SELECT_MEDIA_IN_SETUPMENU
  1806.             if( IsSetupMediaItemDisable(i) )
  1807.                 fontColor = SGRAYCOLOR;
  1808.             else
  1809.             #endif
  1810.             fontColor = SFONTCOLOR;
  1811.             bgColor = SBGCOLOR;
  1812.             upDown = 0;
  1813.         }
  1814.         #endif
  1815.         //special item(PASSWORD), page-0, item-4
  1816.         if (setup_item[page][index_y+index_y_start][0]==SET_NM)
  1817.         {
  1818.             submenuStart = index_y+SETUP_MENU_YSTART;//zhaoyanhua add 2004-1-16 11:03
  1819.             
  1820.             if (UserSet.parental_ststus==C_LOCK)
  1821.             {
  1822.                  setup_sel[page][index_y+index_y_start] = MIN_ITEM_SEL;
  1823.                 str = _OsdMessegeFont1[osd_font_mode][STR_OS_LOCK];
  1824.             } else {
  1825.                 setup_sel[page][index_y+index_y_start] = MIN_ITEM_SEL + 1;
  1826.                 str = _OsdMessegeFont1[osd_font_mode][STR_OS_UNLOCK];
  1827.             }
  1828.             #ifndef QSI_SETUP_MENU_DESIGN//liweihua 2004-7-4 16:41
  1829.             osd_draw_setup_button(SETUP_SUB_XSTART, (submenuStart)+1, SETUP_MAX_WIDTH-SETUP_SUB_XSTART-2, SANTIBGCOLOR, 1);
  1830.             #endif
  1831.             osd_DrawString(SETUP_SUB_XSTART+1, (submenuStart)+1, str, SANTIFONTCOLOR, SANTIBGCOLOR);
  1832.         } 
  1833.         else 
  1834.         {
  1835. #ifdef RATING_8
  1836.             //when I draw PASSWORD GUI, return main seutp with"ShowSetupPage()",
  1837.             //rating8 show uncorrectly. so I add the following codes
  1838.             //zhaoyanhua 2004-1-16 10:44
  1839.             if ( (page==SYSPAGE) && (index_y == GRADEITEM) )
  1840.             {
  1841.                 submenuStart = SETUP_MENU_YSTART;
  1842.             }
  1843.             else
  1844. #endif
  1845. #ifdef SUPER_DEFAULT_OSD_LANG
  1846.             if(index_y==CUSTMOSDITEM)
  1847.             {
  1848.                 if((8-N_OSD_LANGS)>=4)
  1849.                     submenuStart = index_y + SETUP_MENU_YSTART;
  1850.                 else
  1851.                     submenuStart = SETUP_MENU_YSTART + (8-N_OSD_LANGS) + 1;
  1852.             }else
  1853. #endif
  1854.             submenuStart = index_y+SETUP_MENU_YSTART;
  1855.             #ifndef QSI_SETUP_MENU_DESIGN//liweihua 2004-7-4 16:41
  1856.             osd_draw_setup_button(SETUP_SUB_XSTART, (i-2)+submenuStart+1, SETUP_MAX_WIDTH-SETUP_SUB_XSTART-2, bgColor, upDown);
  1857.             #endif
  1858.             //printf("#### in draw3rdmenu    --- draw string ---n");
  1859.             osd_DrawString(SETUP_SUB_XSTART+1, (i-2)+submenuStart+1, str, fontColor, bgColor);
  1860.         }
  1861.     }
  1862.     setupItemNum[2] = i-2;
  1863. }
  1864. void setup_func_return_main(void)
  1865. {
  1866.     setupLevel=0;
  1867.     index_y = 0;
  1868.     index_y_start=0;
  1869.     ShowSetupPage(1);
  1870. }
  1871. void ShowSel(BYTE xStart, BYTE yStart,BYTE xLen,BYTE down)
  1872. {
  1873.     BYTE        fnColor,bgColor;
  1874.     const char *str;
  1875.     str = setup_SetItemString();
  1876.     //#ifdef    SETUP_COLOR_TYPE1       //wangfeng 2003-08-29 17:16
  1877.     #if defined(SETUP_COLOR_TYPE1) || defined( QSI_SETUP_MENU_DESIGN)//liweihua 2004-7-4 16:46
  1878.     if (down)
  1879.         fnColor=SDEFAULTCOLOR;//4;
  1880.     else
  1881.         fnColor=SFONTCOLOR;
  1882.         bgColor = SBGCOLOR;
  1883.     #else    
  1884.     if (down)
  1885.         fnColor=4;
  1886.     else
  1887.         fnColor=SFONTCOLOR;
  1888.         bgColor = SBGCOLOR;
  1889.     #endif
  1890.     #ifndef QSI_SETUP_MENU_DESIGN//liweihua 2004-7-4 16:41
  1891.     osd_draw_setup_button(xStart,yStart,xLen, bgColor, down);
  1892.     #endif
  1893.     osd_DrawString(xStart+1, yStart, str, fnColor, bgColor);
  1894. }
  1895. //NOTE: the following .h files only include UI function,such as
  1896. //      LEFT,RIGHT, UP, DOWN,  SELECT, ShowSetupPage.
  1897. #ifdef NEW_STYLE_SETUP//zhaoyanhua add 3-7-25 17:29
  1898. #include "setup_newstyle_ui.c"
  1899. #elif defined(SOFT_MENU)//Modifed by ChenZhao on 2004-9-8 17:39 WP
  1900. #include "setup_tab_ui_SFM.c"
  1901. #else
  1902. #include "setup_tab_ui.c"
  1903. #endif //NEW_STYLE_SETUP
  1904. #ifdef NEW_STYLE_SETUP //zhaoyanhua add 3-7-25 19:18
  1905. void init_setup(void)
  1906. {
  1907.     page = 0;
  1908.     index_y=0;
  1909.     index_y_start=0;
  1910.     setupLevel=0;
  1911.     GBM_run_setupmenu_flag = 0;
  1912.     //setup_tv_format(MODE_NTSC);//force to NTSC zhaoyanhua note 2003-07-19 21:39
  1913.     full_scrn=SETUP;       //setup menu
  1914.     //read_setup_select();   // read data from EEPROM or Flush
  1915.     
  1916.     //printf("IN Init_SETUP NEW STYLEn");
  1917.     
  1918.     //osd_init_setup();//zhaoyanhuamask
  1919.     //ShowSetupPage(2);//zhaoyanhua amsk
  1920.     //zhaoyanhua add the following page.
  1921.     //printf("getVPP_TVsystem():%xn",getVPP_TVsystem());
  1922.     if(getVPP_TVsystem() ==  1)//terry,0813
  1923.     {
  1924.         
  1925.         osd_init_hand_ICON_for_PAL();
  1926.         setupLevel=1;
  1927.         ShowSetupPage(0);//must showsetuppage,because it will clear the rect.
  1928.         setupLevel=0;
  1929.         ShowCurrentPage_for_PAL(page);
  1930.         
  1931.     }else
  1932.     
  1933.     //if (tv_format ==  MODE_NTSC)
  1934.     {   
  1935.         osd_init_hand_ICON_for_NTSC();
  1936.         setupLevel=1;
  1937.         ShowSetupPage(0);//must showsetuppage,because it will clear the rect.
  1938.         setupLevel=0;
  1939.         ShowCurrentPage_for_NTSC(page);
  1940.     
  1941.     }
  1942.     
  1943. }
  1944. #elif defined(SOFT_MENU)//Modifed by ChenZhao on 2004-9-2 14:46 WP
  1945. void init_setup(void)
  1946. {
  1947.     page = 0;
  1948.     index_y=0;
  1949.     index_y_start=0;
  1950.     setupLevel=0;   // alan, 2003/9/5 02:31