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