From e75648ec64e3b9d8bf2c8d7b621d1c4fd4616e56 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 28 Feb 2016 08:42:09 +0000 Subject: Fixed bug #714. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8972 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/src/usb.c | 14 ++++++++++++++ readme.txt | 2 ++ 2 files changed, 16 insertions(+) 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 -- cgit v1.2.3