USBD ROM Stack  2.0
ROM based USB device stack
Data Fields
USBD_CDC_INIT_PARAM_T Struct Reference

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

#include <C:/Data/nxp/GIT/lpcopen_v3/lpcopen_version3/LPC43xx_18xx/lpc43xx_18xx/LPC_USBD_Lib/mw_usbd/mw_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 initialization parameter data structure.

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

Field Documentation

◆ mem_base

uint32_t USBD_CDC_INIT_PARAM_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.

◆ mem_size

uint32_t USBD_CDC_INIT_PARAM_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.

◆ cif_intf_desc

uint8_t* USBD_CDC_INIT_PARAM_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.

◆ dif_intf_desc

uint8_t* USBD_CDC_INIT_PARAM_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.

◆ CIC_GetRequest

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

Communication Interface Class specific get request call-back function.

This function is provided by the application software. This function gets called when host sends CIC management element get requests.

Note
Applications implementing Abstract Control Model subclass can set this param to NULL. As the default driver parses ACM requests and calls the individual ACM call-back routines defined in this structure. For all other subclasses this routine should be provided by the application.
The setup packet data (pSetup) is passed to the call-back so that application can extract the CIC request type and other associated data. By default the stack will assign 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
[in]hCdcHandle to CDC function driver.
[in]pSetupPointer to setup packet received from host.
[in,out]pBufferPointer to a pointer of data buffer containing request 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,out]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.

◆ CIC_SetRequest

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

Communication Interface Class specific set request call-back function.

This function is provided by the application software. This function gets called when host sends a CIC management element requests.

Note
Applications implementing Abstract Control Model subclass can set this param to NULL. As the default driver parses ACM requests and calls the individual ACM call-back routines defined in this structure. For all other subclasses this routine should be provided by the application.
The setup packet data (pSetup) is passed to the call-back so that application can extract the CIC request type and other associated data. If a set request has data associated, then this call-back is called twice.
  1. First when setup request is received, 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 received from the host. This time the length param is set with number of data bytes received.
Parameters
[in]hCdcHandle to CDC function driver.
[in]pSetupPointer to setup packet received from host.
[in,out]pBufferPointer to a pointer of data buffer containing request 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]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.

◆ CDC_BulkIN_Hdlr

ErrorCode_t(* USBD_CDC_INIT_PARAM_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
[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.

◆ CDC_BulkOUT_Hdlr

ErrorCode_t(* USBD_CDC_INIT_PARAM_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
[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.

◆ SendEncpsCmd

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

Abstract control model(ACM) subclass specific SEND_ENCAPSULATED_COMMAND request call-back function.

This function is provided by the application software. This function gets called when host sends a SEND_ENCAPSULATED_COMMAND set request.

Parameters
[in]hCdcHandle to CDC function driver.
[in]bufferPointer to the command buffer.
[in]lenLength of the command 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.

◆ GetEncpsResp

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

Abstract control model(ACM) subclass specific GET_ENCAPSULATED_RESPONSE request call-back function.

This function is provided by the application software. This function gets called when host sends a GET_ENCAPSULATED_RESPONSE request.

Parameters
[in]hCdcHandle to CDC function driver.
[in,out]bufferPointer to a pointer of data buffer containing response 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,out]lenAmount 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.

◆ SetCommFeature

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

Abstract control model(ACM) subclass specific SET_COMM_FEATURE request call-back function.

This function is provided by the application software. This function gets called when host sends a SET_COMM_FEATURE set request.

Parameters
[in]hCdcHandle to CDC function driver.
[in]featureCommunication feature type. See usbcdc11.pdf, section 6.2.4, Table 47.
[in]bufferPointer to the settings buffer for the specified communication feature.
[in]lenLength of the request 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.

◆ GetCommFeature

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

Abstract control model(ACM) subclass specific GET_COMM_FEATURE request call-back function.

This function is provided by the application software. This function gets called when host sends a GET_ENCAPSULATED_RESPONSE request.

Parameters
[in]hCdcHandle to CDC function driver.
[in]featureCommunication feature type. See usbcdc11.pdf, section 6.2.4, Table 47.
[in,out]bufferPointer to a pointer of data buffer containing current settings for the communication feature. Pointer-to-pointer is used to implement zero-copy buffers.
[in,out]lenAmount 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.

◆ ClrCommFeature

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

Abstract control model(ACM) subclass specific CLEAR_COMM_FEATURE request call-back function.

This function is provided by the application software. This function gets called when host sends a CLEAR_COMM_FEATURE request. In the call-back the application should Clears the settings for a particular communication feature.

Parameters
[in]hCdcHandle to CDC function driver.
[in]featureCommunication feature type. See usbcdc11.pdf, section 6.2.4, Table 47.
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.

◆ SetCtrlLineState

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

Abstract control model(ACM) subclass specific SET_CONTROL_LINE_STATE request call-back function.

This function is provided by the application software. This function gets called when host sends a SET_CONTROL_LINE_STATE request. RS-232 signal used to tell the DCE device the DTE device is now present

Parameters
[in]hCdcHandle to CDC function driver.
[in]stateThe state value uses bitmap values defined in usbcdc11.pdf, section 6.2.14, Table 51.
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.

◆ SendBreak

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

Abstract control model(ACM) subclass specific SEND_BREAK request call-back function.

This function is provided by the application software. This function gets called when host sends a SEND_BREAK request.

Parameters
[in]hCdcHandle to CDC function driver.
[in]mstimeDuration of Break signal in milliseconds. If mstime is FFFFh, then the application should send break until another SendBreak request is received with the wValue of 0000h.
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.

◆ SetLineCode

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

Abstract control model(ACM) subclass specific SET_LINE_CODING request call-back function.

This function is provided by the application software. This function gets called when host sends a SET_LINE_CODING request. The application should configure the device per DTE rate, stop-bits, parity, and number-of-character bits settings provided in command buffer. See usbcdc11.pdf, section 6.2.13, table 50 for detail of the command buffer.

Parameters
[in]hCdcHandle to CDC function driver.
[in]line_codingPointer to the CDC_LINE_CODING command 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.

◆ CDC_InterruptEP_Hdlr

ErrorCode_t(* USBD_CDC_INIT_PARAM_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
[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.

◆ CDC_Ep0_Hdlr

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

Optional user override-able 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
[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.

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