diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-02-05 15:08:12 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-02-05 15:08:12 +0000 |
commit | 5995950eb617d50beb043576eccf6f112bce188e (patch) | |
tree | d04e51caba669f3af46b84743d05882d42a77349 /os/hal | |
parent | 1474f60da3ac5bf5bc04eddfea7e3d41b1932658 (diff) | |
download | ChibiOS-5995950eb617d50beb043576eccf6f112bce188e.tar.gz ChibiOS-5995950eb617d50beb043576eccf6f112bce188e.tar.bz2 ChibiOS-5995950eb617d50beb043576eccf6f112bce188e.zip |
MISRA-related fixes.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10085 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal')
-rw-r--r-- | os/hal/include/hal_qspi.h | 73 | ||||
-rw-r--r-- | os/hal/ports/STM32/LLD/QUADSPIv1/hal_qspi_lld.h | 8 | ||||
-rw-r--r-- | os/hal/src/hal_buffers.c | 2 | ||||
-rw-r--r-- | os/hal/src/hal_serial_usb.c | 2 | ||||
-rw-r--r-- | os/hal/templates/hal_i2s_lld.c | 4 | ||||
-rw-r--r-- | os/hal/templates/hal_qspi_lld.c | 4 | ||||
-rw-r--r-- | os/hal/templates/hal_qspi_lld.h | 8 | ||||
-rw-r--r-- | os/hal/templates/hal_rtc_lld.c | 6 | ||||
-rw-r--r-- | os/hal/templates/hal_wdg_lld.c | 4 |
9 files changed, 58 insertions, 53 deletions
diff --git a/os/hal/include/hal_qspi.h b/os/hal/include/hal_qspi.h index 0b67923b3..c5f0f1c22 100644 --- a/os/hal/include/hal_qspi.h +++ b/os/hal/include/hal_qspi.h @@ -35,42 +35,43 @@ * @name Transfer options
* @{
*/
-#define QSPI_CFG_CMD_MASK (0xFFU << 0U)
-#define QSPI_CFG_CMD(n) ((n) << 0U)
-#define QSPI_CFG_CMD_MODE_MASK (3U << 8U)
-#define QSPI_CFG_CMD_MODE_NONE (0U << 8U)
-#define QSPI_CFG_CMD_MODE_ONE_LINE (1U << 8U)
-#define QSPI_CFG_CMD_MODE_TWO_LINES (2U << 8U)
-#define QSPI_CFG_CMD_MODE_FOUR_LINES (3U << 8U)
-#define QSPI_CFG_ADDR_MODE_MASK (3U << 10U)
-#define QSPI_CFG_ADDR_MODE_NONE (0U << 10U)
-#define QSPI_CFG_ADDR_MODE_ONE_LINE (1U << 10U)
-#define QSPI_CFG_ADDR_MODE_TWO_LINES (2U << 10U)
-#define QSPI_CFG_ADDR_MODE_FOUR_LINES (3U << 10U)
-#define QSPI_CFG_ADDR_SIZE_MASK (3U << 12U)
-#define QSPI_CFG_ADDR_SIZE_8 (0U << 12U)
-#define QSPI_CFG_ADDR_SIZE_16 (1U << 12U)
-#define QSPI_CFG_ADDR_SIZE_24 (2U << 12U)
-#define QSPI_CFG_ADDR_SIZE_32 (3U << 12U)
-#define QSPI_CFG_ALT_MODE_MASK (3U << 14U)
-#define QSPI_CFG_ALT_MODE_NONE (0U << 14U)
-#define QSPI_CFG_ALT_MODE_ONE_LINE (1U << 14U)
-#define QSPI_CFG_ALT_MODE_TWO_LINES (2U << 14U)
-#define QSPI_CFG_ALT_MODE_FOUR_LINES (3U << 14U)
-#define QSPI_CFG_ALT_SIZE_MASK (3U << 16U)
-#define QSPI_CFG_ALT_SIZE_8 (0U << 16U)
-#define QSPI_CFG_ALT_SIZE_16 (1U << 16U)
-#define QSPI_CFG_ALT_SIZE_24 (2U << 16U)
-#define QSPI_CFG_ALT_SIZE_32 (3U << 16U)
-#define QSPI_CFG_DUMMY_CYCLES_MASK (0x1FU << 18U)
-#define QSPI_CFG_DUMMY_CYCLES(n) ((n) << 18U)
-#define QSPI_CFG_DATA_MODE_MASK (3U << 24U)
-#define QSPI_CFG_DATA_MODE_NONE (0U << 24U)
-#define QSPI_CFG_DATA_MODE_ONE_LINE (1U << 24U)
-#define QSPI_CFG_DATA_MODE_TWO_LINES (2U << 24U)
-#define QSPI_CFG_DATA_MODE_FOUR_LINES (3U << 24U)
-#define QSPI_CFG_SIOO (1U << 28U)
-#define QSPI_CFG_DDRM (1U << 31U)
+#define QSPI_CFG_CMD_MASK (0xFFLU << 0LU)
+#define QSPI_CFG_CMD(n) ((n) << 0LU)
+#define QSPI_CFG_CMD_MODE_MASK (3LU << 8LU)
+#define QSPI_CFG_CMD_MODE_NONE (0LU << 8LU)
+#define QSPI_CFG_CMD_MODE_ONE_LINE (1LU << 8LU)
+#define QSPI_CFG_CMD_MODE_TWO_LINES (2LU << 8LU)
+#define QSPI_CFG_CMD_MODE_FOUR_LINES (3LU << 8LU)
+#define QSPI_CFG_ADDR_MODE_MASK (3LU << 10LU)
+#define QSPI_CFG_ADDR_MODE_NONE (0LU << 10LU)
+#define QSPI_CFG_ADDR_MODE_ONE_LINE (1LU << 10LU)
+#define QSPI_CFG_ADDR_MODE_TWO_LINES (2LU << 10LU)
+#define QSPI_CFG_ADDR_MODE_FOUR_LINES (3LU << 10LU)
+#define QSPI_CFG_ADDR_SIZE_MASK (3LU << 12LU)
+#define QSPI_CFG_ADDR_SIZE_8 (0LU << 12LU)
+#define QSPI_CFG_ADDR_SIZE_16 (1LU << 12LU)
+#define QSPI_CFG_ADDR_SIZE_24 (2LU << 12LU)
+#define QSPI_CFG_ADDR_SIZE_32 (3LU << 12LU)
+#define QSPI_CFG_ALT_MODE_MASK (3LU << 14LU)
+#define QSPI_CFG_ALT_MODE_NONE (0LU << 14LU)
+#define QSPI_CFG_ALT_MODE_ONE_LINE (1LU << 14LU)
+#define QSPI_CFG_ALT_MODE_TWO_LINES (2LU << 14LU)
+#define QSPI_CFG_ALT_MODE_FOUR_LINES (3LU << 14LU)
+#define QSPI_CFG_ALT_SIZE_MASK (3LU << 16LU)
+#define QSPI_CFG_ALT_SIZE_8 (0LU << 16LU)
+
+#define QSPI_CFG_ALT_SIZE_16 (1LU << 16LU)
+#define QSPI_CFG_ALT_SIZE_24 (2LU << 16LU)
+#define QSPI_CFG_ALT_SIZE_32 (3LU << 16LU)
+#define QSPI_CFG_DUMMY_CYCLES_MASK (0x1FLU << 18LU)
+#define QSPI_CFG_DUMMY_CYCLES(n) ((n) << 18LU)
+#define QSPI_CFG_DATA_MODE_MASK (3LU << 24LU)
+#define QSPI_CFG_DATA_MODE_NONE (0LU << 24LU)
+#define QSPI_CFG_DATA_MODE_ONE_LINE (1LU << 24LU)
+#define QSPI_CFG_DATA_MODE_TWO_LINES (2LU << 24LU)
+#define QSPI_CFG_DATA_MODE_FOUR_LINES (3LU << 24LU)
+#define QSPI_CFG_SIOO (1LU << 28LU)
+#define QSPI_CFG_DDRM (1LU << 31LU)
/** @} */
/*===========================================================================*/
diff --git a/os/hal/ports/STM32/LLD/QUADSPIv1/hal_qspi_lld.h b/os/hal/ports/STM32/LLD/QUADSPIv1/hal_qspi_lld.h index 0aacca1ba..fe7b31a61 100644 --- a/os/hal/ports/STM32/LLD/QUADSPIv1/hal_qspi_lld.h +++ b/os/hal/ports/STM32/LLD/QUADSPIv1/hal_qspi_lld.h @@ -25,7 +25,7 @@ #ifndef HAL_QSPI_LLD_H
#define HAL_QSPI_LLD_H
-#if HAL_USE_QSPI || defined(__DOXYGEN__)
+#if (HAL_USE_QSPI == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -211,13 +211,13 @@ struct QSPIDriver { * @brief Current configuration data.
*/
const QSPIConfig *config;
-#if QSPI_USE_WAIT || defined(__DOXYGEN__)
+#if (QSPI_USE_WAIT == TRUE) || defined(__DOXYGEN__)
/**
* @brief Waiting thread.
*/
thread_reference_t thread;
#endif /* QSPI_USE_WAIT */
-#if QSPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
+#if (QSPI_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
/**
* @brief Mutex protecting the peripheral.
*/
@@ -249,7 +249,7 @@ struct QSPIDriver { /* External declarations. */
/*===========================================================================*/
-#if STM32_QSPI_USE_QUADSPI1 && !defined(__DOXYGEN__)
+#if (STM32_QSPI_USE_QUADSPI1 == TRUE) && !defined(__DOXYGEN__)
extern QSPIDriver QSPID1;
#endif
diff --git a/os/hal/src/hal_buffers.c b/os/hal/src/hal_buffers.c index b56f79b60..871fd0a42 100644 --- a/os/hal/src/hal_buffers.c +++ b/os/hal/src/hal_buffers.c @@ -873,7 +873,7 @@ void obqFlush(output_buffers_queue_t *obqp) { /* If there is a buffer partially filled and not being written.*/
if (obqp->ptr != NULL) {
- size_t size = (size_t)obqp->ptr - (size_t)obqp->bwrptr - sizeof (size_t);
+ size_t size = ((size_t)obqp->ptr - (size_t)obqp->bwrptr) - sizeof (size_t);
if (size > 0U) {
obqPostFullBufferS(obqp, size);
diff --git a/os/hal/src/hal_serial_usb.c b/os/hal/src/hal_serial_usb.c index 4936a92ae..f3c606942 100644 --- a/os/hal/src/hal_serial_usb.c +++ b/os/hal/src/hal_serial_usb.c @@ -471,7 +471,7 @@ void sduDataReceived(USBDriver *usbp, usbep_t ep) { /* The endpoint cannot be busy, we are in the context of the callback,
so a packet is in the buffer for sure. Trying to get a free buffer
for the next transaction.*/
- sdu_start_receive(sdup);
+ (void) sdu_start_receive(sdup);
osalSysUnlockFromISR();
}
diff --git a/os/hal/templates/hal_i2s_lld.c b/os/hal/templates/hal_i2s_lld.c index 7424a663a..0321d6464 100644 --- a/os/hal/templates/hal_i2s_lld.c +++ b/os/hal/templates/hal_i2s_lld.c @@ -24,7 +24,7 @@ #include "hal.h"
-#if HAL_USE_I2S || defined(__DOXYGEN__)
+#if (HAL_USE_I2S == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
@@ -35,7 +35,7 @@ /*===========================================================================*/
/** @brief I2S2 driver identifier.*/
-#if PLATFORM_I2S_USE_I2S1 || defined(__DOXYGEN__)
+#if (PLATFORM_I2S_USE_I2S1 == TRUE) || defined(__DOXYGEN__)
I2SDriver I2SD1;
#endif
diff --git a/os/hal/templates/hal_qspi_lld.c b/os/hal/templates/hal_qspi_lld.c index d380b6c20..6ba358168 100644 --- a/os/hal/templates/hal_qspi_lld.c +++ b/os/hal/templates/hal_qspi_lld.c @@ -24,7 +24,7 @@ #include "hal.h"
-#if HAL_USE_QSPI || defined(__DOXYGEN__)
+#if (HAL_USE_QSPI == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
@@ -35,7 +35,7 @@ /*===========================================================================*/
/** @brief QSPID1 driver identifier.*/
-#if PLATFORM_QSPI_USE_QSPI1 || defined(__DOXYGEN__)
+#if (PLATFORM_QSPI_USE_QSPI1 == TRUE) || defined(__DOXYGEN__)
QSPIDriver QSPID1;
#endif
diff --git a/os/hal/templates/hal_qspi_lld.h b/os/hal/templates/hal_qspi_lld.h index 18e07f9e6..b36b228c1 100644 --- a/os/hal/templates/hal_qspi_lld.h +++ b/os/hal/templates/hal_qspi_lld.h @@ -25,7 +25,7 @@ #ifndef HAL_QSPI_LLD_H
#define HAL_QSPI_LLD_H
-#if HAL_USE_QSPI || defined(__DOXYGEN__)
+#if (HAL_USE_QSPI == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -100,13 +100,13 @@ struct QSPIDriver { * @brief Current configuration data.
*/
const QSPIConfig *config;
-#if QSPI_USE_WAIT || defined(__DOXYGEN__)
+#if (QSPI_USE_WAIT == TRUE) || defined(__DOXYGEN__)
/**
* @brief Waiting thread.
*/
thread_reference_t thread;
#endif /* QSPI_USE_WAIT */
-#if QSPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
+#if (QSPI_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
/**
* @brief Mutex protecting the peripheral.
*/
@@ -126,7 +126,7 @@ struct QSPIDriver { /* External declarations. */
/*===========================================================================*/
-#if PLATFORM_QSPI_USE_QSPI1 && !defined(__DOXYGEN__)
+#if (PLATFORM_QSPI_USE_QSPI1 == TRUE) && !defined(__DOXYGEN__)
extern QSPIDriver QSPID1;
#endif
diff --git a/os/hal/templates/hal_rtc_lld.c b/os/hal/templates/hal_rtc_lld.c index d32ac5df4..007172df6 100644 --- a/os/hal/templates/hal_rtc_lld.c +++ b/os/hal/templates/hal_rtc_lld.c @@ -28,7 +28,7 @@ #include "hal.h"
-#if HAL_USE_RTC || defined(__DOXYGEN__)
+#if (HAL_USE_RTC == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
@@ -41,7 +41,9 @@ /**
* @brief RTC driver identifier.
*/
+#if (PLATFORM_RTC_USE_RTC1 == TRUE) && !defined(__DOXYGEN__)
RTCDriver RTCD1;
+#endif
/*===========================================================================*/
/* Driver local variables and types. */
@@ -67,7 +69,9 @@ RTCDriver RTCD1; void rtc_lld_init(void) {
/* RTC object initialization.*/
+#if PLATFORM_RTC_USE_RTC1 == TRUE
rtcObjectInit(&RTCD1);
+#endif
}
/**
diff --git a/os/hal/templates/hal_wdg_lld.c b/os/hal/templates/hal_wdg_lld.c index b446a30d5..b24213381 100644 --- a/os/hal/templates/hal_wdg_lld.c +++ b/os/hal/templates/hal_wdg_lld.c @@ -24,7 +24,7 @@ #include "hal.h"
-#if HAL_USE_WDG || defined(__DOXYGEN__)
+#if (HAL_USE_WDG == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
@@ -34,7 +34,7 @@ /* Driver exported variables. */
/*===========================================================================*/
-#if PLATFORM_WDG_USE_WDG1 || defined(__DOXYGEN__)
+#if (PLATFORM_WDG_USE_WDG1 == TRUE) || defined(__DOXYGEN__)
WDGDriver WDGD1;
#endif
|