📄 usbuser.lst
字号:
ARM COMPILER V2.53, usbuser 05/09/06 14:20:50 PAGE 1
ARM COMPILER V2.53, COMPILATION OF MODULE usbuser
OBJECT MODULE PLACED IN .\Obj\usbuser.obj
COMPILER INVOKED BY: C:\Keil\ARM\BIN\CA.exe usbuser.c THUMB DEBUG PRINT(.\LST\USBUSER.LST) TABS(4) OBJECT(.\Obj\usbuser.
-obj)
stmt level source
1 /*----------------------------------------------------------------------------
2 * U S B - K e r n e l
3 *----------------------------------------------------------------------------
4 * Name: USBUSER.C
5 * Purpose: USB Custom User Module
6 * Version: V1.10
7 *----------------------------------------------------------------------------
8 * This software is supplied "AS IS" without any warranties, express,
9 * implied or statutory, including but not limited to the implied
10 * warranties of fitness for purpose, satisfactory quality and
11 * noninfringement. Keil extends you a royalty-free right to reproduce
12 * and distribute executable files created using this software for use
13 * on Philips LPC2xxx microcontroller devices only. Nothing else gives
14 * you the right to use this software.
15 *
16 * Copyright (c) 2005-2006 Keil Software.
17 *---------------------------------------------------------------------------*/
18
19 #include <LPC214X.H> /* LPC214x definitions */
20
21 #include "type.h"
22
23 #include "usb.h"
24 #include "usbcfg.h"
25 #include "usbhw.h"
26 #include "usbcore.h"
27 #include "usbuser.h"
28
29 #include "demo.h"
30
31
32 /*
33 * USB Power Event Callback
34 * Called automatically on USB Power Event
35 * Parameter: power: On(TRUE)/Off(FALSE)
36 */
37
38 #if USB_POWER_EVENT
void USB_Power_Event (BOOL power) {
power;
}
#endif
43
44
45 /*
46 * USB Reset Event Callback
47 * Called automatically on USB Reset Event
48 */
49
50 #if USB_RESET_EVENT
51 void USB_Reset_Event (void) {
52 1 USB_ResetCore();
53 1 }
54 #endif
55
56
57 /*
58 * USB Suspend Event Callback
ARM COMPILER V2.53, usbuser 05/09/06 14:20:50 PAGE 2
59 * Called automatically on USB Suspend Event
60 */
61
62 #if USB_SUSPEND_EVENT
void USB_Suspend_Event (void) {
}
#endif
66
67
68 /*
69 * USB Resume Event Callback
70 * Called automatically on USB Resume Event
71 */
72
73 #if USB_RESUME_EVENT
void USB_Resume_Event (void) {
}
#endif
77
78
79 /*
80 * USB Remote Wakeup Event Callback
81 * Called automatically on USB Remote Wakeup Event
82 */
83
84 #if USB_WAKEUP_EVENT
void USB_WakeUp_Event (void) {
}
#endif
88
89
90 /*
91 * USB Start of Frame Event Callback
92 * Called automatically on USB Start of Frame Event
93 */
94
95 #if USB_SOF_EVENT
96 void USB_SOF_Event (void) {
97 1 #if USB_DMA == 0
98 1 if (USB_ReadEP(0x03, (BYTE *)&DataBuf[DataIn])) {
99 2 /* Data Available */
100 2 DataIn += P_S; /* Update Data In Index */
101 2 DataIn &= B_S - 1; /* Adjust Data In Index */
102 2 if (((DataIn - DataOut) & (B_S - 1)) == (B_S/2)) {
103 3 DataRun = 1; /* Data Stream running */
104 3 }
105 2 } else {
106 2 /* No Data */
107 2 DataRun = 0; /* Data Stream not running */
108 2 DataOut = DataIn; /* Initialize Data Indexes */
109 2 }
110 1 #endif
111 1 }
112 #endif
113
114
115 /*
116 * USB Error Event Callback
117 * Called automatically on USB Error Event
118 * Parameter: error: Error Code
119 */
120
121 #if USB_ERROR_EVENT
void USB_Error_Event (DWORD error) {
error;
}
ARM COMPILER V2.53, usbuser 05/09/06 14:20:50 PAGE 3
#endif
126
127
128 /*
129 * USB Set Configuration Event Callback
130 * Called automatically on USB Set Configuration Request
131 */
132
133 #if USB_CONFIGURE_EVENT
void USB_Configure_Event (void) {
}
#endif
137
138
139 /*
140 * USB Set Interface Event Callback
141 * Called automatically on USB Set Interface Request
142 */
143
144 #if USB_INTERFACE_EVENT
void USB_Interface_Event (void) {
}
#endif
148
149
150 /*
151 * USB Set/Clear Feature Event Callback
152 * Called automatically on USB Set/Clear Feature Request
153 */
154
155 #if USB_FEATURE_EVENT
void USB_Feature_Event (void) {
}
#endif
159
160
161 #define P_EP(n) ((USB_EP_EVENT & (1 << (n))) ? USB_EndPoint##n : NULL)
162
163 /* USB Endpoint Events Callback Pointers */
164 void (* const USB_P_EP[16]) (DWORD event) = {
165 P_EP(0),
166 P_EP(1),
167 P_EP(2),
168 P_EP(3),
169 P_EP(4),
170 P_EP(5),
171 P_EP(6),
172 P_EP(7),
173 P_EP(8),
174 P_EP(9),
175 P_EP(10),
176 P_EP(11),
177 P_EP(12),
178 P_EP(13),
179 P_EP(14),
180 P_EP(15),
181 };
182
183
184 /*
185 * USB Endpoint 1 Event Callback
186 * Called automatically on USB Endpoint 1 Event
187 * Parameter: event
188 */
189
190 void USB_EndPoint1 (DWORD event) {
ARM COMPILER V2.53, usbuser 05/09/06 14:20:50 PAGE 4
191 1 event;
192 1 }
193
194
195 /*
196 * USB Endpoint 2 Event Callback
197 * Called automatically on USB Endpoint 2 Event
198 * Parameter: event
199 */
200
201 void USB_EndPoint2 (DWORD event) {
202 1 event;
203 1 }
204
205
206 /*
207 * USB Endpoint 3 Event Callback
208 * Called automatically on USB Endpoint 3 Event
209 * Parameter: event
210 */
211
212 void USB_EndPoint3 (DWORD event) {
213 1 #if USB_DMA
USB_DMA_DESCRIPTOR DD;
if (event & USB_EVT_OUT_DMA_EOT) {
/* End of Transfer */
if (USB_DMA_BufAdr(0x03) != ((DWORD)DataBuf + 2*DataIn)) {
/* Data Available */
DataIn += P_C*P_S; /* Update Data In Index */
DataIn &= B_S - 1; /* Adjust Data In Index */
if (((DataIn - DataOut) & (B_S - 1)) == (B_S/2)) {
DataRun = 1; /* Data Stream running */
}
} else {
/* No Data */
DataRun = 0; /* Data Stream not running */
DataOut = DataIn; /* Initialize Data Indexes */
}
}
if (event & (USB_EVT_OUT_DMA_EOT) | (USB_EVT_OUT_DMA_NDR)) {
/* End of Transfer or New Descriptor Request */
DD.BufAdr = (DWORD)DataBuf + 2*DataIn; /* DMA Buffer Address */
DD.BufLen = P_C; /* DMA Packet Count */
DD.MaxSize = 0; /* Must be 0 for Iso Transfer */
DD.InfoAdr = (DWORD)InfoBuf; /* Packet Info Buffer Address */
DD.Cfg.Val = 0; /* Initial DMA Configuration */
DD.Cfg.Type.IsoEP = 1; /* Iso Endpoint */
USB_DMA_Setup (0x03, &DD); /* Setup DMA */
USB_DMA_Enable(0x03); /* Enable DMA */
}
#else
243 1 event;
244 1 #endif
245 1 }
246
247
248 /*
249 * USB Endpoint 4 Event Callback
250 * Called automatically on USB Endpoint 4 Event
251 * Parameter: event
252 */
253
254 void USB_EndPoint4 (DWORD event) {
255 1 event;
256 1 }
ARM COMPILER V2.53, usbuser 05/09/06 14:20:50 PAGE 5
257
258
259 /*
260 * USB Endpoint 5 Event Callback
261 * Called automatically on USB Endpoint 5 Event
262 * Parameter: event
263 */
264
265 void USB_EndPoint5 (DWORD event) {
266 1 event;
267 1 }
268
269
270 /*
271 * USB Endpoint 6 Event Callback
272 * Called automatically on USB Endpoint 6 Event
273 * Parameter: event
274 */
275
276 void USB_EndPoint6 (DWORD event) {
277 1 event;
278 1 }
279
280
281 /*
282 * USB Endpoint 7 Event Callback
283 * Called automatically on USB Endpoint 7 Event
284 * Parameter: event
285 */
286
287 void USB_EndPoint7 (DWORD event) {
288 1 event;
289 1 }
290
291
292 /*
293 * USB Endpoint 8 Event Callback
294 * Called automatically on USB Endpoint 8 Event
295 * Parameter: event
296 */
297
298 void USB_EndPoint8 (DWORD event) {
299 1 event;
300 1 }
301
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -