USBD ROM Stack
2.0
ROM based USB device stack
|
USBD stack Core API functions structure. More...
Data Fields | |
ErrorCode_t(* | RegisterClassHandler )(USBD_HANDLE_T hUsb, USB_EP_HANDLER_T pfn, void *data) |
ErrorCode_t(* | RegisterEpHandler )(USBD_HANDLE_T hUsb, uint32_t ep_index, USB_EP_HANDLER_T pfn, void *data) |
void(* | SetupStage )(USBD_HANDLE_T hUsb) |
void(* | DataInStage )(USBD_HANDLE_T hUsb) |
void(* | DataOutStage )(USBD_HANDLE_T hUsb) |
void(* | StatusInStage )(USBD_HANDLE_T hUsb) |
void(* | StatusOutStage )(USBD_HANDLE_T hUsb) |
void(* | StallEp0 )(USBD_HANDLE_T hUsb) |
ErrorCode_t(* | GetEpHandler )(USBD_HANDLE_T hUsb, uint32_t ep_index, USB_EP_HANDLER_T *ep_handler, void **data) |
USBD stack Core API functions structure.
This module exposes functions which interact directly with USB device stack's core layer. The application layer uses this component when it has to implement custom class function driver or standard class function driver which is not part of the current USB device stack. The functions exposed by this interface are to register class specific EP0 handlers and corresponding utility functions to manipulate EP0 state machine of the stack. This interface also exposes function to register custom endpoint interrupt handler.
ErrorCode_t USBD_CORE_API_T::RegisterClassHandler |
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.
[in] | hUsb | Handle to the USB device stack. |
[in] | pfn | Class specific EP0 handler function. |
[in] | data | Pointer to the data which will be passed when callback function is called by the stack. |
LPC_OK | On success |
ERR_USBD_TOO_MANY_CLASS_HDLR(0x0004000c) | The number of class handlers registered is greater than the number of handlers allowed by the stack. |
ErrorCode_t USBD_CORE_API_T::RegisterEpHandler |
Function to register interrupt/event handler for the requested endpoint with USB device stack.
The application layer uses this function to register the endpoint event handler. The stack calls all the registered endpoint handlers when
[in] | hUsb | Handle to the USB device stack. |
[in] | ep_index | Endpoint index. Computed as
|
[in] | pfn | Endpoint event handler function. |
[in] | data | Pointer to the data which will be passed when callback function is called by the stack. |
LPC_OK | On success |
ERR_API_INVALID_PARAM2 | ep_index is outside the boundary ( < 2 * USBD_API_INIT_PARAM_T::max_num_ep). |
void USBD_CORE_API_T::SetupStage |
Function to set EP0 state machine in setup state.
This function is called by USB stack and the application layer to set the EP0 state machine in setup state. This function will read the setup packet received from USB host into stack's buffer.
[in] | hUsb | Handle to the USB device stack. |
void USBD_CORE_API_T::DataInStage |
Function to set EP0 state machine in data_in state.
This function is called by USB stack and the application layer to set the EP0 state machine in data_in state. This function will write the data present in EP0Data buffer to EP0 FIFO for transmission to host.
[in] | hUsb | Handle to the USB device stack. |
void USBD_CORE_API_T::DataOutStage |
Function to set EP0 state machine in data_out state.
This function is called by USB stack and the application layer to set the EP0 state machine in data_out state. This function will read the control data (EP0 out packets) received from USB host into EP0Data buffer.
[in] | hUsb | Handle to the USB device stack. |
void USBD_CORE_API_T::StatusInStage |
Function to set EP0 state machine in status_in state.
This function is called by USB stack and the application layer to set the EP0 state machine in status_in state. This function will send zero length IN packet on EP0 to host, indicating positive status.
[in] | hUsb | Handle to the USB device stack. |
void USBD_CORE_API_T::StatusOutStage |
Function to set EP0 state machine in status_out state.
This function is called by USB stack and the application layer to set the EP0 state machine in status_out state. This function will read the zero length OUT packet received from USB host on EP0.
[in] | hUsb | Handle to the USB device stack. |
void USBD_CORE_API_T::StallEp0 |
Function to set EP0 state machine in stall state.
This function is called by USB stack and the application layer to generate STALL signaling on EP0 endpoint. This function will also reset the EP0Data buffer.
[in] | hUsb | Handle to the USB device stack. |
ErrorCode_t USBD_CORE_API_T::GetEpHandler |
Function to get default EP handler and its parameter for a particular endpoint.
This function is called by the application layer to retrieve the default Endpoint Handler and its data parameter for a particular endpoint.
[in] | hUsb | Handle to the USB device stack. |
[in] | ep_index | Endpoint index. Computed as
|
[in,out] | ep_handler | Double Pointer to Endpoint event handler function which is updated in the function. |
[in,out] | data | Double Pointer to the data parameter that needs to be passed when calling the event handler. |
LPC_OK | On success |
ERR_API_INVALID_PARAM2 | ep_index is outside the boundary ( < 2 * USBD_API_INIT_PARAM_T::max_num_ep). |