Microchip® Advanced Software Framework

udi_cdc.h File Reference

USB Device Communication Device Class (CDC) interface definitions.

Copyright (c) 2009-2018 Microchip Technology Inc. and its subsidiaries.

#include "conf_usb.h"
#include "usb_protocol.h"
#include "usb_protocol_cdc.h"
#include "udd.h"
#include "udc_desc.h"
#include "udi.h"

Data Structures

struct  udi_cdc_comm_desc_t
 Communication Class interface descriptor. More...
 
struct  udi_cdc_data_desc_t
 Data Class interface descriptor. More...
 

Macros

#define UDI_CDC_COMM_DESC(port)
 Content of CDC COMM interface descriptor for all speeds. More...
 
#define UDI_CDC_COMM_EP_SIZE   64
 CDC communication endpoints size for all speeds. More...
 
#define UDI_CDC_DATA_DESC_COMMON
 Content of CDC DATA interface descriptors. More...
 
#define UDI_CDC_DATA_DESC_FS(port)
 
#define UDI_CDC_DATA_DESC_HS(port)
 
#define UDI_CDC_DATA_EPS_FS_SIZE   64
 CDC data endpoints size for FS speed (8B, 16B, 32B, 64B) More...
 
#define UDI_CDC_DATA_EPS_HS_SIZE   512
 CDC data endpoints size for HS speed (512B only) More...
 
#define UDI_CDC_IAD_DESC(port)
 Content of CDC IAD interface descriptor for all speeds. More...
 
#define UDI_CDC_PORT_NB   1
 
Content of interface descriptors

Up to 7 CDC interfaces can be implemented on a USB device.

#define UDI_CDC_IAD_STRING_ID_0   0
 By default no string associated to these interfaces. More...
 
#define UDI_CDC_COMM_STRING_ID_0   0
 
#define UDI_CDC_DATA_STRING_ID_0   0
 
#define UDI_CDC_IAD_DESC_0   UDI_CDC_IAD_DESC(0)
 
#define UDI_CDC_COMM_DESC_0   UDI_CDC_COMM_DESC(0)
 
#define UDI_CDC_DATA_DESC_0_FS   UDI_CDC_DATA_DESC_FS(0)
 
#define UDI_CDC_DATA_DESC_0_HS   UDI_CDC_DATA_DESC_HS(0)
 
#define UDI_CDC_IAD_STRING_ID_1   0
 By default no string associated to these interfaces. More...
 
#define UDI_CDC_COMM_STRING_ID_1   0
 
#define UDI_CDC_DATA_STRING_ID_1   0
 
#define UDI_CDC_IAD_DESC_1   UDI_CDC_IAD_DESC(1)
 
#define UDI_CDC_COMM_DESC_1   UDI_CDC_COMM_DESC(1)
 
#define UDI_CDC_DATA_DESC_1_FS   UDI_CDC_DATA_DESC_FS(1)
 
#define UDI_CDC_DATA_DESC_1_HS   UDI_CDC_DATA_DESC_HS(1)
 
#define UDI_CDC_IAD_STRING_ID_2   0
 By default no string associated to these interfaces. More...
 
#define UDI_CDC_COMM_STRING_ID_2   0
 
#define UDI_CDC_DATA_STRING_ID_2   0
 
#define UDI_CDC_IAD_DESC_2   UDI_CDC_IAD_DESC(2)
 
#define UDI_CDC_COMM_DESC_2   UDI_CDC_COMM_DESC(2)
 
#define UDI_CDC_DATA_DESC_2_FS   UDI_CDC_DATA_DESC_FS(2)
 
#define UDI_CDC_DATA_DESC_2_HS   UDI_CDC_DATA_DESC_HS(2)
 
#define UDI_CDC_IAD_STRING_ID_3   0
 By default no string associated to these interfaces. More...
 
#define UDI_CDC_COMM_STRING_ID_3   0
 
#define UDI_CDC_DATA_STRING_ID_3   0
 
#define UDI_CDC_IAD_DESC_3   UDI_CDC_IAD_DESC(3)
 
#define UDI_CDC_COMM_DESC_3   UDI_CDC_COMM_DESC(3)
 
#define UDI_CDC_DATA_DESC_3_FS   UDI_CDC_DATA_DESC_FS(3)
 
#define UDI_CDC_DATA_DESC_3_HS   UDI_CDC_DATA_DESC_HS(3)
 
#define UDI_CDC_IAD_STRING_ID_4   0
 By default no string associated to these interfaces. More...
 
#define UDI_CDC_COMM_STRING_ID_4   0
 
#define UDI_CDC_DATA_STRING_ID_4   0
 
#define UDI_CDC_IAD_DESC_4   UDI_CDC_IAD_DESC(4)
 
#define UDI_CDC_COMM_DESC_4   UDI_CDC_COMM_DESC(4)
 
#define UDI_CDC_DATA_DESC_4_FS   UDI_CDC_DATA_DESC_FS(4)
 
#define UDI_CDC_DATA_DESC_4_HS   UDI_CDC_DATA_DESC_HS(4)
 
#define UDI_CDC_IAD_STRING_ID_5   0
 By default no string associated to these interfaces. More...
 
