aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2017-10-16 09:14:15 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2017-10-16 09:14:15 +0000
commit5596d3e69e0d1c7c9a7b07f9bf83416d2c25cd8b (patch)
tree4304b4f833a8d5f6c5815875bd3f6d6c87ce99b6
parenta47f5705d3f6abf4abaffa949f7bb50132507d94 (diff)
downloadChibiOS-5596d3e69e0d1c7c9a7b07f9bf83416d2c25cd8b.tar.gz
ChibiOS-5596d3e69e0d1c7c9a7b07f9bf83416d2c25cd8b.tar.bz2
ChibiOS-5596d3e69e0d1c7c9a7b07f9bf83416d2c25cd8b.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/rt5_dev_point1@10832 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/hal/src/hal_queues.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/os/hal/src/hal_queues.c b/os/hal/src/hal_queues.c
index d3ead6998..66e8a89cd 100644
--- a/os/hal/src/hal_queues.c
+++ b/os/hal/src/hal_queues.c
@@ -206,7 +206,7 @@ size_t iqReadTimeout(input_queue_t *iqp, uint8_t *bp,
/* Time deadline for the whole operation, note the result is invalid
when timeout is TIME_INFINITE or TIME_IMMEDIATE but in that case
the deadline is not used.*/
- deadline = osalOsGetSystemTimeX() + timeout;
+ deadline = osalTimeAddX(osalOsGetSystemTimeX(), timeout);
while (true) {
/* Waiting until there is a character available or a timeout occurs.*/
@@ -219,7 +219,8 @@ size_t iqReadTimeout(input_queue_t *iqp, uint8_t *bp,
msg = osalThreadEnqueueTimeoutS(&iqp->q_waiting, timeout);
}
else {
- sysinterval_t next_timeout = deadline - osalOsGetSystemTimeX();
+ 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
@@ -431,7 +432,7 @@ size_t oqWriteTimeout(output_queue_t *oqp, const uint8_t *bp,
/* Time deadline for the whole operation, note the result is invalid
when timeout is TIME_INFINITE or TIME_IMMEDIATE but in that case
the deadline is not used.*/
- deadline = osalOsGetSystemTimeX() + timeout;
+ deadline = osalTimeAddX(osalOsGetSystemTimeX(), timeout);
while (true) {
msg_t msg;
@@ -443,7 +444,8 @@ size_t oqWriteTimeout(output_queue_t *oqp, const uint8_t *bp,
msg = osalThreadEnqueueTimeoutS(&oqp->q_waiting, timeout);
}
else {
- sysinterval_t next_timeout = deadline - osalOsGetSystemTimeX();
+ 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