aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2019-01-26 08:32:07 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2019-01-26 08:32:07 +0000
commit57d31cabcfedbab69c74cde694f8fe1ec652385d (patch)
treefefaa32d234406c79aecfd43d69be09077797593
parent2c757aacd0569a7cf824513ec34e5ed976291597 (diff)
downloadChibiOS-57d31cabcfedbab69c74cde694f8fe1ec652385d.tar.gz
ChibiOS-57d31cabcfedbab69c74cde694f8fe1ec652385d.tar.bz2
ChibiOS-57d31cabcfedbab69c74cde694f8fe1ec652385d.zip
MISRA-related fixes.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12586 110e8d01-0319-4d1e-a829-52ad28d1bb01
-rw-r--r--os/hal/include/hal_adc.h8
-rw-r--r--os/hal/include/hal_buffers.h2
-rw-r--r--os/hal/include/hal_dac.h6
-rw-r--r--os/hal/include/hal_persistent.h8
-rw-r--r--os/hal/include/hal_rtc.h4
-rw-r--r--os/hal/include/hal_spi.h8
-rw-r--r--os/hal/src/hal_dac.c4
-rw-r--r--os/hal/templates/hal_adc_lld.h8
-rw-r--r--os/hal/templates/hal_crypto_lld.c27
-rw-r--r--os/hal/templates/hal_dac_lld.h15
-rw-r--r--os/hal/templates/hal_i2s_lld.h8
-rw-r--r--os/hal/templates/hal_spi_lld.h8
-rw-r--r--os/hal/templates/hal_trng_lld.h12
-rw-r--r--os/hal/templates/hal_wspi_lld.h12
14 files changed, 64 insertions, 66 deletions
diff --git a/os/hal/include/hal_adc.h b/os/hal/include/hal_adc.h
index 57797c7ee..81104ffc2 100644
--- a/os/hal/include/hal_adc.h
+++ b/os/hal/include/hal_adc.h
@@ -177,18 +177,18 @@ struct hal_adc_driver {
* @brief Current conversion group pointer or @p NULL.
*/
const ADCConversionGroup *grpp;
-#if ADC_USE_WAIT || defined(__DOXYGEN__)
+#if (ADC_USE_WAIT == TRUE) || defined(__DOXYGEN__)
/**
* @brief Waiting thread.
*/
thread_reference_t thread;
-#endif
-#if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
+#endif /* ADC_USE_WAIT == TRUE */
+#if (ADC_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
/**
* @brief Mutex protecting the peripheral.
*/
mutex_t mutex;
-#endif /* ADC_USE_MUTUAL_EXCLUSION */
+#endif /* ADC_USE_MUTUAL_EXCLUSION == TRUE */
#if defined(ADC_DRIVER_EXT_FIELDS)
ADC_DRIVER_EXT_FIELDS
#endif
diff --git a/os/hal/include/hal_buffers.h b/os/hal/include/hal_buffers.h
index 9c5ea42d6..200c1b295 100644
--- a/os/hal/include/hal_buffers.h
+++ b/os/hal/include/hal_buffers.h
@@ -47,7 +47,9 @@
/* Derived constants and error checks. */
/*===========================================================================*/
+/*lint -save -e9027 [10.1] It is meant to be this way, not an error.*/
#if (BUFFERS_CHUNKS_SIZE & (BUFFERS_CHUNKS_SIZE - 1)) != 0
+/*lint -restore*/
#error "BUFFERS_CHUNKS_SIZE must be a power of two"
#endif
diff --git a/os/hal/include/hal_dac.h b/os/hal/include/hal_dac.h
index 403df4970..b3624dc07 100644
--- a/os/hal/include/hal_dac.h
+++ b/os/hal/include/hal_dac.h
@@ -158,18 +158,18 @@ struct hal_dac_driver {
/**
* @brief Samples buffer size.
*/
- uint16_t depth;
+ size_t depth;
/**
* @brief Current configuration data.
*/
const DACConfig *config;
-#if DAC_USE_WAIT || defined(__DOXYGEN__)
+#if (DAC_USE_WAIT == TRUE) || defined(__DOXYGEN__)
/**
* @brief Waiting thread.
*/
thread_reference_t thread;
#endif /* DAC_USE_WAIT */
-#if DAC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
+#if (DAC_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
/**
* @brief Mutex protecting the bus.
*/
diff --git a/os/hal/include/hal_persistent.h b/os/hal/include/hal_persistent.h
index 99697f131..e6005227c 100644
--- a/os/hal/include/hal_persistent.h
+++ b/os/hal/include/hal_persistent.h
@@ -65,7 +65,7 @@ typedef uint32_t ps_offset_t;
/**
* @brief @p BasePersistentStorage specific methods.
*/
-#define _base_persistent_storage_methods_alone \
+#define _base_pers_storage_methods_alone \
/* Storage size.*/ \
size_t (*getsize)(void *instance); \
/* Read operation.*/ \
@@ -78,15 +78,15 @@ typedef uint32_t ps_offset_t;
/**
* @brief @p BasePersistentStorage specific methods with inherited ones.
*/
-#define _base_persistent_storage_methods \
+#define _base_pers_storage_methods \
_base_object_methods \
- _base_persistent_storage_methods_alone
+ _base_pers_storage_methods_alone
/**
* @brief @p BasePersistentStorage virtual methods table.
*/
struct BasePersistentStorageVMT {
- _base_persistent_storage_methods
+ _base_pers_storage_methods
};
/**
diff --git a/os/hal/include/hal_rtc.h b/os/hal/include/hal_rtc.h
index e64b036e9..ad62e6ff3 100644
--- a/os/hal/include/hal_rtc.h
+++ b/os/hal/include/hal_rtc.h
@@ -128,7 +128,7 @@ typedef struct {
#error "RTC LLD does not define the required RTC_HAS_STORAGE macro"
#endif
-#if RTC_HAS_STORAGE || defined(__DOXYGEN__)
+#if (RTC_HAS_STORAGE == TRUE) || defined(__DOXYGEN__)
/**
* @extends FileStream
*
@@ -143,7 +143,7 @@ struct RTCDriverVMT {
* @brief Structure representing an RTC driver.
*/
struct RTCDriver {
-#if RTC_HAS_STORAGE || defined(__DOXYGEN__)
+#if (RTC_HAS_STORAGE == TRUE) || defined(__DOXYGEN__)
/**
* @brief Virtual Methods Table.
*/
diff --git a/os/hal/include/hal_spi.h b/os/hal/include/hal_spi.h
index 57f63e13c..35b42c90c 100644
--- a/os/hal/include/hal_spi.h
+++ b/os/hal/include/hal_spi.h
@@ -198,18 +198,18 @@ struct hal_spi_driver {
* @brief Current configuration data.
*/
const SPIConfig *config;
-#if SPI_USE_WAIT || defined(__DOXYGEN__)
+#if (SPI_USE_WAIT == TRUE) || defined(__DOXYGEN__)
/**
* @brief Waiting thread.
*/
thread_reference_t thread;
-#endif /* SPI_USE_WAIT */
-#if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
+#endif /* SPI_USE_WAIT == TRUE */
+#if (SPI_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
/**
* @brief Mutex protecting the peripheral.
*/
mutex_t mutex;
-#endif /* SPI_USE_MUTUAL_EXCLUSION */
+#endif /* SPI_USE_MUTUAL_EXCLUSION == TRUE */
#if defined(SPI_DRIVER_EXT_FIELDS)
SPI_DRIVER_EXT_FIELDS
#endif
diff --git a/os/hal/src/hal_dac.c b/os/hal/src/hal_dac.c
index 21c550d4d..bae19c7f7 100644
--- a/os/hal/src/hal_dac.c
+++ b/os/hal/src/hal_dac.c
@@ -142,7 +142,7 @@ void dacStop(DACDriver *dacp) {
*/
void dacPutChannelX(DACDriver *dacp, dacchannel_t channel, dacsample_t sample) {
- osalDbgCheck(channel < DAC_MAX_CHANNELS);
+ osalDbgCheck(channel < (dacchannel_t)DAC_MAX_CHANNELS);
osalDbgAssert(dacp->state == DAC_READY, "invalid state");
dac_lld_put_channel(dacp, channel, sample);
@@ -199,7 +199,7 @@ void dacStartConversionI(DACDriver *dacp,
osalDbgCheckClassI();
osalDbgCheck((dacp != NULL) && (grpp != NULL) && (samples != NULL) &&
- ((depth == 1) || ((depth & 1) == 0)));
+ ((depth == 1U) || ((depth & 1U) == 0U)));
osalDbgAssert((dacp->state == DAC_READY) ||
(dacp->state == DAC_COMPLETE) ||
(dacp->state == DAC_ERROR),
diff --git a/os/hal/templates/hal_adc_lld.h b/os/hal/templates/hal_adc_lld.h
index d337dd2aa..4ba9bc0dd 100644
--- a/os/hal/templates/hal_adc_lld.h
+++ b/os/hal/templates/hal_adc_lld.h
@@ -85,7 +85,9 @@ typedef enum {
/**
* @brief Low level fields of the ADC driver structure.
*/
-#define adc_lld_driver_fields
+#define adc_lld_driver_fields \
+ /* Dummy field, it is not needed.*/ \
+ uint32_t dummy
/**
* @brief Low level fields of the ADC configuration structure.
@@ -97,7 +99,9 @@ typedef enum {
/**
* @brief Low level fields of the ADC configuration structure.
*/
-#define adc_lld_configuration_group_fields
+#define adc_lld_configuration_group_fields \
+ /* Dummy configuration, it is not needed.*/ \
+ uint32_t dummy
/*===========================================================================*/
/* External declarations. */
diff --git a/os/hal/templates/hal_crypto_lld.c b/os/hal/templates/hal_crypto_lld.c
index 65433f928..3c2cb43c6 100644
--- a/os/hal/templates/hal_crypto_lld.c
+++ b/os/hal/templates/hal_crypto_lld.c
@@ -113,20 +113,11 @@ cryerror_t cry_lld_aes_loadkey(CRYDriver *cryp,
size_t size,
const uint8_t *keyp) {
- osalDbgCheck((cryp != NULL) && (keyp != NULL));
-
-
-#if CRY_LLD_SUPPORTS_AES == TRUE
- return cry_lld_aes_loadkey(cryp, size, keyp);
-#elif HAL_CRY_USE_FALLBACK == TRUE
- return cry_fallback_aes_loadkey(cryp, size, keyp);
-#else
(void)cryp;
(void)size;
(void)keyp;
return CRY_ERR_INV_ALGO;
-#endif
}
/**
@@ -693,20 +684,11 @@ cryerror_t cry_lld_des_loadkey(CRYDriver *cryp,
size_t size,
const uint8_t *keyp) {
- osalDbgCheck((cryp != NULL) && (keyp != NULL));
-
-
-#if CRY_LLD_SUPPORTS_DES == TRUE
- return cry_lld_des_loadkey(cryp, size, keyp);
-#elif HAL_CRY_USE_FALLBACK == TRUE
- return cry_fallback_des_loadkey(cryp, size, keyp);
-#else
(void)cryp;
(void)size;
(void)keyp;
return CRY_ERR_INV_ALGO;
-#endif
}
/**
@@ -1206,20 +1188,11 @@ cryerror_t cry_lld_hmac_loadkey(CRYDriver *cryp,
size_t size,
const uint8_t *keyp) {
- osalDbgCheck((cryp != NULL) && (keyp != NULL));
-
-#if (CRY_LLD_SUPPORTS_HMAC_SHA256 == TRUE) || \
- (CRY_LLD_SUPPORTS_HMAC_SHA512 == TRUE)
- return cry_lld_hmac_loadkey(cryp, size, keyp);
-#elif HAL_CRY_USE_FALLBACK == TRUE
- return cry_fallback_hmac_loadkey(cryp, size, keyp);
-#else
(void)cryp;
(void)size;
(void)keyp;
return CRY_ERR_INV_ALGO;
-#endif
}
/**
diff --git a/os/hal/templates/hal_dac_lld.h b/os/hal/templates/hal_dac_lld.h
index 12f2760c4..ab7b1872e 100644
--- a/os/hal/templates/hal_dac_lld.h
+++ b/os/hal/templates/hal_dac_lld.h
@@ -25,7 +25,7 @@
#ifndef HAL_DAC_LLD_H
#define HAL_DAC_LLD_H
-#if HAL_USE_DAC || defined(__DOXYGEN__)
+#if (HAL_USE_DAC == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -89,7 +89,9 @@ typedef enum {
/**
* @brief Low level fields of the DAC driver structure.
*/
-#define dac_lld_driver_fields
+#define dac_lld_driver_fields \
+ /* Dummy field, it is not needed.*/ \
+ uint32_t dummy
/**
* @brief Low level fields of the DAC configuration structure.
@@ -101,13 +103,16 @@ typedef enum {
/**
* @brief Low level fields of the DAC group configuration structure.
*/
-#define dac_lld_conversion_group_fields
+#define dac_lld_conversion_group_fields \
+ /* Dummy configuration, it is not needed.*/ \
+ uint32_t dummy
+
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
-#if PLATFORM_DAC_USE_DAC1 && !defined(__DOXYGEN__)
+#if (PLATFORM_DAC_USE_DAC1 == TRUE) && !defined(__DOXYGEN__)
extern DACDriver DACD1;
#endif
@@ -126,7 +131,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_DAC */
+#endif /* HAL_USE_DAC == TRUE */
#endif /* HAL_DAC_LLD_H */
diff --git a/os/hal/templates/hal_i2s_lld.h b/os/hal/templates/hal_i2s_lld.h
index 5b01183b4..2bd1a62d2 100644
--- a/os/hal/templates/hal_i2s_lld.h
+++ b/os/hal/templates/hal_i2s_lld.h
@@ -64,12 +64,16 @@
/**
* @brief Low level fields of the I2S driver structure.
*/
-#define i2s_lld_driver_fields
+#define i2s_lld_driver_fields \
+ /* Dummy field, it is not needed.*/ \
+ uint32_t dummy
/**
* @brief Low level fields of the I2S configuration structure.
*/
-#define i2s_lld_config_fields
+#define i2s_lld_config_fields \
+ /* Dummy configuration, it is not needed.*/ \
+ uint32_t dummy
/*===========================================================================*/
/* External declarations. */
diff --git a/os/hal/templates/hal_spi_lld.h b/os/hal/templates/hal_spi_lld.h
index ad3939c9b..b3f180a9d 100644
--- a/os/hal/templates/hal_spi_lld.h
+++ b/os/hal/templates/hal_spi_lld.h
@@ -69,12 +69,16 @@
/**
* @brief Low level fields of the SPI driver structure.
*/
-#define spi_lld_driver_fields
+#define spi_lld_driver_fields \
+ /* Dummy field, it is not needed.*/ \
+ uint32_t dummy
/**
* @brief Low level fields of the SPI configuration structure.
*/
-#define spi_lld_config_fields
+#define spi_lld_config_fields \
+ /* Dummy configuration, it is not needed.*/ \
+ uint32_t dummy
/*===========================================================================*/
/* External declarations. */
diff --git a/os/hal/templates/hal_trng_lld.h b/os/hal/templates/hal_trng_lld.h
index 1c7cfc7e7..c43d09bc2 100644
--- a/os/hal/templates/hal_trng_lld.h
+++ b/os/hal/templates/hal_trng_lld.h
@@ -62,17 +62,19 @@
/*===========================================================================*/
/**
+ * @brief Low level fields of the TRNG driver structure.
+ */
+#define trng_lld_driver_fields \
+ /* Dummy field, it is not needed.*/ \
+ uint32_t dummy
+
+/**
* @brief Low level fields of the TRNG configuration structure.
*/
#define trng_lld_config_fields \
/* Dummy configuration, it is not needed.*/ \
uint32_t dummy
-/**
- * @brief Low level fields of the TRNG driver structure.
- */
-#define trng_lld_driver_fields
-
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
diff --git a/os/hal/templates/hal_wspi_lld.h b/os/hal/templates/hal_wspi_lld.h
index 4c006f296..6df16d0d1 100644
--- a/os/hal/templates/hal_wspi_lld.h
+++ b/os/hal/templates/hal_wspi_lld.h
@@ -70,14 +70,18 @@
/*===========================================================================*/
/**
- * @brief Low level fields of the WSPI configuration structure.
+ * @brief Low level fields of the WSPI driver structure.
*/
-#define wspi_lld_config_fields
+#define wspi_lld_driver_fields \
+ /* Dummy field, it is not needed.*/ \
+ uint32_t dummy
/**
- * @brief Low level fields of the WSPI driver structure.
+ * @brief Low level fields of the WSPI configuration structure.
*/
-#define wspi_lld_driver_fields
+#define wspi_lld_config_fields \
+ /* Dummy configuration, it is not needed.*/ \
+ uint32_t dummy
/*===========================================================================*/
/* External declarations. */