Skip to content

Commit

Permalink
usb basic test update
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejbocianski committed Aug 12, 2019
1 parent c4b2e3f commit 092b26b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 33 deletions.
62 changes: 31 additions & 31 deletions TESTS/usb_device/basic/USBEndpointTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@
#define EP_ISO_IN 5

USBEndpointTester::ep_config_t USBEndpointTester::_intf_config_max[NUM_ENDPOINTS] = {
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_MAX, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_out) },
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_MAX, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_in) },
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_MAX, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_out) },
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_MAX, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_in) },
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_MAX, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_out) },
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_MAX, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_in) },
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_MAX, &USBEndpointTester::_cb_bulk_out },
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_MAX, &USBEndpointTester::_cb_bulk_in },
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_MAX, &USBEndpointTester::_cb_int_out },
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_MAX, &USBEndpointTester::_cb_int_in },
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_MAX, &USBEndpointTester::_cb_iso_out },
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_MAX, &USBEndpointTester::_cb_iso_in },
};

USBEndpointTester::ep_config_t USBEndpointTester::_intf_config0[NUM_ENDPOINTS] = {
Expand All @@ -104,39 +104,39 @@ USBEndpointTester::ep_config_t USBEndpointTester::_intf_config0[NUM_ENDPOINTS] =
};

USBEndpointTester::ep_config_t USBEndpointTester::_intf_config1[NUM_ENDPOINTS] = {
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_1, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_out) },
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_1, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_in) },
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_1, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_out) },
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_1, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_in) },
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_1, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_out) },
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_1, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_in) },
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_1, &USBEndpointTester::_cb_bulk_out },
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_1, &USBEndpointTester::_cb_bulk_in },
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_1, &USBEndpointTester::_cb_int_out },
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_1, &USBEndpointTester::_cb_int_in },
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_1, &USBEndpointTester::_cb_iso_out },
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_1, &USBEndpointTester::_cb_iso_in },
};

USBEndpointTester::ep_config_t USBEndpointTester::_intf_config2[NUM_ENDPOINTS] = {
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_2, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_out) },
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_2, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_in) },
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_2, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_out) },
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_2, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_in) },
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_2, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_out) },
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_2, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_in) },
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_2, &USBEndpointTester::_cb_bulk_out },
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_2, &USBEndpointTester::_cb_bulk_in },
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_2, &USBEndpointTester::_cb_int_out },
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_2, &USBEndpointTester::_cb_int_in },
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_2, &USBEndpointTester::_cb_iso_out },
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_2, &USBEndpointTester::_cb_iso_in },
};

USBEndpointTester::ep_config_t USBEndpointTester::_intf_config3[NUM_ENDPOINTS] = {
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_3, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_out) },
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_3, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_in) },
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_3, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_out) },
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_3, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_in) },
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_3, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_out) },
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_3, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_in) },
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_3, &USBEndpointTester::_cb_bulk_out },
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_3, &USBEndpointTester::_cb_bulk_in },
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_3, &USBEndpointTester::_cb_int_out },
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_3, &USBEndpointTester::_cb_int_in },
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_3, &USBEndpointTester::_cb_iso_out },
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_3, &USBEndpointTester::_cb_iso_in },
};

USBEndpointTester::ep_config_t USBEndpointTester::_intf_config4[NUM_ENDPOINTS] = {
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_4, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_out) },
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_4, static_cast<ep_cb_t>(&USBEndpointTester::_cb_bulk_in) },
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_4, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_out) },
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_4, static_cast<ep_cb_t>(&USBEndpointTester::_cb_int_in) },
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_4, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_out) },
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_4, static_cast<ep_cb_t>(&USBEndpointTester::_cb_iso_in) },
{ false, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_4, &USBEndpointTester::_cb_bulk_out },
{ true, USB_EP_TYPE_BULK, TEST_SIZE_EP_BULK_4, &USBEndpointTester::_cb_bulk_in },
{ false, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_4, &USBEndpointTester::_cb_int_out },
{ true, USB_EP_TYPE_INT, TEST_SIZE_EP_INT_4, &USBEndpointTester::_cb_int_in },
{ false, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_4, &USBEndpointTester::_cb_iso_out },
{ true, USB_EP_TYPE_ISO, TEST_SIZE_EP_ISO_4, &USBEndpointTester::_cb_iso_in },
};

USBEndpointTester::USBEndpointTester(USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint16_t product_release,
Expand Down Expand Up @@ -390,7 +390,7 @@ void USBEndpointTester::_setup_non_zero_endpoints()
ep_config_t *epc = NULL;
for (size_t i = 0; i < NUM_ENDPOINTS; i++) {
epc = &((*_endpoint_configs)[i]);
endpoint_add(_endpoints[i], epc->max_packet, epc->type, epc->callback);
endpoint_add(_endpoints[i], epc->max_packet, epc->type, mbed::callback(this, epc->callback));
if (epc->callback == NULL) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion TESTS/usb_device/basic/USBEndpointTester.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class USBEndpointTester: public USBDevice {
bool dir_in;
usb_ep_type_t type;
uint32_t max_packet;
ep_cb_t callback;
void (USBEndpointTester::*callback)();
};

protected:
Expand Down
2 changes: 1 addition & 1 deletion TESTS/usb_device/basic/USBTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ bool USBTester::setup_iterface(uint8_t ep_in, uint8_t ep_out, uint32_t ep_size,
bool success = false;

success = endpoint_add(ep_in, ep_size, ep_type);
success &= endpoint_add(ep_out, ep_size, ep_type, callback);
success &= endpoint_add(ep_out, ep_size, ep_type, mbed::callback(this, callback));
success &= read_start(ep_out, buf, buf_size);
return success;
}
Expand Down

0 comments on commit 092b26b

Please sign in to comment.