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