95 lines
3.6 KiB
C
95 lines
3.6 KiB
C
#ifndef _USB_DESC_H
|
|
#define _USB_DESC_H
|
|
|
|
#include "../usb_device_types.h"
|
|
|
|
#define USBF_NOF_CONFIGURATIONS (1) // Number of configurations
|
|
|
|
// ---------------------------
|
|
|
|
extern const USB_DeviceDesc devDesc; /* Device Descriptor */
|
|
extern const USB_DeviceQualifierDesc devQualDesc; /* Device Qualifier descriptor */
|
|
typedef struct _USB_HeaderFunctionalDescriptor {
|
|
uint8_t bLength;
|
|
uint8_t bDescriptorType;
|
|
uint8_t bDescriptorSubType;
|
|
uint16_t bcdCDC;
|
|
} __attribute__((packed)) USB_HeaderFunctionalDescriptor;
|
|
typedef struct _USB_AbstractControlManagementFunctionalDescriptor {
|
|
uint8_t bLength;
|
|
uint8_t bDescriptorType;
|
|
uint8_t bDescriptorSubType;
|
|
uint8_t bmCapabilities;
|
|
} __attribute__((packed)) USB_AbstractControlManagementFunctionalDescriptor;
|
|
typedef struct _USB_UnionFunctionalDescriptor {
|
|
uint8_t bLength;
|
|
uint8_t bDescriptorType;
|
|
uint8_t bDescriptorSubType;
|
|
uint8_t bMasterInterface;
|
|
uint8_t bSlaveInterface0;
|
|
} __attribute__((packed)) USB_UnionFunctionalDescriptor;
|
|
typedef struct _USB_CallManagementFunctionalDescriptor {
|
|
uint8_t bLength;
|
|
uint8_t bDescriptorType;
|
|
uint8_t bDescriptorSubType;
|
|
uint8_t bmCapabilities;
|
|
uint8_t dDataInterface;
|
|
} __attribute__((packed)) USB_CallManagementFunctionalDescriptor;
|
|
typedef struct _FullConfigurations0 {
|
|
USB_ConfigurationDesc config; /* Configuration descriptor */
|
|
USB_InterfaceDesc intf0; /* Interface descriptor : 0 */
|
|
USB_HeaderFunctionalDescriptor intf0hfd; /* Header Functional descriptor */
|
|
USB_AbstractControlManagementFunctionalDescriptor intf0acmfd; /* Abstract Control Management Functional descriptor */
|
|
USB_UnionFunctionalDescriptor intf0ufd; /* Union Functional descriptor */
|
|
USB_CallManagementFunctionalDescriptor intf0cmfd; /* Call Management Functional descriptor */
|
|
USB_EndpointDesc ep2in; /* Endpoint descriptor : 2 in */
|
|
USB_InterfaceDesc intf1; /* Interface descriptor : 1 */
|
|
USB_EndpointDesc ep1in; /* Endpoint descriptor : 1 in */
|
|
USB_EndpointDesc ep1out; /* Endpoint descriptor : 1 out */
|
|
USB_InterfaceDesc intf2; /* Interface descriptor : 2 */
|
|
USB_EndpointDesc ep3in; /* Endpoint descriptor : 3 in */
|
|
USB_EndpointDesc ep3out; /* Endpoint descriptor : 3 out */
|
|
} __attribute__((packed)) FullConfigurations0;
|
|
|
|
extern const FullConfigurations0 fullConfDescs0;
|
|
|
|
// ---------------------------
|
|
|
|
typedef USB_ConfigurationDesc *ConfDescs[1];
|
|
extern const ConfDescs confDescs;
|
|
typedef struct _USB_StrDesc_lang_id {
|
|
uint8_t bLength;
|
|
uint8_t bDescriptorType;
|
|
uint16_t bString;
|
|
} __attribute__((packed)) USB_StrDesc_lang_id;
|
|
|
|
extern const USB_StrDesc_lang_id lang_id; /* String descriptor */
|
|
typedef struct _USB_StrDesc_vendor_string {
|
|
uint8_t bLength;
|
|
uint8_t bDescriptorType;
|
|
uint16_t bString[7];
|
|
} __attribute__((packed)) USB_StrDesc_vendor_string;
|
|
|
|
extern const USB_StrDesc_vendor_string vendor_string; /* String descriptor */
|
|
typedef struct _USB_StrDesc_product_string {
|
|
uint8_t bLength;
|
|
uint8_t bDescriptorType;
|
|
uint16_t bString[10];
|
|
} __attribute__((packed)) USB_StrDesc_product_string;
|
|
|
|
extern const USB_StrDesc_product_string product_string; /* String descriptor */
|
|
typedef struct _USB_StrDesc_serial_number {
|
|
uint8_t bLength;
|
|
uint8_t bDescriptorType;
|
|
uint16_t bString[4];
|
|
} __attribute__((packed)) USB_StrDesc_serial_number;
|
|
|
|
extern const USB_StrDesc_serial_number serial_number; /* String descriptor */
|
|
|
|
// ---------------------------
|
|
|
|
typedef USB_StringDesc *StringDescs[4];
|
|
extern const StringDescs strDescs;
|
|
|
|
#endif // _USB_DESC_H
|