Update USBTester for simplified read handling

Remove read_start and replace read_finish with read to match the new
USBDevice API.
pull/9768/head
Russ Butler 2018-03-14 18:38:16 -05:00
parent 3168a92231
commit de12bb57fa
2 changed files with 3 additions and 19 deletions

View File

@ -148,9 +148,6 @@ void USBTester::callback_set_configuration(uint8_t configuration)
endpoint_add(bulk_in, MAX_EP_SIZE, USB_EP_TYPE_BULK);
endpoint_add(bulk_out, MAX_EP_SIZE, USB_EP_TYPE_BULK, &USBTester::epbulk_out_callback);
read_start(int_out);
read_start(bulk_out);
complete_set_configuration(true);
}
@ -167,9 +164,6 @@ void USBTester::callback_set_interface(uint16_t interface, uint8_t alternate)
endpoint_add(bulk_in, MAX_EP_SIZE, USB_EP_TYPE_BULK);
endpoint_add(bulk_out, MAX_EP_SIZE, USB_EP_TYPE_BULK, &USBTester::epbulk_out_callback);
read_start(int_out);
read_start(bulk_out);
complete_set_interface(true);
return;
}
@ -184,9 +178,6 @@ void USBTester::callback_set_interface(uint16_t interface, uint8_t alternate)
endpoint_add(bulk_in, MIN_EP_SIZE, USB_EP_TYPE_BULK);
endpoint_add(bulk_out, MIN_EP_SIZE, USB_EP_TYPE_BULK, &USBTester::epbulk_out_callback);
read_start(int_out);
read_start(bulk_out);
complete_set_interface(true);
return;
}
@ -362,10 +353,7 @@ void USBTester::epint_out_callback(usb_ep_t endpoint)
uint8_t buffer[65];
uint32_t size = 0;
if (!read_finish(endpoint, buffer, sizeof(buffer), &size)) {
return;
}
if (!read_start(endpoint)) {
if (!read(endpoint, buffer, sizeof(buffer), &size)) {
return;
}
}
@ -374,10 +362,7 @@ void USBTester::epbulk_out_callback(usb_ep_t endpoint)
uint8_t buffer[65];
uint32_t size = 0;
if (!read_finish(endpoint, buffer, sizeof(buffer), &size)) {
return;
}
if (!read_start(endpoint)) {
if (!read(endpoint, buffer, sizeof(buffer), &size)) {
return;
}
}

View File

@ -866,8 +866,6 @@ void USBDevice::out(usb_ep_t endpoint)
endpoint_info_t *info = &_endpoint_info[EP_TO_INDEX(endpoint)];
info->pending += 1;
_phy->endpoint_read(endpoint, info->max_packet_size);
if (info->callback) {
(this->*(info->callback))(endpoint);
}
@ -1229,6 +1227,7 @@ bool USBDevice::read(usb_ep_t endpoint, uint8_t *buffer, uint32_t max_size, uint
bool ret = _phy->endpoint_read_result(endpoint, buffer, max_size, size);
if (ret) {
info->pending -= 1;
_phy->endpoint_read(endpoint, info->max_packet_size);
}
unlock();