4.4.Communication Device Class
The CDC ACM allows a host to see a device as a standard serial (COM) port. This is particularly useful when working with legacy applications
that use serial communications. Bulk IN and Bulk OUT transfers are used for all non-setup data.
The CDC module utilises the USBCore layer for the processing of all standard requests. In addition it processes the following class requests.
GET_LINE_CODING
SET_LINE_CODING (As required by MS HyperTerminal)
SET_CONTROL_LINE_STATE
The CDC class is supported by MS Windows so there is no need to develop a custom Windows kernel driver. However a custom ‘inf’ file is
required, the sample CDC application includes such a file. When a CDC ACM device is plugged into a Windows PC an additional (virtual)
COM port will become available that applications can use just like a standard COM port.
Here are the functions that make up the USBCDC API.
Name Description
USBCDC_Init Initialise the CDC module. This also initialises the Core and HAL layers.
USBCDC_IsConnected Returns the connected status of the device.
USBCDC_WriteString A blocking function that sends a string to the host.
USBCDC_PutChar A blocking function that sends a character to the host.
USBCDC_GetChar A blocking function that gets a character from the host.
USBCDC_Write A blocking function that sends a supplied data buffer to the host.
USBCDC_Write_Async Starts an asynchronous write of a data buffer to the host. A call back is used to signal when the operation
has completed.
USBCDC_Read A blocking function that reads from the host into a supplied data buffer.
USBCDC_Read_Async Starts an asynchronous read from the host into a data buffer. A call back is used to signal when the
operation has completed.
USBCDC_Cancel Cancel any asynchronous operations that are pending.
The CDC module consists of the following files:-
usb_cdc.c
usb_cdc.h.
usb_descriptors.c
usb_descriptors.h
usb_common.h
9