| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- Data Structures
- Data Structure Index
- Data Fields

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Fields
USBD_CDC_INIT_PARAM_T Struct Reference
Communication Device Class (CDC) Function Driver

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

`#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)

## 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

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

Returns
  The call back should returns ErrorCode_t type to indicate success or error condition.

Return values

  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.

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

  hUsb | Handle to the USB device stack.
  data | Pointer to the data which will be passed when callback function is called by the stack.
  event | Type 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_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.

Definition at line 162 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

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

Returns
  The call back should returns ErrorCode_t type to indicate success or error condition.

Return values

  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.

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

  hUsb | Handle to the USB device stack.
  data | Pointer to the data which will be passed when callback function is called by the stack.
  event | Type 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_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.

Definition at line 181 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

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

Returns
  The call back should returns ErrorCode_t type to indicate success or error condition.

Return values

  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.

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

  hUsb | Handle to the USB device stack.
  data | Pointer to the data which will be passed when callback function is called by the stack.
  event | Type 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_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.

Definition at line 230 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

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

Returns
  The call back should returns ErrorCode_t type to indicate success or error condition.

Return values

  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.

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

  hUsb | Handle to the USB device stack.
  data | Pointer to the data which will be passed when callback function is called by the stack.
  event | Type 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_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.

Definition at line 209 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

  [in] | hCdc | Handle to CDC function driver.
  [in] | pSetup | Pointer to setup packet recived from host.
  [in,out] | pBuffer | Pointer to a pointer of data buffer containing request data. Pointer-to-pointer is used to implement zero-copy buffers.
  [in,out] | length | Amount 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_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.

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

  hCdc | Handle to CDC function driver.
  pSetup | Pointer to setup packet recived from host.
  pBuffer | Pointer to a pointer of data buffer containing request data. Pointer-to-pointer is used to implement zero-copy buffers.
  length | Amount 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_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.

Definition at line 113 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

  [in] | hCdc | Handle to CDC function driver.
  [in] | pSetup | Pointer to setup packet recived from host.
  [in,out] | pBuffer | Pointer to a pointer of data buffer containing request data. Pointer-to-pointer is used to implement zero-copy buffers.
  [in] | length | Amount of data copied to destination buffer.

Returns
  The call back should returns ErrorCode_t type to indicate success or error condition.

Return values

  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.

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

  hCdc | Handle to CDC function driver.
  pSetup | Pointer to setup packet recived from host.
  pBuffer | Pointer to a pointer of data buffer containing request data. Pointer-to-pointer is used to implement zero-copy buffers.
  length | Amount of data copied to destination buffer.

Returns
  The call back should returns ErrorCode_t type to indicate success or error condition.

Return values

  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.

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

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

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

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

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

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

Definition at line 186 of file usbd_cdcuser.h.

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

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

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

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

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

Definition at line 189 of file usbd_cdcuser.h.

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

Definition at line 183 of file usbd_cdcuser.h.

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

Definition at line 185 of file usbd_cdcuser.h.

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

Definition at line 188 of file usbd_cdcuser.h.

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

Definition at line 190 of file usbd_cdcuser.h.

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

- C:/nxp/v1.03/lpcopen_v1.03/lpcopen/software/lpc_core/lpc_ip/usbd_rom/usbd_cdcuser.h
- C:/nxp/v1.03/lpcopen_v1.03/lpcopen/software/LPCUSBLib/Drivers/USB/Core/DCD/USBRom/usbd_cdcuser.h