root/Examples_CP-JR_ARM7_LPC2368/ETT_LPC2368_Examples/USB_DEMO/USBMem/usbuser.c

Revision 8, 6.2 kB (checked in by phil, 15 years ago)

Added Examples etc. from CD

Line 
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 file is part of the uVision/ARM development tools.
9  *      This software may only be used under the terms of a valid, current,
10  *      end user licence from KEIL for a compatible version of KEIL software
11  *      development tools. Nothing else gives you the right to use it.
12  *
13  *      Copyright (c) 2005-2007 Keil Software.
14  *---------------------------------------------------------------------------*/
15
16 #include <LPC23xx.H>                        /* LPC23xx definitions */
17
18 #include "type.h"
19
20 #include "usb.h"
21 #include "usbcfg.h"
22 #include "usbhw.h"
23 #include "usbcore.h"
24 #include "usbuser.h"
25 #include "mscuser.h"
26
27 #include "memory.h"
28
29
30 /*
31  *  USB Power Event Callback
32  *   Called automatically on USB Power Event
33  *    Parameter:       power: On(TRUE)/Off(FALSE)
34  */
35
36 #if USB_POWER_EVENT
37 void USB_Power_Event (BOOL  power) {
38 }
39 #endif
40
41
42 /*
43  *  USB Reset Event Callback
44  *   Called automatically on USB Reset Event
45  */
46
47 #if USB_RESET_EVENT
48 void USB_Reset_Event (void) {
49   USB_ResetCore();
50   FIO2CLR = LED_CFG;                         /* Turn Off Cfg LED */
51 }
52 #endif
53
54
55 /*
56  *  USB Suspend Event Callback
57  *   Called automatically on USB Suspend Event
58  */
59
60 #if USB_SUSPEND_EVENT
61 void USB_Suspend_Event (void) {
62   FIO2SET = LED_SUSP;                        /* Turn On Suspend LED */
63 }
64 #endif
65
66
67 /*
68  *  USB Resume Event Callback
69  *   Called automatically on USB Resume Event
70  */
71
72 #if USB_RESUME_EVENT
73 void USB_Resume_Event (void) {
74   FIO2CLR = LED_SUSP;                        /* Turn Off Suspend LED */
75 }
76 #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
85 void USB_WakeUp_Event (void) {
86 }
87 #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 }
98 #endif
99
100
101 /*
102  *  USB Error Event Callback
103  *   Called automatically on USB Error Event
104  *    Parameter:       error: Error Code
105  */
106
107 #if USB_ERROR_EVENT
108 void USB_Error_Event (DWORD error) {
109 }
110 #endif
111
112
113 /*
114  *  USB Set Configuration Event Callback
115  *   Called automatically on USB Set Configuration Request
116  */
117
118 #if USB_CONFIGURE_EVENT
119 void USB_Configure_Event (void) {
120
121   if (USB_Configuration) {                  /* Check if USB is configured */
122     FIO2SET = LED_CFG;                       /* Turn On Cfg LED */
123   } else {
124     FIO2CLR = LED_CFG;                       /* Turn Off Cfg LED */
125   }
126 }
127 #endif
128
129
130 /*
131  *  USB Set Interface Event Callback
132  *   Called automatically on USB Set Interface Request
133  */
134
135 #if USB_INTERFACE_EVENT
136 void USB_Interface_Event (void) {
137 }
138 #endif
139
140
141 /*
142  *  USB Set/Clear Feature Event Callback
143  *   Called automatically on USB Set/Clear Feature Request
144  */
145
146 #if USB_FEATURE_EVENT
147 void USB_Feature_Event (void) {
148 }
149 #endif
150
151
152 #define P_EP(n) ((USB_EP_EVENT & (1 << (n))) ? USB_EndPoint##n : NULL)
153
154 /* USB Endpoint Events Callback Pointers */
155 void (* const USB_P_EP[16]) (DWORD event) = {
156   P_EP(0),
157   P_EP(1),
158   P_EP(2),
159   P_EP(3),
160   P_EP(4),
161   P_EP(5),
162   P_EP(6),
163   P_EP(7),
164   P_EP(8),
165   P_EP(9),
166   P_EP(10),
167   P_EP(11),
168   P_EP(12),
169   P_EP(13),
170   P_EP(14),
171   P_EP(15),
172 };
173
174
175 /*
176  *  USB Endpoint 1 Event Callback
177  *   Called automatically on USB Endpoint 1 Event
178  *    Parameter:       event
179  */
180
181 void USB_EndPoint1 (DWORD event) {
182 }
183
184
185 /*
186  *  USB Endpoint 2 Event Callback
187  *   Called automatically on USB Endpoint 2 Event
188  *    Parameter:       event
189  */
190
191 void USB_EndPoint2 (DWORD event) {
192
193   switch (event) {
194     case USB_EVT_OUT:
195       MSC_BulkOut();
196       break;
197     case USB_EVT_IN:
198       MSC_BulkIn();
199       break;
200   }
201 }
202
203
204 /*
205  *  USB Endpoint 3 Event Callback
206  *   Called automatically on USB Endpoint 3 Event
207  *    Parameter:       event
208  */
209
210 void USB_EndPoint3 (DWORD event) {
211 }
212
213
214 /*
215  *  USB Endpoint 4 Event Callback
216  *   Called automatically on USB Endpoint 4 Event
217  *    Parameter:       event
218  */
219
220 void USB_EndPoint4 (DWORD event) {
221 }
222
223
224 /*
225  *  USB Endpoint 5 Event Callback
226  *   Called automatically on USB Endpoint 5 Event
227  *    Parameter:       event
228  */
229
230 void USB_EndPoint5 (DWORD event) {
231 }
232
233
234 /*
235  *  USB Endpoint 6 Event Callback
236  *   Called automatically on USB Endpoint 6 Event
237  *    Parameter:       event
238  */
239
240 void USB_EndPoint6 (DWORD event) {
241 }
242
243
244 /*
245  *  USB Endpoint 7 Event Callback
246  *   Called automatically on USB Endpoint 7 Event
247  *    Parameter:       event
248  */
249
250 void USB_EndPoint7 (DWORD event) {
251 }
252
253
254 /*
255  *  USB Endpoint 8 Event Callback
256  *   Called automatically on USB Endpoint 8 Event
257  *    Parameter:       event
258  */
259
260 void USB_EndPoint8 (DWORD event) {
261 }
262
263
264 /*
265  *  USB Endpoint 9 Event Callback
266  *   Called automatically on USB Endpoint 9 Event
267  *    Parameter:       event
268  */
269
270 void USB_EndPoint9 (DWORD event) {
271 }
272
273
274 /*
275  *  USB Endpoint 10 Event Callback
276  *   Called automatically on USB Endpoint 10 Event
277  *    Parameter:       event
278  */
279
280 void USB_EndPoint10 (DWORD event) {
281 }
282
283
284 /*
285  *  USB Endpoint 11 Event Callback
286  *   Called automatically on USB Endpoint 11 Event
287  *    Parameter:       event
288  */
289
290 void USB_EndPoint11 (DWORD event) {
291 }
292
293
294 /*
295  *  USB Endpoint 12 Event Callback
296  *   Called automatically on USB Endpoint 12 Event
297  *    Parameter:       event
298  */
299
300 void USB_EndPoint12 (DWORD event) {
301 }
302
303
304 /*
305  *  USB Endpoint 13 Event Callback
306  *   Called automatically on USB Endpoint 13 Event
307  *    Parameter:       event
308  */
309
310 void USB_EndPoint13 (DWORD event) {
311 }
312
313
314 /*
315  *  USB Endpoint 14 Event Callback
316  *   Called automatically on USB Endpoint 14 Event
317  *    Parameter:       event
318  */
319
320 void USB_EndPoint14 (DWORD event) {
321 }
322
323
324 /*
325  *  USB Endpoint 15 Event Callback
326  *   Called automatically on USB Endpoint 15 Event
327  *    Parameter:       event
328  */
329
330 void USB_EndPoint15 (DWORD event) {
331 }
Note: See TracBrowser for help on using the browser.