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

Communication Device Class function driver initilization parameter data structure. More...

#include "usbd_cdcuser.h"

Data Fields

uint32_t mem_base
 
uint32_t mem_size
 
uint8_t * cif_intf_desc
 
uint8_t * dif_intf_desc
 
ErrorCode_t(* CIC_GetRequest )(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t **pBuffer, uint16_t *length)
 
ErrorCode_t(* CIC_SetRequest )(USBD_HANDLE_T hCdc, USB_SETUP_PACKET *pSetup, uint8_t **pBuffer, uint16_t length)
 
ErrorCode_t(* CDC_BulkIN_Hdlr )(USBD_HANDLE_T hUsb, void *data, uint32_t event)
 
ErrorCode_t(* CDC_BulkOUT_Hdlr )(USBD_HANDLE_T hUsb, void *data, uint32_t event)
 
ErrorCode_t(* SendEncpsCmd )(USBD_HANDLE_T hCDC, uint8_t *buffer, uint16_t len)
 
ErrorCode_t(* GetEncpsResp )(USBD_HANDLE_T hCDC, uint8_t **buffer, uint16_t *len)
 
ErrorCode_t(* SetCommFeature )(USBD_HANDLE_T hCDC, uint16_t feature, uint8_t *buffer, uint16_t len)
 
ErrorCode_t(* GetCommFeature )(USBD_HANDLE_T hCDC, uint16_t feature, uint8_t **pBuffer, uint16_t *len)
 
ErrorCode_t(* ClrCommFeature )(USBD_HANDLE_T hCDC, uint16_t feature)
 
ErrorCode_t(* SetCtrlLineState )(USBD_HANDLE_T hCDC, uint16_t state)
 
ErrorCode_t(* SendBreak )(USBD_HANDLE_T hCDC, uint16_t mstime)
 
ErrorCode_t(* SetLineCode )(USBD_HANDLE_T hCDC, CDC_LINE_CODING *line_coding)
 
ErrorCode_t(* CDC_InterruptEP_Hdlr )(USBD_HANDLE_T hUsb, void *data, uint32_t event)
 
ErrorCode_t(* CDC_Ep0_Hdlr )(USBD_HANDLE_T hUsb, void *data, uint32_t event)
 

Detailed Description

Communication Device Class function driver initilization parameter data structure.

This data structure is used to pass initialization parameters to the Communication Device Class function driver's init function.

Definition at line 67 of file usbd_cdcuser.h.

Field Documentation

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

Communication Device Class specific BULK IN endpoint handler.

The application software should provide the BULK IN endpoint handler. Applications should transfer data depending on the communication protocol type set in descriptors.

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 166 of file usbd_cdcuser.h.

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

Communication Device Class specific BULK OUT endpoint handler.

The application software should provide the BULK OUT endpoint handler. Applications should transfer data depending on the communication protocol type set in descriptors.

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 185 of file usbd_cdcuser.h.

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

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

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 234 of file usbd_cdcuser.h.

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

Optional Communication Device Class specific INTERRUPT IN endpoint handler.

The application software should provide the INT IN endpoint handler. Applications should transfer data depending on the communication protocol type set in descriptors.

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 213 of file usbd_cdcuser.h.

ErrorCode_t(* CIC_GetRequest)(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t **pBuffer, uint16_t *length)

Communication Interface Class specific get request callback function.

This function is provided by the application software. This function gets called when host sends CIC management element get requests. The setup packet data (pSetup) is passed to the callback so that application can extract the CIC request type and other associated data. By default the stack will ssign pBuffer pointer to EP0Buff allocated at init. The application code can directly write data into this buffer as long as data is less than 64 byte. If more data has to be sent then application code should update pBuffer pointer and length accordingly.

Parameters
hCdcHandle to CDC function driver.
pSetupPointer to setup packet recived from host.
pBufferPointer to a pointer of data buffer containing request data. Pointer-to-pointer is used to implement zero-copy buffers. See USBD_ZeroCopy for more details on zero-copy concept.
lengthAmount of data to be sent back to host.
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 116 of file usbd_cdcuser.h.

ErrorCode_t(* CIC_SetRequest)(USBD_HANDLE_T hCdc, USB_SETUP_PACKET *pSetup, uint8_t **pBuffer, uint16_t length)

Communication Interface Class specific set request callback function.

This function is provided by the application software. This function gets called when host sends a CIC management element requests. The setup packet data (pSetup) is passed to the callback so that application can extract the CIC request type and other associated data. If a set request has data associated, then this callback is called twice. (1) First when setup request is recived, at this time application code could update pBuffer pointer to point to the intended destination. The length param is set to 0 so that application code knows this is first time. By default the stack will assign pBuffer pointer to EP0Buff allocated at init. Note, if data length is greater than 64 bytes and application code doesn't update pBuffer pointer the stack will send STALL condition to host. (2) Second when the data is recived from the host. This time the length param is set with number of data bytes recived.

Parameters
hCdcHandle to CDC function driver.
pSetupPointer to setup packet recived from host.
pBufferPointer to a pointer of data buffer containing request 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
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 147 of file usbd_cdcuser.h.

uint8_t* cif_intf_desc

Pointer to the control interface descriptor within the descriptor array (high_speed_desc) passed to Init() through USB_CORE_DESCS_T structure. The stack assumes both HS and FS use same BULK endpoints.

Definition at line 82 of file usbd_cdcuser.h.

ErrorCode_t(* ClrCommFeature)(USBD_HANDLE_T hCDC, uint16_t feature)

Definition at line 191 of file usbd_cdcuser.h.

uint8_t* dif_intf_desc

Pointer to the data interface descriptor within the descriptor array (high_speed_desc) passed to Init() through USB_CORE_DESCS_T structure. The stack assumes both HS and FS use same BULK endpoints.

Definition at line 87 of file usbd_cdcuser.h.

ErrorCode_t(* GetCommFeature)(USBD_HANDLE_T hCDC, uint16_t feature, uint8_t **pBuffer, uint16_t *len)

Definition at line 190 of file usbd_cdcuser.h.

ErrorCode_t(* GetEncpsResp)(USBD_HANDLE_T hCDC, uint8_t **buffer, uint16_t *len)

Definition at line 188 of file usbd_cdcuser.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 70 of file usbd_cdcuser.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_CDC_API::GetMemSize() routine.

Definition at line 75 of file usbd_cdcuser.h.

ErrorCode_t(* SendBreak)(USBD_HANDLE_T hCDC, uint16_t mstime)

Definition at line 193 of file usbd_cdcuser.h.

ErrorCode_t(* SendEncpsCmd)(USBD_HANDLE_T hCDC, uint8_t *buffer, uint16_t len)

Definition at line 187 of file usbd_cdcuser.h.

ErrorCode_t(* SetCommFeature)(USBD_HANDLE_T hCDC, uint16_t feature, uint8_t *buffer, uint16_t len)

Definition at line 189 of file usbd_cdcuser.h.

ErrorCode_t(* SetCtrlLineState)(USBD_HANDLE_T hCDC, uint16_t state)

Definition at line 192 of file usbd_cdcuser.h.

ErrorCode_t(* SetLineCode)(USBD_HANDLE_T hCDC, CDC_LINE_CODING *line_coding)

Definition at line 194 of file usbd_cdcuser.h.


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