aboutsummaryrefslogtreecommitdiffstats
path: root/os/rt/src/chqueues.c
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2015-03-06 10:13:59 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2015-03-06 10:13:59 +0000
commita380d9ad03f2fcf950dad0f08652a03b738dc0e8 (patch)
tree78dfbd7a271ba17cbb8cd7383a5c7edcb87f448b /os/rt/src/chqueues.c
parentb53489d0e4252aafe5ada7466e0b3b7c4ad5aaaf (diff)
downloadChibiOS-a380d9ad03f2fcf950dad0f08652a03b738dc0e8.tar.gz
ChibiOS-a380d9ad03f2fcf950dad0f08652a03b738dc0e8.tar.bz2
ChibiOS-a380d9ad03f2fcf950dad0f08652a03b738dc0e8.zip
More MISRA.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7716 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/rt/src/chqueues.c')
-rw-r--r--os/rt/src/chqueues.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/os/rt/src/chqueues.c b/os/rt/src/chqueues.c
index f85cac9bc..f02eb14a0 100644
--- a/os/rt/src/chqueues.c
+++ b/os/rt/src/chqueues.c
@@ -42,7 +42,7 @@
#include "ch.h"
-#if CH_CFG_USE_QUEUES || defined(__DOXYGEN__)
+#if (CH_CFG_USE_QUEUES == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Module local definitions. */
@@ -138,7 +138,9 @@ msg_t chIQPutI(input_queue_t *iqp, uint8_t b) {
iqp->q_counter++;
*iqp->q_wrptr++ = b;
+ /*lint -save -e946 [18.2] Normal pointers arithmetic, it is safe.*/
if (iqp->q_wrptr >= iqp->q_top) {
+ /*lint -restore*/
iqp->q_wrptr = iqp->q_buffer;
}
@@ -185,7 +187,9 @@ msg_t chIQGetTimeout(input_queue_t *iqp, systime_t time) {
iqp->q_counter--;
b = *iqp->q_rdptr++;
+ /*lint -save -e946 [18.2] Normal pointers arithmetic, it is safe.*/
if (iqp->q_rdptr >= iqp->q_top) {
+ /*lint -restore*/
iqp->q_rdptr = iqp->q_buffer;
}
chSysUnlock();
@@ -239,8 +243,11 @@ size_t chIQReadTimeout(input_queue_t *iqp, uint8_t *bp,
iqp->q_counter--;
*bp++ = *iqp->q_rdptr++;
- if (iqp->q_rdptr >= iqp->q_top)
+ /*lint -save -e946 [18.2] Normal pointers arithmetic, it is safe.*/
+ if (iqp->q_rdptr >= iqp->q_top) {
+ /*lint -restore*/
iqp->q_rdptr = iqp->q_buffer;
+ }
chSysUnlock(); /* Gives a preemption chance in a controlled point.*/
r++;
@@ -295,7 +302,7 @@ void chOQResetI(output_queue_t *oqp) {
chDbgCheckClassI();
oqp->q_rdptr = oqp->q_wrptr = oqp->q_buffer;
- oqp->q_counter = QSIZE(oqp);
+ oqp->q_counter = chQSizeX(oqp);
chThdDequeueAllI(&oqp->q_waiting, Q_RESET);
}
@@ -335,7 +342,9 @@ msg_t chOQPutTimeout(output_queue_t *oqp, uint8_t b, systime_t time) {
oqp->q_counter--;
*oqp->q_wrptr++ = b;
+ /*lint -save -e946 [18.2] Normal pointers arithmetic, it is safe.*/
if (oqp->q_wrptr >= oqp->q_top) {
+ /*lint -restore*/
oqp->q_wrptr = oqp->q_buffer;
}
@@ -368,7 +377,9 @@ msg_t chOQGetI(output_queue_t *oqp) {
oqp->q_counter++;
b = *oqp->q_rdptr++;
+ /*lint -save -e946 [18.2] Normal pointers arithmetic, it is safe.*/
if (oqp->q_rdptr >= oqp->q_top) {
+ /*lint -restore*/
oqp->q_rdptr = oqp->q_buffer;
}
@@ -418,7 +429,9 @@ size_t chOQWriteTimeout(output_queue_t *oqp, const uint8_t *bp,
}
oqp->q_counter--;
*oqp->q_wrptr++ = *bp++;
+ /*lint -save -e946 [18.2] Normal pointers arithmetic, it is safe.*/
if (oqp->q_wrptr >= oqp->q_top) {
+ /*lint -restore*/
oqp->q_wrptr = oqp->q_buffer;
}
@@ -434,6 +447,6 @@ size_t chOQWriteTimeout(output_queue_t *oqp, const uint8_t *bp,
chSysLock();
}
}
-#endif /* CH_CFG_USE_QUEUES */
+#endif /* CH_CFG_USE_QUEUES == TRUE */
/** @} */