#ifndef __CDC_H__ #define __CDC_H__ #ifdef CDC_ENABLED #include "USBDesc.h" #include "USBAPI.h" #include "api/PluggableUSB.h" #define CDC_V1_10 0x0110 #define CDC_COMMUNICATION_INTERFACE_CLASS 0x02 #define CDC_CALL_MANAGEMENT 0x01 #define CDC_ABSTRACT_CONTROL_MODEL 0x02 #define CDC_HEADER 0x00 #define CDC_ABSTRACT_CONTROL_MANAGEMENT 0x02 #define CDC_UNION 0x06 #define CDC_CS_INTERFACE 0x24 #define CDC_CS_ENDPOINT 0x25 #define CDC_DATA_INTERFACE_CLASS 0x0A // CDC CS interface descriptor typedef struct { uint8_t len; // 5 uint8_t dtype; // 0x24 uint8_t subtype; uint8_t d0; uint8_t d1; } CDCCSInterfaceDescriptor; typedef struct { uint8_t len; // 4 uint8_t dtype; // 0x24 uint8_t subtype; uint8_t d0; } CDCCSInterfaceDescriptor4; typedef struct { uint8_t len; uint8_t dtype; // 0x24 uint8_t subtype; // 1 uint8_t bmCapabilities; uint8_t bDataInterface; } CMFunctionalDescriptor; typedef struct { uint8_t len; uint8_t dtype; // 0x24 uint8_t subtype; // 1 uint8_t bmCapabilities; } ACMFunctionalDescriptor; typedef struct { // IAD IADDescriptor iad; // Only needed on compound device // Control InterfaceDescriptor cif; CDCCSInterfaceDescriptor header; ACMFunctionalDescriptor controlManagement; // ACM CDCCSInterfaceDescriptor functionalDescriptor; // CDC_UNION CMFunctionalDescriptor callManagement; // Call Management EndpointDescriptor cifin; // Data InterfaceDescriptor dif; EndpointDescriptor in; EndpointDescriptor out; } CDCDescriptor; typedef struct { uint32_t dwDTERate; uint8_t bCharFormat; uint8_t bParityType; uint8_t bDataBits; uint8_t lineState; } LineInfo; #endif #endif