aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/rt/include/chdebug.h4
-rw-r--r--os/rt/include/chsys.h8
-rw-r--r--os/rt/src/chdebug.c22
-rw-r--r--os/rt/src/chheap.c4
-rw-r--r--os/rt/src/chmtx.c28
-rw-r--r--os/rt/src/chsys.c12
6 files changed, 39 insertions, 39 deletions
diff --git a/os/rt/include/chdebug.h b/os/rt/include/chdebug.h
index 893ec26b1..c4fd39f39 100644
--- a/os/rt/include/chdebug.h
+++ b/os/rt/include/chdebug.h
@@ -121,8 +121,8 @@ typedef struct {
/*===========================================================================*/
#if CH_DBG_SYSTEM_STATE_CHECK == TRUE
-#define _dbg_enter_lock() (ch.dbg.lock_cnt = 1)
-#define _dbg_leave_lock() (ch.dbg.lock_cnt = 0)
+#define _dbg_enter_lock() (ch.dbg.lock_cnt = (cnt_t)1)
+#define _dbg_leave_lock() (ch.dbg.lock_cnt = (cnt_t)0)
#endif
/* When the state checker feature is disabled then the following functions
diff --git a/os/rt/include/chsys.h b/os/rt/include/chsys.h
index 9d1bff204..a92a67008 100644
--- a/os/rt/include/chsys.h
+++ b/os/rt/include/chsys.h
@@ -38,10 +38,10 @@
* @name Masks of executable integrity checks.
* @{
*/
-#define CH_INTEGRITY_RLIST 1
-#define CH_INTEGRITY_VTLIST 2
-#define CH_INTEGRITY_REGISTRY 4
-#define CH_INTEGRITY_PORT 8
+#define CH_INTEGRITY_RLIST 1U
+#define CH_INTEGRITY_VTLIST 2U
+#define CH_INTEGRITY_REGISTRY 4U
+#define CH_INTEGRITY_PORT 8U
/** @} */
/*===========================================================================*/
diff --git a/os/rt/src/chdebug.c b/os/rt/src/chdebug.c
index a09f327b4..bba6b4fa4 100644
--- a/os/rt/src/chdebug.c
+++ b/os/rt/src/chdebug.c
@@ -113,7 +113,7 @@
*/
void _dbg_check_disable(void) {
- if ((ch.dbg.isr_cnt != 0) || (ch.dbg.lock_cnt != 0)) {
+ if ((ch.dbg.isr_cnt != (cnt_t)0) || (ch.dbg.lock_cnt != (cnt_t)0)) {
chSysHalt("SV#1");
}
}
@@ -125,7 +125,7 @@ void _dbg_check_disable(void) {
*/
void _dbg_check_suspend(void) {
- if ((ch.dbg.isr_cnt != 0) || (ch.dbg.lock_cnt != 0)) {
+ if ((ch.dbg.isr_cnt != (cnt_t)0) || (ch.dbg.lock_cnt != (cnt_t)0)) {
chSysHalt("SV#2");
}
}
@@ -137,7 +137,7 @@ void _dbg_check_suspend(void) {
*/
void _dbg_check_enable(void) {
- if ((ch.dbg.isr_cnt != 0) || (ch.dbg.lock_cnt != 0)) {
+ if ((ch.dbg.isr_cnt != (cnt_t)0) || (ch.dbg.lock_cnt != (cnt_t)0)) {
chSysHalt("SV#3");
}
}
@@ -149,7 +149,7 @@ void _dbg_check_enable(void) {
*/
void _dbg_check_lock(void) {
- if ((ch.dbg.isr_cnt != 0) || (ch.dbg.lock_cnt != 0)) {
+ if ((ch.dbg.isr_cnt != (cnt_t)0) || (ch.dbg.lock_cnt != (cnt_t)0)) {
chSysHalt("SV#4");
}
_dbg_enter_lock();
@@ -162,7 +162,7 @@ void _dbg_check_lock(void) {
*/
void _dbg_check_unlock(void) {
- if ((ch.dbg.isr_cnt != 0) || (ch.dbg.lock_cnt <= 0)) {
+ if ((ch.dbg.isr_cnt != (cnt_t)0) || (ch.dbg.lock_cnt <= (cnt_t)0)) {
chSysHalt("SV#5");
}
_dbg_leave_lock();
@@ -175,7 +175,7 @@ void _dbg_check_unlock(void) {
*/
void _dbg_check_lock_from_isr(void) {
- if ((ch.dbg.isr_cnt <= 0) || (ch.dbg.lock_cnt != 0)) {
+ if ((ch.dbg.isr_cnt <= (cnt_t)0) || (ch.dbg.lock_cnt != (cnt_t)0)) {
chSysHalt("SV#6");
}
_dbg_enter_lock();
@@ -188,7 +188,7 @@ void _dbg_check_lock_from_isr(void) {
*/
void _dbg_check_unlock_from_isr(void) {
- if ((ch.dbg.isr_cnt <= 0) || (ch.dbg.lock_cnt <= 0)) {
+ if ((ch.dbg.isr_cnt <= (cnt_t)0) || (ch.dbg.lock_cnt <= (cnt_t)0)) {
chSysHalt("SV#7");
}
_dbg_leave_lock();
@@ -202,7 +202,7 @@ void _dbg_check_unlock_from_isr(void) {
void _dbg_check_enter_isr(void) {
port_lock_from_isr();
- if ((ch.dbg.isr_cnt < 0) || (ch.dbg.lock_cnt != 0)) {
+ if ((ch.dbg.isr_cnt < (cnt_t)0) || (ch.dbg.lock_cnt != (cnt_t)0)) {
chSysHalt("SV#8");
}
ch.dbg.isr_cnt++;
@@ -217,7 +217,7 @@ void _dbg_check_enter_isr(void) {
void _dbg_check_leave_isr(void) {
port_lock_from_isr();
- if ((ch.dbg.isr_cnt <= 0) || (ch.dbg.lock_cnt != 0)) {
+ if ((ch.dbg.isr_cnt <= (cnt_t)0) || (ch.dbg.lock_cnt != (cnt_t)0)) {
chSysHalt("SV#9");
}
ch.dbg.isr_cnt--;
@@ -234,7 +234,7 @@ void _dbg_check_leave_isr(void) {
*/
void chDbgCheckClassI(void) {
- if ((ch.dbg.isr_cnt < 0) || (ch.dbg.lock_cnt <= 0)) {
+ if ((ch.dbg.isr_cnt < (cnt_t)0) || (ch.dbg.lock_cnt <= (cnt_t)0)) {
chSysHalt("SV#10");
}
}
@@ -249,7 +249,7 @@ void chDbgCheckClassI(void) {
*/
void chDbgCheckClassS(void) {
- if ((ch.dbg.isr_cnt != 0) || (ch.dbg.lock_cnt <= 0)) {
+ if ((ch.dbg.isr_cnt != (cnt_t)0) || (ch.dbg.lock_cnt <= (cnt_t)0)) {
chSysHalt("SV#11");
}
}
diff --git a/os/rt/src/chheap.c b/os/rt/src/chheap.c
index 534a3430c..6f9cff77f 100644
--- a/os/rt/src/chheap.c
+++ b/os/rt/src/chheap.c
@@ -96,7 +96,7 @@ void _heap_init(void) {
#if (CH_CFG_USE_MUTEXES == TRUE) || defined(__DOXYGEN__)
chMtxObjectInit(&default_heap.h_mtx);
#else
- chSemObjectInit(&default_heap.h_sem, 1);
+ chSemObjectInit(&default_heap.h_sem, (cnt_t)1);
#endif
}
@@ -124,7 +124,7 @@ void chHeapObjectInit(memory_heap_t *heapp, void *buf, size_t size) {
#if (CH_CFG_USE_MUTEXES == TRUE) || defined(__DOXYGEN__)
chMtxObjectInit(&heapp->h_mtx);
#else
- chSemObjectInit(&heapp->h_sem, 1);
+ chSemObjectInit(&heapp->h_sem, (cnt_t)1);
#endif
}
diff --git a/os/rt/src/chmtx.c b/os/rt/src/chmtx.c
index deffb397d..03f78a3ce 100644
--- a/os/rt/src/chmtx.c
+++ b/os/rt/src/chmtx.c
@@ -107,7 +107,7 @@ void chMtxObjectInit(mutex_t *mp) {
queue_init(&mp->m_queue);
mp->m_owner = NULL;
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- mp->m_cnt = 0;
+ mp->m_cnt = (cnt_t)0;
#endif
}
@@ -146,7 +146,7 @@ void chMtxLockS(mutex_t *mp) {
if (mp->m_owner != NULL) {
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- chDbgAssert(mp->m_cnt >= 1, "counter is not positive");
+ chDbgAssert(mp->m_cnt >= (cnt_t)1, "counter is not positive");
/* If the mutex is already owned by this thread, the counter is increased
and there is no need of more actions.*/
@@ -218,13 +218,13 @@ void chMtxLockS(mutex_t *mp) {
chDbgAssert(mp->m_owner == ctp, "not owner");
chDbgAssert(ctp->p_mtxlist == mp, "not owned");
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- chDbgAssert(mp->m_cnt == 1, "counter is not one");
+ chDbgAssert(mp->m_cnt == (cnt_t)1, "counter is not one");
}
#endif
}
else {
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- chDbgAssert(mp->m_cnt == 0, "counter is not zero");
+ chDbgAssert(mp->m_cnt == (cnt_t)0, "counter is not zero");
mp->m_cnt++;
#endif
@@ -287,7 +287,7 @@ bool chMtxTryLockS(mutex_t *mp) {
if (mp->m_owner != NULL) {
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- chDbgAssert(mp->m_cnt >= 1, "counter is not positive");
+ chDbgAssert(mp->m_cnt >= (cnt_t)1, "counter is not positive");
if (mp->m_owner == currp) {
mp->m_cnt++;
@@ -298,7 +298,7 @@ bool chMtxTryLockS(mutex_t *mp) {
}
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- chDbgAssert(mp->m_cnt == 0, "counter is not zero");
+ chDbgAssert(mp->m_cnt == (cnt_t)0, "counter is not zero");
mp->m_cnt++;
#endif
@@ -331,9 +331,9 @@ void chMtxUnlock(mutex_t *mp) {
chDbgAssert(ctp->p_mtxlist != NULL, "owned mutexes list empty");
chDbgAssert(ctp->p_mtxlist->m_owner == ctp, "ownership failure");
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- chDbgAssert(mp->m_cnt >= 1, "counter is not positive");
+ chDbgAssert(mp->m_cnt >= (cnt_t)1, "counter is not positive");
- if (--mp->m_cnt == 0) {
+ if (--mp->m_cnt == (cnt_t)0) {
#endif
chDbgAssert(ctp->p_mtxlist == mp, "not next in list");
@@ -369,7 +369,7 @@ void chMtxUnlock(mutex_t *mp) {
/* Awakens the highest priority thread waiting for the unlocked mutex and
assigns the mutex to it.*/
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- mp->m_cnt = 1;
+ mp->m_cnt = (cnt_t)1;
#endif
tp = queue_fifo_remove(&mp->m_queue);
mp->m_owner = tp;
@@ -411,9 +411,9 @@ void chMtxUnlockS(mutex_t *mp) {
chDbgAssert(ctp->p_mtxlist != NULL, "owned mutexes list empty");
chDbgAssert(ctp->p_mtxlist->m_owner == ctp, "ownership failure");
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- chDbgAssert(mp->m_cnt >= 1, "counter is not positive");
+ chDbgAssert(mp->m_cnt >= (cnt_t)1, "counter is not positive");
- if (--mp->m_cnt == 0) {
+ if (--mp->m_cnt == (cnt_t)0) {
#endif
chDbgAssert(ctp->p_mtxlist == mp, "not next in list");
@@ -449,7 +449,7 @@ void chMtxUnlockS(mutex_t *mp) {
/* Awakens the highest priority thread waiting for the unlocked mutex and
assigns the mutex to it.*/
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- mp->m_cnt = 1;
+ mp->m_cnt = (cnt_t)1;
#endif
tp = queue_fifo_remove(&mp->m_queue);
mp->m_owner = tp;
@@ -486,7 +486,7 @@ void chMtxUnlockAll(void) {
ctp->p_mtxlist = mp->m_next;
if (chMtxQueueNotEmptyS(mp)) {
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- mp->m_cnt = 1;
+ mp->m_cnt = (cnt_t)1;
#endif
thread_t *tp = queue_fifo_remove(&mp->m_queue);
mp->m_owner = tp;
@@ -496,7 +496,7 @@ void chMtxUnlockAll(void) {
}
else {
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- mp->m_cnt = 0;
+ mp->m_cnt = (cnt_t)0;
#endif
mp->m_owner = NULL;
}
diff --git a/os/rt/src/chsys.c b/os/rt/src/chsys.c
index 5a9e38cf9..350d647e4 100644
--- a/os/rt/src/chsys.c
+++ b/os/rt/src/chsys.c
@@ -203,7 +203,7 @@ bool chSysIntegrityCheckI(unsigned testmask) {
thread_t *tp;
/* Scanning the ready list forward.*/
- n = 0;
+ n = (cnt_t)0;
tp = ch.rlist.r_queue.p_next;
while (tp != (thread_t *)&ch.rlist.r_queue) {
n++;
@@ -218,7 +218,7 @@ bool chSysIntegrityCheckI(unsigned testmask) {
}
/* The number of elements must match.*/
- if (n != 0) {
+ if (n != (cnt_t)0) {
return true;
}
}
@@ -228,7 +228,7 @@ bool chSysIntegrityCheckI(unsigned testmask) {
virtual_timer_t * vtp;
/* Scanning the timers list forward.*/
- n = 0;
+ n = (cnt_t)0;
vtp = ch.vtlist.vt_next;
while (vtp != (virtual_timer_t *)&ch.vtlist) {
n++;
@@ -243,7 +243,7 @@ bool chSysIntegrityCheckI(unsigned testmask) {
}
/* The number of elements must match.*/
- if (n != 0) {
+ if (n != (cnt_t)0) {
return true;
}
}
@@ -253,7 +253,7 @@ bool chSysIntegrityCheckI(unsigned testmask) {
thread_t *tp;
/* Scanning the ready list forward.*/
- n = 0;
+ n = (cnt_t)0;
tp = ch.rlist.r_newer;
while (tp != (thread_t *)&ch.rlist) {
n++;
@@ -268,7 +268,7 @@ bool chSysIntegrityCheckI(unsigned testmask) {
}
/* The number of elements must match.*/
- if (n != 0) {
+ if (n != (cnt_t)0) {
return true;
}
}