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

DVD

开发平台:

C/C++

  1. /**************************************************************************
  2.  *                                                                        *
  3.  *         Copyright (c) 2002 by Sunplus Technology Co., Ltd.             *
  4.  *                                                                        *
  5.  *  This software is copyrighted by and is the property of Sunplus        *
  6.  *  Technology Co., Ltd. All rights are reserved by Sunplus Technology    *
  7.  *  Co., Ltd. This software may only be used in accordance with the       *
  8.  *  corresponding license agreement. Any unauthorized use, duplication,   *
  9.  *  distribution, or disclosure of this software is expressly forbidden.  *
  10.  *                                                                        *
  11.  *  This Copyright notice MUST not be removed or modified without prior   *
  12.  *  written consent of Sunplus Technology Co., Ltd.                       *
  13.  *                                                                        *
  14.  *  Sunplus Technology Co., Ltd. reserves the right to modify this        *
  15.  *  software without notice.                                              *
  16.  *                                                                        *
  17.  *  Sunplus Technology Co., Ltd.                                          *
  18.  *  19, Innovation First Road, Science-Based Industrial Park,             *
  19.  *  Hsin-Chu, Taiwan, R.O.C.                                              *
  20.  **************************************************************************/
  21. /*--------------------------------------------------------------------------
  22. |  File Name   :  8202_usb_card_if.c
  23. |
  24. |  Description :  8202 Usb and Card Interface
  25. |
  26. |  Version    :  0.1  
  27. |  Rev Date         Author(s)      Status & Comments
  28. |---------------------------------------------------------------------------------
  29. |  0.1 2004/9/18         wthsin         Creating
  30. |--------------------------------------------------------------------------------*/ 
  31. #include "user_init.h"
  32. #include "global.h"
  33. #include "emuio.h"
  34. #include "gpio.h"
  35. #include "func.h"
  36. #include "cpu.h"//wanghaoying 20030812
  37. #include "macro.h"
  38. #include "memmap.h"
  39. #include "memmap0.h"
  40. #include "fsNav.h"//liweihua 2004-3-30 14:34
  41. #include "cderr.h"
  42. #include "cardfs.h"
  43. #include "osd.h"
  44. #include "scsi.h"
  45. #include "usb.h"
  46. #ifdef HOST_UHCI 
  47.  #include "uhci.h"
  48. #else
  49.  #include "host_811.h"
  50. #endif  
  51. #if defined(SPHE8202_CARD_STORAGE)
  52.  #include "card_main.h"
  53.  #include "sd.h"
  54.  #include "cf.h"
  55.  #include "ms.h"
  56. #endif
  57. #ifdef SUPPORT_MIDI         ///xlluo add 04-1-21
  58. #include "fsmidi.h"
  59. #include "fsMidiUI.h"
  60. #endif
  61. #ifdef SPHE8202_ALL_TYPE_CARD_WRITE
  62. extern BYTE card_browse_sign;//dingzhy 4-11-18 9:40
  63. #endif
  64. #ifdef FILE_MODE_WRITE                  //sunzhh add for file mode 2005-1-14
  65. extern BYTE file_mode_flag;                   
  66. #endif    
  67. #if defined(SUPPORT_USB)||defined(SPHE8202_CARD_STORAGE) 
  68.     extern UINT8 MediaIsEmpty;
  69.     extern void show_card_reading_osd(BYTE type);
  70.     extern void ircmd_stop(void);
  71.     extern void SwitchMedia(BYTE direction);
  72. #endif
  73. #if defined(SUPPORT_USB)||defined(SPHE8202_CARD_STORAGE) 
  74.  //0x01: USB ,0x02: CF ,0x04: SD_MMC ,0x08: MS ,0x10: SMC  
  75.  const UINT8 storage_parity_type[]=  { 0x00, 0x01, 0x02, 0x01, 0x04, 0x01, 0x02, 0x01,
  76.                                        0x08, 0x01, 0x02, 0x01, 0x04, 0x01, 0x02, 0x01,
  77.                                        0x10, 0x01, 0x02, 0x01, 0x04, 0x01, 0x02, 0x01,
  78.                                        0x08, 0x01, 0x02, 0x01, 0x04, 0x01, 0x02, 0x01,};
  79. #endif
  80. #ifndef DVDRELEASE
  81.  #define USB_CARD_IF_DBG       1
  82. #endif
  83. #define D printf("INFO: __%d__(%s:%s)n",__LINE__,__FILE__,__FUNCTION__);
  84. #ifndef USB_CARD_IF_DBG
  85.  #undef printf
  86.  #undef print_block
  87.  #define printf(f, a...) do {} while (0)
  88.  #define print_block(x,y) do {} while (0)
  89. #endif
  90. #if defined(SUPPORT_USB)||defined(SPHE8202_CARD_STORAGE) 
  91. #ifdef SPHE8202_CARD_STORAGE  
  92. UINT8   CardEna=0;  
  93. #ifdef IR_SWITCH_CD_USB_CF_OTHER  //dingzhy for bus switch 04-10-22
  94. EXTERN  BYTE detect_result_last;
  95. EXTERN  BYTE now_valid_type;
  96. #endif
  97. #ifdef CARD_SETUP_TYPE_5
  98.  UINT8 PMP_CF_Card_Insert=0;
  99.  UINT8 PMP_CF_Card_Play=0;
  100.  #ifdef SUPPORT_MULTI_PARTITION
  101.   extern void Refresh_Partition_Menu(void);
  102.   #ifdef FAT_FILE_MODE
  103.   extern UINT16 fat_play_mode;
  104.   extern void Refresh_FAT_Mode_GUI(void); 
  105.   #endif//#ifdef FAT_FILE_MODE
  106.  #endif//#ifdef SUPPORT_MULTI_PARTITION
  107. #endif //#ifdef CARD_SETUP_TYPE_5
  108. /**************************************************************************
  109.  *                                                                        *
  110.  *  Function Name: Card_power_reset                                       *
  111.  *                                                                        *
  112.  *  Purposes:                                                             *
  113.  *    USE GPIO to reset card power                                        *
  114.  *  Descriptions:                                                         *
  115.  *    USE GPIO to reset card power                                        *
  116.  *  Arguments:                                                            *
  117.  *          NONE                                                          *
  118.  *  Returns:     NONE                                                     *
  119.  *                                                                        *
  120.  *  See also:    NONE                                                     *
  121.  *                                                                        *
  122.  **************************************************************************/
  123. void Card_power_reset()
  124. {
  125.     GPIO_O_SET(CARD_POWER_RESET,1);  //Power Off
  126.     delay_srv_10ms(30);  
  127.     GPIO_O_SET(CARD_POWER_RESET,0);  //Power On
  128.    #if defined(CARD_SETUP_TYPE_1)||defined(CARD_SETUP_TYPE_2)  
  129.     regs0->fm_gpio_len  = 12                    // Set FMGPIO_B[41:0] turn on
  130.                         |  (0xf << 4);          // Set FMGPIO_B[41:0] enable   
  131.    #elif defined(CARD_SETUP_TYPE_3)||defined(CARD_SETUP_TYPE_5)        
  132.     regs0->fm_gpio_len  = 11                    // Set FMGPIO_B[26:0] turn on
  133.                         |  (0xf << 4);          // Set FMGPIO_B[26:0] enable  
  134.    #elif defined(CARD_SETUP_TYPE_4)      
  135.      regs0->fm_gpio_len  = 3                    // Set FMGPIO_B[5:0] turn on
  136.                         |  (0x1 << 4);          // Set FMGPIO_B[5:0] enable                     
  137.    #endif                                        
  138.     delay_srv_10ms(30); 
  139. }    
  140. /**************************************************************************
  141.  *                                                                        *
  142.  *  Function Name: Card_power_off                                         *
  143.  *                                                                        *
  144.  *  Purposes:                                                             *
  145.  *    turn off card power, let card invalid                               *
  146.  *  Descriptions:                                                         *
  147.  *    turn off card power, let card invalid                               *
  148.  *  Arguments:                                                            *
  149.  *          NONE                                                          *
  150.  *  Returns:     NONE                                                     *
  151.  *                                                                        *
  152.  *  See also:    NONE                                                     *
  153.  *                                                                        *
  154.  **************************************************************************/
  155. void Card_power_off()
  156. {
  157.     GPIO_O_SET(CARD_POWER_RESET,1);  //Power Off
  158.     regs0->fm_gpio_len  = 0; 
  159. }    
  160. /**************************************************************************
  161.  *                                                                        *
  162.  *  Function Name: Card_gpio_init                                         *
  163.  *                                                                        *
  164.  *  Purposes:                                                             *
  165.  *    initialize card GPIO, Set card GPIO valid                           *
  166.  *  Descriptions:                                                         *
  167.  *    initialize card GPIO, Set card GPIO valid                           *
  168.  *  Arguments:                                                            *
  169.  *          NONE                                                          *
  170.  *  Returns:     NONE                                                     *
  171.  *                                                                        *
  172.  *  See also:    NONE                                                     *
  173.  *                                                                        *
  174.  **************************************************************************/
  175. void Card_gpio_init()
  176. {
  177.   #ifdef CARD_SETUP_TYPE_1
  178. regs0->sft_cfg3 &= ~(0x1 << 5);  //set GPIO 50 ca8202 pin193
  179. regs0->sft_cfg1 &= ~(0x1 << 2);  //set GPIO 17 ca8202 pin77
  180. GPIO_M_SET(CARD_SENSE1_PIN, 1);
  181. GPIO_M_SET(CARD_POWER_RESET,1);
  182.   #elif defined(CARD_SETUP_TYPE_2)
  183. regs0->sft_cfg1 &= ~(0x1 << 3);  //set GPIO 16 ca8202 pin76
  184. GPIO_M_SET(CARD_SENSE1_PIN, 1);
  185. GPIO_M_SET(CARD_POWER_RESET,1);
  186.   #elif defined(CARD_SETUP_TYPE_3)
  187.     regs0->sft_cfg3 &= ~(0x1 << 5);  //set AUD4 disable, wthsin 2004/6/14 04:23pm
  188.     regs0->sft_cfg0 &= ~(0x1 << 7);  //set CS1  disable
  189.     regs0->sft_cfg1 &= ~(0x1 << 5);  //set A12  disable
  190.      #ifdef PORTABLE_DVD
  191.      regs0->sft_cfg0 &= ~(0x1 << 5);  //set GPIO 38 ca8202 pin161
  192.      #elif defined(IDE_CF_SW)
  193.      regs0->sft_cfg0 &= ~(0x1 << 5);     //set GPIO 38 ca8202 pin161
  194.      #elif defined(COSMIC_CARD_READER) //FanGang added 2005-1-10 17:32
  195.      regs0->sft_cfg0 &= ~(0x1 << 4);     //set GPIO 39 ca8202 pin162
  196.      #else
  197.     regs0->sft_cfg0 &= ~(0x1 << 6);  //set GPIO 29 ca8202 pin145
  198.      #endif
  199. regs0->sft_cfg1 &= ~(0x1 << 3);  //set GPIO 16 ca8202 pin76
  200. GPIO_M_SET(CARD_SENSE1_PIN, 1);
  201. GPIO_M_SET(CARD_POWER_RESET,1);
  202. #ifdef HDMI_SMC_CLE
  203.   GPIO_M_SET(CARD_SMC_CLE_PIN, 1); // benson 2004/11/17 01:40PM  set gpio 36
  204.   GPIO_E_SET(CARD_SMC_CLE_PIN, 1); // benson 2004/11/17 01:40PM  set gpio 36
  205. #endif
  206.   #elif defined(CARD_SETUP_TYPE_4)
  207. #if defined(MP_BOARD_256_PIN_NON_SHARE)//kenny 2004/7/14
  208. regs0->sft_cfg1 &= ~(0x1 << 3);  //set GPIO 16 ca8202 pin76
  209. GPIO_M_SET(CARD_SENSE1_PIN, 1);
  210. GPIO_M_SET(CARD_POWER_RESET,1);
  211. #elif defined(MP_BOARD_216_PIN_NON_SHARE)
  212. regs0->sft_cfg1 &= ~(0x1 << 3);  //set GPIO 16 ca8202 ns-216 pin66
  213. #ifdef USE_SERVO_DFCT_GPIO //if define USE_SERVO_DFCT_GPIO, then we  set pin55 to be GPIO
  214. regs0->sft_cfg4 &= ~(0x1 << 6);  //set GPIO 8 ca8202 ns-216 pin55 (servo DFCT pin)
  215. #endif
  216. GPIO_M_SET(CARD_SENSE1_PIN, 1);
  217. GPIO_M_SET(CARD_POWER_RESET,1);
  218. #else
  219. regs0->sft_cfg1 &= ~(0x1 << 3);  //set GPIO 16 ca8202 pin76
  220. GPIO_M_SET(CARD_SENSE1_PIN, 1);
  221. GPIO_M_SET(CARD_POWER_RESET,1);
  222. #endif
  223.   #elif defined(CARD_SETUP_TYPE_5)
  224.     regs0->sft_cfg0 &= ~(0x1 << 7);  //set CS1  disable
  225.     regs0->sft_cfg1 &= ~(0x1 << 5);  //set A12  disable
  226.    #ifdef PMP_PCB_VER_B 
  227.     regs0->sft_cfg1 &= ~(0x1 << 3);  //set GPIO 16 ca8202 pin76
  228.     #else  //PMP_PCB_VER_C
  229.      regs0->sft_cfg0 &= ~(0x1 << 4);     //set GPIO 39 ca8202 pin162
  230.     #endif 
  231.     regs0->sft_cfg1 &= ~(0x1 << 1);  //set GPIO 18 ca8202 pin78  
  232.     GPIO_M_SET(CF_INS_SENSE, 1);
  233. GPIO_M_SET(CARD_POWER_RESET,1);
  234. GPIO_E_SET(CF_INS_SENSE, 0);
  235.   #endif
  236.   #ifndef CARD_SETUP_TYPE_5
  237. GPIO_E_SET(CARD_SENSE1_PIN, 0);
  238. GPIO_E_SET(CARD_SENSE2_PIN, 0);
  239.   #endif
  240.   #if !defined(CARD_SETUP_TYPE_4)&&!defined(CARD_SETUP_TYPE_5)
  241. GPIO_E_SET(CARD_SENSE3_PIN, 0);
  242.   #endif
  243. GPIO_E_SET(CARD_POWER_RESET,1);
  244. CardEna=TRUE;
  245. GPIO_O_SET(CARD_POWER_RESET,1);  //Power Off
  246. }
  247. /**************************************************************************
  248.  *                                                                        *
  249.  *  Function Name: CardStorageIsPlugIn                                    *
  250.  *                                                                        *
  251.  *  Purposes:                                                             *
  252.  *    Check card  Storage plug in or not                                  *
  253.  *  Descriptions:                                                         *
  254.  *    Check card  Storage plug in or not                                  *
  255.  *  Arguments:                                                            *
  256.  *          NONE                                                          *
  257.  *  Returns:                                                              *
  258.  *          0: FALSE                                                               *
  259.  *          1: TRUE                                                             *
  260.  *                                                                        *
  261.  *  See also:    NONE                                                     *
  262.  *                                                                        *
  263.  **************************************************************************/
  264. int CardStorageIsPlugIn(void)
  265. {
  266.     UINT8 card_result=0;
  267.     switch(storage_type)
  268.     {
  269.      #if defined(COMPACT_FLASH)    
  270.          case CF_CARD_DEVICE:
  271.                         #if defined(CARD_SETUP_TYPE_5)
  272.                          if((PMP_CF_Card_Play==1)&&(PMP_CF_Card_Insert==0))
  273.                               ircmd_return();   //card_result=1;
  274.                          else     
  275.                               card_result=0;
  276.                         #else 
  277.                          if(GPIO_I_GET(CARD_SENSE2_PIN))  card_result=1;
  278.                         #endif  
  279.                          break; 
  280.         #endif     
  281.         #if defined(SD_MMC_CARD)    
  282.          case SD_CARD_DEVICE:
  283.                         #ifdef CARD_SETUP_TYPE_4
  284.                          if(GPIO_I_GET(CARD_SENSE1_PIN))  card_result=1;
  285.                         #else  
  286.                          if(GPIO_I_GET(CARD_SENSE3_PIN))  card_result=1;
  287.                         #endif 
  288.                          break; 
  289.         #endif  
  290.         #if defined(MEMORY_STICK)    
  291.          case MS_CARD_DEVICE:
  292.                         #ifdef CARD_SETUP_TYPE_4
  293.                          if(GPIO_I_GET(CARD_SENSE2_PIN))  card_result=1;
  294.                         #else 
  295.                          if(GPIO_I_GET(CARD_SENSE1_PIN))  card_result=1;
  296.                         #endif 
  297.                          break; 
  298.         #endif  
  299.         #if defined(SMART_MEDIA)    
  300.          case SMC_CARD_DEVICE:
  301.                          if(GPIO_I_GET(CARD_SENSE1_PIN))  card_result=1;
  302.                          break; 
  303.         #endif  
  304.          default:
  305.          break;
  306.     }     
  307.     
  308. if(card_result)  return FALSE;
  309. else             return TRUE;
  310. }
  311. /**************************************************************************
  312.  *                                                                        *
  313.  *  Function Name: Detect_Card_Storage                                    *
  314.  *                                                                        *
  315.  *  Purposes:                                                             *
  316.  *    Detect which card exist                                             *
  317.  *  Descriptions:                                                         *
  318.  *    Use card GPIO to Detect which card exist                            *
  319.  *  Arguments:                                                            *
  320.  *          NONE                                                          *
  321.  *  Returns:                                                              *
  322.  *          0x02: CF ,0x04: SD_MMC ,0x08: MS ,0x10: SMC                   *
  323.  *          0x06: SD+CF ,0x0a: CF+MS ,0x12: CF+SMC                        *
  324.  *                                                                        *
  325.  *  See also:    NONE                                                     *
  326.  *                                                                        *
  327.  **************************************************************************/
  328. BYTE Detect_Card_Storage()
  329. {
  330.  UINT8 card_sense=0;
  331.  BYTE  card_storage_type=0;
  332.     detect_type &= USB_DEVICE;//liweihua 2004-6-7 
  333.    #ifdef CARD_SETUP_TYPE_4
  334.      card_sense=GPIO_I_GET(CARD_SENSE1_PIN)<<1;
  335.  card_sense|=GPIO_I_GET(CARD_SENSE2_PIN);  
  336.    
  337.      //printf("card_sense =%x!n",card_sense);
  338.      switch(card_sense)
  339.  {
  340.   case 2:
  341.          card_storage_type|=MS_CARD_DEVICE; 
  342.          break; 
  343.   case 1:
  344.          card_storage_type|=SD_CARD_DEVICE;           
  345.          break; 
  346.   default: 
  347.          card_storage_type=0;
  348.          break; 
  349.  }   
  350.    #elif defined(CARD_SETUP_TYPE_5)  
  351.         card_storage_type|=CF_CARD_DEVICE; 
  352.         //liweihua mod 2004-12-1
  353.         int check_result=PMP_CF_Card_IsPlugIn();
  354.         #ifdef SUPPORT_MULTI_PARTITION//liweihua 2004-12-10
  355.         if((check_result>1) || (check_result<0)) 
  356.         {
  357.             #if defined(FAT_FILE_MODE) && (!defined(PMP_UI))//liweihua 2005-1-5
  358.             if(fat_play_mode == 1)
  359.                 Refresh_FAT_Mode_GUI();
  360.             else if((fat_play_mode == 2)&&(pFsJpeg->gifsState == FS_STATE_HDD))
  361.             #else
  362.             if(pFsJpeg->gifsState == FS_STATE_HDD)
  363.             #endif
  364.                 Refresh_Partition_Menu();
  365.         }
  366.         else
  367.         #endif
  368.         if(check_result==1) 
  369.          PMP_CF_Card_Insert=1;
  370.         else
  371.          PMP_CF_Card_Insert=0;
  372.    #else  //CARD_SETUP_TYPE_1 ,CARD_SETUP_TYPE_2,CARD_SETUP_TYPE_3
  373.  card_sense=GPIO_I_GET(CARD_SENSE1_PIN)<<2;
  374.  card_sense|=GPIO_I_GET(CARD_SENSE2_PIN)<<1;
  375.  card_sense|=GPIO_I_GET(CARD_SENSE3_PIN);
  376.  //printf("card_sense =%x!n",card_sense);
  377.  switch(card_sense)
  378.  {
  379.   case 7:
  380.          card_storage_type=0;
  381.          break;  
  382.   case 6:
  383.              card_storage_type|=SD_CARD_DEVICE; 
  384.          break; 
  385.   case 5:
  386.          card_storage_type|=CF_CARD_DEVICE; 
  387.          break; 
  388.   case 4:
  389.          card_storage_type|=CF_CARD_DEVICE; 
  390.          card_storage_type|=SD_CARD_DEVICE; 
  391.          break; 
  392.   case 3:
  393.          card_storage_type|=MS_CARD_DEVICE; 
  394.          break; 
  395.   case 2:
  396.          card_storage_type|=SMC_CARD_DEVICE;
  397.          break; 
  398.   case 1:
  399.          card_storage_type|=CF_CARD_DEVICE; 
  400.          card_storage_type|=MS_CARD_DEVICE; 
  401.          break; 
  402.   case 0:
  403.          card_storage_type|=CF_CARD_DEVICE; 
  404.          card_storage_type|=SMC_CARD_DEVICE;
  405.          break; 
  406.   default: 
  407.          card_storage_type=0;
  408.          break; 
  409.  }   
  410.    #endif  
  411.      detect_type |=card_storage_type;//liweihua 2004-6-7
  412.      return card_storage_type;
  413. }
  414. #endif //#ifdef SPHE8202_CARD_STORAGE  
  415. //-----------------------------------------------------------
  416. #ifdef SUPPORT_USB
  417. extern UINT8 UsbTestUnitReady(BYTE dev_lun);
  418. extern BYTE IsUSBCardReader(void);
  419. extern UINT8 USBEna;  
  420. extern UINT8 CBWLUN;
  421. extern UINT8 SLAVE_ENUMERATED;
  422. extern UINT8 USB_ADDR; 
  423. extern UINT8 MaxLUN;
  424. extern void USBCardReaderDetect(void);
  425. /**************************************************************************
  426.  *                                                                        *
  427.  *  Function Name: UsbIsPlugIn                                            *
  428.  *                                                                        *
  429.  *  Purposes:                                                             *
  430.  *    Detect if the U disk is pluged                                      *
  431.  *  Descriptions:                                                         *
  432.  *    use UHCI command Detect if the U disk is pluged                                      *
  433.  *  Arguments:                                                            *
  434.  *          NONE                                                          *
  435.  *  Returns:                                                              *
  436.  *          TRUE or FALSE                                                 *
  437.  *                                                                        *
  438.  *  See also:    NONE                                                     *
  439.  *                                                                        *
  440.  **************************************************************************/
  441. int UsbIsPlugIn(void)
  442. {
  443.     int detect_result = 0;
  444.   #ifdef HOST_UHCI   
  445.     detect_result = uhci_slaveDetect();
  446.   #else //#define HOST_SL811HS   
  447.     detect_result = slave_detect();
  448.   #endif    
  449.     if((detect_result == 0) && (card_plug_state ==  USER_DO_PLUG_IN))
  450.         return TRUE;
  451.     else if((detect_result == 0) && (card_plug_state == USER_DO_PLUG_OUT))
  452.         return FALSE;
  453.     else
  454.         return FALSE;
  455. }
  456. /**************************************************************************
  457.  *    *
  458.  *  Function Name: uhci_slaveDetect                                       *
  459.  *   *
  460.  *  Purposes:                                                             *
  461.  *    detect whether the U-Device is plugged in or not                    *
  462.  *  Descriptions:                                                         *
  463.  *    This function detect whether the U-Device is plugged in or not.     *
  464.  *  Arguments:                                                            *
  465.  *          NONE                                                          *
  466.  *  Returns:                                                              *
  467.  *          0: nothing  1: plug in  2: detached                           *
  468.  *  See also:    NONE                                                     *
  469.  *   *
  470.  **************************************************************************/
  471. /**************************************************************************************************
  472.  *    *
  473.  * Description: This function detect whether the U-Device is plugged in or not.   *
  474.  *   *
  475.  * Author     : wthsin   *
  476.  * Date       : 2004/1/14 08:31pm   *
  477.  *   *
  478.  * Update     : liweihua 2004-6-7
  479.  **************************************************************************************************/
  480. BYTE usb_plug_out_flag; //for USB plug out when copying lijd 2004-11-19 16:15
  481. UINT32 uhci_slaveDetect(void)
  482. {
  483. int  result;
  484. //-------------------------------------------------------------------------
  485. // Wait for USB enumeration
  486. //-------------------------------------------------------------------------
  487. if(!SLAVE_ENUMERATED)
  488. {  // wait for an USB device to be inserted  
  489.     if(uhci_PlugInOutDetect())
  490.     {  
  491.              printf("slave is plug in!!!n");
  492.              usb_plug_out_flag=0;
  493.              uhci_reset(); //wthsin   2003/12/30 04:43
  494.              USB_ADDR=uDisk_ADDR;
  495.              result=EnumUsbDev(USB_ADDR);
  496.       if(no_disk_cnt == 1)//liweihua 20040324
  497.                  system_state=SYSTEM_OPEN;   //wthsin,    2004/3/16 07:36pm    
  498.      if(result)
  499.      {         // enumerate USB device, assign USB address = #1
  500.                 SLAVE_ENUMERATED = TRUE; // Set slave USB device enumerated flag
  501.                 #ifdef SUPPORT_SLOT_IN_LOADER
  502.                 card_plug_state = USER_DO_PLUG_IN;
  503.                 #else
  504.                 if(play_state != VCD_STATE_OPEN)//liweihua add 2004-3-11
  505.                 card_plug_state = USER_DO_PLUG_IN;
  506.                 else
  507.                     card_plug_state = 0;
  508.                 #endif    
  509.             detect_type |= USB_DEVICE;   //wthsin ,2004/3/1 03:16pm
  510.             MaxLUN = 0;     //Maoyong 2004.05.19
  511.         return 1;
  512.      }
  513.     }
  514. }
  515. //-------------------------------------------------------------------------
  516. // USB enumerated, proceed accordingly
  517. //-------------------------------------------------------------------------
  518. else
  519. {
  520.    if(!uhci_PlugInOutDetect())          // test for slave device detach  
  521.    {
  522.             printf("slave is detached!!!n");
  523.             usb_plug_out_flag=1;
  524.      #ifdef MP3_ONLY_STOP_TO_GUI 
  525.             if( (play_state==VCD_STATE_MP3_FILELIST) && (media_type==MEDIA_CARD) )
  526.             {
  527.          ShowTitle();
  528.          SwitchMedia(CARD2CD);      //wsf 2004-9-16 16:43
  529.       }
  530.  #endif 
  531.  
  532.             SLAVE_ENUMERATED = FALSE; // return to un-enumeration
  533.         if((media_type == MEDIA_CARD)&&(storage_type == USB_DEVICE)) //liweihua mod 2004-3-30
  534.             {
  535.              if(Mp3ReadFinish)
  536.              Mp3ReadFinish = 0;
  537.              if((play_state == VCD_STATE_PAUSE)||(GetCurrentFileType() == CDROM_WMA))//liweihua mod 2004-4-19
  538.              ircmd_stop();         
  539.             AVD_SetMediaInterrupt();        //wthsin ,  2004/4/19 02:47pm         
  540.             }
  541.             if(play_state != VCD_STATE_OPEN) //liweihua add 2004-2-1
  542.             {
  543.             if((media_type == MEDIA_CARD)&&(storage_type == USB_DEVICE))
  544.                 play_state = VCD_STATE_STOP;
  545.              
  546.             card_plug_state = USER_DO_PLUG_OUT;
  547.          }
  548.         detect_type &= (~USB_DEVICE);
  549.         storage_type &= (~USB_DEVICE);
  550.     return 2; // exit now.
  551.    }
  552. }   
  553. //-------------------------------------------------------------------------
  554. //USB Card reader special process
  555. //-------------------------------------------------------------------------
  556. USBCardReaderDetect();
  557.        
  558. return 0;
  559. }     
  560. #endif//end SUPPORT_USB
  561. /**************************************************************************
  562.  *                                                                        *
  563.  *  Function Name: CardTestReady                                          *
  564.  *                                                                        *
  565.  *  Purposes:                                                             *
  566.  *    detect and initialize card/usb, then set card to browse             *
  567.  *  Descriptions:                                                         *
  568.  *    detect and initialize card/usb, then set card to browse             *
  569.  *  Arguments:                                                            *
  570.  *          NONE                                                          *
  571.  *  Returns:     NONE                                                     *
  572.  *                                                                        *
  573.  *  See also:    NONE                                                     *
  574.  *                                                                        *
  575.  **************************************************************************/
  576. void CardTestReady(void)
  577. {
  578. UINT8 media_exit=0;
  579. #ifdef  IR_SWITCH_CD_USB_CF_OTHER
  580. storage_type = detect_result_last;        
  581.         now_valid_type = storage_type; //for bug:read cf,insert usb,will read cf again.
  582.         #ifdef HIGH_CORTROL_CF
  583.         GPIO_O_SET(SWITCH_GPIO,0);//dingzhy for switch bus 4-10-22 10:43
  584.         #else
  585.         GPIO_O_SET(SWITCH_GPIO,1);
  586.         #endif
  587. #endif
  588.     if(storage_type!=0)
  589.     {
  590.         #ifdef SPHE8202_CARD_STORAGE    //Maoyong 2004-8-12 do card power reset.
  591.         if(storage_type != USB_DEVICE)
  592.             Card_power_reset();
  593.         #endif
  594.     switch(storage_type)
  595.     {         
  596.             #ifdef SPHE8202_CARD_STORAGE         
  597.         #if defined(COMPACT_FLASH)    
  598.          case CF_CARD_DEVICE:
  599.           #ifdef IR_SWITCH_CD_USB_CF_OTHER  //dingzhy 4-10-22 10:41
  600.           #ifdef HIGH_CORTROL_CF
  601.          GPIO_O_SET(SWITCH_GPIO,1);//dingzhy use vfd data for test switch bus 4-10-22 10:43
  602.          #else
  603.          GPIO_O_SET(SWITCH_GPIO,0);
  604.          #endif
  605.           #endif         
  606.                          #ifdef CARD_SETUP_TYPE_2
  607.                            regs0->fm_gpio_mode = 8;  
  608.                          #elif defined(CARD_SETUP_TYPE_3)||defined(CARD_SETUP_TYPE_5)
  609.                            regs0->gpio_mode_B=2;
  610.                            regs0->fm_gpio_mode = 3;
  611.                          #endif  
  612.                          
  613.                    #ifdef IDE_CF_SW 
  614.                    IdeSetSequence(HD);//kenny 2004/8/29
  615.                    #endif
  616.                       cfIdeDetect();
  617.                          media_exit=1;
  618.                          break; 
  619.         #endif     
  620.         #if defined(SD_MMC_CARD)    
  621.          case SD_CARD_DEVICE:
  622.                         #ifdef CARD_SETUP_TYPE_2
  623.                           regs0->fm_gpio_mode = 3;  
  624.                         #elif defined(CARD_SETUP_TYPE_3)||defined(CARD_SETUP_TYPE_4)
  625.                           regs0->gpio_mode_B=0;
  626.                           regs0->fm_gpio_mode = 3;                      
  627.                         #endif //CARD_SETUP_TYPE_2
  628.                      if(sdDetect())    //wthsin, 2004/6/24 07:40pm
  629.                      {
  630.                         psprintf(RegionValStr[REGION1], "SD Err");
  631.                            PrintOsdMsg(STR_OS_SPACE, REGION1, 0, 1);  
  632.                      }
  633.                      else    
  634.                        media_exit=1;    
  635.                         break; 
  636.         #endif  
  637.         #if defined(MEMORY_STICK)    
  638.          case MS_CARD_DEVICE:
  639.                         #ifdef CARD_SETUP_TYPE_2
  640.                           regs0->fm_gpio_mode = 4;  
  641.                         #elif defined(CARD_SETUP_TYPE_3)||defined(CARD_SETUP_TYPE_4)
  642.                           regs0->gpio_mode_B=0;
  643.                           regs0->fm_gpio_mode = 4;   
  644.                         #endif //CARD_SETUP_TYPE_2
  645.                      msDetect();
  646.                      media_exit=1;    
  647.                         break; 
  648.         #endif  
  649.         #if defined(SMART_MEDIA)    
  650.          case SMC_CARD_DEVICE:
  651.                         #ifdef CARD_SETUP_TYPE_2
  652.                           regs0->fm_gpio_mode = 8;  
  653.                         #elif defined(CARD_SETUP_TYPE_3)
  654.                           regs0->fm_gpio_mode = 3;  
  655.                           regs0->gpio_mode_B=1;
  656.                         #endif //CARD_SETUP_TYPE_2
  657.                         if(smcDetect())
  658.                         {
  659.                         psprintf(RegionValStr[REGION1], "SMC Err");
  660.                            PrintOsdMsg(STR_OS_SPACE, REGION1, 0, 1);  
  661.                      }
  662.                      else 
  663.                        media_exit=1;              
  664.                         break; 
  665.         #endif  
  666.             #endif//#ifdef SPHE8202_CARD_STORAGE
  667.             #ifdef SUPPORT_USB//liweihua 2004-6-7
  668.             case  USB_DEVICE:
  669.              #if defined(IR_SWITCH_CD_USB_CF_OTHER)||defined(SPHE8202_USB_Write)||defined(FILE_MODE_WRITE) //dingzhy add it
  670.                 UsbTestReady();    //for bug:power on without usb,then insert usb,but can't play usb; dingzhy 04-10-22
  671.                 #endif
  672.                 media_exit=1;
  673.                 break;
  674.             #endif//#ifdef SUPPORT_USB
  675.          default:
  676.                          return;
  677.     //#endif 
  678.     if(media_exit)   
  679.     { 
  680.      #ifdef SPHE8202_ALL_TYPE_CARD_WRITE
  681.      if(card_browse_sign)
  682.      #endif
  683.         #ifdef FILE_MODE_WRITE                  //sunzhh add for file mode 2005-1-14
  684.         if(!file_mode_flag)                   
  685.         #endif        
  686.         CardSetBrowse();
  687.     }
  688. }
  689. /**************************************************************************
  690.  *                                                                        *
  691.  *  Function Name: CARDIsPlugIn                                           *
  692.  *                                                                        *
  693.  *  Purposes:                                                             *
  694.  *    Detect if the USB or CARD is pluged                                        *
  695.  *  Descriptions:                                                         *
  696.  *    Detect if the USB or CARD is pluged                                        *
  697.  *  Arguments:                                                            *
  698.  *          NONE                                                          *
  699.  *  Returns:                                                              *
  700.  *          0: FALSE                                                               *
  701.  *          1: TRUE                                                             *
  702.  *  See also:    NONE                                                     *
  703.  *                                                                        *
  704.  **************************************************************************/
  705. int CARDIsPlugIn(void)
  706. {//liweihua update 2004-6-8
  707.     int detect_result = 0;  
  708.     if(storage_type!=0)
  709.     {
  710.      #ifdef SUPPORT_USB
  711.         if(storage_type == USB_DEVICE)
  712.       detect_result=UsbIsPlugIn();
  713.      #endif
  714.      #if defined(SUPPORT_USB)&&defined(SPHE8202_CARD_STORAGE)  
  715.         else
  716.      #endif 
  717.      #ifdef SPHE8202_CARD_STORAGE
  718.         detect_result=CardStorageIsPlugIn();  
  719.      #endif       
  720.     }  
  721.    return  detect_result; 
  722. }
  723. /**************************************************************************
  724.  *                                                                        *
  725.  *  Function Name: polling_storage                                        *
  726.  *                                                                        *
  727.  *  Purposes:                                                             *
  728.  *    polling to detect usb/card plus in or plug out                      *
  729.  *  Descriptions:                                                         *
  730.  *    polling to detect usb/card plus in or plug out                      *
  731.  *  Arguments:                                                            *
  732.  *          NONE                                                          *
  733.  *  Returns:     NONE                                                     *
  734.  *                                                                        *
  735.  *  See also:    NONE                                                     *
  736.  *                                                                        *
  737.  **************************************************************************/
  738. extern int check_support_usb(void); //wthsin, 2004/5/27 01:34pm
  739. void polling_storage()
  740. {//liweihua update 2004-6-8         
  741.     BYTE detect_result = 0;
  742.     #ifdef SPHE8202_CARD_STORAGE
  743.     if(CardEna == TRUE)   //only after card init then polling.
  744.         Detect_Card_Storage();
  745.     #endif
  746.   #if defined(SUPPORT_USB)               
  747.      if(USBEna == TRUE)    //only after USB init then polling.
  748.     {
  749.         #ifdef SPHE1000
  750.             #ifdef HOST_UHCI 
  751.             uhci_slaveDetect();
  752.             #else //#define HOST_SL811HS   
  753.             slave_detect();
  754.             #endif
  755.         #else
  756.             #ifdef HOST_UHCI 
  757.             if(check_support_usb()==0)   return;  
  758.             uhci_slaveDetect();
  759.             #else //#define HOST_SL811HS   
  760.             slave_detect();
  761.             #endif
  762.         #endif
  763.     }
  764.   #endif
  765.   
  766.     detect_result=storage_parity_type[detect_type];
  767.         
  768.     #ifdef SWITCH_CD_CARD_USB//liweihua 2004-6-9
  769.     extern BYTE select_media_type;
  770.     if(detect_type&select_media_type)
  771.         detect_result = select_media_type;
  772.     else
  773.         select_media_type = 0;
  774.     #endif
  775.     
  776.     #ifdef IR_SWITCH_CD_USB_CF_OTHER   //dingzhy for bus switch 04-10-22
  777.     if((detect_type)&&(now_valid_type))
  778.     {
  779. detect_result = storage_parity_type[now_valid_type];
  780.     }
  781.     else
  782.      now_valid_type = 0;
  783.     
  784.      detect_result_last = detect_result;
  785.    //dingzhy for debug switch function
  786.      //psprintf(RegionValStr[REGION2], "D %x L %x V %x",detect_type,detect_result_last,now_valid_type);
  787. //PrintOsdMsg(STR_OS_SPACE, REGION2, 1, 1);
  788.     #endif
  789.     
  790.     if((detect_result==0)&&(storage_type==0)) 
  791.     {
  792.         //printf("-------- Do nothing! ------n");
  793.         return;
  794.     }
  795.     else if((detect_result!=0)&&((storage_type)==0))   
  796.     {
  797.         printf("-------- Card/USB Insert! ------n");
  798.         printf("media_type = %d",media_type);
  799.         #ifndef SWITCH_CD_CARD_USB//liweihua 2004-6-9
  800.         if(no_disk_cnt == 1)             //liweihua 20040324
  801.         #endif
  802.             system_state=SYSTEM_OPEN;   
  803.         if(play_state != VCD_STATE_OPEN) //liweihua add 2004-3-11
  804.             card_plug_state = USER_DO_PLUG_IN;    
  805.         storage_type = detect_result;
  806.      if(media_type != MEDIA_CD)//nono 2004-9-24 20:17
  807.      {
  808.         t_disp = 0;     //wthsin, 2004/7/6 11:39pm
  809.         remain= 0;
  810.      }
  811.         if(media_type == MEDIA_CARD)
  812.             SwitchMedia(CD2CARD);
  813. #ifdef SUPPORT_CARDREADER_TEST
  814.         else if ((Is_MIDI_STATE())&&(gIsMidiSelMenu))
  815.         {
  816.             printf("polling_storage MidiCard_GetCardFile n");
  817.             MidiCard_GetCardFile();
  818.         }
  819. #endif
  820.     }
  821.     //else if((storage_type!=0)&&(storage_type!=detect_result))
  822.     else if( (storage_type!=0)&& ((storage_type & detect_type) == 0) )
  823.     {
  824.         printf("-------- Card/USB Remove! ------n");
  825.         MediaIsEmpty = MEDIA_NOT_EMPTY;//dingzhy 05-1-11 20:26
  826.         #ifdef IR_SWITCH_CD_USB_CF_OTHER   //dingzhy for tonic 4-10-22 13:19
  827.          now_valid_type = 0;    //for bug:move media,always show no media
  828.         #endif
  829.      #ifdef MP3_ONLY_STOP_TO_GUI 
  830.             if( (play_state==VCD_STATE_MP3_FILELIST) && (media_type==MEDIA_CARD) )
  831.             {
  832.          ShowTitle();
  833.          SwitchMedia(CARD2CD);      //wsf 2004-9-16 16:43
  834.       }
  835.  #endif 
  836.    
  837.         if(media_type == MEDIA_CARD)
  838.         { 
  839.             SwitchMedia(CARD2CD);   //Maoyong 2004-8-11 22:52 marked above and add this.
  840.         }
  841. #ifdef SUPPORT_CARDREADER_TEST
  842.         if ((Is_MIDI_STATE())&&(gIsMidiSelMenu))
  843.         {
  844.             MidiCardReadInit();
  845.         }
  846. #endif
  847.         if(play_state != VCD_STATE_OPEN)
  848.             card_plug_state = USER_DO_PLUG_OUT;
  849.      #ifdef SPHE8202_CARD_STORAGE
  850.         if(storage_type!=USB_DEVICE)    //wthsin, 2004/6/28 10:09am
  851.          Card_power_off();      //Power Off      
  852.      #endif//SPHE8202_CARD_STORAGE
  853.         detect_result = 0;
  854.         storage_type = 0;
  855.         t_disp = 0;     //wthsin, 2004/7/6 11:39pm
  856.         remain= 0;
  857.      }
  858. }
  859. /**************************************************************************
  860.  *                                                                        *
  861.  *  Function Name: CardSetBrowse                                          *
  862.  *                                                                        *
  863.  *  Purposes:                                                             *
  864.  *    set system to play card media                                       *
  865.  *  Descriptions:                                                         *
  866.  *    set system to play card media                                       *
  867.  *  Arguments:                                                            *
  868.  *          NONE                                                          *
  869.  *  Returns:     NONE                                                     *
  870.  *                                                                        *
  871.  *  See also:    NONE                                                     *
  872.  *                                                                        *
  873.  **************************************************************************/
  874. //commone function to make system play card media now. Maoyong 2004.05.17
  875. void CardSetBrowse(void)
  876. {
  877.      full_scrn = 0;  //Maoyong 2004-8-11 23:02 for clear setup menu, must place before ClearOsdMsg
  878.      ClearOsdMsg(0);
  879.      t_disp = 0;
  880.      #ifdef SUPPORT_MULTI_PARTITION//liweihua 2004-10-25 8:56
  881.      browser = HddCardBrowse;
  882.      #else
  883.      browser = read_iso9660;
  884.      #endif
  885.      cd_type_loaded=CDROM;
  886.      cd_type=CDROM;
  887.      play_state=VCD_STATE_CLOSE;
  888.      Mp3ReadFinish = 0;//liweihua 2004-5-13
  889.      memset(pFsJpeg, 0, sizeof(FSJPEGDATA));//liweihua add 2004-5-8 9:11
  890.      system_state=SYSTEM_BROWSE;
  891.      sys_cmd=CMD_FUNC|CMD_FUNC_CLOSE;
  892.      media_type = MEDIA_CARD;
  893.      
  894.      //customized osd information for card reading
  895.      //Maoyong 2004.05.25 build funtions in ircmd.card.c, need to make osd display until
  896.      //read all card files for some cards has too many files and take long times
  897.      show_card_reading_osd(SHOW_MEDIA);
  898. }
  899. /**************************************************************************
  900.  *                                                                        *
  901.  *  Function Name: PMP_CF_Card_IsPlugIn                                   *
  902.  *                                                                        *
  903.  *  Purposes:                                                             *
  904.  *    Detect if the PMP'CF is pluged                                      *
  905.  *  Descriptions:                                                         *
  906.  *    Detect if the PMP'CF is pluged                                      *
  907.  *  Arguments:                                                            *
  908.  *          NONE                                                          *
  909.  *  Returns:                                                              *
  910.  *          0: nothing  2: CF plug in  -2: CF plug out                    *
  911.  *  See also:    NONE                                                     *
  912.  *                                                                        *
  913.  **************************************************************************/
  914. #ifdef CARD_SETUP_TYPE_5
  915. UINT8 sense_check_result=0;//liweihua add 2004-11-30
  916. int PMP_CF_Card_IsPlugIn()
  917. {
  918.     UINT8 cf_card_result=0;
  919.     UINT8 check_result;
  920.     
  921.     check_result = sense_check_result;
  922.     sense_check_result = GPIO_I_GET(CF_INS_SENSE);
  923.     
  924.     if(check_result != sense_check_result)
  925.     {
  926.         if(!sense_check_result)
  927.         {
  928.             printf("CF plug in!n");
  929.             return 2;
  930.         }
  931.         else
  932.         {
  933.             printf("CF plug out!n");
  934.             return -2;
  935.         }
  936.     }     
  937.     if(!sense_check_result)  cf_card_result=1;
  938.      //printf("cf_card_result =%x!n",cf_card_result);
  939.      return cf_card_result;
  940. }       
  941. #endif// CARD_SETUP_TYPE_5
  942. #endif //#if defined(SUPPORT_USB)||defined(SPHE8202_CARD_STORAGE)
  943. /**************************************************************************
  944.  *                                                                        *
  945.  *  Function Name: pc_usb_access_mode                                     *
  946.  *                                                                        *
  947.  *  Purposes:                                                             *
  948.  *    Set system to  PC USB MODE                                          *
  949.  *  Descriptions:                                                         *
  950.  *    when connect computer with usb, Set system to  PC USB MODE          *
  951.  *  Arguments:                                                            *
  952.  *          NONE                                                          *
  953.  *  Returns:     NONE                                                     *
  954.  *                                                                        *
  955.  *  See also:    NONE                                                     *
  956.  *                                                                        *
  957.  **************************************************************************/
  958. #ifdef PMP_DVD 
  959. void pc_usb_access_mode()
  960. {
  961.    delay_1ms(50); //Continous 50ms Detect "USB INSERT"
  962.    if(!GPIO_I_GET(PC_USB_CONNECT_PIN)) return;
  963.    watchdog_onoff(0);    // disable watchdog 
  964.    psprintf(RegionValStr[REGION1], "PC USB MODE");
  965.    PrintOsdMsg(STR_OS_SPACE, REGION1, 0, 1); 
  966.   #ifdef PMP_PCB_VER_C 
  967.    regs0->fm_gpio_mode = 9; //8202 IDE PIN => Hi-Z
  968.    UINT16 temp;
  969.    temp=regs0->gpio_mode_B;
  970.    regs0->gpio_mode_B=0;
  971.   #endif //#ifdef PMP_PCB_VER_C
  972.    GPIO_O_SET(IDE_BUS_SWITCH_CONTROL_PIN,0);
  973.   #ifdef PMP_PCB_VER_C 
  974.    GPIO_O_SET(USB_DEVICE_CHIP_POWER_PIN,0);
  975.    delay_1ms(300); 
  976.   #endif //#ifdef PMP_PCB_VER_C
  977.    GPIO_O_SET(USB_DEVICE_CHIP_POWER_PIN,1);
  978.    GPIO_O_SET(CARD_POWER_RESET,0); 
  979.    
  980.    while(GPIO_I_GET(PC_USB_CONNECT_PIN));
  981.    
  982.    GPIO_O_SET(IDE_BUS_SWITCH_CONTROL_PIN,1);
  983.   #ifdef PMP_PCB_VER_B 
  984.    GPIO_O_SET(USB_DEVICE_CHIP_POWER_PIN,0);
  985.   #else //PMP_PCB_VER_C
  986.    regs0->gpio_mode_B=temp;
  987.   #endif //#ifdef PMP_PCB_VER_B
  988.    watchdog_onoff(1);      // enable watchdog
  989.    watchdog_renew(0xffff);//reset watchdog
  990.    ClearOsdMsg(1); 
  991.    system_state= SYSTEM_OPEN;
  992.    ircmd_stop();
  993.    ircmd_return();
  994. }
  995. /**************************************************************************
  996.  *                                                                        *
  997.  *  Function Name: PMP_PC_Usb_PlugInOut                                   *
  998.  *                                                                        *
  999.  *  Purposes:                                                             *
  1000.  *    detect if usb connect to computer                                   *
  1001.  *  Descriptions:                                                         *
  1002.  *    detect if usb connect to computer                                   *
  1003.  *  Arguments:                                                            *
  1004.  *          NONE                                                          *
  1005.  *  Returns:     NONE                                                     *
  1006.  *                                                                        *
  1007.  *  See also:    NONE                                                     *
  1008.  *                                                                        *
  1009.  **************************************************************************/
  1010. UINT8 pc_usb_vcc_flag=0;
  1011. void PMP_PC_Usb_PlugInOut()
  1012. {
  1013.    if(pc_usb_vcc_flag==0)
  1014.    {
  1015.      if(GPIO_I_GET(PC_USB_CONNECT_PIN))
  1016.      {
  1017.         #ifdef PMP_UI//liweihua 2005-1-17
  1018.         pmpkey_return();
  1019.         #endif
  1020.         pc_usb_access_mode();
  1021.         pc_usb_vcc_flag=1;
  1022.      }    
  1023.    } 
  1024.    else //(pc_usb_vcc_flag==0)
  1025.    {
  1026.      if(!GPIO_I_GET(PC_USB_CONNECT_PIN))
  1027.      {
  1028.         pc_usb_vcc_flag=0;
  1029.      }
  1030.    }  
  1031. }  
  1032. #endif //#ifdef PMP_DVD