Skip to content

Commit 772c7bd

Browse files
committed
Bare metal profile: Enable USB hid and basic test
- 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. - Remove high priority event queue which is used by that request type test casetest became obsolete.
1 parent 918d679 commit 772c7bd

File tree

8 files changed

+5
-34
lines changed

8 files changed

+5
-34
lines changed

TESTS/configs/baremetal.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"kv-global-api",
3232
"sd",
3333
"qspif",
34-
"cryptocell310"
34+
"cryptocell310",
35+
"drivers-usb"
3536
],
3637
"target_overrides": {
3738
"*": {

TESTS/host_tests/pyusb_basic.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ def get_interface(dev, interface, alternate=0):
6161
VENDOR_TEST_CTRL_NONE = 3
6262
VENDOR_TEST_CTRL_IN_DELAY = 4
6363
VENDOR_TEST_CTRL_OUT_DELAY = 5
64-
VENDOR_TEST_CTRL_NONE_DELAY = 6
6564
VENDOR_TEST_CTRL_IN_STATUS_DELAY = 7
6665
VENDOR_TEST_CTRL_OUT_STATUS_DELAY = 8
6766
VENDOR_TEST_CTRL_IN_SIZES = 9

TESTS/usb_device/basic/USBEndpointTester.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
#if USB_DEVICE_TESTS
1919

20-
#if defined(MBED_CONF_RTOS_PRESENT)
21-
2220
#include "stdint.h"
2321
#include "stdlib.h"
2422
#include "USBEndpointTester.h"
@@ -173,7 +171,6 @@ USBEndpointTester::USBEndpointTester(USBPhy *phy, uint16_t vendor_id, uint16_t p
173171
MBED_ASSERT(_endpoint_buffs[i] != NULL);
174172
}
175173
MBED_ASSERT(resolver.valid());
176-
queue = mbed::mbed_highprio_event_queue();
177174
configuration_desc(0);
178175
ctrl_buf = new uint8_t[CTRL_BUF_SIZE];
179176
init();
@@ -864,5 +861,5 @@ void USBEndpointTester::start_ep_in_abort_test()
864861
write_start(_endpoints[EP_BULK_IN], _endpoint_buffs[EP_BULK_IN], (*_endpoint_configs)[EP_BULK_IN].max_packet);
865862
write_start(_endpoints[EP_INT_IN], _endpoint_buffs[EP_INT_IN], (*_endpoint_configs)[EP_INT_IN].max_packet);
866863
}
867-
#endif
864+
868865
#endif //USB_DEVICE_TESTS

TESTS/usb_device/basic/USBEndpointTester.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ class USBEndpointTester: public USBDevice, private mbed::NonCopyable<USBEndpoint
7979
};
8080

8181
protected:
82-
events::EventQueue *queue;
8382
rtos::EventFlags flags;
8483
uint8_t *ctrl_buf;
8584

TESTS/usb_device/basic/USBTester.cpp

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
#if USB_DEVICE_TESTS
1919

20-
#if defined(MBED_CONF_RTOS_PRESENT)
21-
2220
#include "stdint.h"
2321
#include "USBTester.h"
2422
#include "mbed_shared_queues.h"
@@ -32,7 +30,6 @@
3230
#define VENDOR_TEST_CTRL_NONE 3
3331
#define VENDOR_TEST_CTRL_IN_DELAY 4
3432
#define VENDOR_TEST_CTRL_OUT_DELAY 5
35-
#define VENDOR_TEST_CTRL_NONE_DELAY 6
3633
#define VENDOR_TEST_CTRL_IN_STATUS_DELAY 7
3734
#define VENDOR_TEST_CTRL_OUT_STATUS_DELAY 8
3835
#define VENDOR_TEST_CTRL_IN_SIZES 9
@@ -45,7 +42,6 @@
4542

4643
#define EVENT_READY (1 << 0)
4744

48-
4945
USBTester::USBTester(USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint16_t product_release):
5046
USBDevice(phy, vendor_id, product_id, product_release), interface_0_alt_set(NONE),
5147
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
6056
int_in = resolver.endpoint_in(USB_EP_TYPE_INT, 64);
6157
int_out = resolver.endpoint_out(USB_EP_TYPE_INT, 64);
6258
MBED_ASSERT(resolver.valid());
63-
queue = mbed::mbed_highprio_event_queue();
6459
configuration_desc(0);
6560
ctrl_buf = new uint8_t[CTRL_BUF_SIZE];
6661
init();
@@ -136,7 +131,6 @@ void USBTester::callback_request(const setup_packet_t *setup)
136131
RequestResult result = PassThrough;
137132
uint8_t *data = NULL;
138133
uint32_t size = 0;
139-
uint32_t delay = 0;
140134

141135
/* Process vendor-specific requests */
142136
if (setup->bmRequestType.Type == VENDOR_TYPE) {
@@ -154,10 +148,6 @@ void USBTester::callback_request(const setup_packet_t *setup)
154148
case VENDOR_TEST_CTRL_NONE:
155149
result = Success;
156150
break;
157-
case VENDOR_TEST_CTRL_NONE_DELAY:
158-
result = Success;
159-
delay = 2000;
160-
break;
161151
case VENDOR_TEST_CTRL_IN_SIZES:
162152
result = Send;
163153
data = ctrl_buf;
@@ -174,11 +164,7 @@ void USBTester::callback_request(const setup_packet_t *setup)
174164
}
175165
}
176166

177-
if (delay) {
178-
queue->call_in(delay, static_cast<USBDevice *>(this), &USBTester::complete_request, Success, data, size);
179-
} else {
180-
complete_request(result, data, size);
181-
}
167+
complete_request(result, data, size);
182168
}
183169

184170
void USBTester::callback_request_xfer_done(const setup_packet_t *setup, bool aborted)
@@ -706,5 +692,5 @@ void USBTester::epbulk_out_callback()
706692
read_finish(bulk_out);
707693
read_start(bulk_out, bulk_buf, sizeof(bulk_buf));
708694
}
709-
#endif
695+
710696
#endif //USB_DEVICE_TESTS

TESTS/usb_device/basic/USBTester.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ class USBTester: public USBDevice, private mbed::NonCopyable<USBTester> {
125125
uint8_t int_in;
126126
uint8_t int_out;
127127
uint8_t int_buf[64];
128-
events::EventQueue *queue;
129128
rtos::EventFlags flags;
130129
volatile uint32_t reset_count;
131130
volatile uint32_t suspend_count;

TESTS/usb_device/basic/main.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
#error [NOT_SUPPORTED] usb device tests not enabled
2020
#else
2121

22-
#if !defined(MBED_CONF_RTOS_PRESENT)
23-
#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run.
24-
#else
25-
2622
#include <stdio.h>
2723
#include <string.h>
2824
#include "mbed.h"
@@ -669,5 +665,4 @@ int main()
669665
}
670666

671667
#endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
672-
#endif // !defined(MBED_CONF_RTOS_PRESENT)
673668
#endif // !defined(USB_DEVICE_TESTS)

TESTS/usb_device/hid/main.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
#error [NOT_SUPPORTED] usb device tests not enabled
2020
#else
2121

22-
#if !defined(MBED_CONF_RTOS_PRESENT)
23-
#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run.
24-
#else
25-
2622
#if !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
2723
#error [NOT_SUPPORTED] USB Device not supported for this target
2824
#else
@@ -393,5 +389,4 @@ int main()
393389
}
394390

395391
#endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
396-
#endif // !defined(MBED_CONF_RTOS_PRESENT)
397392
#endif // !defined(USB_DEVICE_TESTS)

0 commit comments

Comments
 (0)