]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/ThirdParty/LPCOpen/LPCUSBLib/Drivers/USB/Core/DCD/USBRom/usbd_core.h
Add extra debug comment into list.c.
[freertos] / FreeRTOS-Plus / Demo / FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC / ThirdParty / LPCOpen / LPCUSBLib / Drivers / USB / Core / DCD / USBRom / usbd_core.h
1 /*\r
2  * @brief Definition of functions exported by core layer of ROM based USB device stack\r
3  *\r
4  * @note\r
5  * Copyright(C) NXP Semiconductors, 2012\r
6   * All rights reserved.\r
7  *\r
8  * @par\r
9  * Software that is described herein is for illustrative purposes only\r
10  * which provides customers with programming information regarding the\r
11  * LPC products.  This software is supplied "AS IS" without any warranties of\r
12  * any kind, and NXP Semiconductors and its licensor disclaim any and\r
13  * all warranties, express or implied, including all implied warranties of\r
14  * merchantability, fitness for a particular purpose and non-infringement of\r
15  * intellectual property rights.  NXP Semiconductors assumes no responsibility\r
16  * or liability for the use of the software, conveys no license or rights under any\r
17  * patent, copyright, mask work right, or any other intellectual property rights in\r
18  * or to any products. NXP Semiconductors reserves the right to make changes\r
19  * in the software without notification. NXP Semiconductors also makes no\r
20  * representation or warranty that such application will be suitable for the\r
21  * specified use without further testing or modification.\r
22  *\r
23  * @par\r
24  * Permission to use, copy, modify, and distribute this software and its\r
25  * documentation is hereby granted, under NXP Semiconductors' and its\r
26  * licensor's relevant copyrights in the software, without fee, provided that it\r
27  * is used in conjunction with NXP Semiconductors microcontrollers.  This\r
28  * copyright, permission, and disclaimer notice must appear in all copies of\r
29  * this code.\r
30  */\r
31 \r
32 #ifndef __MW_USBD_CORE_H__\r
33 #define __MW_USBD_CORE_H__\r
34 \r
35 #include "error.h"\r
36 #include "usbd.h"\r
37 #include "lpc_types.h"\r
38 \r
39 /** @ingroup Group_USBD\r
40  *  @defgroup USBD_Core USB Core Layer\r
41  *  @section Sec_CoreModDescription Module Description\r
42  *  The USB Core Layer implements the device abstraction defined in the <em> Universal Serial Bus Specification, </em>\r
43  *  for applications to interact with the USB device interface on the device. The software in this layer responds to\r
44  *  standard requests and returns standard descriptors. In current stack the Init() routine part of\r
45  *  @ref USBD_HW_API_T structure initializes both hardware layer and core layer.\r
46  */\r
47 \r
48 \r
49 /* function pointer types */\r
50 \r
51 /** @ingroup USBD_Core\r
52  *  @typedef USB_CB_T\r
53  *  @brief USB device stack's event callback function type.\r
54  *\r
55  *  The USB device stack exposes several event triggers through callback to application layer. The\r
56  *  application layer can register methods to be called when such USB event happens.\r
57  *\r
58  *  @param hUsb Handle to the USB device stack.\r
59  *  @return The call back should returns @ref ErrorCode_t type to indicate success or error condition.\r
60  *          @retval LPC_OK On success\r
61  *          @retval ERR_USBD_UNHANDLED  Event is not handled hence pass the event to next in line.\r
62  *          @retval ERR_USBD_xxx  Other error conditions.\r
63  *\r
64  */\r
65 typedef ErrorCode_t (*USB_CB_T) (USBD_HANDLE_T hUsb);\r
66 \r
67 /** @ingroup USBD_Core\r
68  *  @typedef USB_PARAM_CB_T\r
69  *  @brief USB device stack's event callback function type.\r
70  *\r
71  *  The USB device stack exposes several event triggers through callback to application layer. The\r
72  *  application layer can register methods to be called when such USB event happens.\r
73  *\r
74  *  @param hUsb Handle to the USB device stack.\r
75  *  @param param1 Extra information related to the event.\r
76  *  @return The call back should returns @ref ErrorCode_t type to indicate success or error condition.\r
77  *          @retval LPC_OK On success\r
78  *          @retval ERR_USBD_UNHANDLED  Event is not handled hence pass the event to next in line.\r
79  *          @retval ERR_USBD_xxx  For other error conditions.\r
80  *\r
81  */\r
82 typedef ErrorCode_t (*USB_PARAM_CB_T) (USBD_HANDLE_T hUsb, uint32_t param1);\r
83 \r
84 /** @ingroup USBD_Core\r
85  *  @typedef USB_EP_HANDLER_T\r
86  *  @brief USBD setup request and endpoint event handler type.\r
87  *\r
88  *  The application layer should define the custom class's EP0 handler with function signature.\r
89  *  The stack calls all the registered class handlers on any EP0 event before going through default\r
90  *  handling of the event. This gives the class handlers to implement class specific request handlers\r
91  *  and also to override the default stack handling for a particular event targeted to the interface.\r
92  *  If an event is not handled by the callback the function should return ERR_USBD_UNHANDLED. For all\r
93  *  other return codes the stack assumes that callback has taken care of the event and hence will not\r
94  *  process the event any further and issues a STALL condition on EP0 indicating error to the host.\r
95  *  \n\r
96  *  For endpoint interrupt handler the return value is ignored by the stack.\r
97  *  \n\r
98  *  @param hUsb Handle to the USB device stack.\r
99  *  @param data Pointer to the data which will be passed when callback function is called by the stack.\r
100  *  @param event  Type of endpoint event. See @ref USBD_EVENT_T for more details.\r
101  *  @return The call back should returns @ref ErrorCode_t type to indicate success or error condition.\r
102  *          @retval LPC_OK On success.\r
103  *          @retval ERR_USBD_UNHANDLED  Event is not handled hence pass the event to next in line.\r
104  *          @retval ERR_USBD_xxx  For other error conditions.\r
105  *\r
106  */\r
107 typedef ErrorCode_t (*USB_EP_HANDLER_T)(USBD_HANDLE_T hUsb, void* data, uint32_t event);\r
108 \r
109 \r
110 /** @ingroup USBD_Core\r
111  *  @brief USB descriptors data structure.\r
112  *  @ingroup USBD_Core\r
113  *\r
114  *  @details  This structure is used as part of USB device stack initialisation\r
115  *  parameter structure @ref USBD_API_INIT_PARAM_T. This structure contains\r
116  *  pointers to various descriptor arrays needed by the stack. These descriptors\r
117  *  are reported to USB host as part of enumerations process.\r
118  *\r
119  *  @note All descriptor pointers assigned in this structure should be on 4 byte\r
120  *  aligned address boundary.\r
121  */\r
122 typedef struct _USB_CORE_DESCS_T\r
123 {\r
124   uint8_t *device_desc; /**< Pointer to USB device descriptor */\r
125   uint8_t *string_desc; /**< Pointer to array of USB string descriptors */\r
126   uint8_t *full_speed_desc; /**< Pointer to USB device configuration descriptor\r
127                             * when device is operating in full speed mode.\r
128                             */\r
129   uint8_t *high_speed_desc; /**< Pointer to USB device configuration descriptor\r
130                             * when device is operating in high speed mode. For\r
131                             * full-speed only implementation this pointer should\r
132                             * be same as full_speed_desc.\r
133                             */\r
134   uint8_t *device_qualifier; /**< Pointer to USB device qualifier descriptor. For\r
135                              * full-speed only implementation this pointer should\r
136                              * be set to null (0).\r
137                              */\r
138 } USB_CORE_DESCS_T;\r
139 \r
140 /** @brief USB device stack initilization parameter data structure.\r
141  *  @ingroup USBD_Core\r
142  *\r
143  *  @details  This data structure is used to pass initialization parameters to the\r
144  *  USB device stack's init function.\r
145  *\r
146  */\r
147 typedef struct USBD_API_INIT_PARAM\r
148 {\r
149   uint32_t usb_reg_base; /**< USB device controller's base register address. */\r
150   uint32_t mem_base;  /**< Base memory location from where the stack can allocate\r
151                       data and buffers. @note The memory address set in this field\r
152                       should be accessible by USB DMA controller. Also this value\r
153                       should be aligned on 2048 byte boundary.\r
154                       */\r
155   uint32_t mem_size;  /**< The size of memory buffer which stack can use.\r
156                       @note The \em mem_size should be greater than the size\r
157                       returned by USBD_HW_API::GetMemSize() routine.*/\r
158   uint8_t max_num_ep; /**< max number of endpoints supported by the USB device\r
159                       controller instance (specified by \em usb_reg_base field)\r
160                       to which this instance of stack is attached.\r
161                       */\r
162 \r
163   /* USB Device Events Callback Functions */\r
164         /** Event for USB interface reset. This event fires when the USB host requests that the device\r
165          *  reset its interface. This event fires after the control endpoint has been automatically\r
166          *  configured by the library.\r
167          *  \n\r
168          *  @note This event is called from USB_ISR context and hence is time-critical. Having delays in this\r
169          *  callback will prevent the device from enumerating correctly or operate properly.\r
170          *\r
171          */\r
172   USB_CB_T USB_Reset_Event;\r
173 \r
174         /** Event for USB suspend. This event fires when the USB host suspends the device by halting its\r
175          *  transmission of Start Of Frame pulses to the device. This is generally hooked in order to move\r
176          *  the device over to a low power state until the host wakes up the device.\r
177          *  \n\r
178          *  @note This event is called from USB_ISR context and hence is time-critical. Having delays in this\r
179          *  callback will cause other system issues.\r
180          */\r
181   USB_CB_T USB_Suspend_Event;\r
182 \r
183         /** Event for USB wake up or resume. This event fires when a the USB device interface is suspended\r
184          *  and the host wakes up the device by supplying Start Of Frame pulses. This is generally\r
185          *  hooked to pull the user application out of a low power state and back into normal operating\r
186          *  mode.\r
187          *  \n\r
188          *  @note This event is called from USB_ISR context and hence is time-critical. Having delays in this\r
189          *  callback will cause other system issues.\r
190          *\r
191          */\r
192   USB_CB_T USB_Resume_Event;\r
193 \r
194   /** Reserved parameter should be set to zero. */\r
195   USB_CB_T reserved_sbz;\r
196 \r
197   /** Event for USB Start Of Frame detection, when enabled. This event fires at the start of each USB\r
198          *  frame, once per millisecond in full-speed mode or once per 125 microseconds in high-speed mode,\r
199    *  and is synchronized to the USB bus.\r
200          *\r
201          *  This event is time-critical; it is run once per millisecond (full-speed mode) and thus long handlers\r
202          *  will significantly degrade device performance. This event should only be enabled when needed to\r
203    *  reduce device wake-ups.\r
204          *\r
205          *  @note This event is not normally active - it must be manually enabled and disabled via the USB interrupt\r
206          *        register.\r
207          *        \n\n\r
208          */\r
209   USB_CB_T USB_SOF_Event;\r
210 \r
211   /** Event for remote wakeup configururation, when enabled. This event fires when the USB host\r
212          *  request the device to configure itself for remote wake-up capability. The USB host sends\r
213    *  this request to device which report remote wakeup capable in their device descriptors,\r
214    *  before going to low-power state. The application layer should implement this callback if\r
215    *  they have any special on board circuit to trigerr remote wake up event.\r
216          *\r
217          *  This event is time-critical; it is run once per millisecond (full-speed mode) and thus long handlers\r
218          *  will significantly degrade device performance.\r
219          *\r
220          *  \n\n\r
221    *  @param hUsb Handle to the USB device stack.\r
222    *  @param param1 When 0 - Clear the wakeup configuration, 1 - Enable the wake-up configuration.\r
223    *  @return The call back should return @ref ErrorCode_t type to indicate success or error condition.\r
224          */\r
225   USB_PARAM_CB_T USB_WakeUpCfg;\r
226 \r
227   /** Reserved parameter should be set to zero. */\r
228   USB_PARAM_CB_T USB_Power_Event;\r
229 \r
230   /** Event for error condition. This event fires when USB device controller detect\r
231          *  an error condition in the system.\r
232          *\r
233          *  \n\n\r
234    *  @param hUsb Handle to the USB device stack.\r
235    *  @param param1 USB device interrupt status register.\r
236    *  @return The call back should return @ref ErrorCode_t type to indicate success or error condition.\r
237    */\r
238   USB_PARAM_CB_T USB_Error_Event;\r
239 \r
240   /* USB Core Events Callback Functions */\r
241   /** Event for USB configuration number changed. This event fires when a the USB host changes the\r
242    *  selected configuration number. On receiving configuration change request from host, the stack\r
243    *  enables/configures the endpoints needed by the new configuration before calling this callback\r
244    *  function.\r
245          *  \n\r
246          *  @note This event is called from USB_ISR context and hence is time-critical. Having delays in this\r
247          *  callback will prevent the device from enumerating correctly or operate properly.\r
248    *\r
249    */\r
250   USB_CB_T USB_Configure_Event;\r
251 \r
252   /** Event for USB interface setting changed. This event fires when a the USB host changes the\r
253    *  interface setting to one of alternate interface settings. On receiving interface change\r
254    *  request from host, the stack enables/configures the endpoints needed by the new alternate\r
255    *  interface setting before calling this callback function.\r
256          *  \n\r
257          *  @note This event is called from USB_ISR context and hence is time-critical. Having delays in this\r
258          *  callback will prevent the device from enumerating correctly or operate properly.\r
259    *\r
260    */\r
261   USB_CB_T USB_Interface_Event;\r
262 \r
263   /** Event for USB feature changed. This event fires when a the USB host send set/clear feature\r
264    *  request. The stack handles this request for USB_FEATURE_REMOTE_WAKEUP, USB_FEATURE_TEST_MODE\r
265    *  and USB_FEATURE_ENDPOINT_STALL features only. On receiving feature request from host, the\r
266    *  stack handle the request appropriately and then calls this callback function.\r
267          *  \n\r
268          *  @note This event is called from USB_ISR context and hence is time-critical. Having delays in this\r
269          *  callback will prevent the device from enumerating correctly or operate properly.\r
270    *\r
271    */\r
272  USB_CB_T USB_Feature_Event;\r
273 \r
274   /* cache and mmu translation functions */\r
275   /** Reserved parameter for future use. should be set to zero. */\r
276   uint32_t (* virt_to_phys)(void* vaddr);\r
277   /** Reserved parameter for future use. should be set to zero. */\r
278   void (* cache_flush)(uint32_t* start_adr, uint32_t* end_adr);\r
279 \r
280 } USBD_API_INIT_PARAM_T;\r
281 \r
282 \r
283 /** @brief USBD stack Core API functions structure.\r
284  *  @ingroup USBD_Core\r
285  *\r
286  *  @details  This module exposes functions which interact directly with USB device stack's core layer.\r
287  *  The application layer uses this component when it has to implement custom class function driver or\r
288  *  standard class function driver which is not part of the current USB device stack.\r
289  *  The functions exposed by this interface are to register class specific EP0 handlers and corresponding\r
290  *  utility functions to manipulate EP0 state machine of the stack. This interface also exposes\r
291  *  function to register custom endpoint interrupt handler.\r
292  *\r
293  */\r
294 typedef struct USBD_CORE_API\r
295 {\r
296  /** @fn ErrorCode_t RegisterClassHandler(USBD_HANDLE_T hUsb, USB_EP_HANDLER_T pfn, void* data)\r
297   *  Function to register class specific EP0 event handler with USB device stack.\r
298   *\r
299   *  The application layer uses this function when it has to register the custom class's EP0 handler.\r
300   *  The stack calls all the registered class handlers on any EP0 event before going through default\r
301   *  handling of the event. This gives the class handlers to implement class specific request handlers\r
302   *  and also to override the default stack handling for a particular event targeted to the interface.\r
303   *  Check USB_EP_HANDLER_T for more details on how the callback function should be implemented. Also\r
304   *  application layer could use this function to register EP0 handler which responds to vendor specific\r
305   *  requests.\r
306   *\r
307   *  @param hUsb Handle to the USB device stack.\r
308   *  @param pfn  Class specific EP0 handler function.\r
309   *  @param data Pointer to the data which will be passed when callback function is called by the stack.\r
310   *  @return Returns @ref ErrorCode_t type to indicate success or error condition.\r
311   *          @retval LPC_OK On success\r
312   *          @retval ERR_USBD_TOO_MANY_CLASS_HDLR(0x0004000c)  The number of class handlers registered is\r
313                         greater than the number of handlers allowed by the stack.\r
314   *\r
315   */\r
316   ErrorCode_t (*RegisterClassHandler)(USBD_HANDLE_T hUsb, USB_EP_HANDLER_T pfn, void* data);\r
317 \r
318  /** @fn ErrorCode_t RegisterEpHandler(USBD_HANDLE_T hUsb, uint32_t ep_index, USB_EP_HANDLER_T pfn, void* data)\r
319   *  Function to register interrupt/event handler for the requested endpoint with USB device stack.\r
320   *\r
321   *  The application layer uses this function to register the custom class's EP0 handler.\r
322   *  The stack calls all the registered class handlers on any EP0 event before going through default\r
323   *  handling of the event. This gives the class handlers to implement class specific request handlers\r
324   *  and also to override the default stack handling for a particular event targeted to the interface.\r
325   *  Check USB_EP_HANDLER_T for more details on how the callback function should be implemented.\r
326   *\r
327   *  @param hUsb Handle to the USB device stack.\r
328   *  @param ep_index  Class specific EP0 handler function.\r
329   *  @param pfn  Class specific EP0 handler function.\r
330   *  @param data Pointer to the data which will be passed when callback function is called by the stack.\r
331   *  @return Returns @ref ErrorCode_t type to indicate success or error condition.\r
332   *          @retval LPC_OK On success\r
333   *          @retval ERR_USBD_TOO_MANY_CLASS_HDLR(0x0004000c)  Too many endpoint handlers.\r
334   *\r
335   */\r
336   ErrorCode_t (*RegisterEpHandler)(USBD_HANDLE_T hUsb, uint32_t ep_index, USB_EP_HANDLER_T pfn, void* data);\r
337 \r
338   /** @fn void SetupStage(USBD_HANDLE_T hUsb)\r
339    *  Function to set EP0 state machine in setup state.\r
340    *\r
341    *  This function is called by USB stack and the application layer to\r
342    *  set the EP0 state machine in setup state. This function will read\r
343    *  the setup packet received from USB host into stack's buffer.\r
344    *  \n\r
345    *  @note This interface is provided to users to invoke this function in other\r
346    *  scenarios which are not handle by current stack. In most user applications\r
347    *  this function is not called directly.Also this function can be used by\r
348    *  users who are selectively modifying the USB device stack's standard handlers\r
349    *  through callback interface exposed by the stack.\r
350    *\r
351    *  @param hUsb Handle to the USB device stack.\r
352    *  @return Nothing.\r
353    */\r
354   void (*SetupStage )(USBD_HANDLE_T hUsb);\r
355 \r
356   /** @fn void DataInStage(USBD_HANDLE_T hUsb)\r
357    *  Function to set EP0 state machine in data_in state.\r
358    *\r
359    *  This function is called by USB stack and the application layer to\r
360    *  set the EP0 state machine in data_in state. This function will write\r
361    *  the data present in EP0Data buffer to EP0 FIFO for tranmission to host.\r
362    *  \n\r
363    *  @note This interface is provided to users to invoke this function in other\r
364    *  scenarios which are not handle by current stack. In most user applications\r
365    *  this function is not called directly.Also this function can be used by\r
366    *  users who are selectively modifying the USB device stack's standard handlers\r
367    *  through callback interface exposed by the stack.\r
368    *\r
369    *  @param hUsb Handle to the USB device stack.\r
370    *  @return Nothing.\r
371    */\r
372   void (*DataInStage)(USBD_HANDLE_T hUsb);\r
373 \r
374   /** @fn void DataOutStage(USBD_HANDLE_T hUsb)\r
375    *  Function to set EP0 state machine in data_out state.\r
376    *\r
377    *  This function is called by USB stack and the application layer to\r
378    *  set the EP0 state machine in data_out state. This function will read\r
379    *  the control data (EP0 out packets) received from USB host into EP0Data buffer.\r
380    *  \n\r
381    *  @note This interface is provided to users to invoke this function in other\r
382    *  scenarios which are not handle by current stack. In most user applications\r
383    *  this function is not called directly.Also this function can be used by\r
384    *  users who are selectively modifying the USB device stack's standard handlers\r
385    *  through callback interface exposed by the stack.\r
386    *\r
387    *  @param hUsb Handle to the USB device stack.\r
388    *  @return Nothing.\r
389    */\r
390   void (*DataOutStage)(USBD_HANDLE_T hUsb);\r
391 \r
392   /** @fn void StatusInStage(USBD_HANDLE_T hUsb)\r
393    *  Function to set EP0 state machine in status_in state.\r
394    *\r
395    *  This function is called by USB stack and the application layer to\r
396    *  set the EP0 state machine in status_in state. This function will send\r
397    *  zero length IN packet on EP0 to host, indicating positive status.\r
398    *  \n\r
399    *  @note This interface is provided to users to invoke this function in other\r
400    *  scenarios which are not handle by current stack. In most user applications\r
401    *  this function is not called directly.Also this function can be used by\r
402    *  users who are selectively modifying the USB device stack's standard handlers\r
403    *  through callback interface exposed by the stack.\r
404    *\r
405    *  @param hUsb Handle to the USB device stack.\r
406    *  @return Nothing.\r
407    */\r
408   void (*StatusInStage)(USBD_HANDLE_T hUsb);\r
409   /** @fn void StatusOutStage(USBD_HANDLE_T hUsb)\r
410    *  Function to set EP0 state machine in status_out state.\r
411    *\r
412    *  This function is called by USB stack and the application layer to\r
413    *  set the EP0 state machine in status_out state. This function will read\r
414    *  the zero length OUT packet received from USB host on EP0.\r
415    *  \n\r
416    *  @note This interface is provided to users to invoke this function in other\r
417    *  scenarios which are not handle by current stack. In most user applications\r
418    *  this function is not called directly.Also this function can be used by\r
419    *  users who are selectively modifying the USB device stack's standard handlers\r
420    *  through callback interface exposed by the stack.\r
421    *\r
422    *  @param hUsb Handle to the USB device stack.\r
423    *  @return Nothing.\r
424    */\r
425   void (*StatusOutStage)(USBD_HANDLE_T hUsb);\r
426 \r
427   /** @fn void StallEp0(USBD_HANDLE_T hUsb)\r
428    *  Function to set EP0 state machine in stall state.\r
429    *\r
430    *  This function is called by USB stack and the application layer to\r
431    *  generate STALL signalling on EP0 endpoint. This function will also\r
432    *  reset the EP0Data buffer.\r
433    *  \n\r
434    *  @note This interface is provided to users to invoke this function in other\r
435    *  scenarios which are not handle by current stack. In most user applications\r
436    *  this function is not called directly.Also this function can be used by\r
437    *  users who are selectively modifying the USB device stack's standard handlers\r
438    *  through callback interface exposed by the stack.\r
439    *\r
440    *  @param hUsb Handle to the USB device stack.\r
441    *  @return Nothing.\r
442    */\r
443   void (*StallEp0)(USBD_HANDLE_T hUsb);\r
444 \r
445 } USBD_CORE_API_T;\r
446 \r
447 /*-----------------------------------------------------------------------------\r
448  *  Private functions & structures prototypes\r
449  *-----------------------------------------------------------------------------*/\r
450 \r
451  /** @cond  ADVANCED_API */\r
452 \r
453 /* forward declaration */\r
454 struct _USB_CORE_CTRL_T;\r
455 typedef struct _USB_CORE_CTRL_T  USB_CORE_CTRL_T;\r
456 \r
457 /* USB device Speed status defines */\r
458 #define USB_FULL_SPEED    0\r
459 #define USB_HIGH_SPEED    1\r
460 \r
461 /* USB Endpoint Data Structure */\r
462 typedef struct _USB_EP_DATA\r
463 {\r
464   uint8_t  *pData;\r
465   uint16_t   Count;\r
466 } USB_EP_DATA;\r
467 \r
468 #define USB_MAX_IF_NUM  8\r
469 #define USB_MAX_EP_NUM  6\r
470 \r
471 /* USB core controller data structure */\r
472 struct _USB_CORE_CTRL_T\r
473 {\r
474   /* overridable function pointers ~ c++ style virtual functions*/\r
475   USB_CB_T USB_EvtSetupHandler;\r
476   USB_CB_T USB_EvtOutHandler;\r
477   USB_PARAM_CB_T USB_ReqVendor;\r
478   USB_CB_T USB_ReqGetStatus;\r
479   USB_CB_T USB_ReqGetDescriptor;\r
480   USB_CB_T USB_ReqGetConfiguration;\r
481   USB_CB_T USB_ReqSetConfiguration;\r
482   USB_CB_T USB_ReqGetInterface;\r
483   USB_CB_T USB_ReqSetInterface;\r
484   USB_PARAM_CB_T USB_ReqSetClrFeature;\r
485 \r
486   /* USB Device Events Callback Functions */\r
487   USB_CB_T USB_Reset_Event;\r
488   USB_CB_T USB_Suspend_Event;\r
489   USB_CB_T USB_Resume_Event;\r
490   USB_CB_T USB_SOF_Event;\r
491   USB_PARAM_CB_T USB_Power_Event;\r
492   USB_PARAM_CB_T USB_Error_Event;\r
493   USB_PARAM_CB_T USB_WakeUpCfg;\r
494 \r
495   /* USB Core Events Callback Functions */\r
496   USB_CB_T USB_Configure_Event;\r
497   USB_CB_T USB_Interface_Event;\r
498   USB_CB_T USB_Feature_Event;\r
499 \r
500   /* cache and mmu translation functions */\r
501   uint32_t (* virt_to_phys)(void* vaddr);\r
502   void (* cache_flush)(uint32_t* start_adr, uint32_t* end_adr);\r
503 \r
504   /* event handlers for endpoints. */\r
505   USB_EP_HANDLER_T  ep_event_hdlr[2 * USB_MAX_EP_NUM];\r
506   void*  ep_hdlr_data[2 * USB_MAX_EP_NUM];\r
507 \r
508   /* USB class handlers */\r
509   USB_EP_HANDLER_T  ep0_hdlr_cb[USB_MAX_IF_NUM];\r
510   void*  ep0_cb_data[USB_MAX_IF_NUM];\r
511   uint8_t num_ep0_hdlrs;\r
512   /* USB Core data Variables */\r
513   uint8_t max_num_ep; /* max number of endpoints supported by the HW */\r
514   uint8_t device_speed;\r
515   uint8_t  num_interfaces;\r
516   uint8_t  device_addr;\r
517   uint8_t  config_value;\r
518   uint16_t device_status;\r
519   uint8_t *device_desc;\r
520   uint8_t *string_desc;\r
521   uint8_t *full_speed_desc;\r
522   uint8_t *high_speed_desc;\r
523   uint8_t *device_qualifier;\r
524   uint32_t ep_mask;\r
525   uint32_t ep_halt;\r
526   uint32_t ep_stall;\r
527   uint8_t  alt_setting[USB_MAX_IF_NUM];\r
528   /* HW driver data pointer */\r
529   void* hw_data;\r
530 \r
531   /* USB Endpoint 0 Data Info */\r
532   USB_EP_DATA EP0Data;\r
533 \r
534   /* USB Endpoint 0 Buffer */\r
535   //ALIGNED(4)\r
536   uint8_t  EP0Buf[64];\r
537 \r
538   /* USB Setup Packet */\r
539   //ALIGNED(4)\r
540   USB_SETUP_PACKET SetupPacket;\r
541 \r
542 };\r
543 \r
544 \r
545 static INLINE void USB_SetSpeedMode(USB_CORE_CTRL_T* pCtrl, uint8_t mode)\r
546 {\r
547   pCtrl->device_speed = mode;\r
548 }\r
549 /** @endcond  */\r
550 \r
551 #endif  /* __MW_USBD_CORE_H__ */\r