Skip to content

Commit f433881

Browse files
committed
Fix USB basic test to match API change
1 parent 811098f commit f433881

File tree

3 files changed

+33
-33
lines changed

3 files changed

+33
-33
lines changed

TESTS/usb_device/basic/USBEndpointTester.cpp

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@
8686
#define EP_ISO_IN 5
8787

8888
USBEndpointTester::ep_config_t USBEndpointTester::_intf_config_max[NUM_ENDPOINTS] = {
89-
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_MAX, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_out) },
90-
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_MAX, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_in) },
91-
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_MAX, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_out) },
92-
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_MAX, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_in) },
93-
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_MAX, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_out) },
94-
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_MAX, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_in) },
89+
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_MAX, &USBEndpointTester::_cb_bulk_out },
90+
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_MAX, &USBEndpointTester::_cb_bulk_in },
91+
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_MAX, &USBEndpointTester::_cb_int_out },
92+
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_MAX, &USBEndpointTester::_cb_int_in },
93+
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_MAX, &USBEndpointTester::_cb_iso_out },
94+
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_MAX, &USBEndpointTester::_cb_iso_in },
9595
};
9696

9797
USBEndpointTester::ep_config_t USBEndpointTester::_intf_config0[NUM_ENDPOINTS] = {
@@ -104,39 +104,39 @@ USBEndpointTester::ep_config_t USBEndpointTester::_intf_config0[NUM_ENDPOINTS] =
104104
};
105105

106106
USBEndpointTester::ep_config_t USBEndpointTester::_intf_config1[NUM_ENDPOINTS] = {
107-
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_1, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_out) },
108-
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_1, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_in) },
109-
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_1, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_out) },
110-
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_1, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_in) },
111-
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_1, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_out) },
112-
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_1, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_in) },
107+
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_1, &USBEndpointTester::_cb_bulk_out },
108+
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_1, &USBEndpointTester::_cb_bulk_in },
109+
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_1, &USBEndpointTester::_cb_int_out },
110+
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_1, &USBEndpointTester::_cb_int_in },
111+
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_1, &USBEndpointTester::_cb_iso_out },
112+
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_1, &USBEndpointTester::_cb_iso_in },
113113
};
114114

115115
USBEndpointTester::ep_config_t USBEndpointTester::_intf_config2[NUM_ENDPOINTS] = {
116-
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_2, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_out) },
117-
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_2, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_in) },
118-
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_2, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_out) },
119-
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_2, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_in) },
120-
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_2, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_out) },
121-
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_2, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_in) },
116+
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_2, &USBEndpointTester::_cb_bulk_out },
117+
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_2, &USBEndpointTester::_cb_bulk_in },
118+
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_2, &USBEndpointTester::_cb_int_out },
119+
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_2, &USBEndpointTester::_cb_int_in },
120+
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_2, &USBEndpointTester::_cb_iso_out },
121+
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_2, &USBEndpointTester::_cb_iso_in },
122122
};
123123

124124
USBEndpointTester::ep_config_t USBEndpointTester::_intf_config3[NUM_ENDPOINTS] = {
125-
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_3, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_out) },
126-
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_3, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_in) },
127-
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_3, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_out) },
128-
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_3, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_in) },
129-
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_3, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_out) },
130-
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_3, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_in) },
125+
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_3, &USBEndpointTester::_cb_bulk_out },
126+
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_3, &USBEndpointTester::_cb_bulk_in },
127+
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_3, &USBEndpointTester::_cb_int_out },
128+
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_3, &USBEndpointTester::_cb_int_in},
129+
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_3, &USBEndpointTester::_cb_iso_out },
130+
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_3, &USBEndpointTester::_cb_iso_in },
131131
};
132132

133133
USBEndpointTester::ep_config_t USBEndpointTester::_intf_config4[NUM_ENDPOINTS] = {
134-
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_4, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_out) },
135-
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_4, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_in) },
136-
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_4, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_out) },
137-
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_4, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_in) },
138-
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_4, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_out) },
139-
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_4, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_in) },
134+
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_4, &USBEndpointTester::_cb_bulk_out },
135+
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_4, &USBEndpointTester::_cb_bulk_in },
136+
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_4, &USBEndpointTester::_cb_int_out },
137+
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_4, &USBEndpointTester::_cb_int_in },
138+
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_4, &USBEndpointTester::_cb_iso_out },
139+
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_4, &USBEndpointTester::_cb_iso_in },
140140
};
141141

142142
USBEndpointTester::USBEndpointTester(USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint16_t product_release,
@@ -390,7 +390,7 @@ void USBEndpointTester::_setup_non_zero_endpoints()
390390
ep_config_t *epc = NULL;
391391
for (size_t i = 0; i < NUM_ENDPOINTS; i++) {
392392
epc = &((*_endpoint_configs)[i]);
393-
endpoint_add(_endpoints[i], epc->max_packet, epc->type, epc->callback);
393+
endpoint_add(_endpoints[i], epc->max_packet, epc->type, mbed::callback(this, epc->callback));
394394
if (epc->callback == NULL) {
395395
continue;
396396
}

TESTS/usb_device/basic/USBEndpointTester.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class USBEndpointTester: public USBDevice {
7474
bool dir_in;
7575
usb_ep_type_t type;
7676
uint32_t max_packet;
77-
ep_cb_t callback;
77+
void (USBEndpointTester::*callback)(void);
7878
};
7979

8080
protected:

TESTS/usb_device/basic/USBTester.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ bool USBTester::setup_iterface(uint8_t ep_in, uint8_t ep_out, uint32_t ep_size,
226226
bool success = false;
227227

228228
success = endpoint_add(ep_in, ep_size, ep_type);
229-
success &= endpoint_add(ep_out, ep_size, ep_type, callback);
229+
success &= endpoint_add(ep_out, ep_size, ep_type, mbed::callback(this, callback));
230230
success &= read_start(ep_out, buf, buf_size);
231231
return success;
232232
}

0 commit comments

Comments
 (0)