48 #ifndef  UDI_CDC_PORT_NB    49 # define  UDI_CDC_PORT_NB 1    51 #if (UDI_CDC_PORT_NB < 1) || (UDI_CDC_PORT_NB > 7)    52 # error UDI_CDC_PORT_NB must be between 1 and 7   116 #define UDI_CDC_COMM_EP_SIZE        64   117 #define UDI_CDC_DATA_EPS_FS_SIZE    64   119 #define UDI_CDC_DATA_EPS_HS_SIZE    512   127 #ifndef UDI_CDC_IAD_STRING_ID_0   129 #define UDI_CDC_IAD_STRING_ID_0   0   131 #ifndef UDI_CDC_COMM_STRING_ID_0   132 #define UDI_CDC_COMM_STRING_ID_0   0   134 #ifndef UDI_CDC_DATA_STRING_ID_0   135 #define UDI_CDC_DATA_STRING_ID_0   0   137 #define UDI_CDC_IAD_DESC_0      UDI_CDC_IAD_DESC(0)   138 #define UDI_CDC_COMM_DESC_0     UDI_CDC_COMM_DESC(0)   139 #define UDI_CDC_DATA_DESC_0_FS  UDI_CDC_DATA_DESC_FS(0)   140 #define UDI_CDC_DATA_DESC_0_HS  UDI_CDC_DATA_DESC_HS(0)   143 #ifndef UDI_CDC_IAD_STRING_ID_1   144 #define UDI_CDC_IAD_STRING_ID_1  0   146 #ifndef UDI_CDC_COMM_STRING_ID_1   147 #define UDI_CDC_COMM_STRING_ID_1 0   149 #ifndef UDI_CDC_DATA_STRING_ID_1   150 #define UDI_CDC_DATA_STRING_ID_1 0   152 #define UDI_CDC_IAD_DESC_1      UDI_CDC_IAD_DESC(1)   153 #define UDI_CDC_COMM_DESC_1     UDI_CDC_COMM_DESC(1)   154 #define UDI_CDC_DATA_DESC_1_FS  UDI_CDC_DATA_DESC_FS(1)   155 #define UDI_CDC_DATA_DESC_1_HS  UDI_CDC_DATA_DESC_HS(1)   158 #ifndef UDI_CDC_IAD_STRING_ID_2   159 #define UDI_CDC_IAD_STRING_ID_2   0   161 #ifndef UDI_CDC_COMM_STRING_ID_2   162 #define UDI_CDC_COMM_STRING_ID_2   0   164 #ifndef UDI_CDC_DATA_STRING_ID_2   165 #define UDI_CDC_DATA_STRING_ID_2   0   167 #define UDI_CDC_IAD_DESC_2      UDI_CDC_IAD_DESC(2)   168 #define UDI_CDC_COMM_DESC_2     UDI_CDC_COMM_DESC(2)   169 #define UDI_CDC_DATA_DESC_2_FS  UDI_CDC_DATA_DESC_FS(2)   170 #define UDI_CDC_DATA_DESC_2_HS  UDI_CDC_DATA_DESC_HS(2)   173 #ifndef UDI_CDC_IAD_STRING_ID_3   174 #define UDI_CDC_IAD_STRING_ID_3   0   176 #ifndef UDI_CDC_COMM_STRING_ID_3   177 #define UDI_CDC_COMM_STRING_ID_3   0   179 #ifndef UDI_CDC_DATA_STRING_ID_3   180 #define UDI_CDC_DATA_STRING_ID_3   0   182 #define UDI_CDC_IAD_DESC_3      UDI_CDC_IAD_DESC(3)   183 #define UDI_CDC_COMM_DESC_3     UDI_CDC_COMM_DESC(3)   184 #define UDI_CDC_DATA_DESC_3_FS  UDI_CDC_DATA_DESC_FS(3)   185 #define UDI_CDC_DATA_DESC_3_HS  UDI_CDC_DATA_DESC_HS(3)   188 #ifndef UDI_CDC_IAD_STRING_ID_4   189 #define UDI_CDC_IAD_STRING_ID_4   0   191 #ifndef UDI_CDC_COMM_STRING_ID_4   192 #define UDI_CDC_COMM_STRING_ID_4   0   194 #ifndef UDI_CDC_DATA_STRING_ID_4   195 #define UDI_CDC_DATA_STRING_ID_4   0   197 #define UDI_CDC_IAD_DESC_4      UDI_CDC_IAD_DESC(4)   198 #define UDI_CDC_COMM_DESC_4     UDI_CDC_COMM_DESC(4)   199 #define UDI_CDC_DATA_DESC_4_FS  UDI_CDC_DATA_DESC_FS(4)   200 #define UDI_CDC_DATA_DESC_4_HS  UDI_CDC_DATA_DESC_HS(4)   203 #ifndef UDI_CDC_IAD_STRING_ID_5   204 #define UDI_CDC_IAD_STRING_ID_5   0   206 #ifndef UDI_CDC_COMM_STRING_ID_5   207 #define UDI_CDC_COMM_STRING_ID_5   0   209 #ifndef UDI_CDC_DATA_STRING_ID_5   210 #define UDI_CDC_DATA_STRING_ID_5   0   212 #define UDI_CDC_IAD_DESC_5      UDI_CDC_IAD_DESC(5)   213 #define UDI_CDC_COMM_DESC_5     UDI_CDC_COMM_DESC(5)   214 #define UDI_CDC_DATA_DESC_5_FS  UDI_CDC_DATA_DESC_FS(5)   215 #define UDI_CDC_DATA_DESC_5_HS  UDI_CDC_DATA_DESC_HS(5)   218 #ifndef UDI_CDC_IAD_STRING_ID_6   219 #define UDI_CDC_IAD_STRING_ID_6   0   221 #ifndef UDI_CDC_COMM_STRING_ID_6   222 #define UDI_CDC_COMM_STRING_ID_6   0   224 #ifndef UDI_CDC_DATA_STRING_ID_6   225 #define UDI_CDC_DATA_STRING_ID_6   0   227 #define UDI_CDC_IAD_DESC_6      UDI_CDC_IAD_DESC(6)   228 #define UDI_CDC_COMM_DESC_6     UDI_CDC_COMM_DESC(6)   229 #define UDI_CDC_DATA_DESC_6_FS  UDI_CDC_DATA_DESC_FS(6)   230 #define UDI_CDC_DATA_DESC_6_HS  UDI_CDC_DATA_DESC_HS(6)   235 #define UDI_CDC_IAD_DESC(port) { \   236    .bLength                      = sizeof(usb_iad_desc_t),\   237    .bDescriptorType              = USB_DT_IAD,\   238    .bInterfaceCount              = 2,\   239    .bFunctionClass               = CDC_CLASS_COMM,\   240    .bFunctionSubClass            = CDC_SUBCLASS_ACM,\   241    .bFunctionProtocol            = CDC_PROTOCOL_V25TER,\   242    .bFirstInterface              = UDI_CDC_COMM_IFACE_NUMBER_##port,\   243    .iFunction                    = UDI_CDC_IAD_STRING_ID_##port,\   247 #define UDI_CDC_COMM_DESC(port) { \   248    .iface.bLength                = sizeof(usb_iface_desc_t),\   249    .iface.bDescriptorType        = USB_DT_INTERFACE,\   250    .iface.bAlternateSetting      = 0,\   251    .iface.bNumEndpoints          = 1,\   252    .iface.bInterfaceClass        = CDC_CLASS_COMM,\   253    .iface.bInterfaceSubClass     = CDC_SUBCLASS_ACM,\   254    .iface.bInterfaceProtocol     = CDC_PROTOCOL_V25TER,\   255    .header.bFunctionLength       = sizeof(usb_cdc_hdr_desc_t),\   256    .header.bDescriptorType       = CDC_CS_INTERFACE,\   257    .header.bDescriptorSubtype    = CDC_SCS_HEADER,\   258    .header.bcdCDC                = LE16(0x0110),\   259    .call_mgmt.bFunctionLength    = sizeof(usb_cdc_call_mgmt_desc_t),\   260    .call_mgmt.bDescriptorType    = CDC_CS_INTERFACE,\   261    .call_mgmt.bDescriptorSubtype = CDC_SCS_CALL_MGMT,\   262    .call_mgmt.bmCapabilities     = \   263                         CDC_CALL_MGMT_SUPPORTED | CDC_CALL_MGMT_OVER_DCI,\   264    .acm.bFunctionLength          = sizeof(usb_cdc_acm_desc_t),\   265    .acm.bDescriptorType          = CDC_CS_INTERFACE,\   266    .acm.bDescriptorSubtype       = CDC_SCS_ACM,\   267    .acm.bmCapabilities           = CDC_ACM_SUPPORT_LINE_REQUESTS,\   268    .union_desc.bFunctionLength   = sizeof(usb_cdc_union_desc_t),\   269    .union_desc.bDescriptorType   = CDC_CS_INTERFACE,\   270    .union_desc.bDescriptorSubtype= CDC_SCS_UNION,\   271    .ep_notify.bLength            = sizeof(usb_ep_desc_t),\   272    .ep_notify.bDescriptorType    = USB_DT_ENDPOINT,\   273    .ep_notify.bmAttributes       = USB_EP_TYPE_INTERRUPT,\   274    .ep_notify.wMaxPacketSize     = LE16(UDI_CDC_COMM_EP_SIZE),\   275    .ep_notify.bInterval          = 0x10,\   276    .ep_notify.bEndpointAddress   = UDI_CDC_COMM_EP_##port,\   277    .iface.bInterfaceNumber       = UDI_CDC_COMM_IFACE_NUMBER_##port,\   278    .call_mgmt.bDataInterface     = UDI_CDC_DATA_IFACE_NUMBER_##port,\   279    .union_desc.bMasterInterface  = UDI_CDC_COMM_IFACE_NUMBER_##port,\   280    .union_desc.bSlaveInterface0  = UDI_CDC_DATA_IFACE_NUMBER_##port,\   281    .iface.iInterface             = UDI_CDC_COMM_STRING_ID_##port,\   285 #define UDI_CDC_DATA_DESC_COMMON \   286    .iface.bLength                = sizeof(usb_iface_desc_t),\   287    .iface.bDescriptorType        = USB_DT_INTERFACE,\   288    .iface.bAlternateSetting      = 0,\   289    .iface.bNumEndpoints          = 2,\   290    .iface.bInterfaceClass        = CDC_CLASS_DATA,\   291    .iface.bInterfaceSubClass     = 0,\   292    .iface.bInterfaceProtocol     = 0,\   293    .ep_in.bLength                = sizeof(usb_ep_desc_t),\   294    .ep_in.bDescriptorType        = USB_DT_ENDPOINT,\   295    .ep_in.bmAttributes           = USB_EP_TYPE_BULK,\   296    .ep_in.bInterval              = 0,\   297    .ep_out.bLength               = sizeof(usb_ep_desc_t),\   298    .ep_out.bDescriptorType       = USB_DT_ENDPOINT,\   299    .ep_out.bmAttributes          = USB_EP_TYPE_BULK,\   300    .ep_out.bInterval             = 0,   302 #define UDI_CDC_DATA_DESC_FS(port) { \   303    UDI_CDC_DATA_DESC_COMMON \   304    .ep_in.wMaxPacketSize         = LE16(UDI_CDC_DATA_EPS_FS_SIZE),\   305    .ep_out.wMaxPacketSize        = LE16(UDI_CDC_DATA_EPS_FS_SIZE),\   306    .ep_in.bEndpointAddress       = UDI_CDC_DATA_EP_IN_##port,\   307    .ep_out.bEndpointAddress      = UDI_CDC_DATA_EP_OUT_##port,\   308    .iface.bInterfaceNumber       = UDI_CDC_DATA_IFACE_NUMBER_##port,\   309    .iface.iInterface             = UDI_CDC_DATA_STRING_ID_##port,\   312 #define UDI_CDC_DATA_DESC_HS(port) { \   313    UDI_CDC_DATA_DESC_COMMON \   314    .ep_in.wMaxPacketSize         = LE16(UDI_CDC_DATA_EPS_HS_SIZE),\   315    .ep_out.wMaxPacketSize        = LE16(UDI_CDC_DATA_EPS_HS_SIZE),\   316    .ep_in.bEndpointAddress       = UDI_CDC_DATA_EP_IN_##port,\   317    .ep_out.bEndpointAddress      = UDI_CDC_DATA_EP_OUT_##port,\   318    .iface.bInterfaceNumber       = UDI_CDC_DATA_IFACE_NUMBER_##port,\   319    .iface.iInterface             = UDI_CDC_DATA_STRING_ID_##port,\   800 #endif // _UDI_CDC_H_ Communication Class interface descriptor. 
 
