LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
USBD_DFU_INIT_PARAM_T Struct Reference

Detailed Description

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.

Definition at line 144 of file usbd_api.h.

#include "usbd_api.h"

Data Fields

uint32_t mem_base
 
uint32_t mem_size
 
uint16_t wTransferSize
 
uint8_t * intf_desc
 
uint8_t(* DFU_Write )(uint32_t block_num, uint8_t **src, uint32_t length)
 
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)
 
uint16_t pad
 

Field Documentation

void(* 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 recieved. 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.

Parameters
[in]hUsbHandle DFU control structure.
Returns
Nothing.

DFU detach callback function.

This function is provided by the application software. This function gets called after USB_REQ_DFU_DETACH is recieved. 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.

Parameters
hUsbHandle DFU control structure.
Returns
Nothing.

Definition at line 168 of file usbd_api.h.

void(* DFU_Done)(void)

DFU done callback function.

This function is provided by the application software. This function gets called after download is finished.

Returns
Nothing.

DFU done callback function.

This function is provided by the application software. This function gets called after download is finished.

Returns
Nothing.

Definition at line 166 of file usbd_api.h.

ErrorCode_t(* DFU_Ep0_Hdlr)(USBD_HANDLE_T hUsb, void *data, uint32_t event)

Optional user overridable 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().

Note
Parameters
[in]hUsbHandle to the USB device stack.
[in]dataPointer to the data which will be passed when callback function is called by the stack.
[in]eventType 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
LPC_OKOn success.
ERR_USBD_UNHANDLEDEvent is not handled hence pass the event to next in line.
ERR_USBD_xxxFor other error conditions.

Optional user overridable 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().

Note
Parameters
hUsbHandle to the USB device stack.
dataPointer to the data which will be passed when callback function is called by the stack.
eventType 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
LPC_OKOn success.
ERR_USBD_UNHANDLEDEvent is not handled hence pass the event to next in line.
ERR_USBD_xxxFor other error conditions.

Definition at line 171 of file usbd_api.h.

uint32_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.

Parameters
[in]block_numDestination start address.
[in,out]dstPointer to a pointer to the source of data. Pointer-to-pointer is used to implement zero-copy buffers.
[in]lengthAmount of data copied to destination buffer.
Returns
Returns DFU_STATUS_ values defined in mw_usbd_dfu.h.

DFU Read callback function.

This function is provided by the application software. This function gets called when host sends a read command.

Parameters
block_numDestination start address.
dstPointer to a pointer to the source of data. Pointer-to-pointer is used to implement zero-copy buffers.
lengthAmount of data copied to destination buffer.
Returns
Returns DFU_STATUS_ values defined in mw_usbd_dfu.h.

Definition at line 164 of file usbd_api.h.

uint8_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.

Parameters
[in]block_numDestination start address.
[in,out]srcPointer to a pointer to the source of data. Pointer-to-pointer is used to implement zero-copy buffers.
[out]bwPollTimeoutPointer 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]lengthNumber of bytes to be written.
Returns
Returns DFU_STATUS_ values defined in mw_usbd_dfu.h.

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.

Parameters
block_numDestination start address.
srcPointer to a pointer to the source of data. Pointer-to-pointer is used to implement zero-copy buffers.
bwPollTimeoutPointer 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.
lengthNumber of bytes to be written.
Returns
Returns DFU_STATUS_ values defined in mw_usbd_dfu.h.

Definition at line 158 of file usbd_api.h.

uint8_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.

Pointer to the DFU interface descriptor within the descriptor array (high_speed_desc) passed to Init() through USB_CORE_DESCS_T structure.

Definition at line 155 of file usbd_api.h.

uint32_t mem_base

Base memory location from where the stack can allocate data and buffers.

Note
The memory address set in this field should be accessible by USB DMA controller. Also this value should be aligned on 4 byte boundary.

Base memory location from where the stack can allocate data and buffers.

Note
The memory address set in this field should be accessible by USB DMA controller. Also this value should be aligned on 4 byte boundary.

Definition at line 147 of file usbd_api.h.

uint32_t mem_size

The size of memory buffer which stack can use.

Note
The mem_size should be greater than the size returned by USBD_DFU_API::GetMemSize() routine.

The size of memory buffer which stack can use.

Note
The mem_size should be greater than the size returned by USBD_DFU_API::GetMemSize() routine.

Definition at line 148 of file usbd_api.h.

uint16_t pad

Definition at line 80 of file usbd_dfuuser.h.

uint16_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.

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.

Definition at line 150 of file usbd_api.h.


The documentation for this struct was generated from the following files: