aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/src/serial.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-05-11 16:41:55 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-05-11 16:41:55 +0000
commitde193fdcff777b88d0fcf2733863993ad033b13f (patch)
treea0c5960bb41e49c478c837106fea44a477e238d7 /os/hal/src/serial.c
parent1ae88ebc04851174eae446506f09463b5656ebdd (diff)
downloadChibiOS-de193fdcff777b88d0fcf2733863993ad033b13f.tar.gz
ChibiOS-de193fdcff777b88d0fcf2733863993ad033b13f.tar.bz2
ChibiOS-de193fdcff777b88d0fcf2733863993ad033b13f.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4185 35acf78f-673a-0410-8e92-d51de3d6d3f4
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) {