MISRA-related fixes.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9235 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
Giovanni Di Sirio 2016-04-03 12:10:15 +00:00
parent c9e95d85ff
commit ca77eb7d3e
2 changed files with 19 additions and 17 deletions

View File

@ -49,11 +49,11 @@
* @{ * @{
*/ */
#define CH_TRACE_SUSPEND_NONE 0U #define CH_TRACE_SUSPEND_NONE 0U
#define CH_TRACE_SUSPEND_SWITCH (1U << CH_TRACE_TYPE_SWITCH) #define CH_TRACE_SUSPEND_SWITCH 1U
#define CH_TRACE_SUSPEND_ISR_ENTER (1U << CH_TRACE_TYPE_ISR_ENTER) #define CH_TRACE_SUSPEND_ISR_ENTER 2U
#define CH_TRACE_SUSPEND_ISR_LEAVE (1U << CH_TRACE_TYPE_ISR_LEAVE) #define CH_TRACE_SUSPEND_ISR_LEAVE 4U
#define CH_TRACE_SUSPEND_HALT (1U << CH_TRACE_TYPE_HALT) #define CH_TRACE_SUSPEND_HALT 8U
#define CH_TRACE_SUSPEND_USER (1U << CH_TRACE_TYPE_USER) #define CH_TRACE_SUSPEND_USER 16U
#define CH_TRACE_SUSPEND_ALL (CH_TRACE_SUSPEND_SWITCH | \ #define CH_TRACE_SUSPEND_ALL (CH_TRACE_SUSPEND_SWITCH | \
CH_TRACE_SUSPEND_ISR_ENTER | \ CH_TRACE_SUSPEND_ISR_ENTER | \
CH_TRACE_SUSPEND_ISR_LEAVE | \ CH_TRACE_SUSPEND_ISR_LEAVE | \
@ -69,8 +69,8 @@
#define CH_DBG_TRACE_MASK_NONE 0U #define CH_DBG_TRACE_MASK_NONE 0U
#define CH_DBG_TRACE_MASK_SWITCH 1U #define CH_DBG_TRACE_MASK_SWITCH 1U
#define CH_DBG_TRACE_MASK_ISR 2U #define CH_DBG_TRACE_MASK_ISR 2U
#define CH_DBG_TRACE_MASK_HALT 4U #define CH_DBG_TRACE_MASK_HALT 8U
#define CH_DBG_TRACE_MASK_USER 8U #define CH_DBG_TRACE_MASK_USER 16U
#define CH_DBG_TRACE_MASK_ALL (CH_DBG_TRACE_MASK_SWITCH | \ #define CH_DBG_TRACE_MASK_ALL (CH_DBG_TRACE_MASK_SWITCH | \
CH_DBG_TRACE_MASK_ISR | \ CH_DBG_TRACE_MASK_ISR | \
CH_DBG_TRACE_MASK_HALT | \ CH_DBG_TRACE_MASK_HALT | \
@ -122,6 +122,7 @@
/*===========================================================================*/ /*===========================================================================*/
#if (CH_DBG_TRACE_MASK != CH_DBG_TRACE_MASK_NONE) || defined(__DOXYGEN__) #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. * @brief Trace buffer record.
*/ */
@ -191,6 +192,7 @@ typedef struct {
} user; } user;
} u; } u;
} ch_trace_event_t; } ch_trace_event_t;
/*lint -restore*/
/** /**
* @brief Trace buffer header. * @brief Trace buffer header.

View File

@ -107,7 +107,7 @@
* *
* @notapi * @notapi
*/ */
NOINLINE static void trace_next(void) { static NOINLINE void trace_next(void) {
ch.dbg.trace_buffer.ptr->time = chVTGetSystemTimeX(); ch.dbg.trace_buffer.ptr->time = chVTGetSystemTimeX();
#if PORT_SUPPORTS_RT == TRUE #if PORT_SUPPORTS_RT == TRUE
@ -292,12 +292,12 @@ void _dbg_trace_init(void) {
ch.dbg.trace_buffer.suspended = 0U; ch.dbg.trace_buffer.suspended = 0U;
ch.dbg.trace_buffer.size = CH_DBG_TRACE_BUFFER_SIZE; ch.dbg.trace_buffer.size = CH_DBG_TRACE_BUFFER_SIZE;
ch.dbg.trace_buffer.ptr = &ch.dbg.trace_buffer.buffer[0]; 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; 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__) defined(__DOXYGEN__)
/** /**
* @brief Inserts in the circular debug trace buffer a context switch record. * @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(); 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__) defined(__DOXYGEN__)
/** /**
* @brief Inserts in the circular debug trace buffer an ISR-enter record. * @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(); 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__) defined(__DOXYGEN__)
/** /**
* @brief Inserts in the circular debug trace buffer an halt record. * @brief Inserts in the circular debug trace buffer an halt record.
@ -377,9 +377,9 @@ void _dbg_trace_halt(const char *reason) {
trace_next(); 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__) defined(__DOXYGEN__)
/** /**
* @brief Adds an user trace record to the trace buffer. * @brief Adds an user trace record to the trace buffer.
@ -416,7 +416,7 @@ void chDbgWriteTrace(void *up1, void *up2) {
chDbgWriteTraceI(up1, up2); chDbgWriteTraceI(up1, up2);
chSysUnlock(); 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. * @brief Suspends one or more trace events.