avr-fw-modules/usb/include/usb/usb_spec_cdc.h

82 lines
1.4 KiB
C

#pragma once
#include <stdint.h>
#define CS_INTERFACE 0x24
#define CS_ENDPOINT 0x25
#define CS_SUB_HEADER 0x00
#define CS_SUB_ACM 0x02
#define CS_SUB_UNION 0x06
#define CDC_DEVICE_CLASS 0x02
#define CDC_INTERFACE_CLASS 0x02
#define CDC_INTERFACE_SUBCLASS_ACM 0x02
#define CDC_INTERFACE_DATA_CLASS 0x0A
#define CDC_REQUEST_GETLINECODING 0x21
#define CDC_REQUEST_SETLINECODING 0x20
#define CDC_REQUEST_SETCONTROL_LINE_STATE 0x22
#define CDC_REQUEST_SENDBREAK 0x23
struct usb_cdc_linecoding
{
uint32_t dwDTERate;
uint8_t bCharFormat;
uint8_t bParityType;
uint8_t bDataBits;
};
struct usb_cdc_functional_header
{
uint8_t bFunctionLength;
uint8_t bDescriptorType;
uint8_t bDescriptorSubtype;
uint16_t bcdCDC;
};
struct usb_cdc_functional_acm
{
uint8_t bFunctionLength;
uint8_t bDescriptorType;
uint8_t bDescriptorSubtype;
uint8_t bmCapabilities;
};
struct usb_cdc_functional_union
{
uint8_t bFunctionLength;
uint8_t bDescriptorType;
uint8_t bDescriptorSubtype;
uint8_t bControlInterface;
uint8_t bSubordinateInterface0;
};
struct usb_cdc_functional_union_interface
{
uint8_t bSubordinateInterface0;
};
typedef struct {
union {
uint16_t value;
struct {
uint16_t dtr:1;
uint16_t rts:1;
};
};
} cdc_linestate_t;
extern cdc_linestate_t _usb_cdc;
int usb_cdc_setup_request(int endpoint,usb_device_request_t *request);