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

DVD

开发平台:

C/C++

  1. /***************************************************************
  2.  *
  3.  * File Name :  USBGUI.c
  4.  * 
  5.  * Discription:
  6.  *     Provide functions when executing UDisk operations 
  7.  *     
  8.  *
  9.  * Creator:  liweihua
  10.  * Date   :  2003-10-30 21:08
  11.  *
  12.  **************************************************************/
  13. #ifdef SUPPORT_USB
  14. #include "USBfs.h"
  15. extern void USBJudgeFAT(void);
  16. extern USB_INFO   USBInfo;
  17. extern UINT32 USBZeroFAT_cnt; 
  18. void cd2UDisk(void)
  19. {
  20.     full_scrn &= (~PERIPHERAL);//for release the IR
  21.     osd_init();
  22.     //atapi_close_tray(0);
  23.     read_USB_flag = 1;
  24.     flag_U=1;
  25.     flag_cd=0;
  26.     media_type=MEDIA_USB;
  27.     ircmd_post_func(CMD_FUNC | CMD_FUNC_STOP);
  28. }
  29. void UDisk2cd(void)
  30. {
  31.     full_scrn &= (~PERIPHERAL);//for release the IR
  32.     osd_init();
  33.     
  34.     read_USB_flag=0;
  35.     flag_U=0;    //xulf
  36.     flag_cd=1;
  37.     media_type=MEDIA_CD;
  38.     ircmd_post_func(CMD_FUNC | CMD_FUNC_STOP);
  39.     bDiscType=CDUNKNOWN;
  40.     sys_cmd=CMD_FUNC_PLAY;
  41. }
  42. int UDisk_delete(void)
  43. {
  44.     if(!USBIsPlugIn()){
  45.         Message_Show(ERROR_MESSAGE);
  46.         show_switch();
  47.     }
  48.     else{
  49.         sign_PFun=PFUN_DELETE;//delete data
  50.         Message_Show(PFUN_DELETING);
  51.         if(USBSchedule(0)==-1){
  52.             Message_Show(P_SPACEEMPTY);
  53.             UDisk2cd();
  54.             return -1;
  55.         }
  56.         else{
  57.             Message_Show(PFUN_DELETE);
  58.         }
  59.     }
  60. }
  61. void UDisk_format(void)
  62. {
  63.     if(!USBIsPlugIn()){//very important!!!
  64.         Message_Show(ERROR_MESSAGE);
  65.         show_switch();
  66.     }
  67.     else{
  68.         sign_PFun=PFUN_FORMAT;
  69.         USBSchedule(0);
  70.         Message_Show(PFUN_FORMAT);
  71.     }
  72. }
  73. void rename_Udiskfile(void)
  74. {
  75.     if(!USBIsPlugIn()){//very important!!!
  76.         Message_Show(ERROR_MESSAGE);
  77.         show_switch();
  78.     }
  79.     else{   
  80.         sign_PFun=PFUN_RENAME;
  81.         USBSchedule(0);
  82.         Message_Show(PFUN_RENAME);
  83.         full_scrn &= (~PERIPHERAL);//for release the IR
  84.         osd_init();    
  85.         cd2UDisk(); 
  86.     }
  87. }
  88. void UDisk_copy(BYTE copymod)
  89. {
  90.     int result;
  91.     if(USBIsPlugIn()==0){
  92.         Message_Show(ERROR_MESSAGE);
  93.         show_switch();
  94.     }
  95.     else{
  96.         sign_PFun=PFUN_WRITE;
  97.         if(pFsJpeg->gifsFuncBtn == FS_FUNC_MP3){
  98.             AVD_SetMediaInterrupt();
  99.             Message_Show(PFUN_COPYING); 
  100.             osd_DrawRegionString(20, 1, " 0%", 7, 0, 2);             
  101.         }
  102.         else if(pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG){
  103.             UINT32 lba;
  104.             Message_Show(PFUN_COPYING);
  105.         
  106.             switch(copymod){
  107.                 case COPY_ROOTDIR:
  108.                     result=USBSchedule(COPY_ROOTDIR);
  109.                     if(result == -1){
  110.                      Message_Show(P_SPACEFULL);
  111.                     }
  112.                     else if(result == -3){
  113.                         Message_Show(ERROR_MESSAGE);
  114.                     }
  115.                     else{
  116.                         Message_Show(PFUN_WRITE);
  117.                     }
  118.                     break;
  119.                 case COPY_EXISTING:
  120.                     result=USBSchedule(COPY_EXISTING);
  121.                     if(result == -1){
  122.                         Message_Show(P_SPACEFULL);
  123.                     }
  124.                     else if(result == -3){
  125.                         Message_Show(ERROR_MESSAGE);
  126.                     }
  127.                     else if(result == -2){
  128.                         Message_Show(P_NOMATCH);
  129.                     }
  130.                     else{
  131.                         Message_Show(PFUN_WRITE);
  132.                     }    
  133.                     break;
  134.                 case COPY_NEWDIR:
  135.                     result=USBSchedule(COPY_NEWDIR);
  136.                     if(result == -1){
  137.                      Message_Show(P_SPACEFULL);
  138.                     }
  139.                     else if(result == -3){
  140.                         Message_Show(ERROR_MESSAGE);
  141.                     }
  142.                     else{
  143.                         Message_Show(PFUN_WRITE);
  144.                     }
  145.                     break; 
  146.             }       
  147.             full_scrn &= (~PERIPHERAL);//for release the IR
  148.          osd_init(); 
  149.         }  
  150.     }
  151. }
  152. #endif //#ifdef SUPPORT_USB