void udi_cdc_ctrl_signal_dsr(bool b_set)
Notify a state change of DSR signal. 
 
void udi_cdc_ctrl_signal_dcd(bool b_set)
Notify a state change of DCD signal. 
 
Common API for USB Device Interface. 
 
Common API for USB Device Drivers (UDD) 
 
USB configuration file for CDC application. 
 
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 redire...
 
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...
 
usb_iface_desc_t iface
Standard interface descriptor. 
 
USB protocol definitions. 
 
usb_cdc_acm_desc_t acm
CDC Abstract Control Model functional descriptor. 
 
Common API for USB Device Interface. 
 
void udi_cdc_signal_parity_error(void)
Notify a parity error. 
 
Data Class interface descriptor. 
 
GeneratorWrapper< T > value(T &&value)
 
void udi_cdc_signal_overrun(void)
Notify a overrun. 
 
void udi_cdc_multi_ctrl_signal_dsr(uint8_t port, bool b_set)
Notify a state change of DSR signal. 
 
iram_size_t udi_cdc_multi_read_buf(uint8_t port, void *buf, iram_size_t size)
Reads a RAM buffer on CDC line. 
 
void udi_cdc_multi_signal_parity_error(uint8_t port)
Notify a parity error. 
 
iram_size_t udi_cdc_get_nb_received_data(void)
Gets the number of byte received. 
 
