diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-07-12 12:40:59 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-07-12 12:40:59 +0000 |
commit | 5cc620c9c1b128b594fb3bb3a8329d4bf2758802 (patch) | |
tree | a5249a1cb3906c0a02158e9f2cf8797b1d86de21 | |
parent | df2e703e9095baf2c037f80b76ab5e1512d63b81 (diff) | |
download | ChibiOS-5cc620c9c1b128b594fb3bb3a8329d4bf2758802.tar.gz ChibiOS-5cc620c9c1b128b594fb3bb3a8329d4bf2758802.tar.bz2 ChibiOS-5cc620c9c1b128b594fb3bb3a8329d4bf2758802.zip |
Fixed bug #960.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12162 110e8d01-0319-4d1e-a829-52ad28d1bb01
-rw-r--r-- | os/hal/src/hal_queues.c | 16 | ||||
-rw-r--r-- | readme.txt | 1 |
2 files changed, 9 insertions, 8 deletions
diff --git a/os/hal/src/hal_queues.c b/os/hal/src/hal_queues.c index 1e2386c2a..6e1814343 100644 --- a/os/hal/src/hal_queues.c +++ b/os/hal/src/hal_queues.c @@ -389,13 +389,13 @@ size_t iqReadI(input_queue_t *iqp, uint8_t *bp, size_t n) { size_t iqReadTimeout(input_queue_t *iqp, uint8_t *bp,
size_t n, sysinterval_t timeout) {
qnotify_t nfy = iqp->q_notify;
- size_t rd = 0;
+ size_t max = n;
osalDbgCheck(n > 0U);
osalSysLock();
- while (rd < n) {
+ while (n > 0U) {
size_t done;
done = iq_read(iqp, bp, n);
@@ -417,7 +417,7 @@ size_t iqReadTimeout(input_queue_t *iqp, uint8_t *bp, /* Giving a preemption chance in a controlled point.*/
osalSysUnlock();
- rd += done;
+ n -= done;
bp += done;
osalSysLock();
@@ -425,7 +425,7 @@ size_t iqReadTimeout(input_queue_t *iqp, uint8_t *bp, }
osalSysUnlock();
- return rd;
+ return max - n;
}
/**
@@ -658,13 +658,13 @@ size_t oqWriteI(output_queue_t *oqp, const uint8_t *bp, size_t n) { size_t oqWriteTimeout(output_queue_t *oqp, const uint8_t *bp,
size_t n, sysinterval_t timeout) {
qnotify_t nfy = oqp->q_notify;
- size_t wr = 0;
+ size_t max = n;
osalDbgCheck(n > 0U);
osalSysLock();
- while (wr < n) {
+ while (n > 0U) {
size_t done;
done = oq_write(oqp, bp, n);
@@ -686,7 +686,7 @@ size_t oqWriteTimeout(output_queue_t *oqp, const uint8_t *bp, /* Giving a preemption chance in a controlled point.*/
osalSysUnlock();
- wr += done;
+ n -= done;
bp += done;
osalSysLock();
@@ -694,7 +694,7 @@ size_t oqWriteTimeout(output_queue_t *oqp, const uint8_t *bp, }
osalSysUnlock();
- return wr;
+ return max - n;
}
/** @} */
diff --git a/readme.txt b/readme.txt index 372d71e9d..3e7cba7b8 100644 --- a/readme.txt +++ b/readme.txt @@ -141,6 +141,7 @@ - EX: Updated LIS302DL to 1.1.0 (backported to 18.2.1).
- EX: Updated LPS25H to 1.1.0 (backported to 18.2.1).
- EX: Updated LSM303DLHC to 1.1.0 (backported to 18.2.1).
+- HAL: Fixed issue in hal_queues (bug #960)(backported to 18.2.2).
- HAL: Fixed incorrect state change in I2S driver (bug #959)(backported
to 18.2.2 and 17.6.5).
- HAL: Fixed incorrect TCIE handling in STM32 serial drivers (bug #958)
|