USB_CONFIGUARTION_DESC_SIZE, /* bLength */ USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL( /* wTotalLength */ 1 * USB_CONFIGUARTION_DESC_SIZE + 1 * USB_INTERFACE_DESC_SIZE + /* communication interface */ 0x0013 + /* CDC functions */ 1 * USB_ENDPOINT_DESC_SIZE + /* interrupt endpoint */ 1 * USB_INTERFACE_DESC_SIZE + /* data interface */ 2 * USB_ENDPOINT_DESC_SIZE /* bulk endpoints */ ), 0x02, /* bNumInterfaces */ 0x01, /* bConfigurationValue: 0x01 is used to select this configuration */ 0x00, /* iConfiguration: no string to describe this configuration */ USB_CONFIG_BUS_POWERED /*|*/ /* bmAttributes */ /* USB_CONFIG_REMOTE_WAKEUP */, USB_CONFIG_POWER_MA(100), /* bMaxPower, device power consumption is 100 mA */ /* Interface 0, Alternate Setting 0, Communication class interface descriptor */ USB_INTERFACE_DESC_SIZE, /* bLength */ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ USB_CDC_CIF_NUM, /* bInterfaceNumber: Number of Interface */ 0x00, /* bAlternateSetting: Alternate setting */ 0x01, /* bNumEndpoints: One endpoint used */ CDC_COMMUNICATION_INTERFACE_CLASS, /* bInterfaceClass: Communication Interface Class */ CDC_ABSTRACT_CONTROL_MODEL, /* bInterfaceSubClass: Abstract Control Model */ 0x00, /* bInterfaceProtocol: no protocol used */ 0x03, /* iInterface: */ /* Header Functional Descriptor */ 0x05, /* bLength: Endpoint Descriptor size */ CDC_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */ CDC_HEADER, /* bDescriptorSubtype: Header Func Desc */ WBVAL(CDC_V1_10), /* 1.10 */ /* bcdCDC */
/* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */ const uint8_t USB_ConfigDescriptor[] = { /* Configuration 1 */ USB_CONFIGUARTION_DESC_SIZE, /* bDescriptorType */ USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL( /* wTotalLength */ 1*USB_CONFIGUARTION_DESC_SIZE + 1*USB_INTERFACE_DESC_SIZE + 2*USB_ENDPOINT_DESC_SIZE ), 0x01, /* bNumInterfaces */ 0x01, /* bConfigurationValue */ 0x00, /* iConfiguration */ USB_CONFIG_BUS_POWERED /*|*/ /* bmAttributes */ /*USB_CONFIG_REMOTE_WAKEUP*/, USB_CONFIG_POWER_MA(100), /* bMaxPower */ /* Interface 0, Alternate Setting 0, MSC Class */ USB_INTERFACE_DESC_SIZE, /* bLength */ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ 0x00, /* bInterfaceNumber */ 0x00, /* bAlternateSetting */ 0x02, /* bNumEndpoints */ USB_DEVICE_CLASS_STORAGE, /* bInterfaceClass */ MSC_SUBCLASS_SCSI, /* bInterfaceSubClass */ MSC_PROTOCOL_BULK_ONLY, /* bInterfaceProtocol */ 0x62, /* iInterface */ /* Bulk In Endpoint */ USB_ENDPOINT_DESC_SIZE, /* bLength */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ USB_ENDPOINT_IN(2), /* bEndpointAddress */ USB_ENDPOINT_TYPE_BULK, /* bmAttributes */
}; /* USB VIDEO device Configuration Descriptor */ static uint8_t usbd_video_CfgDesc[] = { /* Configuration 1 */ USB_CONFIGUARTION_DESC_SIZE, // bLength 9 USB_CONFIGURATION_DESCRIPTOR_TYPE, // bDescriptorType 2 WBVAL(USB_VIDEO_DESC_SIZ), 0x02, // bNumInterfaces 2 0x01, // bConfigurationValue 1 ID of this configuration 0x00, // iConfiguration 0 no description available USB_CONFIG_BUS_POWERED , // bmAttributes 0x80 Bus Powered USB_CONFIG_POWER_MA(100), // bMaxPower 100 mA /* Interface Association Descriptor */ UVC_INTERFACE_ASSOCIATION_DESC_SIZE, // bLength 8 USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE, // bDescriptorType 11 0x00, // bFirstInterface 0 0x02, // bInterfaceCount 2 CC_VIDEO, // bFunctionClass 14 Video SC_VIDEO_INTERFACE_COLLECTION, // bFunctionSubClass 3 Video Interface Collection PC_PROTOCOL_UNDEFINED, // bInterfaceProtocol 0 (protocol undefined) 0x02, // iFunction 2 /* VideoControl Interface Descriptor */
*/ ALIGNED(4) uint8_t USB_msc_FsConfigDescriptor[] = { /* Configuration 1 */ USB_CONFIGURATION_DESC_SIZE, /* bLength */ USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL( /* wTotalLength */ USB_CONFIGURATION_DESC_SIZE + USB_INTERFACE_DESC_SIZE + /* MSC interface */ 2 * USB_ENDPOINT_DESC_SIZE + /* bulk endpoints */ 0 ), 0x01, /* bNumInterfaces */ 0x01, /* bConfigurationValue */ 0x00, /* iConfiguration */ USB_CONFIG_SELF_POWERED, /* bmAttributes */ USB_CONFIG_POWER_MA(2), /* bMaxPower */ /* Interface 0, Alternate Setting 0, MSC class interface descriptor */ USB_INTERFACE_DESC_SIZE, /* bLength */ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ USB_MSC_IF_NUM, /* bInterfaceNumber: Number of Interface */ 0x00, /* bAlternateSetting: Alternate setting */ 0x02, /* bNumEndpoints: One endpoint used */ USB_DEVICE_CLASS_STORAGE, /* bInterfaceClass: Communication Interface Class */ MSC_SUBCLASS_SCSI, /* bInterfaceSubClass: Abstract Control Model */ MSC_PROTOCOL_BULK_ONLY, /* bInterfaceProtocol: no protocol used */ 0x04, /* iInterface: */ /* Endpoint, EP Bulk Out */ USB_ENDPOINT_DESC_SIZE, /* bLength */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
}, { .num_altsetting = 1, .altsetting = msc_iface, } }; static const struct usb_config_descriptor config = { .bLength = USB_DT_CONFIGURATION_SIZE, .bDescriptorType = USB_DT_CONFIGURATION, .wTotalLength = 0, .bNumInterfaces = 3, .bConfigurationValue = 1, .iConfiguration = 0, .bmAttributes = USB_CONFIG_ATTR_BUS_POWERED, .bMaxPower = USB_CONFIG_POWER_MA(500), //0xFA = 500mA, 0x32 = 100mA .interface = ifaces, }; static const char *usb_strings[] = { "CB Innovations", /* Index 0x01: Manufacturer */ "GCS BIOS USB Test", /* Index 0x02: Product */ "GCS Test", /* Index 0x03: Serial Number */ }; static usbd_device *usbd_dev; static uint32_t controlBuffer[(128 / sizeof (uint32_t))]; static uint16_t tx_ep_sizes[5]; static int usbmanager_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, u8 **buf,
*/ ALIGNED(4) uint8_t USB_FsConfigDescriptor[] = { /* Configuration 1 */ USB_CONFIGURATION_DESC_SIZE, /* bLength */ USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL( USB_CONFIGURATION_DESC_SIZE + USB_INTERFACE_DESC_SIZE + USB_ENDPOINT_DESC_SIZE + USB_ENDPOINT_DESC_SIZE ), /* wTotalLength */ 0x01, /* bNumInterfaces: Number of interfaces supported by this configuration. */ 0x01, /* bConfigurationValue: Value to use as an argument to Set Configuration to select this configuration. */ 0x04, /* iConfiguration: Index of string descriptor describing this configuration. */ USB_CONFIG_SELF_POWERED, /* bmAttributes */ USB_CONFIG_POWER_MA(100), /* bMaxPower: 100mA */ /* Interface 0, Alternate Setting 0, MSC Class */ USB_INTERFACE_DESC_SIZE, /* bLength */ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ 0, /* bInterfaceNumber: Number of Interface */ 0x00, /* bAlternateSetting: Alternate setting */ 0x02, /* bNumEndpoints: Two endpoints used */ USB_DEVICE_CLASS_STORAGE, /* bInterfaceClass: Storage device class */ MSC_SUBCLASS_SCSI, /* bInterfaceSubClass: MSC Subclass */ MSC_PROTOCOL_BULK_ONLY, /* bInterfaceProtocol: MSC Protocol */ 0x05, /* iInterface: Index to string descriptor containing interface description. */ /* Bulk In Endpoint */ USB_ENDPOINT_DESC_SIZE, /* bLength */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ MSC_EP_IN, /* bEndpointAddress */ USB_ENDPOINT_TYPE_BULK, /* bmAttributes */
.SerialNumStrIndex = USE_INTERNAL_SERIAL, .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS, }; const USB_Descriptor_Configuration_t PROGMEM configuration_descriptor = { .Config = { .Header = { .Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration, }, .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), .TotalInterfaces = 2, .ConfigurationNumber = 1, .ConfigurationStrIndex = NO_DESCRIPTOR, .ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_SELFPOWERED), .MaxPowerConsumption = USB_CONFIG_POWER_MA(DEMO_MAX_POWER), }, .CDC_CCI_Interface = { .Header = { .Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface, }, .InterfaceNumber = 0, .AlternateSetting = 0, .TotalEndpoints = 1, .Class = CDC_CSCP_CDCClass, .SubClass = CDC_CSCP_ACMSubclass, .Protocol = CDC_CSCP_ATCommandProtocol, .InterfaceStrIndex = NO_DESCRIPTOR, }, .CDC_Functional_Header = {