iram_size_t udi_cdc_get_free_tx_buffer(void)
Gets the number of free byte in TX buffer. 
 
UDC_DESC_STORAGE udi_api_t udi_api_cdc_comm
Global structure which contains standard UDI API for UDC. 
 
iram_size_t udi_cdc_write_buf(const void *buf, iram_size_t size)
Writes a RAM buffer on CDC line. 
 
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. 
 
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 redire...
 
UDC_DESC_STORAGE udi_api_t udi_api_cdc_data
 
usb_iface_desc_t iface
Standard interface descriptor. 
 
bool udi_cdc_is_rx_ready(void)
This function checks if a character has been received on the CDC line. 
 
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. 
 
CDC Call Management Functional Descriptor. 
 
Standard USB interface descriptor structure. 
 
usb_ep_desc_t ep_notify
Notification endpoint descriptor. 
 
CDC Union Functional Descriptor. 
 
int udi_cdc_getc(void)
Waits and gets a value on CDC line. 
 
bool udi_cdc_multi_is_rx_ready(uint8_t port)
This function checks if a character has been received on the CDC line. 
 
iram_size_t udi_cdc_multi_get_nb_received_data(uint8_t port)
Gets the number of byte received. 
 
usb_cdc_hdr_desc_t header
CDC Header functional descriptor. 
 
int udi_cdc_multi_getc(uint8_t port)
Waits and gets a value on CDC line. 
 
Standard USB endpoint descriptor structure. 
 
void udi_cdc_multi_ctrl_signal_dcd(uint8_t port, bool b_set)
Notify a state change of DCD signal. 
 
usb_cdc_union_desc_t union_desc
CDC Union functional descriptor. 
 
#define UDC_DESC_STORAGE
Defines the memory's location of USB descriptors. 
 
iram_size_t udi_cdc_multi_get_free_tx_buffer(uint8_t port)
Gets the number of free byte in TX buffer. 
 
void udi_cdc_signal_framing_error(void)
Notify a framing error. 
 
usb_cdc_call_mgmt_desc_t call_mgmt
CDC Call Management functional descriptor. 
 
usb_ep_desc_t ep_in
Data IN/OUT endpoint descriptors. 
 
USB Communication Device Class (CDC) protocol definitions. 
 
CDC Header Functional Descriptor. 
 
int udi_cdc_putc(int value)
Puts a byte on CDC line The type int is used to support printf redirection from compiler LIB...
 
iram_size_t udi_cdc_read_buf(void *buf, iram_size_t size)
Reads a RAM buffer on CDC line. 
 
void udi_cdc_multi_signal_framing_error(uint8_t port)
Notify a framing error. 
 
CDC ACM Functional Descriptor. 
 
void udi_cdc_multi_signal_overrun(uint8_t port)
Notify a overrun.