📄 common.lst
字号:
C51 COMPILER V7.50 COMMON 09/05/2008 09:54:25 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE COMMON
OBJECT MODULE PLACED IN ..\output\output_bin\output_mainmenu\common.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\..\code\common\common.c LARGE OPTIMIZE(9,SIZE) BROWSE INCDIR(..\..\..\bs
-p\include;..\..\code\ap_main\src\include;..\..\code\global;..\..\code\include) DEFINE(dynamic_load) DEBUG OBJECTEXTEND P
-RINT(..\output\output_bin\output_mainmenu\common.lst) OBJECT(..\output\output_bin\output_mainmenu\common.obj)
line level source
1 /*******************
2 * common.c
3 *******************/
4 #include <string.h>
5 #include "api.h"
6 #include "lcd.h"
7 #include "common.h"
8 #include "display.h"
9 #include "ap_common.h"
10 #include "prefer.h"
11 #include "global_user.h"
12 #include "res.h"
13 #include "res_show.h"
14
15 UINT32 u16TimerCount=0;
16
17 MUSIC_INFORMATION curr_music;
18 UINT16 curr_lyric_time;
19
20 INT8U _buf[256];
21 INT8U vol_flag=0;
22
23 FILE_INFORMATION curr_finfo, curr_dir, play_dir;
24 SCREENLEVEL screen_level;
25
26 UINT16 select;
27 UINT16 totdir, totfile, totitem;
28 UINT8 *search_extstr;
29
30
31 BOOLEAN bHotKeyHandle(UINT8 ekey)
32 {
33 1
34 1 switch(ekey)
35 1 {
36 2 case KEY_LONG_MENU:
37 2 key_menu_long = 1;
38 2 api_bSavePreferenceData(&tUserPreference,sizeof(USER_PREFERENCE_T));
39 2 //close_volume();
40 2 #ifdef dynamic_load
41 2 api_vLoad(Code_USER1,1);
42 2 #else
Print("Load Function\n");
#endif
45 2 break;
46 2 case KEY_LONG_PLAY:
47 2 api_bSavePreferenceData(&tUserPreference,sizeof(USER_PREFERENCE_T));
48 2 vShutDown();
49 2 break;
50 2 default:
51 2 return FALSE;
52 2 }
53 1 }
C51 COMPILER V7.50 COMMON 09/05/2008 09:54:25 PAGE 2
54
55 void key_process(UINT8 key)
56 {
57 1 u16TimerCount=0;
58 1
59 1 //vOpenBackLight();
60 1 if(bLCD_PIN_BACKLIGHT)
61 1 return;
62 1
63 1 //now handle hot key
64 1 bHotKeyHandle(key);
65 1
66 1 //deal other key now.
67 1 if(curr_screen->main)
68 1 curr_screen->main(key);
69 1 }
70
71 void get_short_name(FILE_INFORMATION *pfinfo, UINT8 xdata *buf)
72 {
73 1 UINT8 xdata *name = pfinfo->pu8FileName;
74 1 UINT8 xdata *ext = pfinfo->pu8FileExt;
75 1 BOOLEAN flags = false;
76 1
77 1 while(1) {
78 2 if(*name == '\0' || *name == ' ')
79 2 break;
80 2 *buf++ = *name++;
81 2 }
82 1
83 1 *buf++ = '.';
84 1
85 1 while(1) {
86 2 if(*ext == '\0' || *ext == ' ')
87 2 break;
88 2 *buf++ = *ext++;
89 2 flags = true;
90 2 }
91 1
92 1 if(!flags)
93 1 buf--;
94 1
95 1 *buf = '\0';
96 1 }
97
98 void get_long_name(FILE_INFORMATION *pfinfo, UINT8 xdata *buf)
99 {
100 1 UINT16 xdata *name = (UINT16 xdata *)pfinfo->pu8LongFileName;
101 1
102 1 while(*name != 0) {
103 2 buf[0] = ((UNION16 *)name)->v8[1];
104 2 buf[1] = ((UNION16 *)name)->v8[0];
105 2
106 2 if(*(UINT16 *)buf >= 'a' && *(UINT16 *)buf <= 'z')
107 2 *(UINT16 *)buf = *(UINT16 *)buf - 'a' + 'A';
108 2
109 2 name++;
110 2 buf += 2;
111 2 }
112 1
113 1 *(UINT16 *)buf = 0;
114 1 }
115
C51 COMPILER V7.50 COMMON 09/05/2008 09:54:25 PAGE 3
116
117 BOOLEAN change_dir(FILE_INFORMATION *pDir)
118 {
119 1 if(pDir)
120 1 memcpy(&curr_dir, pDir, sizeof(FILE_INFORMATION));
121 1 else
122 1 curr_dir.u32startclus = 0; // ROOT dir
123 1
124 1 return api_bChangeDir(pDir);
125 1 }
126
127 void scan_dir_file(UINT8 search_mode, UINT8 *extstr, BOOLEAN select_dir)
128 {
129 1 select = totitem = totdir = totfile = 0;
130 1
131 1 if(api_bSearchDirInDir(search_mode))
132 1 totdir = api_u16GetTotalFile();
133 1
134 1 if(api_bSearchFileInDir(search_mode, extstr))
135 1 totfile = api_u16GetTotalFile();
136 1
137 1 if(select_dir && totdir)
138 1 if(!api_bSearchDirInDir(SEARCH_MODE_CURRDIR))
139 1 return;
140 1
141 1 totitem = totdir + totfile;
142 1 search_extstr = extstr;
143 1 }
144
145 BOOLEAN playdir_valid()
146 {
147 1 if(curr_dir.u32startclus != play_dir.u32startclus)
148 1 return false;
149 1 else
150 1 return true;
151 1 }
152
153 BOOLEAN init_volume(void)
154 {
155 1 *(INT8U xdata*)(0xF96E) = 0x00;
156 1 api_bSetVolume(tUserPreference.u8Volume);
157 1 return 1;
158 1 }
159
160 BOOLEAN close_volume(void)
161 {
162 1 api_bSetVolume(0-api_s8GetVolume());
163 1 *(INT8U xdata*)(0xF96E) = 0x03;
164 1 return 1;
165 1 }
166
167
168 //--------------------------------------------------------------------------
169 void vKeyTimeOut(void)
170 {
171 1 if (u16TimerCount == 0)
172 1 {
173 2 if(tUserPreference.u8BackLightTime!=0)
174 2 vOpenBackLight();
175 2 }
176 1
177 1 u16TimerCount++;
C51 COMPILER V7.50 COMMON 09/05/2008 09:54:25 PAGE 4
178 1
179 1 if((u16TimerCount>=tUserPreference.u8BackLightTime*4) && (tUserPreference.u8BackLightTime>0))
180 1 vCloseBackLight();
181 1
182 1 if((u16TimerCount>=tUserPreference.u8ShutDownTime*240) && (tUserPreference.u8ShutDownTime>0))
183 1 vShutDown();
184 1
185 1 }
186
187 void vShutDown()
188 {
189 1 INT16U i;
190 1
191 1 api_bSetVolume(0-api_s8GetVolume());
192 1 for(i=0;i<9;i++)
193 1 {
194 2 delay(20);
195 2 bResShowPic(GJI01+i,0,0);
196 2 }
197 1
198 1 delay(20);
199 1 vCloseBackLight();
200 1 lcd_clear();
201 1 delay(20);
202 1
203 1 api_bSetPowerDownMode(POWER_DOWN_ADDA_OFF);
204 1 delay(200);
205 1 b_PIN_POWEROFF = 0;
206 1 while(1){;}
207 1 }
208
209 void vOpenBackLight(void)
210 {
211 1 bLCD_PIN_BACKLIGHT = 0;
212 1 }
213
214 void vCloseBackLight(void)
215 {
216 1 bLCD_PIN_BACKLIGHT = 1;
217 1 }
218
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 915 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 344 19
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- 2
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -