Skip to content

Remove endpoint parameter from USB callbacks #7267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions TESTS/usb_device/basic/USBTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void USBTester::callback_set_configuration(uint8_t configuration)
}

bool USBTester::setup_iterface(uint8_t ep_in, uint8_t ep_out, uint32_t ep_size, usb_ep_type_t ep_type,
uint8_t *buf, uint32_t buf_size, void (USBTester::*callback)(usb_ep_t endpoint))
uint8_t *buf, uint32_t buf_size, void (USBTester::*callback)())
{
bool success = false;

Expand Down Expand Up @@ -690,13 +690,13 @@ const uint8_t *USBTester::configuration_desc(uint8_t index)
}
}

void USBTester::epint_out_callback(usb_ep_t endpoint)
void USBTester::epint_out_callback()
{
read_finish(endpoint);
read_start(endpoint, int_buf, sizeof(int_buf));
read_finish(int_out);
read_start(int_out, int_buf, sizeof(int_buf));
}
void USBTester::epbulk_out_callback(usb_ep_t endpoint)
void USBTester::epbulk_out_callback()
{
read_finish(endpoint);
read_start(endpoint, bulk_buf, sizeof(bulk_buf));
read_finish(bulk_out);
read_start(bulk_out, bulk_buf, sizeof(bulk_buf));
}
6 changes: 3 additions & 3 deletions TESTS/usb_device/basic/USBTester.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class USBTester: public USBDevice {
bool set_configuration(uint16_t configuration);
bool set_interface(uint16_t interface, uint16_t alternate);
bool setup_iterface(uint8_t ep_in, uint8_t ep_out, uint32_t ep_size, usb_ep_type_t ep_type,
uint8_t *buf, uint32_t buf_size, void (USBTester::*callback)(usb_ep_t endpoint));
uint8_t *buf, uint32_t buf_size, void (USBTester::*callback)());
void remove_iterface(uint16_t interface);
int16_t interface_0_alt_set;
int16_t interface_1_alt_set;
Expand Down Expand Up @@ -117,8 +117,8 @@ class USBTester: public USBDevice {
virtual void callback_request_xfer_done(const setup_packet_t *setup, bool aborted);
virtual void callback_set_configuration(uint8_t configuration);
virtual void callback_set_interface(uint16_t interface, uint8_t alternate);
virtual void epbulk_out_callback(usb_ep_t endpoint);
virtual void epint_out_callback(usb_ep_t endpoint);
virtual void epbulk_out_callback();
virtual void epint_out_callback();
virtual void callback_reset();
uint8_t ctrl_buf[2048];

Expand Down
6 changes: 2 additions & 4 deletions usb/device/USBAudio/USBAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -883,10 +883,9 @@ void USBAudio::_receive_change(ChannelState new_state)
}
}

void USBAudio::_receive_isr(usb_ep_t ep)
void USBAudio::_receive_isr()
{
assert_locked();
MBED_ASSERT(ep == _episo_out);

uint32_t size = read_finish(_episo_out);

Expand Down Expand Up @@ -984,10 +983,9 @@ void USBAudio::_send_isr_next_sync()
_tx_frame_fract += _tx_fract_frames_per_xfer;
}

void USBAudio::_send_isr(usb_ep_t ep)
void USBAudio::_send_isr()
{
assert_locked();
MBED_ASSERT(ep == _episo_in);

write_finish(_episo_in);

Expand Down
4 changes: 2 additions & 2 deletions usb/device/USBAudio/USBAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,11 @@ class USBAudio: protected USBDevice {
void _build_configuration_desc();

void _receive_change(ChannelState new_state);
void _receive_isr(usb_ep_t ep);
void _receive_isr();
void _send_change(ChannelState new_state);
void _send_isr_start();
void _send_isr_next_sync();
void _send_isr(usb_ep_t ep);
void _send_isr();

// has connect been called
bool _connected;
Expand Down
4 changes: 2 additions & 2 deletions usb/device/USBDevice/USBDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ void USBDevice::out(usb_ep_t endpoint)
MBED_ASSERT(info->pending >= 1);
info->pending -= 1;
if (info->callback) {
(this->*(info->callback))(endpoint);
(this->*(info->callback))();
}
}

Expand All @@ -957,7 +957,7 @@ void USBDevice::in(usb_ep_t endpoint)
MBED_ASSERT(info->pending >= 1);
info->pending -= 1;
if (info->callback) {
(this->*(info->callback))(endpoint);
(this->*(info->callback))();
}
}

Expand Down
6 changes: 3 additions & 3 deletions usb/device/USBDevice/USBDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
*/
class USBDevice: public USBPhyEvents {
public:
typedef void (USBDevice::*ep_cb_t)(usb_ep_t endpoint);
typedef void (USBDevice::*ep_cb_t)();

enum RequestResult {
Receive = 0,
Expand Down Expand Up @@ -157,7 +157,7 @@ class USBDevice: public USBPhyEvents {
* @returns true if successful, false otherwise
*/
template<typename T>
bool endpoint_add(usb_ep_t endpoint, uint32_t max_packet, usb_ep_type_t type, void (T::*callback)(usb_ep_t endpoint))
bool endpoint_add(usb_ep_t endpoint, uint32_t max_packet, usb_ep_type_t type, void (T::*callback)())
{
return endpoint_add(endpoint, max_packet, type, static_cast<ep_cb_t>(callback));
}
Expand Down Expand Up @@ -539,7 +539,7 @@ class USBDevice: public USBPhyEvents {
void _complete_set_interface();

struct endpoint_info_t {
void (USBDevice::*callback)(usb_ep_t endpoint);
ep_cb_t callback;
uint16_t max_packet_size;
uint16_t transfer_size;
uint8_t flags;
Expand Down
4 changes: 2 additions & 2 deletions usb/device/USBHID/USBHID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ bool USBHID::read_nb(HID_REPORT *report)
return success;
}

void USBHID::_send_isr(usb_ep_t endpoint)
void USBHID::_send_isr()
{
assert_locked();

Expand All @@ -247,7 +247,7 @@ void USBHID::_send_isr(usb_ep_t endpoint)

}

void USBHID::_read_isr(usb_ep_t endpoint)
void USBHID::_read_isr()
{
assert_locked();

Expand Down
4 changes: 2 additions & 2 deletions usb/device/USBHID/USBHID.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ class USBHID: public USBDevice {

private:
void _init(uint8_t output_report_length, uint8_t input_report_length);
void _send_isr(usb_ep_t endpoint);
void _read_isr(usb_ep_t endpoint);
void _send_isr();
void _read_isr();

class AsyncSend;
class AsyncRead;
Expand Down
4 changes: 2 additions & 2 deletions usb/device/USBMIDI/USBMIDI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,14 @@ const uint8_t *USBMIDI::configuration_desc(uint8_t index)
return _config_descriptor;
}

void USBMIDI::_in_callback(usb_ep_t ep)
void USBMIDI::_in_callback()
{
assert_locked();

_flags.set(FLAG_WRITE_DONE);
}

void USBMIDI::_out_callback(usb_ep_t ep)
void USBMIDI::_out_callback()
{
assert_locked();

Expand Down
4 changes: 2 additions & 2 deletions usb/device/USBMIDI/USBMIDI.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ class USBMIDI: public USBDevice {
Callback<void()> _callback;

void _init();
void _in_callback(usb_ep_t);
void _out_callback(usb_ep_t);
void _in_callback();
void _out_callback();
bool _next_message();
};

Expand Down
4 changes: 2 additions & 2 deletions usb/device/USBMSD/USBMSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,12 @@ int USBMSD::disk_status()
return 0;
}

void USBMSD::_isr_out(usb_ep_t endpoint)
void USBMSD::_isr_out()
{
_out_task.call();
}

void USBMSD::_isr_in(usb_ep_t endpoint)
void USBMSD::_isr_in()
{
_in_task.call();
}
Expand Down
4 changes: 2 additions & 2 deletions usb/device/USBMSD/USBMSD.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ class USBMSD: public USBDevice {
virtual void callback_request(const setup_packet_t *setup);
virtual void callback_request_xfer_done(const setup_packet_t *setup, bool aborted);

void _isr_out(usb_ep_t endpoint);
void _isr_in(usb_ep_t endpoint);
void _isr_out();
void _isr_in();

void _out();
void _in();
Expand Down
6 changes: 3 additions & 3 deletions usb/device/USBSerial/USBCDC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,11 @@ void USBCDC::_send_isr_start()
* Called by when CDC data is sent
* Warning: Called in ISR
*/
void USBCDC::_send_isr(usb_ep_t endpoint)
void USBCDC::_send_isr()
{
assert_locked();

write_finish(endpoint);
write_finish(_bulk_in);
_tx_buf = _tx_buffer;
_tx_size = 0;
_tx_in_progress = false;
Expand Down Expand Up @@ -472,7 +472,7 @@ void USBCDC::_receive_isr_start()
* Called by when CDC data is received
* Warning: Called in ISR
*/
void USBCDC::_receive_isr(usb_ep_t endpoint)
void USBCDC::_receive_isr()
{
assert_locked();

Expand Down
4 changes: 2 additions & 2 deletions usb/device/USBSerial/USBCDC.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ class USBCDC: public USBDevice {
void _change_terminal_connected(bool connected);

void _send_isr_start();
void _send_isr(usb_ep_t endpoint);
void _send_isr();

void _receive_isr_start();
void _receive_isr(usb_ep_t endpoint);
void _receive_isr();

usb_ep_t _bulk_in;
usb_ep_t _bulk_out;
Expand Down