📄 common.lst
字号:
C51 COMPILER V7.50 COMMON 08/20/2008 17:11:01 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE COMMON
OBJECT MODULE PLACED IN ..\output\output_bin\output_voice\common.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\..\code\ap_voice\src\common.c LARGE OPTIMIZE(9,SIZE) BROWSE INCDIR(..\..
-\..\bsp\include;..\..\code\ap_voice\src\include;..\..\code\global;..\..\code\include) DEFINE(CONFIG_ASIC,dynamic_load) D
-EBUG OBJECTEXTEND PRINT(..\output\output_bin\output_voice\common.lst) OBJECT(..\output\output_bin\output_voice\common.ob
-j)
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 #include "voice_utile.h"
15
16 UINT32 u16TimerCount=0;
17
18 MUSIC_INFORMATION curr_music;
19 UINT16 curr_lyric_time;
20
21 INT8U _buf[256];
22 INT8U vol_flag=0;
23
24 FILE_INFORMATION curr_finfo, curr_dir, play_dir;
25 SCREENLEVEL screen_level;
26
27 UINT16 select;
28 UINT16 totdir, totfile, totitem;
29 UINT8 *search_extstr;
30
31
32 BOOLEAN bHotKeyHandle(UINT8 ekey)
33 {
34 1
35 1 switch(ekey)
36 1 {
37 2 case KEY_LONG_MENU:
38 2 key_menu_long = 1;
39 2 api_bSavePreferenceData(&tUserPreference,sizeof(USER_PREFERENCE_T));
40 2 //close_volume();
41 2 #ifdef dynamic_load
42 2 api_vLoad(Code_USER1,1);
43 2 #else
Print("Load Function\n");
#endif
46 2 break;
47 2 case KEY_LONG_PLAY:
48 2 api_bStop();
49 2 api_bSavePreferenceData(&tUserPreference,sizeof(USER_PREFERENCE_T));
50 2 vShutDown();
51 2 break;
52 2 default:
C51 COMPILER V7.50 COMMON 08/20/2008 17:11:01 PAGE 2
53 2 return FALSE;
54 2 }
55 1 }
56
57 void key_process(UINT8 key)
58 {
59 1 u16TimerCount=0;
60 1
61 1 //vOpenBackLight();
62 1 if(bLCD_PIN_BACKLIGHT && key!=KEY_EOS)
63 1 return;
64 1
65 1 //now handle hot key
66 1 if(key==KEY_EOS)
67 1 deal_loop();
68 1
69 1 bHotKeyHandle(key);
70 1
71 1 //deal other key now.
72 1 if(curr_screen->main)
73 1 curr_screen->main(key);
74 1 }
75
76 void get_short_name(FILE_INFORMATION *pfinfo, UINT8 xdata *buf)
77 {
78 1 UINT8 xdata *name = pfinfo->pu8FileName;
79 1 UINT8 xdata *ext = pfinfo->pu8FileExt;
80 1 BOOLEAN flags = false;
81 1
82 1 while(1) {
83 2 if(*name == '\0' || *name == ' ')
84 2 break;
85 2 *buf++ = *name++;
86 2 }
87 1
88 1 *buf++ = '.';
89 1
90 1 while(1) {
91 2 if(*ext == '\0' || *ext == ' ')
92 2 break;
93 2 *buf++ = *ext++;
94 2 flags = true;
95 2 }
96 1
97 1 if(!flags)
98 1 buf--;
99 1
100 1 *buf = '\0';
101 1 }
102
103 void get_long_name(FILE_INFORMATION *pfinfo, UINT8 xdata *buf)
104 {
105 1 UINT16 xdata *name = (UINT16 xdata *)pfinfo->pu8LongFileName;
106 1
107 1 while(*name != 0) {
108 2 buf[0] = ((UNION16 *)name)->v8[1];
109 2 buf[1] = ((UNION16 *)name)->v8[0];
110 2
111 2 if(*(UINT16 *)buf >= 'a' && *(UINT16 *)buf <= 'z')
112 2 *(UINT16 *)buf = *(UINT16 *)buf - 'a' + 'A';
113 2
114 2 name++;
C51 COMPILER V7.50 COMMON 08/20/2008 17:11:01 PAGE 3
115 2 buf += 2;
116 2 }
117 1
118 1 *(UINT16 *)buf = 0;
119 1 }
120
121
122 BOOLEAN change_dir(FILE_INFORMATION *pDir)
123 {
124 1 if(pDir)
125 1 memcpy(&curr_dir, pDir, sizeof(FILE_INFORMATION));
126 1 else
127 1 curr_dir.u32startclus = 0; // ROOT dir
128 1
129 1 return api_bChangeDir(pDir);
130 1 }
131
132 void scan_dir_file(UINT8 search_mode, UINT8 *extstr, BOOLEAN select_dir)
133 {
134 1 select = totitem = totdir = totfile = 0;
135 1
136 1 if(api_bSearchDirInDir(search_mode))
137 1 totdir = api_u16GetTotalFile();
138 1
139 1 if(api_bSearchFileInDir(search_mode, extstr))
140 1 totfile = api_u16GetTotalFile();
141 1
142 1 if(select_dir && totdir)
143 1 if(!api_bSearchDirInDir(SEARCH_MODE_CURRDIR))
144 1 return;
145 1
146 1 totitem = totdir + totfile;
147 1 search_extstr = extstr;
148 1 }
149
150 BOOLEAN playdir_valid()
151 {
152 1 if(curr_dir.u32startclus != play_dir.u32startclus)
153 1 return false;
154 1 else
155 1 return true;
156 1 }
157
158 BOOLEAN init_volume(void)
159 {
160 1 //*(INT8U xdata*)(0xF96E) = 0x00;
161 1 *(INT8U xdata*)(0xF96E) = 0x00;
162 1 api_bSetVolume(tUserPreference.u8Volume);
163 1 return 1;
164 1 }
165
166 BOOLEAN close_volume(void)
167 {
168 1 api_bSetVolume(0-api_s8GetVolume());
169 1 *(INT8U xdata*)(0xF96E) = 0x03;
170 1 return 1;
171 1 }
172
173
174 //--------------------------------------------------------------------------
175 void vKeyTimeOut(void)
176 {
C51 COMPILER V7.50 COMMON 08/20/2008 17:11:01 PAGE 4
177 1 if (u16TimerCount == 0)
178 1 {
179 2 if(tUserPreference.u8BackLightTime!=0)
180 2 vOpenBackLight();
181 2 }
182 1
183 1 u16TimerCount++;
184 1
185 1 if((u16TimerCount>=tUserPreference.u8BackLightTime*4) && (tUserPreference.u8BackLightTime>0))
186 1 vCloseBackLight();
187 1 if (screen_level != SCREEN_LEVEL_MUSIC_PLAY)
188 1 {
189 2 if((u16TimerCount>=tUserPreference.u8ShutDownTime*240) && (tUserPreference.u8ShutDownTime>0))
190 2 vShutDown();
191 2 }
192 1 }
193
194 void vShutDown()
195 {
196 1 INT16U i;
197 1
198 1 api_bSetVolume(0-api_s8GetVolume());
199 1 for(i=0;i<9;i++)
200 1 {
201 2 delay(20);
202 2 bResShowPic(GJI01+i,0,0);
203 2 }
204 1
205 1 delay(20);
206 1 vCloseBackLight();
207 1 lcd_clear();
208 1 delay(20);
209 1
210 1 api_bSetPowerDownMode(POWER_DOWN_ADDA_OFF);
211 1 delay(200);
212 1 b_PIN_POWEROFF = 0;
213 1 while(1){;}
214 1 }
215
216 void vOpenBackLight(void)
217 {
218 1 bLCD_PIN_BACKLIGHT = 0;
219 1 }
220
221 void vCloseBackLight(void)
222 {
223 1 bLCD_PIN_BACKLIGHT = 1;
224 1 }
225
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 944 ----
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 + -