UM10462
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2016. All rights reserved.
User manual
Rev. 5.5 — 21 December 2016
194 of 523
NXP Semiconductors
UM10462
Chapter 10: LPC11U3x/2x/1x USB on-chip drivers
10.5.29 USBD_CORE_API
USBD stack Core API functions structure.
CDC_Ep0_Hdlr
ErrorCode_t(* USBD_CDC_INIT_PARAM::CDC_Ep0_Hdlr)(USBD_HANDLE_T hUsb, void *data, uint32_t
event)
Optional user override-able function to replace the default CDC class handler.
The application software could override the default EP0 class handler with their own by
providing the handler function address as this data member of the parameter structure.
Application which like the default handler should set this data member to zero before calling
the USBD_CDC_API::Init().
Parameters:
1. hUsb = Handle to the USB device stack.
2. data = Pointer to the data which will be passed when callback function is called by the
stack.
3. event = Type of endpoint event. See USBD_EVENT_T for more details.
Returns:
The call back should returns ErrorCode_t type to indicate success or error condition.
Return values:
1. LPC_OK = On success.
2. ERR_USBD_UNHANDLED = Event is not handled hence pass the event to next in line.
3. ERR_USBD_xxx = For other error conditions.
Table 202. USBD_CDC_INIT_PARAM class structure
Member
Description
Table 203. USBD_CORE_API class structure
Member
Description
RegisterClassHandler
ErrorCode_t(*ErrorCode_t USBD_CORE_API::RegisterClassHandler)(USBD_HANDLE_T hUsb,
USB_EP_HANDLER_T pfn, void *data)
Function to register class specific EP0 event handler with USB device stack.
The application layer uses this function when it has to register the custom class's EP0 handler. The
stack calls all the registered class handlers on any EP0 event before going through default
handling of the event. This gives the class handlers to implement class specific request handlers
and also to override the default stack handling for a particular event targeted to the interface.
Check USB_EP_HANDLER_T for more details on how the callback function should be
implemented. Also application layer could use this function to register EP0 handler which responds
to vendor specific requests.
Parameters:
1. hUsb = Handle to the USB device stack.
2. pfn = Class specific EP0 handler function.
3. data = Pointer to the data which will be passed when callback function is called by the stack.
Returns:
Returns ErrorCode_t type to indicate success or error condition.
Return values:
1. LPC_OK = On success
2. ERR_USBD_TOO_MANY_CLASS_HDLR(0x0004000c) = The number of class handlers
registered is greater than the number of handlers allowed by the stack.