aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/src/hal_serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/src/hal_serial.c')
-rw-r--r--os/hal/src/hal_serial.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/os/hal/src/hal_serial.c b/os/hal/src/hal_serial.c
index 0b578fdc4..5439245ed 100644
--- a/os/hal/src/hal_serial.c
+++ b/os/hal/src/hal_serial.c
@@ -170,13 +170,17 @@ void sdStop(SerialDriver *sdp) {
osalDbgCheck(sdp != NULL);
osalSysLock();
+
osalDbgAssert((sdp->state == SD_STOP) || (sdp->state == SD_READY),
"invalid state");
+
sd_lld_stop(sdp);
- sdp->state = SD_STOP;
+ sdp->config = NULL;
+ sdp->state = SD_STOP;
oqResetI(&sdp->oqueue);
iqResetI(&sdp->iqueue);
osalOsRescheduleS();
+
osalSysUnlock();
}