aboutsummaryrefslogtreecommitdiffstats
path: root/os/rt/src
diff options
context:
space:
mode:
Diffstat (limited to 'os/rt/src')
-rw-r--r--os/rt/src/chdebug.c3
-rw-r--r--os/rt/src/chheap.c3
-rw-r--r--os/rt/src/chmboxes.c29
-rw-r--r--os/rt/src/chmemcore.c6
-rw-r--r--os/rt/src/chqueues.c39
-rw-r--r--os/rt/src/chregistry.c4
-rw-r--r--os/rt/src/chschd.c16
-rw-r--r--os/rt/src/chsys.c3
-rw-r--r--os/rt/src/chthreads.c6
-rw-r--r--os/rt/src/chvt.c6
10 files changed, 19 insertions, 96 deletions
diff --git a/os/rt/src/chdebug.c b/os/rt/src/chdebug.c
index d13be65b4..a09f327b4 100644
--- a/os/rt/src/chdebug.c
+++ b/os/rt/src/chdebug.c
@@ -280,11 +280,8 @@ void _dbg_trace(thread_t *otp) {
ch.dbg.trace_buffer.tb_ptr->se_tp = currp;
ch.dbg.trace_buffer.tb_ptr->se_wtobjp = otp->p_u.wtobjp;
ch.dbg.trace_buffer.tb_ptr->se_state = (uint8_t)otp->p_state;
- /*lint -save -e946 -e947 [18.2, 18.3] Normal pointers arithmetic, it
- is safe.*/
if (++ch.dbg.trace_buffer.tb_ptr >=
&ch.dbg.trace_buffer.tb_buffer[CH_DBG_TRACE_BUFFER_SIZE]) {
- /*lint -restore*/
ch.dbg.trace_buffer.tb_ptr = &ch.dbg.trace_buffer.tb_buffer[0];
}
}
diff --git a/os/rt/src/chheap.c b/os/rt/src/chheap.c
index e492d8a52..534a3430c 100644
--- a/os/rt/src/chheap.c
+++ b/os/rt/src/chheap.c
@@ -224,13 +224,10 @@ void chHeapFree(void *p) {
H_LOCK(heapp);
while (true) {
- /*lint -save -e946 -e947 [18.2, 18.3] Normal pointers arithmetic, it
- is safe.*/
chDbgAssert((hp < qp) || (hp >= LIMIT(qp)), "within free block");
if (((qp == &heapp->h_free) || (hp > qp)) &&
((qp->h.u.next == NULL) || (hp < qp->h.u.next))) {
- /*lint -restore*/
/* Insertion after qp.*/
hp->h.u.next = qp->h.u.next;
qp->h.u.next = hp;
diff --git a/os/rt/src/chmboxes.c b/os/rt/src/chmboxes.c
index 9c0c3ae0d..6c518676b 100644
--- a/os/rt/src/chmboxes.c
+++ b/os/rt/src/chmboxes.c
@@ -128,10 +128,7 @@ void chMBResetI(mailbox_t *mbp) {
mbp->mb_wrptr = mbp->mb_buffer;
mbp->mb_rdptr = mbp->mb_buffer;
- /*lint -save -e946 -e947 [18.2, 18.3] Normal pointers arithmetic, it
- is safe.*/
chSemResetI(&mbp->mb_emptysem, (cnt_t)(mbp->mb_top - mbp->mb_buffer));
- /*lint -restore*/
chSemResetI(&mbp->mb_fullsem, 0);
}
@@ -191,11 +188,8 @@ msg_t chMBPostS(mailbox_t *mbp, msg_t msg, systime_t timeout) {
rdymsg = chSemWaitTimeoutS(&mbp->mb_emptysem, timeout);
if (rdymsg == MSG_OK) {
- *mbp->mb_wrptr = msg;
- mbp->mb_wrptr++;
- /*lint -save -e946 [18.2, 18.3] Normal pointers arithmetic, it is safe.*/
+ *mbp->mb_wrptr++ = msg;
if (mbp->mb_wrptr >= mbp->mb_top) {
- /*lint -restore*/
mbp->mb_wrptr = mbp->mb_buffer;
}
chSemSignalI(&mbp->mb_fullsem);
@@ -229,12 +223,9 @@ msg_t chMBPostI(mailbox_t *mbp, msg_t msg) {
}
chSemFastWaitI(&mbp->mb_emptysem);
- *mbp->mb_wrptr = msg;
- mbp->mb_wrptr++;
- /*lint -save -e946 [18.2, 18.3] Normal pointers arithmetic, it is safe.*/
+ *mbp->mb_wrptr++ = msg;
if (mbp->mb_wrptr >= mbp->mb_top) {
- /*lint -restore*/
- mbp->mb_wrptr = mbp->mb_buffer;
+ mbp->mb_wrptr = mbp->mb_buffer;
}
chSemSignalI(&mbp->mb_fullsem);
@@ -297,9 +288,7 @@ msg_t chMBPostAheadS(mailbox_t *mbp, msg_t msg, systime_t timeout) {
rdymsg = chSemWaitTimeoutS(&mbp->mb_emptysem, timeout);
if (rdymsg == MSG_OK) {
- /*lint -save -e946 [18.2, 18.3] Normal pointers arithmetic, it is safe.*/
if (--mbp->mb_rdptr < mbp->mb_buffer) {
- /*lint -restore*/
mbp->mb_rdptr = mbp->mb_top - 1;
}
*mbp->mb_rdptr = msg;
@@ -333,9 +322,7 @@ msg_t chMBPostAheadI(mailbox_t *mbp, msg_t msg) {
return MSG_TIMEOUT;
}
chSemFastWaitI(&mbp->mb_emptysem);
- /*lint -save -e946 [18.2, 18.3] Normal pointers arithmetic, it is safe.*/
if (--mbp->mb_rdptr < mbp->mb_buffer) {
- /*lint -restore*/
mbp->mb_rdptr = mbp->mb_top - 1;
}
*mbp->mb_rdptr = msg;
@@ -400,11 +387,8 @@ msg_t chMBFetchS(mailbox_t *mbp, msg_t *msgp, systime_t timeout) {
rdymsg = chSemWaitTimeoutS(&mbp->mb_fullsem, timeout);
if (rdymsg == MSG_OK) {
- *msgp = *mbp->mb_rdptr;
- mbp->mb_rdptr++;
- /*lint -save -e946 [18.2, 18.3] Normal pointers arithmetic, it is safe.*/
+ *msgp = *mbp->mb_rdptr++;
if (mbp->mb_rdptr >= mbp->mb_top) {
- /*lint -restore*/
mbp->mb_rdptr = mbp->mb_buffer;
}
chSemSignalI(&mbp->mb_emptysem);
@@ -437,11 +421,8 @@ msg_t chMBFetchI(mailbox_t *mbp, msg_t *msgp) {
return MSG_TIMEOUT;
}
chSemFastWaitI(&mbp->mb_fullsem);
- *msgp = *mbp->mb_rdptr;
- mbp->mb_rdptr++;
- /*lint -save -e946 [18.2, 18.3] Normal pointers arithmetic, it is safe.*/
+ *msgp = *mbp->mb_rdptr++;
if (mbp->mb_rdptr >= mbp->mb_top) {
- /*lint -restore*/
mbp->mb_rdptr = mbp->mb_buffer;
}
chSemSignalI(&mbp->mb_emptysem);
diff --git a/os/rt/src/chmemcore.c b/os/rt/src/chmemcore.c
index 901fb5828..64f82aa84 100644
--- a/os/rt/src/chmemcore.c
+++ b/os/rt/src/chmemcore.c
@@ -134,8 +134,7 @@ void *chCoreAllocI(size_t size) {
chDbgCheckClassI();
size = MEM_ALIGN_NEXT(size);
- /*lint -save -e9033 -e946 -e947 [10.8, 18.2, 18.3] Normal pointers
- arithmetic, it is safe.*/
+ /*lint -save -e9033 [10.8] The cast is safe.*/
if ((size_t)(endmem - nextmem) < size) {
/*lint -restore*/
return NULL;
@@ -155,8 +154,7 @@ void *chCoreAllocI(size_t size) {
*/
size_t chCoreGetStatusX(void) {
- /*lint -save -e9033 -e946 -e947 [10.8, 18.2, 18.3] Normal pointers
- arithmetic, it is safe.*/
+ /*lint -save -e9033 [10.8] The cast is safe.*/
return (size_t)(endmem - nextmem);
/*lint -restore*/
}
diff --git a/os/rt/src/chqueues.c b/os/rt/src/chqueues.c
index 1a9564a07..718fae5fd 100644
--- a/os/rt/src/chqueues.c
+++ b/os/rt/src/chqueues.c
@@ -139,12 +139,9 @@ msg_t chIQPutI(input_queue_t *iqp, uint8_t b) {
return Q_FULL;
}
- *iqp->q_wrptr = b;
- iqp->q_wrptr++;
iqp->q_counter++;
- /*lint -save -e946 [18.2] Normal pointers arithmetic, it is safe.*/
+ *iqp->q_wrptr++ = b;
if (iqp->q_wrptr >= iqp->q_top) {
- /*lint -restore*/
iqp->q_wrptr = iqp->q_buffer;
}
@@ -189,12 +186,9 @@ msg_t chIQGetTimeout(input_queue_t *iqp, systime_t timeout) {
}
}
- b = *iqp->q_rdptr;
- iqp->q_rdptr++;
iqp->q_counter--;
- /*lint -save -e946 [18.2] Normal pointers arithmetic, it is safe.*/
+ b = *iqp->q_rdptr++;
if (iqp->q_rdptr >= iqp->q_top) {
- /*lint -restore*/
iqp->q_rdptr = iqp->q_buffer;
}
chSysUnlock();
@@ -246,20 +240,15 @@ size_t chIQReadTimeout(input_queue_t *iqp, uint8_t *bp,
}
}
- *bp = *iqp->q_rdptr;
- bp++;
- iqp->q_rdptr++;
iqp->q_counter--;
- /*lint -save -e946 [18.2] Normal pointers arithmetic, it is safe.*/
+ *bp++ = *iqp->q_rdptr++;
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++;
- n--;
- if (n == 0U) {
+ if (--n == 0U) {
return r;
}
@@ -350,12 +339,9 @@ msg_t chOQPutTimeout(output_queue_t *oqp, uint8_t b, systime_t timeout) {
}
}
- *oqp->q_wrptr = b;
- oqp->q_wrptr++;
oqp->q_counter--;
- /*lint -save -e946 [18.2] Normal pointers arithmetic, it is safe.*/
+ *oqp->q_wrptr++ = b;
if (oqp->q_wrptr >= oqp->q_top) {
- /*lint -restore*/
oqp->q_wrptr = oqp->q_buffer;
}
@@ -386,12 +372,9 @@ msg_t chOQGetI(output_queue_t *oqp) {
return Q_EMPTY;
}
- b = *oqp->q_rdptr;
- oqp->q_rdptr++;
oqp->q_counter++;
- /*lint -save -e946 [18.2] Normal pointers arithmetic, it is safe.*/
+ b = *oqp->q_rdptr++;
if (oqp->q_rdptr >= oqp->q_top) {
- /*lint -restore*/
oqp->q_rdptr = oqp->q_buffer;
}
@@ -439,13 +422,10 @@ size_t chOQWriteTimeout(output_queue_t *oqp, const uint8_t *bp,
return w;
}
}
- *oqp->q_wrptr = *bp;
- bp++;
- oqp->q_wrptr++;
+
oqp->q_counter--;
- /*lint -save -e946 [18.2] Normal pointers arithmetic, it is safe.*/
+ *oqp->q_wrptr++ = *bp++;
if (oqp->q_wrptr >= oqp->q_top) {
- /*lint -restore*/
oqp->q_wrptr = oqp->q_buffer;
}
@@ -455,8 +435,7 @@ size_t chOQWriteTimeout(output_queue_t *oqp, const uint8_t *bp,
chSysUnlock(); /* Gives a preemption chance in a controlled point.*/
w++;
- n--;
- if (n == 0U) {
+ if (--n == 0U) {
return w;
}
chSysLock();
diff --git a/os/rt/src/chregistry.c b/os/rt/src/chregistry.c
index 8a237ab69..162d69bf2 100644
--- a/os/rt/src/chregistry.c
+++ b/os/rt/src/chregistry.c
@@ -65,8 +65,8 @@
/*===========================================================================*/
#define _offsetof(st, m) \
- /*lint -save -e9005 -e946 -e947 -e9033 -e413 [11.8, 18.2, 18.3, 10.8 1.3]
- Normal pointers arithmetic, it is safe.*/ \
+ /*lint -save -e9005 -e9033 -e413 [11.8, 10.8 1.3] Normal pointers
+ arithmetic, it is safe.*/ \
((size_t)((char *)&((st *)0)->m - (char *)0)) \
/*lint -restore*/
diff --git a/os/rt/src/chschd.c b/os/rt/src/chschd.c
index dacc1b7c1..91b982b0c 100644
--- a/os/rt/src/chschd.c
+++ b/os/rt/src/chschd.c
@@ -67,10 +67,8 @@ void _scheduler_init(void) {
queue_init(&ch.rlist.r_queue);
ch.rlist.r_prio = NOPRIO;
#if CH_CFG_USE_REGISTRY == TRUE
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
ch.rlist.r_newer = (thread_t *)&ch.rlist;
ch.rlist.r_older = (thread_t *)&ch.rlist;
- /*lint -restore*/
#endif
}
@@ -87,12 +85,10 @@ void _scheduler_init(void) {
*/
void queue_prio_insert(thread_t *tp, threads_queue_t *tqp) {
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
thread_t *cp = (thread_t *)tqp;
do {
cp = cp->p_next;
} while ((cp != (thread_t *)tqp) && (cp->p_prio >= tp->p_prio));
- /*lint -restore*/
tp->p_next = cp;
tp->p_prev = cp->p_prev;
tp->p_prev->p_next = tp;
@@ -109,9 +105,7 @@ void queue_prio_insert(thread_t *tp, threads_queue_t *tqp) {
*/
void queue_insert(thread_t *tp, threads_queue_t *tqp) {
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
tp->p_next = (thread_t *)tqp;
- /*lint -restore*/
tp->p_prev = tqp->p_prev;
tp->p_prev->p_next = tp;
tqp->p_prev = tp;
@@ -131,9 +125,7 @@ thread_t *queue_fifo_remove(threads_queue_t *tqp) {
thread_t *tp = tqp->p_next;
tqp->p_next = tp->p_next;
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
tqp->p_next->p_prev = (thread_t *)tqp;
- /*lint -restore*/
return tp;
}
@@ -152,9 +144,7 @@ thread_t *queue_lifo_remove(threads_queue_t *tqp) {
thread_t *tp = tqp->p_prev;
tqp->p_prev = tp->p_prev;
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
tqp->p_prev->p_next = (thread_t *)tqp;
- /*lint -restore*/
return tp;
}
@@ -235,9 +225,7 @@ thread_t *chSchReadyI(thread_t *tp) {
"invalid state");
tp->p_state = CH_STATE_READY;
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
cp = (thread_t *)&ch.rlist.r_queue;
- /*lint -restore*/
do {
cp = cp->p_next;
} while (cp->p_prio >= tp->p_prio);
@@ -285,9 +273,7 @@ void chSchGoSleepS(tstate_t newstate) {
* Timeout wakeup callback.
*/
static void wakeup(void *p) {
- /*lint -save -e9087 [11.3] The real type is hidden but correct.*/
thread_t *tp = (thread_t *)p;
- /*lint -restore*/
chSysLockFromISR();
switch (tp->p_state) {
@@ -504,9 +490,7 @@ void chSchDoRescheduleAhead(void) {
currp->p_state = CH_STATE_CURRENT;
otp->p_state = CH_STATE_READY;
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
cp = (thread_t *)&ch.rlist.r_queue;
- /*lint -restore*/
do {
cp = cp->p_next;
} while (cp->p_prio > otp->p_prio);
diff --git a/os/rt/src/chsys.c b/os/rt/src/chsys.c
index 7754e546d..44c4fc567 100644
--- a/os/rt/src/chsys.c
+++ b/os/rt/src/chsys.c
@@ -138,11 +138,8 @@ void chSysInit(void) {
/* This thread has the lowest priority in the system, its role is just to
serve interrupts in its context while keeping the lowest energy saving
mode compatible with the system status.*/
- /*lint -save -e9074 -e9087 [11.3, 11.1] The idle thread returns void because
- an optimization.*/
(void) chThdCreateStatic(ch.idle_thread_wa, sizeof(ch.idle_thread_wa),
IDLEPRIO, (tfunc_t)_idle_thread, NULL);
- /*lint -restore*/
#endif
}
diff --git a/os/rt/src/chthreads.c b/os/rt/src/chthreads.c
index 69013017e..491f416d5 100644
--- a/os/rt/src/chthreads.c
+++ b/os/rt/src/chthreads.c
@@ -144,12 +144,8 @@ thread_t *_thread_init(thread_t *tp, tprio_t prio) {
*/
void _thread_memfill(uint8_t *startp, uint8_t *endp, uint8_t v) {
- /*lint -save -e946 -e947 [18.2, 18.3] Normal pointers arithmetic, it
- is safe.*/
while (startp < endp) {
- /*lint -restore*/
- *startp = v;
- startp++;
+ *startp++ = v;
}
}
#endif /* CH_DBG_FILL_THREADS */
diff --git a/os/rt/src/chvt.c b/os/rt/src/chvt.c
index de50a4ae5..d802bc0c3 100644
--- a/os/rt/src/chvt.c
+++ b/os/rt/src/chvt.c
@@ -60,10 +60,8 @@
*/
void _vt_init(void) {
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
ch.vtlist.vt_next = (virtual_timer_t *)&ch.vtlist;
ch.vtlist.vt_prev = (virtual_timer_t *)&ch.vtlist;
- /*lint -restore*/
ch.vtlist.vt_delta = (systime_t)-1;
#if CH_CFG_ST_TIMEDELTA == 0
ch.vtlist.vt_systime = 0;
@@ -115,9 +113,7 @@ void chVTDoSetI(virtual_timer_t *vtp, systime_t delay,
delay = (systime_t)CH_CFG_ST_TIMEDELTA;
}
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
if (&ch.vtlist == (virtual_timers_list_t *)p) {
- /*lint -restore*/
/* The delta list is empty, the current time becomes the new
delta list base time.*/
ch.vtlist.vt_lasttime = now;
@@ -183,9 +179,7 @@ void chVTDoResetI(virtual_timer_t *vtp) {
#if (CH_CFG_ST_TIMEDELTA > 0) || defined(__DOXYGEN__)
{
- /*lint -save -e9087 -e740 [11.3, 1.3] Cast required by list handling.*/
if (&ch.vtlist == (virtual_timers_list_t *)ch.vtlist.vt_next) {
- /*lint -restore*/
/* Just removed the last element in the list, alarm timer stopped.*/
port_timer_stop_alarm();
}