USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */ USB_DESC_BYTE (0x02), /* bDescriptorSubtype (Abstract Control Management Descriptor). */ USB_DESC_BYTE (0x02), /* bmCapabilities. */ /* Union Functional Descriptor.*/ USB_DESC_BYTE (5), /* bFunctionLength. */ USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */ USB_DESC_BYTE (0x06), /* bDescriptorSubtype (Union Functional Descriptor). */ USB_DESC_BYTE (0x00), /* bMasterInterface (Communication Class Interface). */ USB_DESC_BYTE (0x01), /* bSlaveInterface0 (Data Class Interface). */ /* Endpoint 2 Descriptor.*/ USB_DESC_ENDPOINT (USB_CDC_INTERRUPT_REQUEST_EP|0x80, 0x03, /* bmAttributes (Interrupt). */ 0x0008, /* wMaxPacketSize. */ 0xFF), /* bInterval. */ /* Interface Descriptor.*/ USB_DESC_INTERFACE (0x01, /* bInterfaceNumber. */ 0x00, /* bAlternateSetting. */ 0x02, /* bNumEndpoints. */ 0x0A, /* bInterfaceClass (Data Class Interface, CDC section 4.5). */ 0x00, /* bInterfaceSubClass (CDC section 4.6). */ 0x00, /* bInterfaceProtocol (CDC section 4.7). */ 0x00), /* iInterface. */ /* Endpoint 3 Descriptor.*/ USB_DESC_ENDPOINT (USB_CDC_DATA_AVAILABLE_EP, /* bEndpointAddress.*/ 0x02, /* bmAttributes (Bulk). */
0x00, /* bInterfaceSubClass: None */ 0x00, /* bInterfaceProtocol: None */ 0), /* iInterface */ /* HID descriptor (9 bytes) */ USB_DESC_BYTE(9), /* bLength */ USB_DESC_BYTE(0x21), /* bDescriptorType (HID class) */ USB_DESC_BCD(0x0111), /* bcdHID: HID version 1.11 */ USB_DESC_BYTE(0), /* bCountryCode */ USB_DESC_BYTE(1), /* bNumDescriptors */ USB_DESC_BYTE(0x22), /* bDescriptorType (report desc) */ USB_DESC_WORD(sizeof(hid_report_descriptor_data)), /* wDescriptorLength */ /* HID debug Endpoint (IN) Descriptor (7 bytes) */ USB_DESC_ENDPOINT(DEBUG_TX_ENDPOINT | 0x80, /* bEndpointAddress */ 0x03, /* bmAttributes (Interrupt) */ DEBUG_TX_SIZE, /* wMaxPacketSize */ 1) /* bInterval */ }; /* Configuration Descriptor wrapper */ static const USBDescriptor hid_configuration_descriptor = { sizeof hid_configuration_descriptor_data, hid_configuration_descriptor_data }; /* HID descriptor wrapper */ static const USBDescriptor hid_descriptor = { HID_DESCRIPTOR_SIZE, &hid_configuration_descriptor_data[HID_DESCRIPTOR_OFFSET] };
USB_DESC_INTERFACE ( 0, /* interface number */ 0, /* value used to select alternative setting */ 2, /* number of end-points used by this interface */ 0x08, /* interface class (Mass Storage) */ 0x06, /* interface sub-class (SCSI Transparent Storage) */ 0x50, /* interface protocol (Bulk Only) */ 0 /* index of string descriptor describing this interface */ ), /* end-point descriptor */ USB_DESC_ENDPOINT ( USB_MS_DATA_EP | 0x80, /* address (end point index | OUT direction) */ USB_EP_MODE_TYPE_BULK, /* attributes (bulk) */ 64, /* max packet size */ 0x05 /* polling interval (ignored for bulk end-points) */ ), /* end-point descriptor */ USB_DESC_ENDPOINT ( USB_MS_DATA_EP | 0x00, /* address (end point index | IN direction) */ USB_EP_MODE_TYPE_BULK, /* attributes (bulk) */ 64, /* max packet size */ 0x05 /* polling interval (ignored for bulk end-points) */ ) }; static const USBDescriptor configurationDescriptor = {
USB_DESC_BYTE (0x00), /* bmCapabilities (D0+D1). */ USB_DESC_BYTE (0x02), /* bDataInterface. */ /* ACM Functional Descriptor.*/ USB_DESC_BYTE (4), /* bFunctionLength. */ USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */ USB_DESC_BYTE (0x02), /* bDescriptorSubtype (Abstract Control Management Descriptor). */ USB_DESC_BYTE (0x02), /* bmCapabilities. */ /* Union Functional Descriptor.*/ USB_DESC_BYTE (5), /* bFunctionLength. */ USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */ USB_DESC_BYTE (0x06), /* bDescriptorSubtype (Union Functional Descriptor). */ USB_DESC_BYTE (0x00), /* bMasterInterface (Communication Class Interface). */ USB_DESC_BYTE (0x01), /* bSlaveInterface0 (Data Class Interface). */ /* Endpoint 2 Descriptor. */ USB_DESC_ENDPOINT (USB_CDC_INTERRUPT_REQUEST_EP|0x80, 0x03, /* bmAttributes (Interrupt). */ 0x0008, /* wMaxPacketSize. */ USB_CDC_INTERUPT_INTERVAL), /* bInterval. */ /* Interface Descriptor. */ USB_DESC_INTERFACE (0x01, /* bInterfaceNumber. */ 0x00, /* bAlternateSetting. */ 0x02, /* bNumEndpoints. */ 0x0A, /* bInterfaceClass (Data Class Interface, CDC section 4.5). */ 0x00, /* bInterfaceSubClass (CDC section 4.6). */ 0x00, /* bInterfaceProtocol (CDC section 4.7). */ 0x00), /* iInterface. */ /* Endpoint 3 Descriptor. */ USB_DESC_ENDPOINT (USB_CDC_DATA_AVAILABLE_EP, /* bEndpointAddress.*/ 0x02, /* bmAttributes (Bulk). */ USB_MAX_PACKET_SIZE, /* wMaxPacketSize. */ 0x00), /* bInterval. */
0x02, /* bNumEndpoints. */ 0x03, /* bInterfaceClass (HID Interface Class). */ 0x00, /* bInterfaceSubClass (None). */ 0x00, /* bInterfaceProtocol (None). */ 0), /* iInterface. */ /* HID Descriptor.*/ USB_DESC_HID (0x0110, /* bcdHID. */ 0x00, /* bCountryCode. */ 0x01, /* bNumDescriptors. */ 0x22, /* bDescriptorType (Report Descriptor). */ 34), /* wDescriptorLength. */ /* Endpoint 1 Descriptor.*/ USB_DESC_ENDPOINT (USBD1_DATA_AVAILABLE_EP, /* bEndpointAddress.*/ 0x03, /* bmAttributes (Interrupt). */ 0x0040, /* wMaxPacketSize. */ 0x0A), /* bInterval (10ms). */ /* Endpoint 1 Descriptor.*/ USB_DESC_ENDPOINT (USBD1_DATA_REQUEST_EP|0x80, /* bEndpointAddress.*/ 0x03, /* bmAttributes (Interrupt). */ 0x0040, /* wMaxPacketSize. */ 0x0A) /* bInterval (10ms). */ }; /* * Configuration Descriptor wrapper. */ static const USBDescriptor hid_configuration_descriptor = { sizeof hid_configuration_descriptor_data, hid_configuration_descriptor_data };