UiVideoCommon.c
上传用户:hjhsjcl
上传日期:2020-09-25
资源大小:11378k
文件大小:6k
源码类别:

压缩解压

开发平台:

C++ Builder

  1. /*==========================================================================
  2. Copyright (c) 2004 ALi Corporation. All Rights Reserved
  3. File: UiVideo.c
  4. content: user interface for play module
  5. History: Created by Walace 2005/11/16
  6. ==========================================================================*/
  7. #define _UI_VIDEO_COMMON_H_
  8. #include <DP8051XP.H>
  9. #include "TypeDef.h"
  10. #include "Const.h"
  11. #include "Reg5661.h"
  12. #include "Common.h"
  13. #include "Key.h"
  14. #include "SaveSetting.h"
  15. #include "NandFlash.h"
  16. #include "Idma.h"
  17. #include "FileSystem.h"
  18. #include "UiCommon.h"
  19. #include "OLED.h"
  20. #include "IconDefine.h"
  21. #include "SysStrDef.h"
  22. #include "UiSysStr.h"
  23. #include "OledString.h"
  24. #include "UiPlayCommon.h"
  25. #include "UiVideoCommon.h"
  26. #include "UiVideo.h"
  27. //Walace060926#1 VideoResume start
  28. #include "Video.h"
  29. //#if(!_PM_VD_MENU_)
  30. //extern void CdbGetDbSector(void) large; //tne 2005/12/17
  31. //#endif
  32. #if(_PM_VD_LIST_)
  33. #include "UiVideoFileList.h"
  34. #endif
  35. //Walace060926#1 VideoResume end
  36. #if(SETTING_FOR_ICE_START)
  37. void UiVideoICEInit(void)
  38. {
  39. SettingForIceStart();
  40. //SM Clock
  41. obCLKSMDIVF=0x03;
  42. obCLKSMCTRL=0xB8;
  43. NandInit();
  44. FsInit();
  45. KeyInit();
  46. #if(!OLED_USE_SM_INTERFEACE)
  47. OledCtrlEn();
  48. obPARLCD = 0x31;  //Select Parallel Mode & Give CS Hight
  49. obMODSEL2 |= LCD_PAR_EN; //LCD Parallel mode enable
  50. obCLKLCDCTRL |= (LCD_CLK_EN | LCD_CLK_3000); //LCD Enable & Set Clock 3MHz
  51. OledCtrlDis();
  52. #endif
  53. OledInit() ;
  54. FontTableInit();
  55. LoadStringTableIndex();
  56. LoadTransTableIndex();
  57. EnableTimer0();
  58.        gxbDeviceMode = DEV_VIDEO;
  59. }
  60. #endif
  61. //Walace051218
  62. void UiVideoNormalCheck(void)
  63. {
  64. #if(UI_USE_AUTO_POWER_OFF)
  65. // #if(!PM_VIDEO) // not power save when video playing //Walace060504#4
  66. if(gxwAutoOff&SYS_PLAY_NOT_OFF_EN)
  67. // #endif
  68. {
  69. gxwAutoOffCounter=0;
  70. }
  71. #endif
  72. //Walace060926#1 VideoResume start 
  73. if(VbusCheck(CHECK_VBUS_ON)) //Walace060901#2
  74. {
  75. gxbSettingBuffer[SETTING_NEXT_MODE]=SAVE_AND_USB;
  76. UiVideoSwitchModule(VIDEO_TO_SAVE);
  77. }
  78. //Walace060926#1 VideoResume end
  79. }
  80. //Walace060926#1 VideoResume start
  81. #if(1)
  82. void UiVideoSwitchModule(BYTE bModuleFlowState) large
  83. {
  84. WORD wNextModule;
  85. #if(_PM_VD_PLAY_)
  86. VideoEngineSetCmd(VIDEO_CMD_STOP);
  87. bModuleFlowState|=VIDEO_FROM_PLAY;
  88. #elif(_PM_VD_MENU_)
  89. bModuleFlowState|=VIDEO_FROM_MENU;
  90. #else
  91. bModuleFlowState|=VIDEO_FROM_FLIST;
  92. #endif
  93. SET_VD_MODULE_FLOW(bModuleFlowState);
  94. switch(GET_VD_MODULE_TO())
  95. {
  96. case VIDEO_TO_PLAY:
  97. wNextModule=PM_VIDEO;
  98. break;
  99. case VIDEO_TO_MENU:
  100. #if(_PM_VD_LIST_)
  101. wNextModule=PM_VIDEO_MENU;
  102. #elif(_PM_VD_PLAY_)
  103. wNextModule=PM_VIDEO_FLIST;
  104. #endif
  105. break;
  106. case VIDEO_TO_SAVE:
  107. if(gxbSettingBuffer[SETTING_NEXT_MODE]==SAVE_AND_POWER_OFF)
  108. {
  109. OLED_CLEAR_ALL(); // Walace051001
  110. //OledShowIcon(ICON_ALI_LOGO,11,9) ; //Icon AliLogo
  111. }
  112. #if(_PM_VD_LIST_)
  113. SwicthToSaveSetting();
  114. #endif
  115. case VIDEO_TO_FLIST_INIT:
  116. case VIDEO_TO_FLIST:
  117. wNextModule=PM_VIDEO_FLIST;
  118. break;
  119. }
  120.        EA=0;
  121. obPMSIZE|=0x04;
  122. SetSysSpeed(VIDEO_MODULE_SWITCH_SPEED);
  123. LoadProgram(wNextModule,NORMAL_CODE);
  124. }
  125. #else
  126. void UiVideoSwitchSubModule(WORD wNextModule) large
  127. {
  128.        EA=0;
  129. obPMSIZE|=0x04;
  130. #if(_PM_VD_LIST_)
  131. gxbModuleState=MODULE_FROM_PLAY_FLIST;
  132. #elif(_PM_VD_MENU_)
  133. gxbModuleState=MODULE_FROM_PLAY_MENU;
  134. #else
  135. gxbModuleState=MODULE_FROM_PLAYBACK;
  136. #endif
  137. SetSysSpeed(VIDEO_MODULE_SWITCH_SPEED);
  138. LoadProgram(wNextModule,NORMAL_CODE);
  139. }
  140. #if((!_PM_VD_MENU_)&&(!SETTING_FOR_ICE_START))
  141. void SwicthToSaveSetting(void) large
  142. {
  143.     gxbSettingBuffer[SETTING_NEXT_MODE]=SAVE_AND_SEL_MODE;
  144.     gxbLastErrCode=ERR_NO_ERROR;
  145.     SaveSetting();
  146. }
  147. #endif
  148. #endif
  149. void VideoCommonInitial(void)
  150. {
  151. BYTE bTemp;
  152. //tne 2006/08/08 #1
  153. IE=0x83;
  154. #if(ICE_REAL_MODE) //vicky061001#2 Debug Play
  155. EnableTimer0();
  156. IE=0x83;
  157. #endif
  158. //gxbUiMenuMainStates=obDCV_INT_FLAG;
  159. #if(ENABLE_SD_FUNCTION&&SD_DET_USE_INT1) //Nick060808
  160. EX1=1;
  161. bTemp = obGPIO_INT_FLAG&obGPIO_INT_MASK;//use gbDdmCheck as temp, ok la
  162. if(bTemp&0x20)//gpiod5 // sd init flase anyway, even SD/MMC plug in
  163. gfSDinit = FALSE;
  164. bTemp=0;
  165. #endif
  166. SetSysSpeed(VIDEO_UI_SPEED); // Walace060801#1
  167. bTemp=obDCV_INT_FLAG; //Walace061225#1
  168. if((gxbModuleState&MODULE_SUB)==MODULE_NAND_RTN_RESOTRE) //Nick061120 //NandRestore
  169. return;
  170. #if(USE_SYS_STR_UNICODE)
  171. gxfSourceUnicode=STRING_TYPE_UNICODE; 
  172. #else
  173. gxfSourceUnicode=STRING_TYPE_ASCII;
  174. #endif
  175. UiFileListFileType=UI_FILE_LIST_PLAYBACK; 
  176. #if(SYS_USE_KEY_HOLD)
  177. gfLastKeyLocked=KEY_UNLOCK; 
  178. #endif
  179. gxwAutoOffCounter=0; 
  180. gxbLcdLimitCol=MAX_COLNUM;
  181. gxbPwOffCounter = 0;
  182. gxbBtyLowNum=0;
  183. OLED_DISP_MASK_INIT();
  184. //tne 2006/08/08 #1
  185. /*
  186. #if(SETTING_FOR_ICE_START|UI_USE_ALARM_DISPLAY)
  187. EX0=1;
  188. #endif
  189.    
  190. EA=1;
  191. ET0=1;
  192. */
  193. }
  194. #if(0) //Walace060926#1 VideoResume start
  195. #if(!_PM_VD_MENU_)
  196. void VideoFileInit(void)
  197. {       
  198. //Walace060629#2
  199. if(gbFsUnableUse)
  200. return;
  201. gpstFileIndex=&stUiFileListData; // global
  202. gpstFileIndex->pbFileName=gxbFileName;
  203. gpstFileIndex->pbLongFileName=gxbLongFileName;
  204. gpstFileIndex->bPathDepth=0;
  205. gpstFileIndex->dwDirStartSec=gxdwRoot;
  206. gpstFileIndex->dwDirSec[0]=gxdwRoot;
  207. gpstFileIndex->wDirOffset[0]=0;
  208. stPhoFileInf=stUiFileListData;   
  209. gxbFileMode = VIDEO_FILE;
  210. #if(DRM_MODE_EN)
  211. UiSearchMtpPropFile();
  212. #else
  213. gxbExceptFileAttrib=(FILE_ATTR_LABEL|FILE_ATTR_SYSTEM|FILE_ATTR_HIDDEN);
  214. #endif
  215. CdbGetDbSector();
  216. UiGetFileListNum();  //determine gxwTotalFileInDir , gxwTotalDirInDir 
  217. gxwFileNumInFileList =0;
  218. gxwTotalFileInAll=UiCountFileInDir(COUNT_ALL_PLAYBACK);
  219. gxwCurtFileInAll=0;
  220. gxwCurrentFileNum=gxwCurtFileInAll;
  221. gxwNumTotalFiles=gxwTotalFileInAll;
  222. stUiFileListData=stPhoFileInf; //restore to root
  223. gdwFileSector=0;  
  224. gfDelFile = FALSE;
  225. gxbLongFileName[0]=STRING_TYPE_UNICODE;
  226.        UiRndPlayInit();
  227. }
  228. #endif //Walace060926#1 VideoResume end
  229. #endif
  230. //Walace060712#1 start