rename descriptor type, hid descriptor type

This commit is contained in:
hathach
2013-05-25 17:19:18 +07:00
parent ae02263d81
commit ed217948b8
14 changed files with 67 additions and 65 deletions

View File

@@ -123,7 +123,7 @@ TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4)
tusb_descriptor_device_t const desc_device = tusb_descriptor_device_t const desc_device =
{ {
.bLength = sizeof(tusb_descriptor_device_t), .bLength = sizeof(tusb_descriptor_device_t),
.bDescriptorType = TUSB_DESC_DEVICE, .bDescriptorType = TUSB_DESC_TYPE_DEVICE,
.bcdUSB = 0x0200, .bcdUSB = 0x0200,
.bDeviceClass = 0x00, .bDeviceClass = 0x00,
.bDeviceSubClass = 0x00, .bDeviceSubClass = 0x00,
@@ -149,7 +149,7 @@ const app_configuration_desc_t desc_configuration =
.configuration = .configuration =
{ {
.bLength = sizeof(tusb_descriptor_configuration_t), .bLength = sizeof(tusb_descriptor_configuration_t),
.bDescriptorType = TUSB_DESC_CONFIGURATION, .bDescriptorType = TUSB_DESC_TYPE_CONFIGURATION,
.wTotalLength = sizeof(app_configuration_desc_t) - 1, // exclude termination .wTotalLength = sizeof(app_configuration_desc_t) - 1, // exclude termination
.bNumInterfaces = TOTAL_INTEFACES, .bNumInterfaces = TOTAL_INTEFACES,
@@ -165,7 +165,7 @@ const app_configuration_desc_t desc_configuration =
.CDC_IAD = .CDC_IAD =
{ {
.bLength = sizeof(tusb_descriptor_interface_association_t), .bLength = sizeof(tusb_descriptor_interface_association_t),
.bDescriptorType = TUSB_DESC_INTERFACE_ASSOCIATION, .bDescriptorType = TUSB_DESC_TYPE_INTERFACE_ASSOCIATION,
.bFirstInterface = 0, .bFirstInterface = 0,
.bInterfaceCount = 2, .bInterfaceCount = 2,
@@ -184,7 +184,7 @@ const app_configuration_desc_t desc_configuration =
.CDC_CCI_Interface = .CDC_CCI_Interface =
{ {
.bLength = sizeof(tusb_descriptor_interface_t), .bLength = sizeof(tusb_descriptor_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE, .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
.bInterfaceNumber = INTERFACE_INDEX_CDC, .bInterfaceNumber = INTERFACE_INDEX_CDC,
.bAlternateSetting = 0, .bAlternateSetting = 0,
.bNumEndpoints = 1, .bNumEndpoints = 1,
@@ -225,7 +225,7 @@ const app_configuration_desc_t desc_configuration =
.CDC_NotificationEndpoint = .CDC_NotificationEndpoint =
{ {
.bLength = sizeof(tusb_descriptor_endpoint_t), .bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = CDC_NOTIFICATION_EP, .bEndpointAddress = CDC_NOTIFICATION_EP,
.bmAttributes = USB_ENDPOINT_TYPE_INTERRUPT, .bmAttributes = USB_ENDPOINT_TYPE_INTERRUPT,
.wMaxPacketSize = CDC_NOTIFICATION_EP_MAXPACKETSIZE, .wMaxPacketSize = CDC_NOTIFICATION_EP_MAXPACKETSIZE,
@@ -236,7 +236,7 @@ const app_configuration_desc_t desc_configuration =
.CDC_DCI_Interface = .CDC_DCI_Interface =
{ {
.bLength = sizeof(tusb_descriptor_interface_t), .bLength = sizeof(tusb_descriptor_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE, .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
.bInterfaceNumber = INTERFACE_INDEX_CDC+1, .bInterfaceNumber = INTERFACE_INDEX_CDC+1,
.bAlternateSetting = 0x00, .bAlternateSetting = 0x00,
.bNumEndpoints = 2, .bNumEndpoints = 2,
@@ -249,7 +249,7 @@ const app_configuration_desc_t desc_configuration =
.CDC_DataOutEndpoint = .CDC_DataOutEndpoint =
{ {
.bLength = sizeof(tusb_descriptor_endpoint_t), .bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = CDC_DATA_EP_OUT, .bEndpointAddress = CDC_DATA_EP_OUT,
.bmAttributes = USB_ENDPOINT_TYPE_BULK, .bmAttributes = USB_ENDPOINT_TYPE_BULK,
.wMaxPacketSize = CDC_DATA_EP_MAXPACKET_SIZE, .wMaxPacketSize = CDC_DATA_EP_MAXPACKET_SIZE,
@@ -259,7 +259,7 @@ const app_configuration_desc_t desc_configuration =
.CDC_DataInEndpoint = .CDC_DataInEndpoint =
{ {
.bLength = sizeof(tusb_descriptor_endpoint_t), .bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = CDC_DATA_EP_IN, .bEndpointAddress = CDC_DATA_EP_IN,
.bmAttributes = USB_ENDPOINT_TYPE_BULK, .bmAttributes = USB_ENDPOINT_TYPE_BULK,
.wMaxPacketSize = CDC_DATA_EP_MAXPACKET_SIZE, .wMaxPacketSize = CDC_DATA_EP_MAXPACKET_SIZE,
@@ -272,7 +272,7 @@ const app_configuration_desc_t desc_configuration =
.keyboard_interface = .keyboard_interface =
{ {
.bLength = sizeof(tusb_descriptor_interface_t), .bLength = sizeof(tusb_descriptor_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE, .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
.bInterfaceNumber = 1, .bInterfaceNumber = 1,
.bAlternateSetting = 0x00, .bAlternateSetting = 0x00,
.bNumEndpoints = 1, .bNumEndpoints = 1,
@@ -285,18 +285,18 @@ const app_configuration_desc_t desc_configuration =
.keyboard_hid = .keyboard_hid =
{ {
.bLength = sizeof(tusb_hid_descriptor_hid_t), .bLength = sizeof(tusb_hid_descriptor_hid_t),
.bDescriptorType = HID_DESC_HID, .bDescriptorType = HID_DESC_TYPE_HID,
.bcdHID = 0x0111, .bcdHID = 0x0111,
.bCountryCode = HID_Local_NotSupported, .bCountryCode = HID_Local_NotSupported,
.bNumDescriptors = 1, .bNumDescriptors = 1,
.bReportType = HID_DESC_REPORT, .bReportType = HID_DESC_TYPE_REPORT,
.wReportLength = sizeof(keyboard_report_descriptor) .wReportLength = sizeof(keyboard_report_descriptor)
}, },
.keyboard_endpoint = .keyboard_endpoint =
{ {
.bLength = sizeof(tusb_descriptor_endpoint_t), .bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x81, .bEndpointAddress = 0x81,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT }, .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
.wMaxPacketSize = { .size = 0x08 }, .wMaxPacketSize = { .size = 0x08 },
@@ -309,7 +309,7 @@ const app_configuration_desc_t desc_configuration =
.HID_MouseInterface = .HID_MouseInterface =
{ {
.bLength = sizeof(tusb_descriptor_interface_t), .bLength = sizeof(tusb_descriptor_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE, .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
.bInterfaceNumber = INTERFACE_INDEX_HID_MOUSE, .bInterfaceNumber = INTERFACE_INDEX_HID_MOUSE,
.bAlternateSetting = 0x00, .bAlternateSetting = 0x00,
.bNumEndpoints = 1, .bNumEndpoints = 1,
@@ -322,18 +322,18 @@ const app_configuration_desc_t desc_configuration =
.mouse_hid = .mouse_hid =
{ {
.bLength = sizeof(tusb_hid_descriptor_hid_t), .bLength = sizeof(tusb_hid_descriptor_hid_t),
.bDescriptorType = HID_DESC_HID, .bDescriptorType = HID_DESC_TYPE_HID,
.bcdHID = 0x0111, .bcdHID = 0x0111,
.bCountryCode = HID_Local_NotSupported, .bCountryCode = HID_Local_NotSupported,
.bNumDescriptors = 1, .bNumDescriptors = 1,
.bReportType = HID_DESC_REPORT, .bReportType = HID_DESC_TYPE_REPORT,
.wReportLength = sizeof(mouse_report_descriptor) .wReportLength = sizeof(mouse_report_descriptor)
}, },
.mouse_endpoint = .mouse_endpoint =
{ {
.bLength = sizeof(tusb_descriptor_endpoint_t), .bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x82, .bEndpointAddress = 0x82,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT }, .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
.wMaxPacketSize = 0x08, .wMaxPacketSize = 0x08,
@@ -346,7 +346,7 @@ const app_configuration_desc_t desc_configuration =
.msc_interface = .msc_interface =
{ {
.bLength = sizeof(tusb_descriptor_interface_t), .bLength = sizeof(tusb_descriptor_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE, .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
.bInterfaceNumber = 3, .bInterfaceNumber = 3,
.bAlternateSetting = 0x00, .bAlternateSetting = 0x00,
.bNumEndpoints = 2, .bNumEndpoints = 2,
@@ -359,7 +359,7 @@ const app_configuration_desc_t desc_configuration =
.msc_endpoint_in = .msc_endpoint_in =
{ {
.bLength = sizeof(tusb_descriptor_endpoint_t), .bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x83, .bEndpointAddress = 0x83,
.bmAttributes = { .xfer = TUSB_XFER_BULK }, .bmAttributes = { .xfer = TUSB_XFER_BULK },
.wMaxPacketSize = 512, .wMaxPacketSize = 512,
@@ -369,7 +369,7 @@ const app_configuration_desc_t desc_configuration =
.msc_endpoint_out = .msc_endpoint_out =
{ {
.bLength = sizeof(tusb_descriptor_endpoint_t), .bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x03, .bEndpointAddress = 0x03,
.bmAttributes = { .xfer = TUSB_XFER_BULK }, .bmAttributes = { .xfer = TUSB_XFER_BULK },
.wMaxPacketSize = 512, .wMaxPacketSize = 512,

View File

@@ -25,10 +25,12 @@ int main(void)
{ {
if (current_tick + 1000 < system_ticks) if (current_tick + 1000 < system_ticks)
{ {
current_tick += 1000; static uint32_t led_on_mask = 0;
board_leds(0x01, (current_tick/1000)%2); /* Toggle LED once per second */
printf("tinyusb: " __DATE__ "\t" __TIME__ "\n"); current_tick += 1000;
board_leds(led_on_mask, 1 - led_on_mask);
led_on_mask = 1 - led_on_mask; // toggle
#if !(defined TUSB_CFG_DEVICE_CDC) && 0 #if !(defined TUSB_CFG_DEVICE_CDC) && 0
if (usb_isConfigured()) if (usb_isConfigured())

View File

@@ -152,7 +152,7 @@ void test_bulk_pipe_close(void)
tusb_descriptor_endpoint_t const desc_ept_bulk_in = tusb_descriptor_endpoint_t const desc_ept_bulk_in =
{ {
.bLength = sizeof(tusb_descriptor_endpoint_t), .bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x81, .bEndpointAddress = 0x81,
.bmAttributes = { .xfer = TUSB_XFER_BULK }, .bmAttributes = { .xfer = TUSB_XFER_BULK },
.wMaxPacketSize = 512, .wMaxPacketSize = 512,

View File

@@ -110,7 +110,7 @@ void verify_open_qhd(ehci_qhd_t *p_qhd, uint8_t endpoint_addr, uint16_t max_pack
tusb_descriptor_endpoint_t const desc_ept_bulk_in = tusb_descriptor_endpoint_t const desc_ept_bulk_in =
{ {
.bLength = sizeof(tusb_descriptor_endpoint_t), .bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x81, .bEndpointAddress = 0x81,
.bmAttributes = { .xfer = TUSB_XFER_BULK }, .bmAttributes = { .xfer = TUSB_XFER_BULK },
.wMaxPacketSize = 512, .wMaxPacketSize = 512,

View File

@@ -67,7 +67,7 @@ static pipe_handle_t pipe_hdl_bulk;
tusb_descriptor_endpoint_t const desc_ept_bulk_in = tusb_descriptor_endpoint_t const desc_ept_bulk_in =
{ {
.bLength = sizeof(tusb_descriptor_endpoint_t), .bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x81, .bEndpointAddress = 0x81,
.bmAttributes = { .xfer = TUSB_XFER_BULK }, .bmAttributes = { .xfer = TUSB_XFER_BULK },
.wMaxPacketSize = 512, .wMaxPacketSize = 512,
@@ -77,7 +77,7 @@ tusb_descriptor_endpoint_t const desc_ept_bulk_in =
tusb_descriptor_endpoint_t const desc_ept_bulk_out = tusb_descriptor_endpoint_t const desc_ept_bulk_out =
{ {
.bLength = sizeof(tusb_descriptor_endpoint_t), .bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x01, .bEndpointAddress = 0x01,
.bmAttributes = { .xfer = TUSB_XFER_BULK }, .bmAttributes = { .xfer = TUSB_XFER_BULK },
.wMaxPacketSize = 512, .wMaxPacketSize = 512,

View File

@@ -107,7 +107,7 @@ tusb_std_request_t request_get_dev_desc =
{ {
.bmRequestType = { .direction = TUSB_DIR_DEV_TO_HOST, .type = TUSB_REQUEST_TYPE_STANDARD, .recipient = TUSB_REQUEST_RECIPIENT_DEVICE }, .bmRequestType = { .direction = TUSB_DIR_DEV_TO_HOST, .type = TUSB_REQUEST_TYPE_STANDARD, .recipient = TUSB_REQUEST_RECIPIENT_DEVICE },
.bRequest = TUSB_REQUEST_GET_DESCRIPTOR, .bRequest = TUSB_REQUEST_GET_DESCRIPTOR,
.wValue = (TUSB_DESC_DEVICE << 8), .wValue = (TUSB_DESC_TYPE_DEVICE << 8),
.wLength = 18 .wLength = 18
}; };

View File

@@ -116,7 +116,7 @@ void verify_open_qhd(ehci_qhd_t *p_qhd, uint8_t endpoint_addr, uint16_t max_pack
tusb_descriptor_endpoint_t const desc_ept_interrupt_out = tusb_descriptor_endpoint_t const desc_ept_interrupt_out =
{ {
.bLength = sizeof(tusb_descriptor_endpoint_t), .bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x02, .bEndpointAddress = 0x02,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT }, .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
.wMaxPacketSize = 16, .wMaxPacketSize = 16,

View File

@@ -67,7 +67,7 @@ static pipe_handle_t pipe_hdl_interrupt;
static tusb_descriptor_endpoint_t const desc_ept_interrupt_in = static tusb_descriptor_endpoint_t const desc_ept_interrupt_in =
{ {
.bLength = sizeof(tusb_descriptor_endpoint_t), .bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x81, .bEndpointAddress = 0x81,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT }, .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
.wMaxPacketSize = 8, .wMaxPacketSize = 8,
@@ -77,7 +77,7 @@ static tusb_descriptor_endpoint_t const desc_ept_interrupt_in =
static tusb_descriptor_endpoint_t const desc_ept_interupt_out = static tusb_descriptor_endpoint_t const desc_ept_interupt_out =
{ {
.bLength = sizeof(tusb_descriptor_endpoint_t), .bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x01, .bEndpointAddress = 0x01,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT }, .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
.wMaxPacketSize = 64, .wMaxPacketSize = 64,

View File

@@ -85,7 +85,7 @@ void tearDown(void)
tusb_descriptor_endpoint_t const desc_ept_iso_in = tusb_descriptor_endpoint_t const desc_ept_iso_in =
{ {
.bLength = sizeof(tusb_descriptor_endpoint_t), .bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x83, .bEndpointAddress = 0x83,
.bmAttributes = { .xfer = TUSB_XFER_ISOCHRONOUS }, .bmAttributes = { .xfer = TUSB_XFER_ISOCHRONOUS },
.wMaxPacketSize = 1024, .wMaxPacketSize = 1024,

View File

@@ -122,7 +122,7 @@ TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4)
tusb_descriptor_device_t const desc_device = tusb_descriptor_device_t const desc_device =
{ {
.bLength = sizeof(tusb_descriptor_device_t), .bLength = sizeof(tusb_descriptor_device_t),
.bDescriptorType = TUSB_DESC_DEVICE, .bDescriptorType = TUSB_DESC_TYPE_DEVICE,
.bcdUSB = 0x0200, .bcdUSB = 0x0200,
.bDeviceClass = 0x00, .bDeviceClass = 0x00,
.bDeviceSubClass = 0x00, .bDeviceSubClass = 0x00,
@@ -148,7 +148,7 @@ const app_configuration_desc_t desc_configuration =
.configuration = .configuration =
{ {
.bLength = sizeof(tusb_descriptor_configuration_t), .bLength = sizeof(tusb_descriptor_configuration_t),
.bDescriptorType = TUSB_DESC_CONFIGURATION, .bDescriptorType = TUSB_DESC_TYPE_CONFIGURATION,
.wTotalLength = sizeof(app_configuration_desc_t) - 1, // exclude termination .wTotalLength = sizeof(app_configuration_desc_t) - 1, // exclude termination
.bNumInterfaces = 1, .bNumInterfaces = 1,
@@ -163,7 +163,7 @@ const app_configuration_desc_t desc_configuration =
.keyboard_interface = .keyboard_interface =
{ {
.bLength = sizeof(tusb_descriptor_interface_t), .bLength = sizeof(tusb_descriptor_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE, .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
.bInterfaceNumber = 1, .bInterfaceNumber = 1,
.bAlternateSetting = 0x00, .bAlternateSetting = 0x00,
.bNumEndpoints = 1, .bNumEndpoints = 1,
@@ -176,18 +176,18 @@ const app_configuration_desc_t desc_configuration =
.keyboard_hid = .keyboard_hid =
{ {
.bLength = sizeof(tusb_hid_descriptor_hid_t), .bLength = sizeof(tusb_hid_descriptor_hid_t),
.bDescriptorType = HID_DESC_HID, .bDescriptorType = HID_DESC_TYPE_HID,
.bcdHID = 0x0111, .bcdHID = 0x0111,
.bCountryCode = HID_Local_NotSupported, .bCountryCode = HID_Local_NotSupported,
.bNumDescriptors = 1, .bNumDescriptors = 1,
.bReportType = HID_DESC_REPORT, .bReportType = HID_DESC_TYPE_REPORT,
.wReportLength = sizeof(keyboard_report_descriptor) .wReportLength = sizeof(keyboard_report_descriptor)
}, },
.keyboard_endpoint = .keyboard_endpoint =
{ {
.bLength = sizeof(tusb_descriptor_endpoint_t), .bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x81, .bEndpointAddress = 0x81,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT }, .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
.wMaxPacketSize = 0x08, .wMaxPacketSize = 0x08,
@@ -198,7 +198,7 @@ const app_configuration_desc_t desc_configuration =
.mouse_interface = .mouse_interface =
{ {
.bLength = sizeof(tusb_descriptor_interface_t), .bLength = sizeof(tusb_descriptor_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE, .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
.bInterfaceNumber = 2, .bInterfaceNumber = 2,
.bAlternateSetting = 0x00, .bAlternateSetting = 0x00,
.bNumEndpoints = 1, .bNumEndpoints = 1,
@@ -211,18 +211,18 @@ const app_configuration_desc_t desc_configuration =
.mouse_hid = .mouse_hid =
{ {
.bLength = sizeof(tusb_hid_descriptor_hid_t), .bLength = sizeof(tusb_hid_descriptor_hid_t),
.bDescriptorType = HID_DESC_HID, .bDescriptorType = HID_DESC_TYPE_HID,
.bcdHID = 0x0111, .bcdHID = 0x0111,
.bCountryCode = HID_Local_NotSupported, .bCountryCode = HID_Local_NotSupported,
.bNumDescriptors = 1, .bNumDescriptors = 1,
.bReportType = HID_DESC_REPORT, .bReportType = HID_DESC_TYPE_REPORT,
.wReportLength = sizeof(mouse_report_descriptor) .wReportLength = sizeof(mouse_report_descriptor)
}, },
.mouse_endpoint = .mouse_endpoint =
{ {
.bLength = sizeof(tusb_descriptor_endpoint_t), .bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x82, .bEndpointAddress = 0x82,
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT }, .bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
.wMaxPacketSize = 0x08, .wMaxPacketSize = 0x08,
@@ -233,7 +233,7 @@ const app_configuration_desc_t desc_configuration =
.msc_interface = .msc_interface =
{ {
.bLength = sizeof(tusb_descriptor_interface_t), .bLength = sizeof(tusb_descriptor_interface_t),
.bDescriptorType = TUSB_DESC_INTERFACE, .bDescriptorType = TUSB_DESC_TYPE_INTERFACE,
.bInterfaceNumber = 3, .bInterfaceNumber = 3,
.bAlternateSetting = 0x00, .bAlternateSetting = 0x00,
.bNumEndpoints = 2, .bNumEndpoints = 2,
@@ -246,7 +246,7 @@ const app_configuration_desc_t desc_configuration =
.msc_endpoint_in = .msc_endpoint_in =
{ {
.bLength = sizeof(tusb_descriptor_endpoint_t), .bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x83, .bEndpointAddress = 0x83,
.bmAttributes = { .xfer = TUSB_XFER_BULK }, .bmAttributes = { .xfer = TUSB_XFER_BULK },
.wMaxPacketSize = 512, .wMaxPacketSize = 512,
@@ -256,7 +256,7 @@ const app_configuration_desc_t desc_configuration =
.msc_endpoint_out = .msc_endpoint_out =
{ {
.bLength = sizeof(tusb_descriptor_endpoint_t), .bLength = sizeof(tusb_descriptor_endpoint_t),
.bDescriptorType = TUSB_DESC_ENDPOINT, .bDescriptorType = TUSB_DESC_TYPE_ENDPOINT,
.bEndpointAddress = 0x03, .bEndpointAddress = 0x03,
.bmAttributes = { .xfer = TUSB_XFER_BULK }, .bmAttributes = { .xfer = TUSB_XFER_BULK },
.wMaxPacketSize = 512, .wMaxPacketSize = 512,

View File

@@ -64,9 +64,9 @@
//}; //};
enum { enum {
HID_DESC_HID = 0x21, HID_DESC_TYPE_HID = 0x21,
HID_DESC_REPORT = 0x22, HID_DESC_TYPE_REPORT = 0x22,
HID_DESC_PHYSICAL = 0x23 HID_DESC_TYPE_PHYSICAL = 0x23
}; };
typedef ATTR_PREPACKED struct ATTR_PACKED { typedef ATTR_PREPACKED struct ATTR_PACKED {

View File

@@ -205,14 +205,14 @@ tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
//------------- HID descriptor -------------// //------------- HID descriptor -------------//
p_desc += p_desc[DESCRIPTOR_OFFSET_LENGTH]; p_desc += p_desc[DESCRIPTOR_OFFSET_LENGTH];
tusb_hid_descriptor_hid_t const *p_desc_hid = (tusb_hid_descriptor_hid_t const *) p_desc; tusb_hid_descriptor_hid_t const *p_desc_hid = (tusb_hid_descriptor_hid_t const *) p_desc;
ASSERT_INT(HID_DESC_HID, p_desc_hid->bDescriptorType, TUSB_ERROR_INVALID_PARA); ASSERT_INT(HID_DESC_TYPE_HID, p_desc_hid->bDescriptorType, TUSB_ERROR_INVALID_PARA);
//------------- TODO skip Get Report Descriptor -------------// //------------- TODO skip Get Report Descriptor -------------//
uint8_t *p_report_desc = NULL; // report descriptor has to be global & in USB RAM uint8_t *p_report_desc = NULL; // report descriptor has to be global & in USB RAM
//------------- Endpoint Descriptor -------------// //------------- Endpoint Descriptor -------------//
p_desc += p_desc[DESCRIPTOR_OFFSET_LENGTH]; p_desc += p_desc[DESCRIPTOR_OFFSET_LENGTH];
ASSERT_INT(TUSB_DESC_ENDPOINT, p_desc[DESCRIPTOR_OFFSET_TYPE], TUSB_ERROR_INVALID_PARA); ASSERT_INT(TUSB_DESC_TYPE_ENDPOINT, p_desc[DESCRIPTOR_OFFSET_TYPE], TUSB_ERROR_INVALID_PARA);
if (p_interface_desc->bInterfaceSubClass == HID_SUBCLASS_BOOT) if (p_interface_desc->bInterfaceSubClass == HID_SUBCLASS_BOOT)
{ {

View File

@@ -76,17 +76,17 @@ typedef enum {
/// USB Descriptor Types (section 9.4 table 9-5) /// USB Descriptor Types (section 9.4 table 9-5)
typedef enum { typedef enum {
TUSB_DESC_DEVICE =1 , ///< 1 TUSB_DESC_TYPE_DEVICE =1 , ///< 1
TUSB_DESC_CONFIGURATION , ///< 2 TUSB_DESC_TYPE_CONFIGURATION , ///< 2
TUSB_DESC_STRING , ///< 3 TUSB_DESC_TYPE_STRING , ///< 3
TUSB_DESC_INTERFACE , ///< 4 TUSB_DESC_TYPE_INTERFACE , ///< 4
TUSB_DESC_ENDPOINT , ///< 5 TUSB_DESC_TYPE_ENDPOINT , ///< 5
TUSB_DESC_DEVICE_QUALIFIER , ///< 6 TUSB_DESC_TYPE_DEVICE_QUALIFIER , ///< 6
TUSB_DESC_OTHER_SPEED_CONFIGURATION , ///< 7 TUSB_DESC_TYPE_OTHER_SPEED_CONFIGURATION , ///< 7
TUSB_DESC_INTERFACE_POWER , ///< 8 TUSB_DESC_TYPE_INTERFACE_POWER , ///< 8
TUSB_DESC_OTG , ///< 9 TUSB_DESC_TYPE_OTG , ///< 9
TUSB_DESC_DEBUGRIPTOR , ///< 10 TUSB_DESC_TYPE_DEBUG , ///< 10
TUSB_DESC_INTERFACE_ASSOCIATION ///< 11 TUSB_DESC_TYPE_INTERFACE_ASSOCIATION ///< 11
}tusb_std_descriptor_type_t; }tusb_std_descriptor_type_t;
typedef enum { typedef enum {

View File

@@ -303,7 +303,7 @@ tusb_error_t enumeration_body_subtask(void)
{ {
.bmRequestType = { .direction = TUSB_DIR_DEV_TO_HOST, .type = TUSB_REQUEST_TYPE_STANDARD, .recipient = TUSB_REQUEST_RECIPIENT_DEVICE }, .bmRequestType = { .direction = TUSB_DIR_DEV_TO_HOST, .type = TUSB_REQUEST_TYPE_STANDARD, .recipient = TUSB_REQUEST_RECIPIENT_DEVICE },
.bRequest = TUSB_REQUEST_GET_DESCRIPTOR, .bRequest = TUSB_REQUEST_GET_DESCRIPTOR,
.wValue = (TUSB_DESC_DEVICE << 8), .wValue = (TUSB_DESC_TYPE_DEVICE << 8),
.wLength = 8 .wLength = 8
}, },
enum_data_buffer ), enum_data_buffer ),
@@ -352,7 +352,7 @@ tusb_error_t enumeration_body_subtask(void)
{ {
.bmRequestType = { .direction = TUSB_DIR_DEV_TO_HOST, .type = TUSB_REQUEST_TYPE_STANDARD, .recipient = TUSB_REQUEST_RECIPIENT_DEVICE }, .bmRequestType = { .direction = TUSB_DIR_DEV_TO_HOST, .type = TUSB_REQUEST_TYPE_STANDARD, .recipient = TUSB_REQUEST_RECIPIENT_DEVICE },
.bRequest = TUSB_REQUEST_GET_DESCRIPTOR, .bRequest = TUSB_REQUEST_GET_DESCRIPTOR,
.wValue = (TUSB_DESC_DEVICE << 8), .wValue = (TUSB_DESC_TYPE_DEVICE << 8),
.wLength = 18 .wLength = 18
}, },
enum_data_buffer ), enum_data_buffer ),
@@ -376,7 +376,7 @@ tusb_error_t enumeration_body_subtask(void)
{ {
.bmRequestType = { .direction = TUSB_DIR_DEV_TO_HOST, .type = TUSB_REQUEST_TYPE_STANDARD, .recipient = TUSB_REQUEST_RECIPIENT_DEVICE }, .bmRequestType = { .direction = TUSB_DIR_DEV_TO_HOST, .type = TUSB_REQUEST_TYPE_STANDARD, .recipient = TUSB_REQUEST_RECIPIENT_DEVICE },
.bRequest = TUSB_REQUEST_GET_DESCRIPTOR, .bRequest = TUSB_REQUEST_GET_DESCRIPTOR,
.wValue = (TUSB_DESC_CONFIGURATION << 8) | (configure_selected - 1), .wValue = (TUSB_DESC_TYPE_CONFIGURATION << 8) | (configure_selected - 1),
.wLength = 9 .wLength = 9
}, },
enum_data_buffer ), enum_data_buffer ),
@@ -394,7 +394,7 @@ tusb_error_t enumeration_body_subtask(void)
{ {
.bmRequestType = { .direction = TUSB_DIR_DEV_TO_HOST, .type = TUSB_REQUEST_TYPE_STANDARD, .recipient = TUSB_REQUEST_RECIPIENT_DEVICE }, .bmRequestType = { .direction = TUSB_DIR_DEV_TO_HOST, .type = TUSB_REQUEST_TYPE_STANDARD, .recipient = TUSB_REQUEST_RECIPIENT_DEVICE },
.bRequest = TUSB_REQUEST_GET_DESCRIPTOR, .bRequest = TUSB_REQUEST_GET_DESCRIPTOR,
.wValue = (TUSB_DESC_CONFIGURATION << 8) | (configure_selected - 1), .wValue = (TUSB_DESC_TYPE_CONFIGURATION << 8) | (configure_selected - 1),
.wLength = ((tusb_descriptor_configuration_t*) enum_data_buffer)->wTotalLength .wLength = ((tusb_descriptor_configuration_t*) enum_data_buffer)->wTotalLength
}, },
enum_data_buffer ), enum_data_buffer ),
@@ -429,7 +429,7 @@ tusb_error_t enumeration_body_subtask(void)
while( p_desc < enum_data_buffer + ((tusb_descriptor_configuration_t*)enum_data_buffer)->wTotalLength ) while( p_desc < enum_data_buffer + ((tusb_descriptor_configuration_t*)enum_data_buffer)->wTotalLength )
{ {
// skip until we see interface descriptor // skip until we see interface descriptor
if ( TUSB_DESC_INTERFACE != p_desc[DESCRIPTOR_OFFSET_TYPE] ) if ( TUSB_DESC_TYPE_INTERFACE != p_desc[DESCRIPTOR_OFFSET_TYPE] )
{ {
p_desc += p_desc[DESCRIPTOR_OFFSET_LENGTH]; // skip the descriptor, increase by the descriptor's length p_desc += p_desc[DESCRIPTOR_OFFSET_LENGTH]; // skip the descriptor, increase by the descriptor's length
}else }else