aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/hal/src/usb.c14
-rw-r--r--readme.txt2
2 files changed, 16 insertions, 0 deletions
diff --git a/os/hal/src/usb.c b/os/hal/src/usb.c
index 1b4993e49..8e557d14e 100644
--- a/os/hal/src/usb.c
+++ b/os/hal/src/usb.c
@@ -309,6 +309,7 @@ void usbStart(USBDriver *usbp, const USBConfig *config) {
* @api
*/
void usbStop(USBDriver *usbp) {
+ unsigned i;
osalDbgCheck(usbp != NULL);
@@ -319,6 +320,19 @@ void usbStop(USBDriver *usbp) {
"invalid state");
usb_lld_stop(usbp);
usbp->state = USB_STOP;
+
+ /* Resetting all ongoing synchronous operations.*/
+ for (i = 0; i <= (unsigned)USB_MAX_ENDPOINTS; i++) {
+ if (usbp->epc[i] != NULL) {
+ if (usbp->epc[i]->in_state != NULL) {
+ osalThreadResumeI(&usbp->epc[i]->in_state->thread, MSG_RESET);
+ }
+ if (usbp->epc[i]->out_state != NULL) {
+ osalThreadResumeI(&usbp->epc[i]->out_state->thread, MSG_RESET);
+ }
+ }
+ }
+ osalOsRescheduleS();
osalSysUnlock();
}
diff --git a/readme.txt b/readme.txt
index a047fb224..21e4e9171 100644
--- a/readme.txt
+++ b/readme.txt
@@ -92,6 +92,8 @@
- RT: Merged RT4.
- NIL: Merged NIL2.
- NIL: Added STM32F7 demo.
+- HAL: Fixed usbStop does not resume threads suspended in synchronous calls
+ to usbTransmit (bug #714)(backported to 16.1.4).
- VAR: Fixed state check in lwIP when SYS_LIGHTWEIGHT_PROT is disabled
(bug #713)(backported to 2.6.10, 3.0.6 and 16.1.4).
- RT: Removed the p_msg field from the thread_t structure saving a