LPCOpen Platform
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

USB descriptors data structure. More...

#include "usbd_dfuuser.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, 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)
 

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 62 of file usbd_dfuuser.h.

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
hUsbHandle DFU control structure.
Returns
Nothing.

Definition at line 151 of file usbd_dfuuser.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.

Definition at line 133 of file usbd_dfuuser.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
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 172 of file usbd_dfuuser.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
block_numDestination start address.
dstPointer to a pointer to the source of data. Pointer-to-pointer is used to implement zero-copy buffers. See USBD_ZeroCopy for more details on zero-copy concept.
lengthAmount of data copied to destination buffer.
Returns
Returns DFU_STATUS_ values defined in mw_usbd_dfu.h.

Definition at line 122 of file usbd_dfuuser.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
block_numDestination start address.
srcPointer to a pointer to the source of data. Pointer-to-pointer is used to implement zero-copy buffers. See USBD_ZeroCopy for more details on zero-copy concept.
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 106 of file usbd_dfuuser.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.

Definition at line 84 of file usbd_dfuuser.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.

Definition at line 65 of file usbd_dfuuser.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.

Definition at line 70 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.

Definition at line 74 of file usbd_dfuuser.h.


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