| USBD ROM Stack 2.0 ROM based USB device stack

Data Fields
USBD_CDC_API_T Struct Reference
Communication Device Class (CDC) Function Driver

CDC class API functions structure.This module exposes functions which interact directly with USB device controller hardware. More...

`#include <C:/Data/nxp/GIT/lpcopen_v3/lpcopen_version3/LPC11u6x/lpc11u6x/LPC_USBD_Lib/mw_usbd/mw_usbd_cdcuser.h>`

## Data Fields
uint32_t(* | GetMemSize )(USBD_CDC_INIT_PARAM_T *param)
ErrorCode_t(* | init )(USBD_HANDLE_T hUsb, USBD_CDC_INIT_PARAM_T *param, USBD_HANDLE_T *phCDC)
ErrorCode_t(* | SendNotification )(USBD_HANDLE_T hCdc, uint8_t bNotification, uint16_t data)

## Detailed Description

CDC class API functions structure.

This module exposes functions which interact directly with USB device controller hardware.

## Field Documentation

## ◆ GetMemSize

uint32_t USBD_CDC_API_T::GetMemSize

Function to determine the memory required by the CDC function driver module.

This function is called by application layer before calling pUsbApi->CDC->Init(), to allocate memory used by CDC function driver module. The application should allocate the memory which is accessible by USB controller/DMA controller.

Note
  Some memory areas are not accessible by all bus masters.

Parameters

  [in] | param | Structure containing CDC function driver module initialization parameters.

Returns
  Returns the required memory size in bytes.

## ◆ init

ErrorCode_t USBD_CDC_API_T::init

Function to initialize CDC function driver module.

This function is called by application layer to initialize CDC function driver module.

Parameters

  [in] | hUsb | Handle to the USB device stack.
  [in,out] | param | Structure containing CDC function driver module initialization parameters.

Returns
  Returns ErrorCode_t type to indicate success or error condition.

Return values

  LPC_OK | On success
  ERR_USBD_BAD_MEM_BUF | Memory buffer passed is not 4-byte aligned or smaller than required.
  ERR_API_INVALID_PARAM2 | Either CDC_Write() or CDC_Read() or CDC_Verify() callbacks are not defined.
  ERR_USBD_BAD_INTF_DESC | Wrong interface descriptor is passed.
  ERR_USBD_BAD_EP_DESC | Wrong endpoint descriptor is passed.

## ◆ SendNotification

ErrorCode_t USBD_CDC_API_T::SendNotification

Function to send CDC class notifications to host.

This function is called by application layer to send CDC class notifications to host. See usbcdc11.pdf, section 6.3, Table 67 for various notification types the CDC device can send.

Note
  The current version of the driver only supports following notifications allowed by ACM subclass: CDC_NOTIFICATION_NETWORK_CONNECTION, CDC_RESPONSE_AVAILABLE, CDC_NOTIFICATION_SERIAL_STATE.
  For all other notifications application should construct the notification buffer appropriately and call hw->USB_WriteEP() for interrupt endpoint associated with the interface.

Parameters

  [in] | hCdc | Handle to CDC function driver.
  [in] | bNotification | Notification type allowed by ACM subclass. Should be CDC_NOTIFICATION_NETWORK_CONNECTION, CDC_RESPONSE_AVAILABLE or CDC_NOTIFICATION_SERIAL_STATE. For all other types ERR_API_INVALID_PARAM2 is returned. See usbcdc11.pdf, section 3.6.2.1, table 5.
  [in] | data | Data associated with notification. For CDC_NOTIFICATION_NETWORK_CONNECTION a non-zero data value is interpreted as connected state. For CDC_RESPONSE_AVAILABLE this parameter is ignored. For CDC_NOTIFICATION_SERIAL_STATE the data should use bitmap values defined in usbcdc11.pdf, section 6.3.5, Table 69.

Returns
  Returns ErrorCode_t type to indicate success or error condition.

Return values

  LPC_OK | On success
  ERR_API_INVALID_PARAM2 | If unsupported notification type is passed.

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

- C:/Data/nxp/GIT/lpcopen_v3/lpcopen_version3/LPC11u6x/lpc11u6x/LPC_USBD_Lib/mw_usbd/mw_usbd_cdcuser.h