From f7f0681c7b03ed4b724e7a339c9210f2b937bc50 Mon Sep 17 00:00:00 2001 From: Rajkumar Kanagaraj Date: Mon, 4 May 2020 18:35:06 +0100 Subject: [PATCH] USB hid and basic test - Enable the USB hid and basic test for bare metal profile. - Remove the partially (The green tea test host side implementation is missing on pyusb_basic.py ) implemented USB control transfer VENDOR_TEST_CTRL_NONE_DELAY request type test case as it is becoming obsolete. - Remove high priority event queue which is used by that request type test case. --- TESTS/configs/baremetal.json | 3 ++- TESTS/host_tests/pyusb_basic.py | 1 - TESTS/usb_device/basic/USBEndpointTester.cpp | 5 +---- TESTS/usb_device/basic/USBEndpointTester.h | 1 - TESTS/usb_device/basic/USBTester.cpp | 18 ++---------------- TESTS/usb_device/basic/USBTester.h | 1 - TESTS/usb_device/basic/main.cpp | 5 ----- TESTS/usb_device/hid/main.cpp | 5 ----- 8 files changed, 5 insertions(+), 34 deletions(-) diff --git a/TESTS/configs/baremetal.json b/TESTS/configs/baremetal.json index c6a83768d5..f4bab91ded 100644 --- a/TESTS/configs/baremetal.json +++ b/TESTS/configs/baremetal.json @@ -31,7 +31,8 @@ "kv-global-api", "sd", "qspif", - "cryptocell310" + "cryptocell310", + "drivers-usb" ], "target_overrides": { "*": { diff --git a/TESTS/host_tests/pyusb_basic.py b/TESTS/host_tests/pyusb_basic.py index 6ad2a255fd..67651098bf 100644 --- a/TESTS/host_tests/pyusb_basic.py +++ b/TESTS/host_tests/pyusb_basic.py @@ -61,7 +61,6 @@ VENDOR_TEST_CTRL_OUT = 2 VENDOR_TEST_CTRL_NONE = 3 VENDOR_TEST_CTRL_IN_DELAY = 4 VENDOR_TEST_CTRL_OUT_DELAY = 5 -VENDOR_TEST_CTRL_NONE_DELAY = 6 VENDOR_TEST_CTRL_IN_STATUS_DELAY = 7 VENDOR_TEST_CTRL_OUT_STATUS_DELAY = 8 VENDOR_TEST_CTRL_IN_SIZES = 9 diff --git a/TESTS/usb_device/basic/USBEndpointTester.cpp b/TESTS/usb_device/basic/USBEndpointTester.cpp index f3af42b75e..172443cd70 100644 --- a/TESTS/usb_device/basic/USBEndpointTester.cpp +++ b/TESTS/usb_device/basic/USBEndpointTester.cpp @@ -17,8 +17,6 @@ #if USB_DEVICE_TESTS -#if defined(MBED_CONF_RTOS_PRESENT) - #include "stdint.h" #include "stdlib.h" #include "USBEndpointTester.h" @@ -173,7 +171,6 @@ USBEndpointTester::USBEndpointTester(USBPhy *phy, uint16_t vendor_id, uint16_t p MBED_ASSERT(_endpoint_buffs[i] != NULL); } MBED_ASSERT(resolver.valid()); - queue = mbed::mbed_highprio_event_queue(); configuration_desc(0); ctrl_buf = new uint8_t[CTRL_BUF_SIZE]; init(); @@ -864,5 +861,5 @@ void USBEndpointTester::start_ep_in_abort_test() write_start(_endpoints[EP_BULK_IN], _endpoint_buffs[EP_BULK_IN], (*_endpoint_configs)[EP_BULK_IN].max_packet); write_start(_endpoints[EP_INT_IN], _endpoint_buffs[EP_INT_IN], (*_endpoint_configs)[EP_INT_IN].max_packet); } -#endif + #endif //USB_DEVICE_TESTS diff --git a/TESTS/usb_device/basic/USBEndpointTester.h b/TESTS/usb_device/basic/USBEndpointTester.h index b6037f60a7..a1d02ea185 100644 --- a/TESTS/usb_device/basic/USBEndpointTester.h +++ b/TESTS/usb_device/basic/USBEndpointTester.h @@ -79,7 +79,6 @@ public: }; protected: - events::EventQueue *queue; rtos::EventFlags flags; uint8_t *ctrl_buf; diff --git a/TESTS/usb_device/basic/USBTester.cpp b/TESTS/usb_device/basic/USBTester.cpp index 7f01ba16ae..6f9672be6e 100644 --- a/TESTS/usb_device/basic/USBTester.cpp +++ b/TESTS/usb_device/basic/USBTester.cpp @@ -17,8 +17,6 @@ #if USB_DEVICE_TESTS -#if defined(MBED_CONF_RTOS_PRESENT) - #include "stdint.h" #include "USBTester.h" #include "mbed_shared_queues.h" @@ -32,7 +30,6 @@ #define VENDOR_TEST_CTRL_NONE 3 #define VENDOR_TEST_CTRL_IN_DELAY 4 #define VENDOR_TEST_CTRL_OUT_DELAY 5 -#define VENDOR_TEST_CTRL_NONE_DELAY 6 #define VENDOR_TEST_CTRL_IN_STATUS_DELAY 7 #define VENDOR_TEST_CTRL_OUT_STATUS_DELAY 8 #define VENDOR_TEST_CTRL_IN_SIZES 9 @@ -45,7 +42,6 @@ #define EVENT_READY (1 << 0) - USBTester::USBTester(USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint16_t product_release): USBDevice(phy, vendor_id, product_id, product_release), interface_0_alt_set(NONE), interface_1_alt_set(NONE), configuration_set(NONE), reset_count(0), @@ -60,7 +56,6 @@ USBTester::USBTester(USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint1 int_in = resolver.endpoint_in(USB_EP_TYPE_INT, 64); int_out = resolver.endpoint_out(USB_EP_TYPE_INT, 64); MBED_ASSERT(resolver.valid()); - queue = mbed::mbed_highprio_event_queue(); configuration_desc(0); ctrl_buf = new uint8_t[CTRL_BUF_SIZE]; init(); @@ -136,7 +131,6 @@ void USBTester::callback_request(const setup_packet_t *setup) RequestResult result = PassThrough; uint8_t *data = NULL; uint32_t size = 0; - uint32_t delay = 0; /* Process vendor-specific requests */ if (setup->bmRequestType.Type == VENDOR_TYPE) { @@ -154,10 +148,6 @@ void USBTester::callback_request(const setup_packet_t *setup) case VENDOR_TEST_CTRL_NONE: result = Success; break; - case VENDOR_TEST_CTRL_NONE_DELAY: - result = Success; - delay = 2000; - break; case VENDOR_TEST_CTRL_IN_SIZES: result = Send; data = ctrl_buf; @@ -174,11 +164,7 @@ void USBTester::callback_request(const setup_packet_t *setup) } } - if (delay) { - queue->call_in(delay, static_cast(this), &USBTester::complete_request, Success, data, size); - } else { - complete_request(result, data, size); - } + complete_request(result, data, size); } void USBTester::callback_request_xfer_done(const setup_packet_t *setup, bool aborted) @@ -706,5 +692,5 @@ void USBTester::epbulk_out_callback() read_finish(bulk_out); read_start(bulk_out, bulk_buf, sizeof(bulk_buf)); } -#endif + #endif //USB_DEVICE_TESTS diff --git a/TESTS/usb_device/basic/USBTester.h b/TESTS/usb_device/basic/USBTester.h index 76258004d9..afe1dfa92e 100644 --- a/TESTS/usb_device/basic/USBTester.h +++ b/TESTS/usb_device/basic/USBTester.h @@ -125,7 +125,6 @@ protected: uint8_t int_in; uint8_t int_out; uint8_t int_buf[64]; - events::EventQueue *queue; rtos::EventFlags flags; volatile uint32_t reset_count; volatile uint32_t suspend_count; diff --git a/TESTS/usb_device/basic/main.cpp b/TESTS/usb_device/basic/main.cpp index efa559cac3..2667af2c61 100644 --- a/TESTS/usb_device/basic/main.cpp +++ b/TESTS/usb_device/basic/main.cpp @@ -19,10 +19,6 @@ #error [NOT_SUPPORTED] usb device tests not enabled #else -#if !defined(MBED_CONF_RTOS_PRESENT) -#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run. -#else - #include #include #include "mbed.h" @@ -669,5 +665,4 @@ int main() } #endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE -#endif // !defined(MBED_CONF_RTOS_PRESENT) #endif // !defined(USB_DEVICE_TESTS) diff --git a/TESTS/usb_device/hid/main.cpp b/TESTS/usb_device/hid/main.cpp index cd92070eb3..551bac2a8f 100644 --- a/TESTS/usb_device/hid/main.cpp +++ b/TESTS/usb_device/hid/main.cpp @@ -19,10 +19,6 @@ #error [NOT_SUPPORTED] usb device tests not enabled #else -#if !defined(MBED_CONF_RTOS_PRESENT) -#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run. -#else - #if !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE #error [NOT_SUPPORTED] USB Device not supported for this target #else @@ -393,5 +389,4 @@ int main() } #endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE -#endif // !defined(MBED_CONF_RTOS_PRESENT) #endif // !defined(USB_DEVICE_TESTS)