aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2018-02-10 10:32:02 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2018-02-10 10:32:02 +0000
commit87bae60d9dc02e8d415f490acf416e6207c86f4b (patch)
tree45d6b367a3094981075adeb4ceae1e90594494e8 /os/hal
parent083c5f3ae361368da09c26cde1367e4474b3029c (diff)
downloadChibiOS-87bae60d9dc02e8d415f490acf416e6207c86f4b.tar.gz
ChibiOS-87bae60d9dc02e8d415f490acf416e6207c86f4b.tar.bz2
ChibiOS-87bae60d9dc02e8d415f490acf416e6207c86f4b.zip
MISRA-related fixes.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11472 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/include/hal_pal.h67
1 files changed, 36 insertions, 31 deletions
diff --git a/os/hal/include/hal_pal.h b/os/hal/include/hal_pal.h
index 91774189c..abd2d0fd7 100644
--- a/os/hal/include/hal_pal.h
+++ b/os/hal/include/hal_pal.h
@@ -151,13 +151,13 @@ typedef void (*palcallback_t)(void *arg);
* @brief Type of a PAL event record.
*/
typedef struct {
-#if PAL_USE_WAIT || defined(__DOXYGEN__)
+#if (PAL_USE_WAIT == TRUE) || defined(__DOXYGEN__)
/**
* @brief Threads queued for an event.
*/
threads_queue_t threads;
#endif
-#if PAL_USE_CALLBACKS || defined(__DOXYGEN__)
+#if (PAL_USE_CALLBACKS == TRUE) || defined(__DOXYGEN__)
/**
* @brief Event callback.
*/
@@ -245,12 +245,14 @@ typedef struct {
#define IOBUS_DECL(name, port, width, offset) \
IOBus name = _IOBUS_DATA(name, port, width, offset)
-#if PAL_USE_CALLBACKS || PAL_USE_WAIT || defined(__DOXYGEN__)
+#if (PAL_USE_CALLBACKS == TRUE) || (PAL_USE_WAIT == TRUE) || \
+ defined(__DOXYGEN__)
/**
* @name Low level driver helper macros
* @{
*/
-#if (PAL_USE_CALLBACKS && PAL_USE_WAIT) || defined(__DOXYGEN__)
+#if ((PAL_USE_CALLBACKS == TRUE) && (PAL_USE_WAIT == TRUE)) || \
+ defined(__DOXYGEN__)
/**
* @brief Initializes a PAL event object.
*
@@ -264,24 +266,24 @@ typedef struct {
_pal_events[e].cb = NULL; \
_pal_events[e].arg = NULL; \
} while (false)
-#endif /* PAL_USE_CALLBACKS && PAL_USE_WAIT */
+#endif /* (PAL_USE_CALLBACKS == TRUE) && (PAL_USE_WAIT == TRUE) */
-#if PAL_USE_CALLBACKS && !PAL_USE_WAIT
+#if (PAL_USE_CALLBACKS == TRUE) && (PAL_USE_WAIT == FALSE)
#define _pal_init_event(e) \
do { \
_pal_events[e].cb = NULL; \
_pal_events[e].arg = NULL; \
} while (false)
-#endif /* PAL_USE_CALLBACKS && !PAL_USE_WAIT */
+#endif /* (PAL_USE_CALLBACKS == TRUE) && (PAL_USE_WAIT == FALSE) */
-#if !PAL_USE_CALLBACKS && PAL_USE_WAIT
+#if (PAL_USE_CALLBACKS == FALSE) && (PAL_USE_WAIT == TRUE)
#define _pal_init_event(e) \
do { \
osalThreadQueueObjectInit(&_pal_events[e].threads); \
} while (false)
-#endif /* !PAL_USE_CALLBACKS && PAL_USE_WAIT */
+#endif /* (PAL_USE_CALLBACKS == FALSE) && (PAL_USE_WAIT == TRUE) */
-#if (PAL_USE_CALLBACKS && PAL_USE_WAIT) || defined(__DOXYGEN__)
+#if ((PAL_USE_CALLBACKS == TRUE) && (PAL_USE_WAIT == TRUE)) || defined(__DOXYGEN__)
/**
* @brief Clears a PAL event object.
*
@@ -295,22 +297,22 @@ typedef struct {
_pal_events[e].cb = NULL; \
_pal_events[e].arg = NULL; \
} while (false)
-#endif /* PAL_USE_CALLBACKS && PAL_USE_WAIT */
+#endif /* (PAL_USE_CALLBACKS == TRUE) && (PAL_USE_WAIT == TRUE) */
-#if PAL_USE_CALLBACKS && !PAL_USE_WAIT
+#if (PAL_USE_CALLBACKS == TRUE) && (PAL_USE_WAIT == FALSE)
#define _pal_clear_event(e) \
do { \
_pal_events[e].cb = NULL; \
_pal_events[e].arg = NULL; \
} while (false)
-#endif /* PAL_USE_CALLBACKS && !PAL_USE_WAIT */
+#endif /* (PAL_USE_CALLBACKS == TRUE) && (PAL_USE_WAIT == FALSE) */
-#if !PAL_USE_CALLBACKS && PAL_USE_WAIT
+#if (PAL_USE_CALLBACKS == FALSE) && (PAL_USE_WAIT == TRUE)
#define _pal_clear_event(e) \
do { \
osalThreadDequeueAllI(&_pal_events[pad].threads, MSG_RESET); \
} while (false)
-#endif /* !PAL_USE_CALLBACKS && PAL_USE_WAIT */
+#endif /* (PAL_USE_CALLBACKS == FALSE) && (PAL_USE_WAIT == TRUE) */
/**
* @brief Common ISR code.
@@ -321,7 +323,8 @@ typedef struct {
*
* @notapi
*/
-#if (PAL_USE_CALLBACKS && PAL_USE_WAIT) || defined(__DOXYGEN__)
+#if ((PAL_USE_CALLBACKS == TRUE) && (PAL_USE_WAIT == TRUE)) || \
+ defined(__DOXYGEN__)
#define _pal_isr_code(e) do { \
if (_pal_events[e].cb != NULL) { \
_pal_events[e].cb(_pal_events[e].arg); \
@@ -330,26 +333,27 @@ typedef struct {
osalThreadDequeueAllI(&_pal_events[e].threads, MSG_OK); \
osalSysUnlockFromISR(); \
} while (false)
-#endif /* PAL_USE_CALLBACKS && PAL_USE_WAIT */
+#endif /* (PAL_USE_CALLBACKS == TRUE) && (PAL_USE_WAIT == TRUE) */
-#if PAL_USE_CALLBACKS && !PAL_USE_WAIT
+#if (PAL_USE_CALLBACKS == TRUE) && (PAL_USE_WAIT == FALSE)
#define _pal_isr_code(e) do { \
if (_pal_events[e].cb != NULL) { \
_pal_events[e].cb(_pal_events[e].arg); \
} \
} while (false)
-#endif /* PAL_USE_CALLBACKS && !PAL_USE_WAIT */
+#endif /* (PAL_USE_CALLBACKS == TRUE) && (PAL_USE_WAIT == FALSE) */
-#if (!PAL_USE_CALLBACKS && PAL_USE_WAIT) || defined(__DOXYGEN__)
+#if ((PAL_USE_CALLBACKS == FALSE) && (PAL_USE_WAIT == TRUE)) || \
+ defined(__DOXYGEN__)
#define _pal_isr_code(e) do { \
osalSysLockFromISR(); \
osalThreadDequeueAllI(&_pal_events[e].threads, MSG_OK); \
osalSysUnlockFromISR(); \
} while (false)
-#endif /* !PAL_USE_CALLBACKS && PAL_USE_WAIT */
+#endif /* (PAL_USE_CALLBACKS == FALSE) && (PAL_USE_WAIT == TRUE) */
/** @} */
-#endif /* PAL_USE_CALLBACKS || PAL_USE_WAIT */
+#endif /* (PAL_USE_CALLBACKS == TRUE) || (PAL_USE_WAIT == TRUE) */
/**
* @name Macro Functions
@@ -777,7 +781,8 @@ typedef struct {
#define palSetLineMode(line, mode) pal_lld_setlinemode(line, mode)
#endif
-#if PAL_USE_CALLBACKS || PAL_USE_WAIT || defined(__DOXYGEN__)
+#if (PAL_USE_CALLBACKS == TRUE) || (PAL_USE_WAIT == TRUE) || \
+ defined(__DOXYGEN__)
/**
* @brief Pad event enable.
* @note Programming an unknown or unsupported mode is silently ignored.
@@ -909,7 +914,7 @@ typedef struct {
#endif /* PAL_USE_CALLBACKS || PAL_USE_WAIT */
-#if PAL_USE_CALLBACKS || defined(__DOXYGEN__)
+#if (PAL_USE_CALLBACKS == TRUE) || defined(__DOXYGEN__)
/**
* @brief Associates a callback to a pad.
*
@@ -943,9 +948,9 @@ typedef struct {
palSetLineCallbackI(line, cb, arg); \
osalSysUnlock(); \
} while (false)
-#endif /* PAL_USE_CALLBACKS */
+#endif /* PAL_USE_CALLBACKS == TRUE */
-#if PAL_USE_WAIT || defined(__DOXYGEN__)
+#if (PAL_USE_WAIT == TRUE) || defined(__DOXYGEN__)
/**
* @brief Waits for an edge on the specified port/pad.
*
@@ -986,7 +991,7 @@ typedef struct {
palWaitLineTimeoutS(line, timeout); \
osalSysUnlock(); \
} while (false)
-#endif /* PAL_USE_WAIT */
+#endif /* PAL_USE_WAIT == TRUE */
/** @} */
@@ -1000,16 +1005,16 @@ extern "C" {
ioportmask_t palReadBus(IOBus *bus);
void palWriteBus(IOBus *bus, ioportmask_t bits);
void palSetBusMode(IOBus *bus, iomode_t mode);
-#if PAL_USE_CALLBACKS || defined(__DOXYGEN__)
+#if (PAL_USE_CALLBACKS == TRUE) || defined(__DOXYGEN__)
void palSetPadCallbackI(ioportid_t port, iopadid_t pad,
palcallback_t cb, void *arg);
void palSetLineCallbackI(ioline_t line, palcallback_t cb, void *arg);
-#endif /* PAL_USE_CALLBACKS */
-#if PAL_USE_WAIT || defined(__DOXYGEN__)
+#endif /* PAL_USE_CALLBACKS == TRUE */
+#if (PAL_USE_WAIT == TRUE) || defined(__DOXYGEN__)
msg_t palWaitPadTimeoutS(ioportid_t port, iopadid_t pad,
sysinterval_t timeout);
msg_t palWaitLineTimeoutS(ioline_t line, sysinterval_t timeout);
-#endif /* PAL_USE_WAIT */
+#endif /* PAL_USE_WAIT == TRUE */
#ifdef __cplusplus
}
#endif