X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/afe6ae14023c7040befe73e49d00077d3425c564..d475ea4394ba0e16f89300ebeb452cea7c2d9232:/LUFA/Drivers/USB/Class/Host/CDC.h?ds=sidebyside diff --git a/LUFA/Drivers/USB/Class/Host/CDC.h b/LUFA/Drivers/USB/Class/Host/CDC.h index 35c2b2716..e39333ee8 100644 --- a/LUFA/Drivers/USB/Class/Host/CDC.h +++ b/LUFA/Drivers/USB/Class/Host/CDC.h @@ -49,16 +49,70 @@ extern "C" { #endif - /* Function Prototypes: */ - #if defined(INCLUDE_FROM_CDC_CLASS_HOST_C) - static uint8_t CDC_Host_ProcessConfigDescriptor(void); - static uint8_t DComp_CDC_Host_NextCDCControlInterface(void* CurrentDescriptor); - static uint8_t DComp_CDC_Host_NextCDCDataInterface(void* CurrentDescriptor); - static uint8_t DComp_CDC_Host_NextInterfaceCDCDataEndpoint(void* CurrentDescriptor); - #endif - - void CDC_Host_Task(void); - + /* Public Interface - May be used in end-application: */ + /* Type Defines: */ + typedef struct + { + uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device */ + + uint8_t DataINPipeNumber; /**< Pipe number of the CDC interface's IN data pipe */ + uint16_t DataINPipeSize; /**< Size in bytes of the CDC interface's IN data pipe */ + + uint8_t DataOUTPipeNumber; /**< Pipe number of the CDC interface's OUT data pipe */ + uint16_t DataOUTPipeSize; /**< Size in bytes of the CDC interface's OUT data pipe */ + + uint8_t NotificationPipeNumber; /**< Pipe number of the CDC interface's IN notification endpoint, if used */ + uint16_t NotificationPipeSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used */ + + uint8_t ControlLineState; /**< Current control line states */ + + struct + { + uint32_t BaudRateBPS; /**< Baud rate of the virtual serial port, in bits per second */ + uint8_t CharFormat; /**< Character format of the virtual serial port, a value from the + * CDCDevice_CDC_LineCodingFormats_t enum + */ + uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the + * CDCDevice_LineCodingParity_t enum + */ + uint8_t DataBits; /**< Bits of data per character of the virtual serial port */ + } LineEncoding; + } USB_ClassInfo_CDC_Host_t; + + /* Enums: */ + typedef enum + { + CDC_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully */ + CDC_ENUMERROR_ControlError = 1, /**< A control request to the device failed to complete successfully */ + CDC_ENUMERROR_DescriptorTooLarge = 2, /**< The device's Configuration Descriptor is too large to process */ + CDC_ENUMERROR_InvalidConfigDataReturned = 3, /**< The device returned an invalid Configuration Descriptor */ + CDC_ENUMERROR_NoCDCInterfaceFound = 4, /**< A compatible CDC interface was not found in the device's Configuration Descriptor */ + CDC_ENUMERROR_NoEndpointFound = 5, /**< Compatible CDC endpoints were not found in the device's CDC interface */ + } CDCHost_EnumerationFailure_ErrorCodes_t; + + /* Function Prototypes: */ + void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo); + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + /* Macros: */ + #define CDC_CONTROL_CLASS 0x02 + #define CDC_CONTROL_SUBCLASS 0x02 + #define CDC_CONTROL_PROTOCOL 0x01 + #define CDC_DATA_CLASS 0x0A + #define CDC_DATA_SUBCLASS 0x00 + #define CDC_DATA_PROTOCOL 0x00 + + /* Function Prototypes: */ + #if defined(INCLUDE_FROM_CDC_CLASS_HOST_C) + static uint8_t CDC_Host_ProcessConfigDescriptor(void); + static uint8_t DComp_CDC_Host_NextCDCControlInterface(void* CurrentDescriptor); + static uint8_t DComp_CDC_Host_NextCDCDataInterface(void* CurrentDescriptor); + static uint8_t DComp_CDC_Host_NextInterfaceCDCDataEndpoint(void* CurrentDescriptor); + #endif + + #endif + /* Disable C linkage for C++ Compilers: */ #if defined(__cplusplus) }