aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2018-07-15 07:52:46 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2018-07-15 07:52:46 +0000
commit286e53490456ce99e1802539964ae72f9d4a81cc (patch)
tree42131286b00552c220ed0f3b96e8b7596367030b /os/hal
parent2f43a43dcac2219fa5bdb195c599ccc69c63bffe (diff)
downloadChibiOS-286e53490456ce99e1802539964ae72f9d4a81cc.tar.gz
ChibiOS-286e53490456ce99e1802539964ae72f9d4a81cc.tar.bz2
ChibiOS-286e53490456ce99e1802539964ae72f9d4a81cc.zip
Fixed bug #963.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12168 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/src/hal_buffers.c50
1 files changed, 5 insertions, 45 deletions
diff --git a/os/hal/src/hal_buffers.c b/os/hal/src/hal_buffers.c
index c85be601c..f9a62c210 100644
--- a/os/hal/src/hal_buffers.c
+++ b/os/hal/src/hal_buffers.c
@@ -358,15 +358,11 @@ msg_t ibqGetTimeout(input_buffers_queue_t *ibqp, sysinterval_t timeout) {
size_t ibqReadTimeout(input_buffers_queue_t *ibqp, uint8_t *bp,
size_t n, sysinterval_t timeout) {
size_t r = 0;
- systime_t deadline;
osalDbgCheck(n > 0U);
osalSysLock();
- /* Time window for the whole operation.*/
- deadline = osalTimeAddX(osalOsGetSystemTimeX(), timeout);
-
while (true) {
size_t size;
@@ -374,24 +370,8 @@ size_t ibqReadTimeout(input_buffers_queue_t *ibqp, uint8_t *bp,
if (ibqp->ptr == NULL) {
msg_t msg;
- /* TIME_INFINITE and TIME_IMMEDIATE are handled differently, no
- deadline.*/
- if ((timeout == TIME_INFINITE) || (timeout == TIME_IMMEDIATE)) {
- msg = ibqGetFullBufferTimeoutS(ibqp, timeout);
- }
- else {
- sysinterval_t next_timeout = osalTimeDiffX(osalOsGetSystemTimeX(),
- deadline);
-
- /* Handling the case where the system time went past the deadline,
- in this case next becomes a very high number because the system
- time is an unsigned type.*/
- if (next_timeout > timeout) {
- osalSysUnlock();
- return r;
- }
- msg = ibqGetFullBufferTimeoutS(ibqp, next_timeout);
- }
+ /* Getting a data buffer using the specified timeout.*/
+ msg = ibqGetFullBufferTimeoutS(ibqp, timeout);
/* Anything except MSG_OK interrupts the operation.*/
if (msg != MSG_OK) {
@@ -563,7 +543,7 @@ void obqReleaseEmptyBufferI(output_buffers_queue_t *obqp) {
* @api
*/
msg_t obqGetEmptyBufferTimeout(output_buffers_queue_t *obqp,
- sysinterval_t timeout) {
+ sysinterval_t timeout) {
msg_t msg;
osalSysLock();
@@ -741,15 +721,11 @@ msg_t obqPutTimeout(output_buffers_queue_t *obqp, uint8_t b,
size_t obqWriteTimeout(output_buffers_queue_t *obqp, const uint8_t *bp,
size_t n, sysinterval_t timeout) {
size_t w = 0;
- systime_t deadline;
osalDbgCheck(n > 0U);
osalSysLock();
- /* Time window for the whole operation.*/
- deadline = osalTimeAddX(osalOsGetSystemTimeX(), timeout);
-
while (true) {
size_t size;
@@ -757,24 +733,8 @@ size_t obqWriteTimeout(output_buffers_queue_t *obqp, const uint8_t *bp,
if (obqp->ptr == NULL) {
msg_t msg;
- /* TIME_INFINITE and TIME_IMMEDIATE are handled differently, no
- deadline.*/
- if ((timeout == TIME_INFINITE) || (timeout == TIME_IMMEDIATE)) {
- msg = obqGetEmptyBufferTimeoutS(obqp, timeout);
- }
- else {
- sysinterval_t next_timeout = osalTimeDiffX(osalOsGetSystemTimeX(),
- deadline);
-
- /* Handling the case where the system time went past the deadline,
- in this case next becomes a very high number because the system
- time is an unsigned type.*/
- if (next_timeout > timeout) {
- osalSysUnlock();
- return w;
- }
- msg = obqGetEmptyBufferTimeoutS(obqp, next_timeout);
- }
+ /* Getting an empty buffer using the specified timeout.*/
+ msg = obqGetEmptyBufferTimeoutS(obqp, timeout);
/* Anything except MSG_OK interrupts the operation.*/
if (msg != MSG_OK) {