aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/src/serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/src/serial.c')
-rw-r--r--os/hal/src/serial.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/os/hal/src/serial.c b/os/hal/src/serial.c
index aaeb5e6ee..3f06025c6 100644
--- a/os/hal/src/serial.c
+++ b/os/hal/src/serial.c
@@ -65,13 +65,21 @@ static size_t reads(void *ip, uint8_t *bp, size_t n) {
}
static bool_t putwouldblock(void *ip) {
+ bool_t b;
- return chOQIsFullI(&((SerialDriver *)ip)->oqueue);
+ chSysLock();
+ b = chOQIsFullI(&((SerialDriver *)ip)->oqueue);
+ chSysUnlock();
+ return b;
}
static bool_t getwouldblock(void *ip) {
+ bool_t b;
- return chIQIsEmptyI(&((SerialDriver *)ip)->iqueue);
+ chSysLock();
+ b = chIQIsEmptyI(&((SerialDriver *)ip)->iqueue);
+ chSysUnlock();
+ return b;
}
static msg_t putt(void *ip, uint8_t b, systime_t timeout) {