Hi, there seems to be a bug in oqWriteTimeout() at hal\src\hal_queues.c
Internal while loop will try to write N bytes to the queue in each iteration, it doesn't take into account number of already written bytes.
The same bug is encountered for iqReadTimeout() function.
Proposed solution:
diff --git a/hal/src/hal_queues.c b/hal/src/hal_queues.c --- a/hal/src/hal_queues.c +++ b/hal/src/hal_queues.c @@ -423,7 +423,7 @@ size_t iqReadTimeout(input_queue_t *iqp, uint8_t *bp, osalSysLock(); - while (rd < n) { + while (n) { size_t done; done = iq_read(iqp, bp, n); @@ -445,6 +445,7 @@ size_t iqReadTimeout(input_queue_t *iqp, uint8_t *bp, /* Giving a preemption chance in a controlled point.*/ osalSysUnlock(); + n -= done; rd += done; if (bp != NULL) { bp += done; @@ -708,7 +709,7 @@ size_t oqWriteTimeout(output_queue_t *oqp, const uint8_t *bp, osalSysLock(); - while (wr < n) { + while (n) { size_t done; done = oq_write(oqp, bp, n); @@ -730,6 +731,7 @@ size_t oqWriteTimeout(output_queue_t *oqp, const uint8_t *bp, /* Giving a preemption chance in a controlled point.*/ osalSysUnlock(); + n -= done; wr += done; bp += done;
Please take a look.
Thanks!
Fixed in slightly different way, thanks for reporting.
Giovanni