diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2016-02-28 08:42:09 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2016-02-28 08:42:09 +0000 |
commit | e75648ec64e3b9d8bf2c8d7b621d1c4fd4616e56 (patch) | |
tree | 8b24c586119c2f68cc29e6a0ca8369a4b9df9c18 /os/hal | |
parent | 4491129f54af198c7df8507b07e2d3a93581b998 (diff) | |
download | ChibiOS-e75648ec64e3b9d8bf2c8d7b621d1c4fd4616e56.tar.gz ChibiOS-e75648ec64e3b9d8bf2c8d7b621d1c4fd4616e56.tar.bz2 ChibiOS-e75648ec64e3b9d8bf2c8d7b621d1c4fd4616e56.zip |
Fixed bug #714.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8972 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal')
-rw-r--r-- | os/hal/src/usb.c | 14 |
1 files changed, 14 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();
}
|