Skip to content

Commit 631e81e

Browse files
authored
Merge pull request #12916 from rajkan01/usb_basic_hid_greentea
USB basic and hid greentea test cleanup and enable to the bare metal profile
2 parents 5f76dfe + 61c70e0 commit 631e81e

File tree

8 files changed

+15
-57
lines changed

8 files changed

+15
-57
lines changed

TESTS/configs/baremetal.json

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

TESTS/host_tests/pyusb_basic.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,10 @@ def get_interface(dev, interface, alternate=0):
5858

5959
VENDOR_TEST_CTRL_IN = 1
6060
VENDOR_TEST_CTRL_OUT = 2
61-
VENDOR_TEST_CTRL_NONE = 3
62-
VENDOR_TEST_CTRL_IN_DELAY = 4
63-
VENDOR_TEST_CTRL_OUT_DELAY = 5
64-
VENDOR_TEST_CTRL_NONE_DELAY = 6
65-
VENDOR_TEST_CTRL_IN_STATUS_DELAY = 7
66-
VENDOR_TEST_CTRL_OUT_STATUS_DELAY = 8
67-
VENDOR_TEST_CTRL_IN_SIZES = 9
68-
VENDOR_TEST_CTRL_OUT_SIZES = 10
69-
VENDOR_TEST_RW_RESTART = 11
70-
VENDOR_TEST_ABORT_BUFF_CHECK = 12
61+
VENDOR_TEST_CTRL_IN_SIZES = 3
62+
VENDOR_TEST_CTRL_OUT_SIZES = 4
63+
VENDOR_TEST_RW_RESTART = 5
64+
VENDOR_TEST_ABORT_BUFF_CHECK = 6
7165
VENDOR_TEST_UNSUPPORTED_REQUEST = 32
7266

7367
REQUEST_GET_STATUS = 0

TESTS/usb_device/basic/USBEndpointTester.cpp

Lines changed: 5 additions & 8 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"
@@ -39,10 +37,10 @@
3937

4038
#define VENDOR_TEST_CTRL_IN 1
4139
#define VENDOR_TEST_CTRL_OUT 2
42-
#define VENDOR_TEST_CTRL_IN_SIZES 9
43-
#define VENDOR_TEST_CTRL_OUT_SIZES 10
44-
#define VENDOR_TEST_RW_RESTART 11
45-
#define VENDOR_TEST_ABORT_BUFF_CHECK 12
40+
#define VENDOR_TEST_CTRL_IN_SIZES 3
41+
#define VENDOR_TEST_CTRL_OUT_SIZES 4
42+
#define VENDOR_TEST_RW_RESTART 5
43+
#define VENDOR_TEST_ABORT_BUFF_CHECK 6
4644

4745
#define CTRL_BUF_SIZE (2048)
4846

@@ -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: 4 additions & 26 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"
@@ -29,14 +27,8 @@
2927

3028
#define VENDOR_TEST_CTRL_IN 1
3129
#define VENDOR_TEST_CTRL_OUT 2
32-
#define VENDOR_TEST_CTRL_NONE 3
33-
#define VENDOR_TEST_CTRL_IN_DELAY 4
34-
#define VENDOR_TEST_CTRL_OUT_DELAY 5
35-
#define VENDOR_TEST_CTRL_NONE_DELAY 6
36-
#define VENDOR_TEST_CTRL_IN_STATUS_DELAY 7
37-
#define VENDOR_TEST_CTRL_OUT_STATUS_DELAY 8
38-
#define VENDOR_TEST_CTRL_IN_SIZES 9
39-
#define VENDOR_TEST_CTRL_OUT_SIZES 10
30+
#define VENDOR_TEST_CTRL_IN_SIZES 3
31+
#define VENDOR_TEST_CTRL_OUT_SIZES 4
4032

4133
#define MAX_EP_SIZE 64
4234
#define MIN_EP_SIZE 8
@@ -45,7 +37,6 @@
4537

4638
#define EVENT_READY (1 << 0)
4739

48-
4940
USBTester::USBTester(USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint16_t product_release):
5041
USBDevice(phy, vendor_id, product_id, product_release), interface_0_alt_set(NONE),
5142
interface_1_alt_set(NONE), configuration_set(NONE), reset_count(0),
@@ -60,7 +51,6 @@ USBTester::USBTester(USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint1
6051
int_in = resolver.endpoint_in(USB_EP_TYPE_INT, 64);
6152
int_out = resolver.endpoint_out(USB_EP_TYPE_INT, 64);
6253
MBED_ASSERT(resolver.valid());
63-
queue = mbed::mbed_highprio_event_queue();
6454
configuration_desc(0);
6555
ctrl_buf = new uint8_t[CTRL_BUF_SIZE];
6656
init();
@@ -136,7 +126,6 @@ void USBTester::callback_request(const setup_packet_t *setup)
136126
RequestResult result = PassThrough;
137127
uint8_t *data = NULL;
138128
uint32_t size = 0;
139-
uint32_t delay = 0;
140129

141130
/* Process vendor-specific requests */
142131
if (setup->bmRequestType.Type == VENDOR_TYPE) {
@@ -151,13 +140,6 @@ void USBTester::callback_request(const setup_packet_t *setup)
151140
data = ctrl_buf;
152141
size = setup->wValue < 8 ? setup->wValue : 8;
153142
break;
154-
case VENDOR_TEST_CTRL_NONE:
155-
result = Success;
156-
break;
157-
case VENDOR_TEST_CTRL_NONE_DELAY:
158-
result = Success;
159-
delay = 2000;
160-
break;
161143
case VENDOR_TEST_CTRL_IN_SIZES:
162144
result = Send;
163145
data = ctrl_buf;
@@ -174,11 +156,7 @@ void USBTester::callback_request(const setup_packet_t *setup)
174156
}
175157
}
176158

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-
}
159+
complete_request(result, data, size);
182160
}
183161

184162
void USBTester::callback_request_xfer_done(const setup_packet_t *setup, bool aborted)
@@ -706,5 +684,5 @@ void USBTester::epbulk_out_callback()
706684
read_finish(bulk_out);
707685
read_start(bulk_out, bulk_buf, sizeof(bulk_buf));
708686
}
709-
#endif
687+
710688
#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)