From 5a1884c287e65b64d35f43d27435b90280f91b1b Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 20 Dec 2015 10:43:14 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8622 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/src/hal_buffers.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'os/hal/src') diff --git a/os/hal/src/hal_buffers.c b/os/hal/src/hal_buffers.c index fe23c5ba1..f06392d65 100644 --- a/os/hal/src/hal_buffers.c +++ b/os/hal/src/hal_buffers.c @@ -143,7 +143,6 @@ uint8_t *ibqGetFullBufferI(input_buffers_queue_t *ibqp) { if (ibqIsEmptyI(ibqp)) { ibqp->ptr = NULL; - ibqp->top = NULL; return NULL; } @@ -171,6 +170,9 @@ void ibqReleaseBufferI(io_buffers_queue_t *ibqp) { ibqp->brdptr = ibqp->buffers; } + /* Marked as no more sequentially accessible.*/ + ibqp->ptr = NULL; + /* Notifying the buffer release.*/ if (ibqp->notify != NULL) { ibqp->notify(ibqp); @@ -206,6 +208,7 @@ msg_t ibqGetTimeout(input_buffers_queue_t *ibqp, systime_t timeout) { if (msg < MSG_OK) { return msg; } + /* Tries to get the buffer, the fields ptr and top are setup inside.*/ (void) ibqGetFullBufferI(ibqp); } @@ -217,7 +220,6 @@ msg_t ibqGetTimeout(input_buffers_queue_t *ibqp, systime_t timeout) { empty in the queue.*/ if (ibqp->ptr == ibqp->top) { ibqReleaseBufferI(ibqp); - ibqp->ptr = NULL; } return msg; -- cgit v1.2.3