#define UDI_CDC_COMM_STRING_ID_5   0
 
#define UDI_CDC_DATA_STRING_ID_5   0
 
#define UDI_CDC_IAD_DESC_5   UDI_CDC_IAD_DESC(5)
 
#define UDI_CDC_COMM_DESC_5   UDI_CDC_COMM_DESC(5)
 
#define UDI_CDC_DATA_DESC_5_FS   UDI_CDC_DATA_DESC_FS(5)
 
#define UDI_CDC_DATA_DESC_5_HS   UDI_CDC_DATA_DESC_HS(5)
 
#define UDI_CDC_IAD_STRING_ID_6   0
 By default no string associated to these interfaces. More...
 
#define UDI_CDC_COMM_STRING_ID_6   0
 
#define UDI_CDC_DATA_STRING_ID_6   0
 
#define UDI_CDC_IAD_DESC_6   UDI_CDC_IAD_DESC(6)
 
#define UDI_CDC_COMM_DESC_6   UDI_CDC_COMM_DESC(6)
 
#define UDI_CDC_DATA_DESC_6_FS   UDI_CDC_DATA_DESC_FS(6)
 
#define UDI_CDC_DATA_DESC_6_HS   UDI_CDC_DATA_DESC_HS(6)
 

Functions

Interface for application with single CDC interface support
void udi_cdc_ctrl_signal_dcd (bool b_set)
 Notify a state change of DCD signal. More...
 
void udi_cdc_ctrl_signal_dsr (bool b_set)
 Notify a state change of DSR signal. More...
 
void udi_cdc_signal_framing_error (void)
 Notify a framing error. More...
 
void udi_cdc_signal_parity_error (void)
 Notify a parity error. More...
 
void udi_cdc_signal_overrun (void)
 Notify a overrun. More...
 
iram_size_t udi_cdc_get_nb_received_data (void)
 Gets the number of byte received. More...
 
bool udi_cdc_is_rx_ready (void)
 This function checks if a character has been received on the CDC line. More...
 
int udi_cdc_getc (void)
 Waits and gets a value on CDC line. More...
 
iram_size_t udi_cdc_read_buf (void *buf, iram_size_t size)
 Reads a RAM buffer on CDC line. More...
 
iram_size_t udi_cdc_multi_read_no_polling (uint8_t port, void *buf, iram_size_t size)
 Non polling reads of a up to 'size' data from CDC line. More...
 
iram_size_t udi_cdc_read_no_polling (void *buf, iram_size_t size)
 Non polling reads of a up to 'size' data from CDC line. More...
 
iram_size_t udi_cdc_get_free_tx_buffer (void)
 Gets the number of free byte in TX buffer. More...
 
bool udi_cdc_is_tx_ready (void)
 This function checks if a new character sent is possible The type int is used to support scanf redirection from compiler LIB. More...
 
int udi_cdc_putc (int value)
 Puts a byte on CDC line The type int is used to support printf redirection from compiler LIB. More...
 
iram_size_t udi_cdc_write_buf (const void *buf, iram_size_t size)
 Writes a RAM buffer on CDC line. More...
 
Interface for application with multi CDC interfaces support
void udi_cdc_multi_ctrl_signal_dcd (uint8_t port, bool b_set)
 Notify a state change of DCD signal. More...
 
void udi_cdc_multi_ctrl_signal_dsr (uint8_t port, bool b_set)
 Notify a state change of DSR signal. More...
 
void udi_cdc_multi_signal_framing_error (uint8_t port)
 Notify a framing error. More...
 
void udi_cdc_multi_signal_parity_error (uint8_t port)
 Notify a parity error. More...
 
void udi_cdc_multi_signal_overrun (uint8_t port)
 Notify a overrun. More...
 
iram_size_t udi_cdc_multi_get_nb_received_data (uint8_t port)
 Gets the number of byte received. More...
 
bool udi_cdc_multi_is_rx_ready (uint8_t port)
 This function checks if a character has been received on the CDC line. More...
 
int udi_cdc_multi_getc (uint8_t port)
 Waits and gets a value on CDC line. More...
 
iram_size_t udi_cdc_multi_read_buf (uint8_t port, void *buf, iram_size_t size)
 Reads a RAM buffer on CDC line. More...
 
iram_size_t udi_cdc_multi_get_free_tx_buffer (uint8_t port)
 Gets the number of free byte in TX buffer. More...
 
bool udi_cdc_multi_is_tx_ready (uint8_t port)
 This function checks if a new character sent is possible The type int is used to support scanf redirection from compiler LIB. More...
 
int udi_cdc_multi_putc (uint8_t port, int value)
 Puts a byte on CDC line The type int is used to support printf redirection from compiler LIB. More...
 
iram_size_t udi_cdc_multi_write_buf (uint8_t port, const void *buf, iram_size_t size)
 Writes a RAM buffer on CDC line. More...
 

Variables

UDC_DESC_STORAGE udi_api_t udi_api_cdc_comm
 Global structure which contains standard UDI API for UDC. More...
 
UDC_DESC_STORAGE udi_api_t udi_api_cdc_data
 

#define UDI_CDC_PORT_NB   1