aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2016-04-03 12:10:15 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2016-04-03 12:10:15 +0000
commitca77eb7d3ed8ff14cb2551076e2a235258ef8040 (patch)
treef3fb865355548434cc42fda3fb4a9baa4308c063 /os
parentc9e95d85ff61e631a4c7f0dd283a567a6dc751a9 (diff)
downloadChibiOS-ca77eb7d3ed8ff14cb2551076e2a235258ef8040.tar.gz
ChibiOS-ca77eb7d3ed8ff14cb2551076e2a235258ef8040.tar.bz2
ChibiOS-ca77eb7d3ed8ff14cb2551076e2a235258ef8040.zip
MISRA-related fixes.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9235 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/rt/include/chdebug.h16
-rw-r--r--os/rt/src/chdebug.c20
2 files changed, 19 insertions, 17 deletions
diff --git a/os/rt/include/chdebug.h b/os/rt/include/chdebug.h
index a6631fffb..c1e10b939 100644
--- a/os/rt/include/chdebug.h
+++ b/os/rt/include/chdebug.h
@@ -49,11 +49,11 @@
* @{
*/
#define CH_TRACE_SUSPEND_NONE 0U
-#define CH_TRACE_SUSPEND_SWITCH (1U << CH_TRACE_TYPE_SWITCH)
-#define CH_TRACE_SUSPEND_ISR_ENTER (1U << CH_TRACE_TYPE_ISR_ENTER)
-#define CH_TRACE_SUSPEND_ISR_LEAVE (1U << CH_TRACE_TYPE_ISR_LEAVE)
-#define CH_TRACE_SUSPEND_HALT (1U << CH_TRACE_TYPE_HALT)
-#define CH_TRACE_SUSPEND_USER (1U << CH_TRACE_TYPE_USER)
+#define CH_TRACE_SUSPEND_SWITCH 1U
+#define CH_TRACE_SUSPEND_ISR_ENTER 2U
+#define CH_TRACE_SUSPEND_ISR_LEAVE 4U
+#define CH_TRACE_SUSPEND_HALT 8U
+#define CH_TRACE_SUSPEND_USER 16U
#define CH_TRACE_SUSPEND_ALL (CH_TRACE_SUSPEND_SWITCH | \
CH_TRACE_SUSPEND_ISR_ENTER | \
CH_TRACE_SUSPEND_ISR_LEAVE | \
@@ -69,8 +69,8 @@
#define CH_DBG_TRACE_MASK_NONE 0U
#define CH_DBG_TRACE_MASK_SWITCH 1U
#define CH_DBG_TRACE_MASK_ISR 2U
-#define CH_DBG_TRACE_MASK_HALT 4U
-#define CH_DBG_TRACE_MASK_USER 8U
+#define CH_DBG_TRACE_MASK_HALT 8U
+#define CH_DBG_TRACE_MASK_USER 16U
#define CH_DBG_TRACE_MASK_ALL (CH_DBG_TRACE_MASK_SWITCH | \
CH_DBG_TRACE_MASK_ISR | \
CH_DBG_TRACE_MASK_HALT | \
@@ -122,6 +122,7 @@
/*===========================================================================*/
#if (CH_DBG_TRACE_MASK != CH_DBG_TRACE_MASK_NONE) || defined(__DOXYGEN__)
+/*lint -save -e46 [6.1] An uint32_t is required.*/
/**
* @brief Trace buffer record.
*/
@@ -191,6 +192,7 @@ typedef struct {
} user;
} u;
} ch_trace_event_t;
+/*lint -restore*/
/**
* @brief Trace buffer header.
diff --git a/os/rt/src/chdebug.c b/os/rt/src/chdebug.c
index aa7276417..fd6b3c92b 100644
--- a/os/rt/src/chdebug.c
+++ b/os/rt/src/chdebug.c
@@ -107,7 +107,7 @@
*
* @notapi
*/
-NOINLINE static void trace_next(void) {
+static NOINLINE void trace_next(void) {
ch.dbg.trace_buffer.ptr->time = chVTGetSystemTimeX();
#if PORT_SUPPORTS_RT == TRUE
@@ -292,12 +292,12 @@ void _dbg_trace_init(void) {
ch.dbg.trace_buffer.suspended = 0U;
ch.dbg.trace_buffer.size = CH_DBG_TRACE_BUFFER_SIZE;
ch.dbg.trace_buffer.ptr = &ch.dbg.trace_buffer.buffer[0];
- for (i = 0U; i < CH_DBG_TRACE_BUFFER_SIZE; i++) {
+ for (i = 0U; i < (unsigned)CH_DBG_TRACE_BUFFER_SIZE; i++) {
ch.dbg.trace_buffer.buffer[i].type = CH_TRACE_TYPE_UNUSED;
}
}
-#if ((CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_SWITCH) != 0) || \
+#if ((CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_SWITCH) != 0U) || \
defined(__DOXYGEN__)
/**
* @brief Inserts in the circular debug trace buffer a context switch record.
@@ -316,9 +316,9 @@ void _dbg_trace_switch(thread_t *otp) {
trace_next();
}
}
-#endif /* (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_SWITCH) != 0 */
+#endif /* (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_SWITCH) != 0U */
-#if ((CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_ISR) != 0) || \
+#if ((CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_ISR) != 0U) || \
defined(__DOXYGEN__)
/**
* @brief Inserts in the circular debug trace buffer an ISR-enter record.
@@ -357,9 +357,9 @@ void _dbg_trace_isr_leave(const char *isr) {
port_unlock_from_isr();
}
}
-#endif /* (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_ISR) != 0 */
+#endif /* (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_ISR) != 0U */
-#if ((CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_HALT) != 0) || \
+#if ((CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_HALT) != 0U) || \
defined(__DOXYGEN__)
/**
* @brief Inserts in the circular debug trace buffer an halt record.
@@ -377,9 +377,9 @@ void _dbg_trace_halt(const char *reason) {
trace_next();
}
}
-#endif /* (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_HALT) != 0 */
+#endif /* (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_HALT) != 0U */
-#if ((CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_USER) != 0) || \
+#if ((CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_USER) != 0U) || \
defined(__DOXYGEN__)
/**
* @brief Adds an user trace record to the trace buffer.
@@ -416,7 +416,7 @@ void chDbgWriteTrace(void *up1, void *up2) {
chDbgWriteTraceI(up1, up2);
chSysUnlock();
}
-#endif /* (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_USER) != 0 */
+#endif /* (CH_DBG_TRACE_MASK & CH_DBG_TRACE_MASK_USER) != 0U */
/**
* @brief Suspends one or more trace events.