?? user.lst
字號:
C51 COMPILER V7.20 USER 07/12/2006 09:11:37 PAGE 1
C51 COMPILER V7.20, COMPILATION OF MODULE USER
OBJECT MODULE PLACED IN .\obj\user.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE USER\user.c LARGE OPTIMIZE(9,SIZE) BROWSE NOAREGS DEFINE(K_CARD_TYPE=0x01,K
-_CARD_TOTAL=0x01) DEBUG OBJECTEXTEND PRINT(.\lst\user.lst) OBJECT(.\obj\user.obj)
line level source
1 //===========================================================
2 // Project Name(項目名稱): SPCA755 rebuild
3 // File Name(模塊名稱): user.c
4 // Built Date(創建日期):2004-09-14
5 // Abstract(模塊描述): 用戶函數模塊
6 // Revision History(版本信息):
7 // Rev Date Author Comment(修改說明)
8 // 1.0 2004-09-14 XYQ created
9 //============================================================
10 //============================================================
11 #include "..\userdefine.h"
12 #include "user.h"
13 #include "userinit.h"
14 #include "interrupt.h"
15 #include "..\LCM\lcd501.h"
16 #include "main.h"
17 //================================================================================================
18
19 //****************************Note:以下函數必須保留,用戶不能刪除以下函數變量定義**********************
20 //**********************************************************************************************
21 #if ((K_CARD_TYPE &0x02)== 0x02)
bit data gb_USBCardST0;
bit data gb_USBCardST1;
U8 xdata gc_MlunCardType;
#endif
27
28 #if ((K_CARD_TYPE &0x01)== 0x01)
29 void Mlun_NAND_Initialize();
30 #endif
31
32 #if ((K_CARD_TYPE &0x02)== 0x02)
void Mlun_SD_Initialize();
#endif
35
36 #if ((K_CARD_TYPE &0x04)== 0x04)
void Mlun_SMC_Initialize();
#endif
39
40 #if ((K_CARD_TYPE &0x08)== 0x08)
void Mlun_CF_Initialize();
#endif
43 #if (K_CARD_TYPE &0x10 == 0x10)
44 void Mlun_MS_Initialize();//memory stick
45 #endif
46
47 #if ((K_CARD_TYPE &0x20) == 0x20)
void Mlun_XD_Initialize();//XD stick
#endif
50
51 code void (code *MlunMediaInitialize[K_CARD_TOTAL])()=
52 {
53 #if((K_CARD_TYPE &0x01)== 0x01)
54 Mlun_NAND_Initialize,
C51 COMPILER V7.20 USER 07/12/2006 09:11:37 PAGE 2
55 #endif
56 #if((K_CARD_TYPE &0x02)== 0x02)
Mlun_SD_Initialize,
#endif
59 #if((K_CARD_TYPE &0x04)== 0x04)
Mlun_SMC_Initialize,
#endif
62 #if((K_CARD_TYPE &0x08)== 0x08)
Mlun_CF_Initialize,
#endif
65 #if((K_CARD_TYPE &0x10)== 0x10)
Mlun_MS_Initialize,//SPCA755 NOT SUPPORT
#endif
68 #if((K_CARD_TYPE &0x20)== 0x20)
Mlun_XD_Initialize,//SPCA755 NOT SUPPORT
#endif
71 };
72 xdata U8 MlunSequence[K_CARD_TOTAL];
73 //=============================*Note End*==================================
74 //-------------------------------------------------
75 void USER_FillSettingInfo(void);
76 U16 USER_GetMusicTotalTime(void);
77 void USER_GetSettingInfo(void);
78 void USER_Remove_USB(void);
79 void SD_InsertState_Detect(void);
80 void X_Get_DefaultUserValue(void);
81 void UI_PreProcessor_scan_key(void);
82 void UI_Battery_Detect();
83 extern U8 UserSendDataToDSP(U8 tc_FileType,U8 tc_DspCommand);
84 //============================================================================================
85 //---------
86 //Variable
87 //---------
88 bit gb_ShowNowSongNumberFG;//show the filename flag
89 bit gb_DisplayEvent_Happened;//ui_event flag
90 bit gb_ADCKey_Pressed;
91 data BIT gb_FastFFFR=0;
92 data BIT gb_Openfile=FALSE; // For Open file Flag behind the UI-State transition
93 data BIT gb_UIPostError = FALSE; // The Error flag of UI post-processor for Audio Engine, such as
-Open file fail, initial fail etc.
94 // here can't initialize,move to main.c to initialize.xyq021228
95 data BIT gb_RecordPauseAndStop; // chamber@030121 Close file when Stop after Pause!!
96
97
98 xdata U8 gc_SKeyState;//[2];
99 xdata U8 gc_SPressingKey;//multi with gcl_ADCOldKey
100 xdata U8 gc_SKeyHoldCnt;//[2];
101 xdata U8 REC_name[12];
102 xdata U8 gc_fileend;
103
104 U8 gc_LongKey_Speed;
105 U8 ForBackWord_SecondCount;
106
107 bit gb_FFFRHoldToPlay;
108 bit gb_LowBattery_StopRecord;
109 U8 xdata gc_Play_Pause_Stop_State;
110 U8 xdata gc_Menu_State;
111 unsigned int code USER_SetIdleTime[]={0,180,300,600,1800};
112 U8 code UserBackLightArray[]={5,10,15,30,0xff,0};
113 U8 code USER_Set_Play_DPC_Value[]={12,8,3,17,22};
114 //U8 xdata gc_the_CurrentDSP_Volume;
115 //============================================================================================
C51 COMPILER V7.20 USER 07/12/2006 09:11:37 PAGE 3
116
117 xdata U32 gdw_TxtFileStartCluster;//lyh add
118 xdata U32 gdw_TxtFileCurrentCluster;
119 xdata U32 gdw_TxtFileSize;
120 xdata U8 gc_TxtDisplayBuf[41];
121 xdata U8 gc_TxtCurrentLen;
122 xdata U8 gc_TheSameTXT;
123 xdata U8 gc_DownorUp;
124 xdata U8 gc_OffsetByte;
125 //============================================================================================
126 xdata U8 gc_USR_PowerOffCount;
127 U8 xdata X_G_LRC_HaveGetFirstLyrics;//lyh add
128 bit _G_RecordNextFile;//lyh add
129 xdata U8 gc_USR_HaveID3OrNot;
130 data U8 gc_sts ;//lyh add
131 U8 data gc_Battery_Detect_Timer;//lyh add
132 xdata U8 ADCOldKey1;
133 //============================================================================================
134 xdata U16 gw_TotalSecond;
135 //============================================================================================
136 #define MAXLEN 6
137 xdata U8 gc_UI_CurrSecond;//gc_UI_BSecond;
138 xdata U32 gdw_UI_ADataPoint;
139 xdata U32 gdw_UI_BDataPoint;
140 xdata U32 gdw_UI_AFrameCnt;
141 xdata U8 gc_UI_ABStateMode;
142 idata U8 gc_DOS_ErrorStatus;//lzp add for test
143 //============================================================================================
144 //-------------------------------------------------------------------------------
145 U16 USER_GetMusicTotalTime(void)
146 {
147 1 U16 tw_FileTotalSecond;
148 1
149 1 if ((gs_File_FCB[gc_UIMode].c_FileType == AUDIO_FILE_TYPE_WAV)&&(gc_UIMode == 1))
150 1 {
151 2 tw_FileTotalSecond = ((gs_File_FCB[gc_UIMode].dw_File_TotalSize-60)*252/256)/4000;
152 2 }
153 1 else
154 1 {
155 2 tw_FileTotalSecond =((gs_File_FCB[gc_UIMode].dw_File_TotalSize/gs_System_State.w_BitRate)/125);
156 2
157 2 }
158 1
159 1
160 1 return tw_FileTotalSecond;
161 1 }
162 //==========================================================================================
163 void USER_Remove_USB(void)
164 {
165 1 //must initialize after remove USB
166 1 #if (K_CARD_TYPE == 0x03)
SMC_STORAGE_Initialize();
if (gc_DOS_ErrorStatus = SD_STORAGE_Initialize())//try to initialize SD card
#endif
170 1 {//if SD card is not exist
171 2 gc_DOS_ErrorStatus = SMC_STORAGE_Initialize();//try to initialize SMC
172 2 }
173 1 //*
174 1 gw_FileIndex[0]=0;
175 1 gw_FileIndex[1]=0;
176 1 gw_FileIndex[2]=0;
177 1
C51 COMPILER V7.20 USER 07/12/2006 09:11:37 PAGE 4
178 1 gw_FileTotalNumber[0]=0;
179 1 gw_FileTotalNumber[1]=0;
180 1 //*/
181 1 if (gc_DOS_ErrorStatus == 0)
182 1 {
183 2 USER_FindDir(0,gdw_DOS_RootDirClus);//detect DVR dir
184 2 }
185 1
186 1 if (gdw_USER_DirClus[0])
187 1 {//if DVR is exist
188 2 gs_File_FCB[1].dw_FDB_StartCluster = gdw_USER_DirClus[0]; //040830 lzp add
189 2 gbt_FindFlag = 0;//當要第一次查找或改變查找文件類型時,都需要將該值清0
190 2 DOS_Search_File(0x10,1,0x10); //在單目錄下統計錄音文件總數 040907 LIZHN
191 2 }
192 1
193 1 gs_File_FCB[0].dw_FDB_StartCluster = gdw_DOS_RootDirClus;
194 1 gbt_FindFlag = 0;//當要第一次查找或改變查找文件類型時,都需要將該值清0
195 1 DOS_Search_File(0,0,0x10);//全盤檢索音樂文件
196 1
197 1 gbt_FindFlag = 0;//當要第一次查找或改變查找文件類型時,都需要將該值清0
198 1 if (gc_UIMode)
199 1 {
200 2
201 2 if (gdw_USER_DirClus[0] != 0)
202 2 {
203 3 DOS_Search_File(0x12,gc_UIMode,0x10);
204 3 }
205 2 }
206 1 else
207 1 {
208 2 DOS_Search_File(0x01,0,0x10);//向下檢索一個音樂文件
209 2 }
210 1 if(gw_FileTotalNumber[gc_UIMode])
211 1 {
212 2
213 2 gw_FileIndex[gc_UIMode] = 1;
214 2 }
215 1 else
216 1 {
217 2 gw_FileIndex[gc_UIMode] = 0;//clear index
218 2
219 2 // gs_File_FCB[gc_UIMode].c_FileType = gc_UIMode + 4;
220 2 }
221 1 gb_Storage_Full=0;
222 1 gc_Menu_State=0;
223 1 gc_Busy_Timer = 0;
224 1 /*
225 1 if(!USER_Get_SYSInformation(0))
226 1 {
227 1 gb_Storage_Full=1;
228 1 }
229 1 else
230 1 {
231 1 gb_Storage_Full = 0;
232 1 }
233 1 */
234 1 UI_idle_Display();//lyh add
235 1 gc_SystemStateMode=SYSTEM_STATE0_IDLE;
236 1 USER_MCUClock_Select(K_MCU_LOWSPEED);//return back MCU Clock
237 1 }
238
239 //======================================================================================
C51 COMPILER V7.20 USER 07/12/2006 09:11:37 PAGE 5
240 #if (K_CARD_TYPE == 0x03)
void SD_InsertState_Detect(void)
{
U8 tc_CardInsert;
U8 tc_DoInitialize = 0;
//printf("Time=%bx\n",gc_ReadWriteTimeOut);
if (gc_ReadWriteTimeOut)
{//if data read write timeout occur
//printf("Read Write TimeOut\n");
System_Stop();
gc_ReadWriteTimeOut = 0;
gc_SystemStateMode = SYSTEM_STATE0_IDLE;
}
if (gc_SystemStateMode == SYSTEM_STATE0_IDLE)
{//if in IDLE STATE
STORAGE_Detect(&tc_CardInsert);
//printf("tc_CardInsert=%bu\n",tc_CardInsert);
if (tc_CardInsert)//首先要判斷是否有卡插入
{//if SD or MMC is not insert last time
if (!(gc_CurrentExistMedia & 0x40))//如果有,而且是bit6為0,說明上一次檢測時,是沒有卡插入的。因為如果
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -