USBD ROM Stack
2.0
ROM based USB device stack
|
USB descriptors data structure. More...
Data Fields | |
uint32_t | mem_base |
uint32_t | mem_size |
uint16_t | wTransferSize |
uint16_t | pad |
uint8_t * | intf_desc |
uint8_t(* | DFU_Write )(uint32_t block_num, uint8_t **src, uint32_t length, uint8_t *bwPollTimeout) |
uint32_t(* | DFU_Read )(uint32_t block_num, uint8_t **dst, uint32_t length) |
void(* | DFU_Done )(void) |
void(* | DFU_Detach )(USBD_HANDLE_T hUsb) |
ErrorCode_t(* | DFU_Ep0_Hdlr )(USBD_HANDLE_T hUsb, void *data, uint32_t event) |
uint32_t(* | DFU_GetStatus )(uint32_t *timeout, int32_t last) |
USB descriptors data 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.
uint32_t USBD_DFU_INIT_PARAM_T::mem_base |
Base memory location from where the stack can allocate data and buffers.
uint32_t USBD_DFU_INIT_PARAM_T::mem_size |
The size of memory buffer which stack can use.
uint16_t USBD_DFU_INIT_PARAM_T::wTransferSize |
DFU transfer block size in number of bytes. This value should match the value set in DFU descriptor provided as part of the descriptor array (high_speed_desc) passed to Init() through USB_CORE_DESCS_T structure.
uint8_t* USBD_DFU_INIT_PARAM_T::intf_desc |
Pointer to the DFU interface descriptor within the descriptor array (high_speed_desc) passed to Init() through USB_CORE_DESCS_T structure.
uint8_t(* USBD_DFU_INIT_PARAM_T::DFU_Write) (uint32_t block_num, uint8_t **src, uint32_t length, uint8_t *bwPollTimeout) |
DFU Write callback function.
This function is provided by the application software. This function gets called when host sends a write command. For application using zero-copy buffer scheme this function is called for the first time with length parameter set to 0. The application code should update the buffer pointer.
[in] | block_num | Destination start address. |
[in,out] | src | Pointer to a pointer to the source of data. Pointer-to-pointer is used to implement zero-copy buffers. See Zero-Copy Data Transfer model for more details on zero-copy concept. |
[out] | bwPollTimeout | Pointer to a 3 byte buffer which the callback implementer should fill with the amount of minimum time, in milliseconds, that the host should wait before sending a subsequent DFU_GETSTATUS request. |
[in] | length | Number of bytes to be written. |
uint32_t(* USBD_DFU_INIT_PARAM_T::DFU_Read) (uint32_t block_num, uint8_t **dst, uint32_t length) |
DFU Read callback function.
This function is provided by the application software. This function gets called when host sends a read command.
[in] | block_num | Destination start address. |
[in,out] | dst | Pointer to a pointer to the source of data. Pointer-to-pointer is used to implement zero-copy buffers. See Zero-Copy Data Transfer model for more details on zero-copy concept. |
[in] | length | Amount of data copied to destination buffer. |
void(* USBD_DFU_INIT_PARAM_T::DFU_Done) (void) |
DFU done callback function.
This function is provided by the application software. This function gets called after firmware download completes.
void(* USBD_DFU_INIT_PARAM_T::DFU_Detach) (USBD_HANDLE_T hUsb) |
DFU detach callback function.
This function is provided by the application software. This function gets called after USB_REQ_DFU_DETACH is received. Applications which set USB_DFU_WILL_DETACH bit in DFU descriptor should define this function. As part of this function application can call Connect() routine to disconnect and then connect back with host. For application which rely on WinUSB based host application should use this feature since USB reset can be invoked only by kernel drivers on Windows host. By implementing this feature host doen't have to issue reset instead the device has to do it automatically by disconnect and connect procedure.
[in] | hUsb | Handle DFU control structure. |
ErrorCode_t(* USBD_DFU_INIT_PARAM_T::DFU_Ep0_Hdlr) (USBD_HANDLE_T hUsb, void *data, uint32_t event) |
Optional user override-able function to replace the default DFU 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_DFU_API::Init().
[in] | hUsb | Handle to the USB device stack. |
[in] | data | Pointer to the data which will be passed when callback function is called by the stack. |
[in] | event | Type of endpoint event. See USBD_EVENT_T for more details. |
LPC_OK | On success. |
ERR_USBD_UNHANDLED | Event is not handled hence pass the event to next in line. |
ERR_USBD_xxx | For other error conditions. |
uint32_t(* USBD_DFU_INIT_PARAM_T::DFU_GetStatus) (uint32_t *timeout, int32_t last) |
Optional callback function to get the status of the previous write(download) transfer.
This function will be called when the stack needs to know the status of the current transfer. the last param when 1 it indicates that the transfer on going is the last download packet.
[out] | timeout | : If non zero then DFU device will send dfuDNBUSY status when last = 0 or will send dfuMANIFEST when last = 1. |
[in] | last | : When 1 indicates that the download is complete, 0 otherwise. |
DFU_STATUS_OK | on Success. |
DFU_STATUS_errXXXXXX | on DFU standard error (example: #DFU_STATUS_errTARGET) |
DFU_STATUS_errVENDOR | on Vendor specific error (lower 8 bits Bit0-7), set the upper 8 bits (bit15:bit8) with corresponding index to descriptive string supported by the application. |