diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_ehci_usbh_hcd_integration.c b/tests/lpc18xx_43xx/test/host/ehci/test_ehci_usbh_hcd_integration.c index f28527bfb..f742e4cee 100644 --- a/tests/lpc18xx_43xx/test/host/ehci/test_ehci_usbh_hcd_integration.c +++ b/tests/lpc18xx_43xx/test/host/ehci/test_ehci_usbh_hcd_integration.c @@ -102,8 +102,8 @@ void test_addr0_control_close(void) TEST_ASSERT_STATUS( hcd_pipe_control_xfer(dev_addr, &(tusb_control_request_t) { - .bmRequestType_bit = { .direction = TUSB_DIR_HOST_TO_DEV, .type = TUSB_REQUEST_TYPE_STANDARD, .recipient = TUSB_REQUEST_RECIPIENT_DEVICE }, - .bRequest = TUSB_REQUEST_SET_ADDRESS, + .bmRequestType_bit = { .direction = TUSB_DIR_HOST_TO_DEV, .type = TUSB_REQ_TYPE_STANDARD, .recipient = TUSB_REQ_RECIPIENT_DEVICE }, + .bRequest = TUSB_REQ_SET_ADDRESS, .wValue = 3 }, NULL) ) ; @@ -128,8 +128,8 @@ void test_isr_disconnect_then_async_advance_control_pipe(void) TEST_ASSERT_STATUS( hcd_pipe_control_xfer(dev_addr, &(tusb_control_request_t) { - .bmRequestType_bit = { .direction = TUSB_DIR_HOST_TO_DEV, .type = TUSB_REQUEST_TYPE_STANDARD, .recipient = TUSB_REQUEST_RECIPIENT_DEVICE }, - .bRequest = TUSB_REQUEST_SET_ADDRESS, + .bmRequestType_bit = { .direction = TUSB_DIR_HOST_TO_DEV, .type = TUSB_REQ_TYPE_STANDARD, .recipient = TUSB_REQ_RECIPIENT_DEVICE }, + .bRequest = TUSB_REQ_SET_ADDRESS, .wValue = 3 }, NULL) ); diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_xfer.c b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_xfer.c index 4ffb276ce..556823de2 100644 --- a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_xfer.c +++ b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_xfer.c @@ -105,16 +105,16 @@ void tearDown(void) //--------------------------------------------------------------------+ tusb_control_request_t request_get_dev_desc = { - .bmRequestType_bit = { .direction = TUSB_DIR_DEV_TO_HOST, .type = TUSB_REQUEST_TYPE_STANDARD, .recipient = TUSB_REQUEST_RECIPIENT_DEVICE }, - .bRequest = TUSB_REQUEST_GET_DESCRIPTOR, + .bmRequestType_bit = { .direction = TUSB_DIR_DEV_TO_HOST, .type = TUSB_REQ_TYPE_STANDARD, .recipient = TUSB_REQ_RECIPIENT_DEVICE }, + .bRequest = TUSB_REQ_GET_DESCRIPTOR, .wValue = (TUSB_DESC_TYPE_DEVICE << 8), .wLength = 18 }; tusb_control_request_t request_set_dev_addr = { - .bmRequestType_bit = { .direction = TUSB_DIR_HOST_TO_DEV, .type = TUSB_REQUEST_TYPE_STANDARD, .recipient = TUSB_REQUEST_RECIPIENT_DEVICE }, - .bRequest = TUSB_REQUEST_SET_ADDRESS, + .bmRequestType_bit = { .direction = TUSB_DIR_HOST_TO_DEV, .type = TUSB_REQ_TYPE_STANDARD, .recipient = TUSB_REQ_RECIPIENT_DEVICE }, + .bRequest = TUSB_REQ_SET_ADDRESS, .wValue = 3 }; diff --git a/tests/lpc18xx_43xx/test/host/hid/test_hidh_keyboard.c b/tests/lpc18xx_43xx/test/host/hid/test_hidh_keyboard.c index 26da8dec8..7f014f181 100644 --- a/tests/lpc18xx_43xx/test/host/hid/test_hidh_keyboard.c +++ b/tests/lpc18xx_43xx/test/host/hid/test_hidh_keyboard.c @@ -125,8 +125,8 @@ tusb_error_t stub_set_idle_request(uint8_t address, tusb_control_request_t const //------------- expecting Set Idle with value = 0 -------------// TEST_ASSERT_NOT_NULL( p_request ); TEST_ASSERT_EQUAL(TUSB_DIR_HOST_TO_DEV , p_request->bmRequestType_bit.direction); - TEST_ASSERT_EQUAL(TUSB_REQUEST_TYPE_CLASS , p_request->bmRequestType_bit.type); - TEST_ASSERT_EQUAL(TUSB_REQUEST_RECIPIENT_INTERFACE , p_request->bmRequestType_bit.recipient); + TEST_ASSERT_EQUAL(TUSB_REQ_TYPE_CLASS , p_request->bmRequestType_bit.type); + TEST_ASSERT_EQUAL(TUSB_REQ_RECIPIENT_INTERFACE , p_request->bmRequestType_bit.recipient); TEST_ASSERT_EQUAL(HID_REQUEST_CONTROL_SET_IDLE , p_request->bRequest); TEST_ASSERT_EQUAL(0 , p_request->wValue); TEST_ASSERT_EQUAL(p_kbd_interface_desc->bInterfaceNumber , p_request->wIndex); @@ -143,7 +143,7 @@ void test_keyboard_open_ok(void) hidh_init(); - usbh_control_xfer_subtask_ExpectAndReturn(dev_addr, bm_request_type(TUSB_DIR_HOST_TO_DEV, TUSB_REQUEST_TYPE_CLASS, TUSB_REQUEST_RECIPIENT_INTERFACE), + usbh_control_xfer_subtask_ExpectAndReturn(dev_addr, bm_request_type(TUSB_DIR_HOST_TO_DEV, TUSB_REQ_TYPE_CLASS, TUSB_REQ_RECIPIENT_INTERFACE), HID_REQUEST_CONTROL_SET_IDLE, 0, p_kbd_interface_desc->bInterfaceNumber, 0, NULL, TUSB_ERROR_NONE); hcd_pipe_open_ExpectAndReturn(dev_addr, p_kdb_endpoint_desc, TUSB_CLASS_HID, pipe_hdl); diff --git a/tests/lpc18xx_43xx/test/host/hid/test_hidh_mouse.c b/tests/lpc18xx_43xx/test/host/hid/test_hidh_mouse.c index 04287f5c7..47478b43a 100644 --- a/tests/lpc18xx_43xx/test/host/hid/test_hidh_mouse.c +++ b/tests/lpc18xx_43xx/test/host/hid/test_hidh_mouse.c @@ -114,7 +114,7 @@ void test_mouse_open_ok(void) hidh_init(); - usbh_control_xfer_subtask_ExpectAndReturn(dev_addr, bm_request_type(TUSB_DIR_HOST_TO_DEV, TUSB_REQUEST_TYPE_CLASS, TUSB_REQUEST_RECIPIENT_INTERFACE), + usbh_control_xfer_subtask_ExpectAndReturn(dev_addr, bm_request_type(TUSB_DIR_HOST_TO_DEV, TUSB_REQ_TYPE_CLASS, TUSB_REQ_RECIPIENT_INTERFACE), HID_REQUEST_CONTROL_SET_IDLE, 0, p_mouse_interface_desc->bInterfaceNumber, 0, NULL, TUSB_ERROR_NONE); hcd_pipe_open_ExpectAndReturn(dev_addr, p_mouse_endpoint_desc, TUSB_CLASS_HID, pipe_hdl); diff --git a/tests/lpc18xx_43xx/test/host/msc/test_msc_host.c b/tests/lpc18xx_43xx/test/host/msc/test_msc_host.c index ede9e2541..f937c5052 100644 --- a/tests/lpc18xx_43xx/test/host/msc/test_msc_host.c +++ b/tests/lpc18xx_43xx/test/host/msc/test_msc_host.c @@ -103,7 +103,7 @@ tusb_error_t stub_control_xfer(uint8_t dev_addr, uint8_t bmRequestType, uint8_t switch ( num_call ) { case 0: // get max lun - TEST_ASSERT_EQUAL(bm_request_type(TUSB_DIR_DEV_TO_HOST, TUSB_REQUEST_TYPE_CLASS, TUSB_REQUEST_RECIPIENT_INTERFACE), + TEST_ASSERT_EQUAL(bm_request_type(TUSB_DIR_DEV_TO_HOST, TUSB_REQ_TYPE_CLASS, TUSB_REQ_RECIPIENT_INTERFACE), bmRequestType); TEST_ASSERT_EQUAL(MSC_REQUEST_GET_MAX_LUN, bRequest); TEST_ASSERT_EQUAL(p_msc_interface_desc->bInterfaceNumber, wIndex); diff --git a/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c b/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c index 6b548577f..93bb2f94e 100644 --- a/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c +++ b/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c @@ -136,40 +136,40 @@ tusb_error_t control_xfer_stub(uint8_t dev_addr, const tusb_control_request_t * switch (num_call) { case 0: // get 8 bytes of device descriptor - TEST_ASSERT_EQUAL(TUSB_REQUEST_GET_DESCRIPTOR, p_request->bRequest); + TEST_ASSERT_EQUAL(TUSB_REQ_GET_DESCRIPTOR, p_request->bRequest); TEST_ASSERT_EQUAL(TUSB_DESC_TYPE_DEVICE, p_request->wValue >> 8); TEST_ASSERT_EQUAL(8, p_request->wLength); memcpy(data, &desc_device, p_request->wLength); break; case 1: // set device address - TEST_ASSERT_EQUAL(TUSB_REQUEST_SET_ADDRESS, p_request->bRequest); + TEST_ASSERT_EQUAL(TUSB_REQ_SET_ADDRESS, p_request->bRequest); TEST_ASSERT_EQUAL(p_request->wValue, 1); break; case 2: // get full device decriptor for new address - TEST_ASSERT_EQUAL(TUSB_REQUEST_GET_DESCRIPTOR, p_request->bRequest); + TEST_ASSERT_EQUAL(TUSB_REQ_GET_DESCRIPTOR, p_request->bRequest); TEST_ASSERT_EQUAL(TUSB_DESC_TYPE_DEVICE, p_request->wValue >> 8); TEST_ASSERT_EQUAL(18, p_request->wLength); memcpy(data, &desc_device, p_request->wLength); break; case 3: // get 9 bytes of configuration descriptor - TEST_ASSERT_EQUAL(TUSB_REQUEST_GET_DESCRIPTOR, p_request->bRequest); + TEST_ASSERT_EQUAL(TUSB_REQ_GET_DESCRIPTOR, p_request->bRequest); TEST_ASSERT_EQUAL(TUSB_DESC_TYPE_CONFIGURATION, p_request->wValue >> 8); TEST_ASSERT_EQUAL(9, p_request->wLength); memcpy(data, &desc_configuration, p_request->wLength); break; case 4: // get full-length configuration descriptor - TEST_ASSERT_EQUAL(TUSB_REQUEST_GET_DESCRIPTOR, p_request->bRequest); + TEST_ASSERT_EQUAL(TUSB_REQ_GET_DESCRIPTOR, p_request->bRequest); TEST_ASSERT_EQUAL(TUSB_DESC_TYPE_CONFIGURATION, p_request->wValue >> 8); TEST_ASSERT_EQUAL(TUSB_CFG_HOST_ENUM_BUFFER_SIZE, p_request->wLength); memcpy(data, &desc_configuration, p_request->wLength); break; case 5: // set configure - TEST_ASSERT_EQUAL(TUSB_REQUEST_SET_CONFIGURATION, p_request->bRequest); + TEST_ASSERT_EQUAL(TUSB_REQ_SET_CONFIGURATION, p_request->bRequest); TEST_ASSERT_EQUAL(1, p_request->wValue); TEST_ASSERT_EQUAL(0, p_request->wIndex); TEST_ASSERT_EQUAL(0, p_request->wLength); diff --git a/tinyusb/class/hid/hid_device.c b/tinyusb/class/hid/hid_device.c index fd6da979f..69f0778aa 100644 --- a/tinyusb/class/hid/hid_device.c +++ b/tinyusb/class/hid/hid_device.c @@ -197,7 +197,7 @@ tusb_error_t hidd_control_request_subtask(uint8_t port, tusb_control_request_t c (void) desc_index; - ASSERT ( p_request->bRequest == TUSB_REQUEST_GET_DESCRIPTOR && desc_type == HID_DESC_TYPE_REPORT, + ASSERT ( p_request->bRequest == TUSB_REQ_GET_DESCRIPTOR && desc_type == HID_DESC_TYPE_REPORT, TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT); ASSERT ( p_hid->report_length <= HIDD_BUFFER_SIZE, TUSB_ERROR_NOT_ENOUGH_MEMORY); diff --git a/tinyusb/class/hid/hid_host.c b/tinyusb/class/hid/hid_host.c index c1751814c..e3bdc6137 100644 --- a/tinyusb/class/hid/hid_host.c +++ b/tinyusb/class/hid/hid_host.c @@ -212,7 +212,7 @@ tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con { OSAL_SUBTASK_INVOKED( usbh_control_xfer_subtask( dev_addr, bm_request_type(TUSB_DIR_IN, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_INTERFACE), - TUSB_REQUEST_GET_DESCRIPTOR, (p_desc_hid->bReportType << 8), 0, + TUSB_REQ_GET_DESCRIPTOR, (p_desc_hid->bReportType << 8), 0, p_desc_hid->wReportLength, report_descriptor ), error ); diff --git a/tinyusb/class/msc/msc_host.c b/tinyusb/class/msc/msc_host.c index 01e6f58c7..61cd8796d 100644 --- a/tinyusb/class/msc/msc_host.c +++ b/tinyusb/class/msc/msc_host.c @@ -367,7 +367,7 @@ tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con { // clear stall TODO abstract clear stall function OSAL_SUBTASK_INVOKED( usbh_control_xfer_subtask( dev_addr, bm_request_type(TUSB_DIR_OUT, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_ENDPOINT), - TUSB_REQUEST_CLEAR_FEATURE, 0, hcd_pipe_get_endpoint_addr(msch_data[dev_addr-1].bulk_in), + TUSB_REQ_CLEAR_FEATURE, 0, hcd_pipe_get_endpoint_addr(msch_data[dev_addr-1].bulk_in), 0, NULL ), error ); diff --git a/tinyusb/common/tusb_types.h b/tinyusb/common/tusb_types.h index 2e3cf513d..a77519e80 100644 --- a/tinyusb/common/tusb_types.h +++ b/tinyusb/common/tusb_types.h @@ -92,19 +92,19 @@ typedef enum typedef enum { - TUSB_REQUEST_GET_STATUS =0 , ///< 0 - TUSB_REQUEST_CLEAR_FEATURE , ///< 1 - TUSB_REQUEST_RESERVED , ///< 2 - TUSB_REQUEST_SET_FEATURE , ///< 3 - TUSB_REQUEST_RESERVED2 , ///< 4 - TUSB_REQUEST_SET_ADDRESS , ///< 5 - TUSB_REQUEST_GET_DESCRIPTOR , ///< 6 - TUSB_REQUEST_SET_DESCRIPTOR , ///< 7 - TUSB_REQUEST_GET_CONFIGURATION , ///< 8 - TUSB_REQUEST_SET_CONFIGURATION , ///< 9 - TUSB_REQUEST_GET_INTERFACE , ///< 10 - TUSB_REQUEST_SET_INTERFACE , ///< 11 - TUSB_REQUEST_SYNCH_FRAME ///< 12 + TUSB_REQ_GET_STATUS =0 , ///< 0 + TUSB_REQ_CLEAR_FEATURE , ///< 1 + TUSB_REQ_RESERVED , ///< 2 + TUSB_REQ_SET_FEATURE , ///< 3 + TUSB_REQ_RESERVED2 , ///< 4 + TUSB_REQ_SET_ADDRESS , ///< 5 + TUSB_REQ_GET_DESCRIPTOR , ///< 6 + TUSB_REQ_SET_DESCRIPTOR , ///< 7 + TUSB_REQ_GET_CONFIGURATION , ///< 8 + TUSB_REQ_SET_CONFIGURATION , ///< 9 + TUSB_REQ_GET_INTERFACE , ///< 10 + TUSB_REQ_SET_INTERFACE , ///< 11 + TUSB_REQ_SYNCH_FRAME ///< 12 }tusb_request_code_t; typedef enum diff --git a/tinyusb/device/usbd.h b/tinyusb/device/usbd.h index 6a9c6cffa..6585020c2 100644 --- a/tinyusb/device/usbd.h +++ b/tinyusb/device/usbd.h @@ -134,7 +134,7 @@ tusb_error_t usbd_control_xfer_substak(uint8_t port, tusb_dir_t dir, uint8_t * b static inline bool usbd_control_status(uint8_t port, tusb_dir_t dir) { - tusb_dcd_control_xfer(port , dir, NULL, 0, false); + return tusb_dcd_control_xfer(port, dir, NULL, 0, false); } tusb_error_t usbd_init(void); diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c index fb2ad14b2..713002a50 100644 --- a/tinyusb/host/usbh.c +++ b/tinyusb/host/usbh.c @@ -450,7 +450,7 @@ tusb_error_t enumeration_body_subtask(void) //------------- Get first 8 bytes of device descriptor to get Control Endpoint Size -------------// OSAL_SUBTASK_INVOKED( usbh_control_xfer_subtask( 0, bm_request_type(TUSB_DIR_IN, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE), - TUSB_REQUEST_GET_DESCRIPTOR, (TUSB_DESC_DEVICE << 8), 0, + TUSB_REQ_GET_DESCRIPTOR, (TUSB_DESC_DEVICE << 8), 0, 8, enum_data_buffer ), error ); @@ -483,7 +483,7 @@ tusb_error_t enumeration_body_subtask(void) OSAL_SUBTASK_INVOKED( usbh_control_xfer_subtask( 0, bm_request_type(TUSB_DIR_OUT, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE), - TUSB_REQUEST_SET_ADDRESS, new_addr, 0, + TUSB_REQ_SET_ADDRESS, new_addr, 0, 0, NULL ), error ); @@ -505,7 +505,7 @@ tusb_error_t enumeration_body_subtask(void) //------------- Get full device descriptor -------------// OSAL_SUBTASK_INVOKED( usbh_control_xfer_subtask( new_addr, bm_request_type(TUSB_DIR_IN, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE), - TUSB_REQUEST_GET_DESCRIPTOR, (TUSB_DESC_DEVICE << 8), 0, + TUSB_REQ_GET_DESCRIPTOR, (TUSB_DESC_DEVICE << 8), 0, 18, enum_data_buffer ), error ); @@ -522,7 +522,7 @@ tusb_error_t enumeration_body_subtask(void) //------------- Get 9 bytes of configuration descriptor -------------// OSAL_SUBTASK_INVOKED( usbh_control_xfer_subtask( new_addr, bm_request_type(TUSB_DIR_IN, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE), - TUSB_REQUEST_GET_DESCRIPTOR, (TUSB_DESC_CONFIGURATION << 8) | (configure_selected - 1), 0, + TUSB_REQ_GET_DESCRIPTOR, (TUSB_DESC_CONFIGURATION << 8) | (configure_selected - 1), 0, 9, enum_data_buffer ), error ); @@ -533,7 +533,7 @@ tusb_error_t enumeration_body_subtask(void) //------------- Get full configuration descriptor -------------// OSAL_SUBTASK_INVOKED( usbh_control_xfer_subtask( new_addr, bm_request_type(TUSB_DIR_IN, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE), - TUSB_REQUEST_GET_DESCRIPTOR, (TUSB_DESC_CONFIGURATION << 8) | (configure_selected - 1), 0, + TUSB_REQ_GET_DESCRIPTOR, (TUSB_DESC_CONFIGURATION << 8) | (configure_selected - 1), 0, TUSB_CFG_HOST_ENUM_BUFFER_SIZE, enum_data_buffer ), error ); @@ -545,7 +545,7 @@ tusb_error_t enumeration_body_subtask(void) //------------- Set Configure -------------// OSAL_SUBTASK_INVOKED( usbh_control_xfer_subtask( new_addr, bm_request_type(TUSB_DIR_OUT, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE), - TUSB_REQUEST_SET_CONFIGURATION, configure_selected, 0, + TUSB_REQ_SET_CONFIGURATION, configure_selected, 0, 0, NULL ), error );