mirror of https://github.com/ARMmbed/mbed-os.git
Update USBTester for simplified read handling
Remove read_start and replace read_finish with read to match the new USBDevice API.pull/6479/head
parent
311e8b7d0d
commit
05aafac28b
|
@ -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_in, MAX_EP_SIZE, USB_EP_TYPE_BULK);
|
||||||
endpoint_add(bulk_out, MAX_EP_SIZE, USB_EP_TYPE_BULK, &USBTester::epbulk_out_callback);
|
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);
|
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_in, MAX_EP_SIZE, USB_EP_TYPE_BULK);
|
||||||
endpoint_add(bulk_out, MAX_EP_SIZE, USB_EP_TYPE_BULK, &USBTester::epbulk_out_callback);
|
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);
|
complete_set_interface(true);
|
||||||
return;
|
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_in, MIN_EP_SIZE, USB_EP_TYPE_BULK);
|
||||||
endpoint_add(bulk_out, MIN_EP_SIZE, USB_EP_TYPE_BULK, &USBTester::epbulk_out_callback);
|
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);
|
complete_set_interface(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -362,10 +353,7 @@ void USBTester::epint_out_callback(usb_ep_t endpoint)
|
||||||
uint8_t buffer[65];
|
uint8_t buffer[65];
|
||||||
uint32_t size = 0;
|
uint32_t size = 0;
|
||||||
|
|
||||||
if (!read_finish(endpoint, buffer, sizeof(buffer), &size)) {
|
if (!read(endpoint, buffer, sizeof(buffer), &size)) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!read_start(endpoint)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -374,10 +362,7 @@ void USBTester::epbulk_out_callback(usb_ep_t endpoint)
|
||||||
uint8_t buffer[65];
|
uint8_t buffer[65];
|
||||||
uint32_t size = 0;
|
uint32_t size = 0;
|
||||||
|
|
||||||
if (!read_finish(endpoint, buffer, sizeof(buffer), &size)) {
|
if (!read(endpoint, buffer, sizeof(buffer), &size)) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!read_start(endpoint)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -866,8 +866,6 @@ void USBDevice::out(usb_ep_t endpoint)
|
||||||
endpoint_info_t *info = &_endpoint_info[EP_TO_INDEX(endpoint)];
|
endpoint_info_t *info = &_endpoint_info[EP_TO_INDEX(endpoint)];
|
||||||
|
|
||||||
info->pending += 1;
|
info->pending += 1;
|
||||||
_phy->endpoint_read(endpoint, info->max_packet_size);
|
|
||||||
|
|
||||||
if (info->callback) {
|
if (info->callback) {
|
||||||
(this->*(info->callback))(endpoint);
|
(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);
|
bool ret = _phy->endpoint_read_result(endpoint, buffer, max_size, size);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
info->pending -= 1;
|
info->pending -= 1;
|
||||||
|
_phy->endpoint_read(endpoint, info->max_packet_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
unlock();
|
unlock();
|
||||||
|
|
Loading…
Reference in New Issue