aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/src/hal_usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/src/hal_usb.c')
-rw-r--r--os/hal/src/hal_usb.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/os/hal/src/hal_usb.c b/os/hal/src/hal_usb.c
index bc0cf088b..f0da64978 100644
--- a/os/hal/src/hal_usb.c
+++ b/os/hal/src/hal_usb.c
@@ -314,12 +314,15 @@ void usbStop(USBDriver *usbp) {
osalDbgCheck(usbp != NULL);
osalSysLock();
+
osalDbgAssert((usbp->state == USB_STOP) || (usbp->state == USB_READY) ||
(usbp->state == USB_SELECTED) || (usbp->state == USB_ACTIVE) ||
(usbp->state == USB_SUSPENDED),
+
"invalid state");
usb_lld_stop(usbp);
- usbp->state = USB_STOP;
+ spip->config = NULL;
+ spip->state = USB_STOP;
/* Resetting all ongoing synchronous operations.*/
for (i = 0; i <= (unsigned)USB_MAX_ENDPOINTS; i++) {
@@ -336,6 +339,7 @@ void usbStop(USBDriver *usbp) {
usbp->epc[i] = NULL;
}
osalOsRescheduleS();
+
osalSysUnlock();
}