aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/include')
-rw-r--r--os/hal/include/adc.h12
-rw-r--r--os/hal/include/can.h6
-rw-r--r--os/hal/include/dac.h12
-rw-r--r--os/hal/include/ext.h18
-rw-r--r--os/hal/include/gpt.h4
-rw-r--r--os/hal/include/hal.h4
-rw-r--r--os/hal/include/hal_mmcsd.h264
-rw-r--r--os/hal/include/hal_queues.h36
-rw-r--r--os/hal/include/i2c.h8
-rw-r--r--os/hal/include/i2s.h4
-rw-r--r--os/hal/include/icu.h14
-rw-r--r--os/hal/include/mac.h12
-rw-r--r--os/hal/include/mmc_spi.h14
-rw-r--r--os/hal/include/pal.h4
-rw-r--r--os/hal/include/pwm.h24
-rw-r--r--os/hal/include/rtc.h40
-rw-r--r--os/hal/include/sdc.h40
-rw-r--r--os/hal/include/serial.h4
-rw-r--r--os/hal/include/serial_usb.h8
-rw-r--r--os/hal/include/spi.h12
-rw-r--r--os/hal/include/st.h4
-rw-r--r--os/hal/include/uart.h4
-rw-r--r--os/hal/include/usb.h137
23 files changed, 345 insertions, 340 deletions
diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h
index def17a30e..a87df380c 100644
--- a/os/hal/include/adc.h
+++ b/os/hal/include/adc.h
@@ -28,7 +28,7 @@
#ifndef _ADC_H_
#define _ADC_H_
-#if HAL_USE_ADC || defined(__DOXYGEN__)
+#if (HAL_USE_ADC == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -89,7 +89,7 @@ typedef enum {
* @name Low level driver helper macros
* @{
*/
-#if ADC_USE_WAIT || defined(__DOXYGEN__)
+#if (ADC_USE_WAIT == TRUE) || defined(__DOXYGEN__)
/**
* @brief Resumes a thread waiting for a conversion completion.
*
@@ -260,21 +260,21 @@ extern "C" {
size_t depth);
void adcStopConversion(ADCDriver *adcp);
void adcStopConversionI(ADCDriver *adcp);
-#if ADC_USE_WAIT
+#if ADC_USE_WAIT == TRUE
msg_t adcConvert(ADCDriver *adcp,
const ADCConversionGroup *grpp,
adcsample_t *samples,
size_t depth);
#endif
-#if ADC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
+#if ADC_USE_MUTUAL_EXCLUSION == TRUE
void adcAcquireBus(ADCDriver *adcp);
void adcReleaseBus(ADCDriver *adcp);
-#endif /* ADC_USE_MUTUAL_EXCLUSION */
+#endif
#ifdef __cplusplus
}
#endif
-#endif /* HAL_USE_ADC */
+#endif /* HAL_USE_ADC == TRUE */
#endif /* _ADC_H_ */
diff --git a/os/hal/include/can.h b/os/hal/include/can.h
index 1fd671e10..9e56440a1 100644
--- a/os/hal/include/can.h
+++ b/os/hal/include/can.h
@@ -28,7 +28,7 @@
#ifndef _CAN_H_
#define _CAN_H_
-#if HAL_USE_CAN || defined(__DOXYGEN__)
+#if (HAL_USE_CAN == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -141,12 +141,12 @@ extern "C" {
#if CAN_USE_SLEEP_MODE
void canSleep(CANDriver *canp);
void canWakeup(CANDriver *canp);
-#endif /* CAN_USE_SLEEP_MODE */
+#endif
#ifdef __cplusplus
}
#endif
-#endif /* HAL_USE_CAN */
+#endif /* HAL_USE_CAN == TRUE */
#endif /* _CAN_H_ */
diff --git a/os/hal/include/dac.h b/os/hal/include/dac.h
index 8d7477aa9..3bae48ec2 100644
--- a/os/hal/include/dac.h
+++ b/os/hal/include/dac.h
@@ -28,7 +28,7 @@
#ifndef _DAC_H_
#define _DAC_H_
-#if HAL_USE_DAC || defined(__DOXYGEN__)
+#if (HAL_USE_DAC == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -89,7 +89,7 @@ typedef enum {
* @name Low level driver helper macros
* @{
*/
-#if DAC_USE_WAIT || defined(__DOXYGEN__)
+#if (DAC_USE_WAIT == TRUE) || defined(__DOXYGEN__)
/**
* @brief Waits for operation completion.
* @details This function waits for the driver to complete the current
@@ -277,19 +277,19 @@ extern "C" {
const dacsample_t *samples, size_t depth);
void dacStopConversion(DACDriver *dacp);
void dacStopConversionI(DACDriver *dacp);
-#if DAC_USE_WAIT || defined(__DOXYGEN__)
+#if DAC_USE_WAIT
msg_t dacConvert(DACDriver *dacp, const DACConversionGroup *grpp,
const dacsample_t *samples, size_t depth);
-#endif /* DAC_USE_WAIT */
+#endif
#if DAC_USE_MUTUAL_EXCLUSION
void dacAcquireBus(DACDriver *dacp);
void dacReleaseBus(DACDriver *dacp);
-#endif /* DAC_USE_MUTUAL_EXCLUSION */
+#endif
#ifdef __cplusplus
}
#endif
-#endif /* HAL_USE_DAC */
+#endif /* HAL_USE_DAC == TRUE */
#endif /* _DAC_H_ */
diff --git a/os/hal/include/ext.h b/os/hal/include/ext.h
index 8da23324f..24a6b4816 100644
--- a/os/hal/include/ext.h
+++ b/os/hal/include/ext.h
@@ -28,7 +28,7 @@
#ifndef _EXT_H_
#define _EXT_H_
-#if HAL_USE_EXT || defined(__DOXYGEN__)
+#if (HAL_USE_EXT == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -38,13 +38,13 @@
* @name EXT channel modes
* @{
*/
-#define EXT_CH_MODE_EDGES_MASK 3 /**< @brief Mask of edges field. */
-#define EXT_CH_MODE_DISABLED 0 /**< @brief Channel disabled. */
-#define EXT_CH_MODE_RISING_EDGE 1 /**< @brief Rising edge callback. */
-#define EXT_CH_MODE_FALLING_EDGE 2 /**< @brief Falling edge callback. */
-#define EXT_CH_MODE_BOTH_EDGES 3 /**< @brief Both edges callback. */
+#define EXT_CH_MODE_EDGES_MASK 3U /**< @brief Mask of edges field. */
+#define EXT_CH_MODE_DISABLED 0U /**< @brief Channel disabled. */
+#define EXT_CH_MODE_RISING_EDGE 1U /**< @brief Rising edge callback. */
+#define EXT_CH_MODE_FALLING_EDGE 2U /**< @brief Falling edge callback. */
+#define EXT_CH_MODE_BOTH_EDGES 3U /**< @brief Both edges callback. */
-#define EXT_CH_MODE_AUTOSTART 4 /**< @brief Channel started
+#define EXT_CH_MODE_AUTOSTART 4U /**< @brief Channel started
automatically on driver start. */
/** @} */
@@ -66,7 +66,7 @@
typedef enum {
EXT_UNINIT = 0, /**< Not initialized. */
EXT_STOP = 1, /**< Stopped. */
- EXT_ACTIVE = 2, /**< Active. */
+ EXT_ACTIVE = 2 /**< Active. */
} extstate_t;
/**
@@ -146,7 +146,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_EXT */
+#endif /* HAL_USE_EXT == TRUE */
#endif /* _EXT_H_ */
diff --git a/os/hal/include/gpt.h b/os/hal/include/gpt.h
index 5dddb94fe..c16fd2a03 100644
--- a/os/hal/include/gpt.h
+++ b/os/hal/include/gpt.h
@@ -28,7 +28,7 @@
#ifndef _GPT_H_
#define _GPT_H_
-#if HAL_USE_GPT || defined(__DOXYGEN__)
+#if (HAL_USE_GPT == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -137,7 +137,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_GPT */
+#endif /* HAL_USE_GPT == TRUE */
#endif /* _GPT_H_ */
diff --git a/os/hal/include/hal.h b/os/hal/include/hal.h
index fb2d91006..6c346da9d 100644
--- a/os/hal/include/hal.h
+++ b/os/hal/include/hal.h
@@ -77,9 +77,11 @@
#include "serial_usb.h"
/* Community drivers.*/
-#if HAL_USE_COMMUNITY
+#if defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__)
+#if (HAL_USE_COMMUNITY == TRUE) || defined(__DOXYGEN__)
#include "hal_community.h"
#endif
+#endif
/*===========================================================================*/
/* Driver constants. */
diff --git a/os/hal/include/hal_mmcsd.h b/os/hal/include/hal_mmcsd.h
index c3589301a..de3b1ab13 100644
--- a/os/hal/include/hal_mmcsd.h
+++ b/os/hal/include/hal_mmcsd.h
@@ -30,7 +30,7 @@
#ifndef _HAL_MMCSD_H_
#define _HAL_MMCSD_H_
-#if HAL_USE_MMC_SPI || HAL_USE_SDC || defined(__DOXYGEN__)
+#if (HAL_USE_MMC_SPI == TRUE) || (HAL_USE_SDC == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -39,63 +39,63 @@
/**
* @brief Fixed block size for MMC/SD block devices.
*/
-#define MMCSD_BLOCK_SIZE 512
+#define MMCSD_BLOCK_SIZE 512U
/**
* @brief Mask of error bits in R1 responses.
*/
-#define MMCSD_R1_ERROR_MASK 0xFDFFE008
+#define MMCSD_R1_ERROR_MASK 0xFDFFE008U
/**
* @brief Fixed pattern for CMD8.
*/
-#define MMCSD_CMD8_PATTERN 0x000001AA
+#define MMCSD_CMD8_PATTERN 0x000001AAU
/**
* @name SD/MMC status conditions
* @{
*/
-#define MMCSD_STS_IDLE 0
-#define MMCSD_STS_READY 1
-#define MMCSD_STS_IDENT 2
-#define MMCSD_STS_STBY 3
-#define MMCSD_STS_TRAN 4
-#define MMCSD_STS_DATA 5
-#define MMCSD_STS_RCV 6
-#define MMCSD_STS_PRG 7
-#define MMCSD_STS_DIS 8
+#define MMCSD_STS_IDLE 0U
+#define MMCSD_STS_READY 1U
+#define MMCSD_STS_IDENT 2U
+#define MMCSD_STS_STBY 3U
+#define MMCSD_STS_TRAN 4U
+#define MMCSD_STS_DATA 5U
+#define MMCSD_STS_RCV 6U
+#define MMCSD_STS_PRG 7U
+#define MMCSD_STS_DIS 8U
/** @} */
/**
* @name SD/MMC commands
* @{
*/
-#define MMCSD_CMD_GO_IDLE_STATE 0
-#define MMCSD_CMD_INIT 1
-#define MMCSD_CMD_ALL_SEND_CID 2
-#define MMCSD_CMD_SEND_RELATIVE_ADDR 3
-#define MMCSD_CMD_SET_BUS_WIDTH 6
+#define MMCSD_CMD_GO_IDLE_STATE 0U
+#define MMCSD_CMD_INIT 1U
+#define MMCSD_CMD_ALL_SEND_CID 2U
+#define MMCSD_CMD_SEND_RELATIVE_ADDR 3U
+#define MMCSD_CMD_SET_BUS_WIDTH 6U
#define MMCSD_CMD_SWITCH MMCSD_CMD_SET_BUS_WIDTH
-#define MMCSD_CMD_SEL_DESEL_CARD 7
-#define MMCSD_CMD_SEND_IF_COND 8
+#define MMCSD_CMD_SEL_DESEL_CARD 7U
+#define MMCSD_CMD_SEND_IF_COND 8U
#define MMCSD_CMD_SEND_EXT_CSD MMCSD_CMD_SEND_IF_COND
-#define MMCSD_CMD_SEND_CSD 9
-#define MMCSD_CMD_SEND_CID 10
-#define MMCSD_CMD_STOP_TRANSMISSION 12
-#define MMCSD_CMD_SEND_STATUS 13
-#define MMCSD_CMD_SET_BLOCKLEN 16
-#define MMCSD_CMD_READ_SINGLE_BLOCK 17
-#define MMCSD_CMD_READ_MULTIPLE_BLOCK 18
-#define MMCSD_CMD_SET_BLOCK_COUNT 23
-#define MMCSD_CMD_WRITE_BLOCK 24
-#define MMCSD_CMD_WRITE_MULTIPLE_BLOCK 25
-#define MMCSD_CMD_ERASE_RW_BLK_START 32
-#define MMCSD_CMD_ERASE_RW_BLK_END 33
-#define MMCSD_CMD_ERASE 38
-#define MMCSD_CMD_APP_OP_COND 41
-#define MMCSD_CMD_LOCK_UNLOCK 42
-#define MMCSD_CMD_APP_CMD 55
-#define MMCSD_CMD_READ_OCR 58
+#define MMCSD_CMD_SEND_CSD 9U
+#define MMCSD_CMD_SEND_CID 10U
+#define MMCSD_CMD_STOP_TRANSMISSION 12U
+#define MMCSD_CMD_SEND_STATUS 13U
+#define MMCSD_CMD_SET_BLOCKLEN 16U
+#define MMCSD_CMD_READ_SINGLE_BLOCK 17U
+#define MMCSD_CMD_READ_MULTIPLE_BLOCK 18U
+#define MMCSD_CMD_SET_BLOCK_COUNT 23U
+#define MMCSD_CMD_WRITE_BLOCK 24U
+#define MMCSD_CMD_WRITE_MULTIPLE_BLOCK 25U
+#define MMCSD_CMD_ERASE_RW_BLK_START 32U
+#define MMCSD_CMD_ERASE_RW_BLK_END 33U
+#define MMCSD_CMD_ERASE 38U
+#define MMCSD_CMD_APP_OP_COND 41U
+#define MMCSD_CMD_LOCK_UNLOCK 42U
+#define MMCSD_CMD_APP_CMD 55U
+#define MMCSD_CMD_READ_OCR 58U
/** @} */
/**
@@ -105,65 +105,65 @@
* @brief Slice position of values in CSD register.
*/
/* CSD for MMC */
-#define MMCSD_CSD_MMC_CSD_STRUCTURE_SLICE 127,126
-#define MMCSD_CSD_MMC_SPEC_VERS_SLICE 125,122
-#define MMCSD_CSD_MMC_TAAC_SLICE 119,112
-#define MMCSD_CSD_MMC_NSAC_SLICE 111,104
-#define MMCSD_CSD_MMC_TRAN_SPEED_SLICE 103,96
-#define MMCSD_CSD_MMC_CCC_SLICE 95,84
-#define MMCSD_CSD_MMC_READ_BL_LEN_SLICE 83,80
-#define MMCSD_CSD_MMC_READ_BL_PARTIAL_SLICE 79,79
-#define MMCSD_CSD_MMC_WRITE_BLK_MISALIGN_SLICE 78,78
-#define MMCSD_CSD_MMC_READ_BLK_MISALIGN_SLICE 77,77
-#define MMCSD_CSD_MMC_DSR_IMP_SLICE 76,76
-#define MMCSD_CSD_MMC_C_SIZE_SLICE 73,62
-#define MMCSD_CSD_MMC_VDD_R_CURR_MIN_SLICE 61,59
-#define MMCSD_CSD_MMC_VDD_R_CURR_MAX_SLICE 58,56
-#define MMCSD_CSD_MMC_VDD_W_CURR_MIN_SLICE 55,53
-#define MMCSD_CSD_MMC_VDD_W_CURR_MAX_SLICE 52,50
-#define MMCSD_CSD_MMC_C_SIZE_MULT_SLICE 49,47
-#define MMCSD_CSD_MMC_ERASE_GRP_SIZE_SLICE 46,42
-#define MMCSD_CSD_MMC_ERASE_GRP_MULT_SLICE 41,37
-#define MMCSD_CSD_MMC_WP_GRP_SIZE_SLICE 36,32
-#define MMCSD_CSD_MMC_WP_GRP_ENABLE_SLICE 31,31
-#define MMCSD_CSD_MMC_DEFAULT_ECC_SLICE 30,29
-#define MMCSD_CSD_MMC_R2W_FACTOR_SLICE 28,26
-#define MMCSD_CSD_MMC_WRITE_BL_LEN_SLICE 25,22
-#define MMCSD_CSD_MMC_WRITE_BL_PARTIAL_SLICE 21,21
-#define MMCSD_CSD_MMC_CONTENT_PROT_APP_SLICE 16,16
-#define MMCSD_CSD_MMC_FILE_FORMAT_GRP_SLICE 15,15
-#define MMCSD_CSD_MMC_COPY_SLICE 14,14
-#define MMCSD_CSD_MMC_PERM_WRITE_PROTECT_SLICE 13,13
-#define MMCSD_CSD_MMC_TMP_WRITE_PROTECT_SLICE 12,12
-#define MMCSD_CSD_MMC_FILE_FORMAT_SLICE 11,10
-#define MMCSD_CSD_MMC_ECC_SLICE 9,8
-#define MMCSD_CSD_MMC_CRC_SLICE 7,1
+#define MMCSD_CSD_MMC_CSD_STRUCTURE_SLICE 127U,126U
+#define MMCSD_CSD_MMC_SPEC_VERS_SLICE 125U,122U
+#define MMCSD_CSD_MMC_TAAC_SLICE 119U,112U
+#define MMCSD_CSD_MMC_NSAC_SLICE 111U,104U
+#define MMCSD_CSD_MMC_TRAN_SPEED_SLICE 103U,96U
+#define MMCSD_CSD_MMC_CCC_SLICE 95U,84U
+#define MMCSD_CSD_MMC_READ_BL_LEN_SLICE 83U,80U
+#define MMCSD_CSD_MMC_READ_BL_PARTIAL_SLICE 79U,79U
+#define MMCSD_CSD_MMC_WRITE_BLK_MISALIGN_SLICE 78U,78U
+#define MMCSD_CSD_MMC_READ_BLK_MISALIGN_SLICE 77U,77U
+#define MMCSD_CSD_MMC_DSR_IMP_SLICE 76U,76U
+#define MMCSD_CSD_MMC_C_SIZE_SLICE 73U,62U
+#define MMCSD_CSD_MMC_VDD_R_CURR_MIN_SLICE 61U,59U
+#define MMCSD_CSD_MMC_VDD_R_CURR_MAX_SLICE 58U,56U
+#define MMCSD_CSD_MMC_VDD_W_CURR_MIN_SLICE 55U,53U
+#define MMCSD_CSD_MMC_VDD_W_CURR_MAX_SLICE 52U,50U
+#define MMCSD_CSD_MMC_C_SIZE_MULT_SLICE 49U,47U
+#define MMCSD_CSD_MMC_ERASE_GRP_SIZE_SLICE 46U,42U
+#define MMCSD_CSD_MMC_ERASE_GRP_MULT_SLICE 41U,37U
+#define MMCSD_CSD_MMC_WP_GRP_SIZE_SLICE 36U,32U
+#define MMCSD_CSD_MMC_WP_GRP_ENABLE_SLICE 31U,31U
+#define MMCSD_CSD_MMC_DEFAULT_ECC_SLICE 30U,29U
+#define MMCSD_CSD_MMC_R2W_FACTOR_SLICE 28U,26U
+#define MMCSD_CSD_MMC_WRITE_BL_LEN_SLICE 25U,22U
+#define MMCSD_CSD_MMC_WRITE_BL_PARTIAL_SLICE 21U,21U
+#define MMCSD_CSD_MMC_CONTENT_PROT_APP_SLICE 16U,16U
+#define MMCSD_CSD_MMC_FILE_FORMAT_GRP_SLICE 15U,15U
+#define MMCSD_CSD_MMC_COPY_SLICE 14U,14U
+#define MMCSD_CSD_MMC_PERM_WRITE_PROTECT_SLICE 13U,13U
+#define MMCSD_CSD_MMC_TMP_WRITE_PROTECT_SLICE 12U,12U
+#define MMCSD_CSD_MMC_FILE_FORMAT_SLICE 11U,10U
+#define MMCSD_CSD_MMC_ECC_SLICE 9U,8U
+#define MMCSD_CSD_MMC_CRC_SLICE 7U,1U
/* CSD version 2.0 */
-#define MMCSD_CSD_20_CRC_SLICE 7,1
-#define MMCSD_CSD_20_FILE_FORMAT_SLICE 11,10
-#define MMCSD_CSD_20_TMP_WRITE_PROTECT_SLICE 12,12
-#define MMCSD_CSD_20_PERM_WRITE_PROTECT_SLICE 13,13
-#define MMCSD_CSD_20_COPY_SLICE 14,14
-#define MMCSD_CSD_20_FILE_FORMAT_GRP_SLICE 15,15
-#define MMCSD_CSD_20_WRITE_BL_PARTIAL_SLICE 21,21
-#define MMCSD_CSD_20_WRITE_BL_LEN_SLICE 25,12
-#define MMCSD_CSD_20_R2W_FACTOR_SLICE 28,26
-#define MMCSD_CSD_20_WP_GRP_ENABLE_SLICE 31,31
-#define MMCSD_CSD_20_WP_GRP_SIZE_SLICE 38,32
-#define MMCSD_CSD_20_ERASE_SECTOR_SIZE_SLICE 45,39
-#define MMCSD_CSD_20_ERASE_BLK_EN_SLICE 46,46
-#define MMCSD_CSD_20_C_SIZE_SLICE 69,48
-#define MMCSD_CSD_20_DSR_IMP_SLICE 76,76
-#define MMCSD_CSD_20_READ_BLK_MISALIGN_SLICE 77,77
-#define MMCSD_CSD_20_WRITE_BLK_MISALIGN_SLICE 78,78
-#define MMCSD_CSD_20_READ_BL_PARTIAL_SLICE 79,79
-#define MMCSD_CSD_20_READ_BL_LEN_SLICE 83,80
-#define MMCSD_CSD_20_CCC_SLICE 95,84
-#define MMCSD_CSD_20_TRANS_SPEED_SLICE 103,96
-#define MMCSD_CSD_20_NSAC_SLICE 111,104
-#define MMCSD_CSD_20_TAAC_SLICE 119,112
-#define MMCSD_CSD_20_CSD_STRUCTURE_SLICE 127,126
+#define MMCSD_CSD_20_CRC_SLICE 7U,1U
+#define MMCSD_CSD_20_FILE_FORMAT_SLICE 11U,10U
+#define MMCSD_CSD_20_TMP_WRITE_PROTECT_SLICE 12U,12U
+#define MMCSD_CSD_20_PERM_WRITE_PROTECT_SLICE 13U,13U
+#define MMCSD_CSD_20_COPY_SLICE 14U,14U
+#define MMCSD_CSD_20_FILE_FORMAT_GRP_SLICE 15U,15U
+#define MMCSD_CSD_20_WRITE_BL_PARTIAL_SLICE 21U,21U
+#define MMCSD_CSD_20_WRITE_BL_LEN_SLICE 25U,12U
+#define MMCSD_CSD_20_R2W_FACTOR_SLICE 28U,26U
+#define MMCSD_CSD_20_WP_GRP_ENABLE_SLICE 31U,31U
+#define MMCSD_CSD_20_WP_GRP_SIZE_SLICE 38U,32U
+#define MMCSD_CSD_20_ERASE_SECTOR_SIZE_SLICE 45U,39U
+#define MMCSD_CSD_20_ERASE_BLK_EN_SLICE 46U,46U
+#define MMCSD_CSD_20_C_SIZE_SLICE 69U,48U
+#define MMCSD_CSD_20_DSR_IMP_SLICE 76U,76U
+#define MMCSD_CSD_20_READ_BLK_MISALIGN_SLICE 77U,77U
+#define MMCSD_CSD_20_WRITE_BLK_MISALIGN_SLICE 78U,78U
+#define MMCSD_CSD_20_READ_BL_PARTIAL_SLICE 79U,79U
+#define MMCSD_CSD_20_READ_BL_LEN_SLICE 83U,80U
+#define MMCSD_CSD_20_CCC_SLICE 95U,84U
+#define MMCSD_CSD_20_TRANS_SPEED_SLICE 103U,96U
+#define MMCSD_CSD_20_NSAC_SLICE 111U,104U
+#define MMCSD_CSD_20_TAAC_SLICE 119U,112U
+#define MMCSD_CSD_20_CSD_STRUCTURE_SLICE 127U,126U
/* CSD version 1.0 */
#define MMCSD_CSD_10_CRC_SLICE MMCSD_CSD_20_CRC_SLICE
@@ -179,17 +179,17 @@
#define MMCSD_CSD_10_WP_GRP_SIZE_SLICE MMCSD_CSD_20_WP_GRP_SIZE_SLICE
#define MMCSD_CSD_10_ERASE_SECTOR_SIZE_SLICE MMCSD_CSD_20_ERASE_SECTOR_SIZE_SLICE
#define MMCSD_CSD_10_ERASE_BLK_EN_SLICE MMCSD_CSD_20_ERASE_BLK_EN_SLICE
-#define MMCSD_CSD_10_C_SIZE_MULT_SLICE 49,47
-#define MMCSD_CSD_10_VDD_W_CURR_MAX_SLICE 52,50
-#define MMCSD_CSD_10_VDD_W_CURR_MIN_SLICE 55,53
-#define MMCSD_CSD_10_VDD_R_CURR_MAX_SLICE 58,56
-#define MMCSD_CSD_10_VDD_R_CURR_MIX_SLICE 61,59
-#define MMCSD_CSD_10_C_SIZE_SLICE 73,62
+#define MMCSD_CSD_10_C_SIZE_MULT_SLICE 49U,47U
+#define MMCSD_CSD_10_VDD_W_CURR_MAX_SLICE 52U,50U
+#define MMCSD_CSD_10_VDD_W_CURR_MIN_SLICE 55U,53U
+#define MMCSD_CSD_10_VDD_R_CURR_MAX_SLICE 58U,56U
+#define MMCSD_CSD_10_VDD_R_CURR_MIX_SLICE 61U,59U
+#define MMCSD_CSD_10_C_SIZE_SLICE 73U,62U
#define MMCSD_CSD_10_DSR_IMP_SLICE MMCSD_CSD_20_DSR_IMP_SLICE
#define MMCSD_CSD_10_READ_BLK_MISALIGN_SLICE MMCSD_CSD_20_READ_BLK_MISALIGN_SLICE
#define MMCSD_CSD_10_WRITE_BLK_MISALIGN_SLICE MMCSD_CSD_20_WRITE_BLK_MISALIGN_SLICE
#define MMCSD_CSD_10_READ_BL_PARTIAL_SLICE MMCSD_CSD_20_READ_BL_PARTIAL_SLICE
-#define MMCSD_CSD_10_READ_BL_LEN_SLICE 83, 80
+#define MMCSD_CSD_10_READ_BL_LEN_SLICE 83U,80U
#define MMCSD_CSD_10_CCC_SLICE MMCSD_CSD_20_CCC_SLICE
#define MMCSD_CSD_10_TRANS_SPEED_SLICE MMCSD_CSD_20_TRANS_SPEED_SLICE
#define MMCSD_CSD_10_NSAC_SLICE MMCSD_CSD_20_NSAC_SLICE
@@ -204,35 +204,35 @@
* @brief Slice position of values in CID register.
*/
/* CID for SDC */
-#define MMCSD_CID_SDC_CRC_SLICE 7,1
-#define MMCSD_CID_SDC_MDT_M_SLICE 11,8
-#define MMCSD_CID_SDC_MDT_Y_SLICE 19,12
-#define MMCSD_CID_SDC_PSN_SLICE 55,24
-#define MMCSD_CID_SDC_PRV_M_SLICE 59,56
-#define MMCSD_CID_SDC_PRV_N_SLICE 63,60
-#define MMCSD_CID_SDC_PNM0_SLICE 71,64
-#define MMCSD_CID_SDC_PNM1_SLICE 79,72
-#define MMCSD_CID_SDC_PNM2_SLICE 87,80
-#define MMCSD_CID_SDC_PNM3_SLICE 95,88
-#define MMCSD_CID_SDC_PNM4_SLICE 103,96
-#define MMCSD_CID_SDC_OID_SLICE 119,104
-#define MMCSD_CID_SDC_MID_SLICE 127,120
+#define MMCSD_CID_SDC_CRC_SLICE 7U,1U
+#define MMCSD_CID_SDC_MDT_M_SLICE 11U,8U
+#define MMCSD_CID_SDC_MDT_Y_SLICE 19U,12U
+#define MMCSD_CID_SDC_PSN_SLICE 55U,24U
+#define MMCSD_CID_SDC_PRV_M_SLICE 59U,56U
+#define MMCSD_CID_SDC_PRV_N_SLICE 63U,60U
+#define MMCSD_CID_SDC_PNM0_SLICE 71U,64U
+#define MMCSD_CID_SDC_PNM1_SLICE 79U,72U
+#define MMCSD_CID_SDC_PNM2_SLICE 87U,80U
+#define MMCSD_CID_SDC_PNM3_SLICE 95U,88U
+#define MMCSD_CID_SDC_PNM4_SLICE 103U,96U
+#define MMCSD_CID_SDC_OID_SLICE 119U,104U
+#define MMCSD_CID_SDC_MID_SLICE 127U,120U
/* CID for MMC */
-#define MMCSD_CID_MMC_CRC_SLICE 7,1
-#define MMCSD_CID_MMC_MDT_Y_SLICE 11,8
-#define MMCSD_CID_MMC_MDT_M_SLICE 15,12
-#define MMCSD_CID_MMC_PSN_SLICE 47,16
-#define MMCSD_CID_MMC_PRV_M_SLICE 51,48
-#define MMCSD_CID_MMC_PRV_N_SLICE 55,52
-#define MMCSD_CID_MMC_PNM0_SLICE 63,56
-#define MMCSD_CID_MMC_PNM1_SLICE 71,64
-#define MMCSD_CID_MMC_PNM2_SLICE 79,72
-#define MMCSD_CID_MMC_PNM3_SLICE 87,80
-#define MMCSD_CID_MMC_PNM4_SLICE 95,88
-#define MMCSD_CID_MMC_PNM5_SLICE 103,96
-#define MMCSD_CID_MMC_OID_SLICE 119,104
-#define MMCSD_CID_MMC_MID_SLICE 127,120
+#define MMCSD_CID_MMC_CRC_SLICE 7U,1U
+#define MMCSD_CID_MMC_MDT_Y_SLICE 11U,8U
+#define MMCSD_CID_MMC_MDT_M_SLICE 15U,12U
+#define MMCSD_CID_MMC_PSN_SLICE 47U,16U
+#define MMCSD_CID_MMC_PRV_M_SLICE 51U,48U
+#define MMCSD_CID_MMC_PRV_N_SLICE 55U,52U
+#define MMCSD_CID_MMC_PNM0_SLICE 63U,56U
+#define MMCSD_CID_MMC_PNM1_SLICE 71U,64U
+#define MMCSD_CID_MMC_PNM2_SLICE 79U,72U
+#define MMCSD_CID_MMC_PNM3_SLICE 87U,80U
+#define MMCSD_CID_MMC_PNM4_SLICE 95U,88U
+#define MMCSD_CID_MMC_PNM5_SLICE 103U,96U
+#define MMCSD_CID_MMC_OID_SLICE 119U,104U
+#define MMCSD_CID_MMC_MID_SLICE 127U,120U
/** @} */
/*===========================================================================*/
@@ -435,21 +435,21 @@ typedef struct {
*
* @param[in] r1 the r1 response
*/
-#define MMCSD_R1_ERROR(r1) (((r1) & MMCSD_R1_ERROR_MASK) != 0)
+#define MMCSD_R1_ERROR(r1) (((r1) & MMCSD_R1_ERROR_MASK) != 0U)
/**
* @brief Returns the status field of an R1 response.
*
* @param[in] r1 the r1 response
*/
-#define MMCSD_R1_STS(r1) (((r1) >> 9) & 15)
+#define MMCSD_R1_STS(r1) (((r1) >> 9U) & 15U)
/**
* @brief Evaluates to @p TRUE if the R1 response indicates a locked card.
*
* @param[in] r1 the r1 response
*/
-#define MMCSD_R1_IS_CARD_LOCKED(r1) (((r1) >> 21) & 1)
+#define MMCSD_R1_IS_CARD_LOCKED(r1) ((((r1) >> 21U) & 1U) != 0U)
/** @} */
/**
@@ -494,7 +494,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_MMC_SPI || HAL_USE_MMC_SDC*/
+#endif /* HAL_USE_MMC_SPI == TRUE || HAL_USE_MMC_SDC == TRUE */
#endif /* _HAL_MMCSD_H_ */
diff --git a/os/hal/include/hal_queues.h b/os/hal/include/hal_queues.h
index 08515fd45..62c08d11c 100644
--- a/os/hal/include/hal_queues.h
+++ b/os/hal/include/hal_queues.h
@@ -30,7 +30,8 @@
/* The ChibiOS/RT kernel provides the following definitions by itself, this
check is performed in order to avoid conflicts. */
-#if !defined(_CHIBIOS_RT_) || !CH_CFG_USE_QUEUES || defined(__DOXYGEN__)
+#if !defined(_CHIBIOS_RT_) || (CH_CFG_USE_QUEUES == FALSE) || \
+ defined(__DOXYGEN__)
/**
* @name Queue functions returned status value
@@ -85,9 +86,12 @@ struct io_queue {
* @param[in] qp pointer to a @p io_queue_t structure.
* @return The buffer size.
*
- * @iclass
+ * @xclass
*/
-#define qSizeI(qp) ((size_t)((qp)->q_top - (qp)->q_buffer))
+#define qSizeX(qp) \
+ /*lint -save -e9033 [10.8] The cast is safe.*/ \
+ ((size_t)((qp)->q_top - (qp)->q_buffer)) \
+ /*lint -restore*/
/**
* @brief Queue space.
@@ -149,7 +153,7 @@ typedef io_queue_t input_queue_t;
*
* @iclass
*/
-#define iqGetEmptyI(iqp) (qSizeI(iqp) - qSpaceI(iqp))
+#define iqGetEmptyI(iqp) (qSizeX(iqp) - qSpaceI(iqp))
/**
* @brief Evaluates to @p TRUE if the specified input queue is empty.
@@ -161,7 +165,7 @@ typedef io_queue_t input_queue_t;
*
* @iclass
*/
-#define iqIsEmptyI(iqp) ((bool)(qSpaceI(iqp) <= 0))
+#define iqIsEmptyI(iqp) ((bool)(qSpaceI(iqp) == 0U))
/**
* @brief Evaluates to @p TRUE if the specified input queue is full.
@@ -174,7 +178,7 @@ typedef io_queue_t input_queue_t;
* @iclass
*/
#define iqIsFullI(iqp) ((bool)(((iqp)->q_wrptr == (iqp)->q_rdptr) && \
- ((iqp)->q_counter != 0)))
+ ((iqp)->q_counter != 0U)))
/**
* @brief Input queue read.
@@ -204,7 +208,7 @@ typedef io_queue_t input_queue_t;
*/
#define _INPUTQUEUE_DATA(name, buffer, size, inotify, link) { \
NULL, \
- 0, \
+ 0U, \
(uint8_t *)(buffer), \
(uint8_t *)(buffer) + (size), \
(uint8_t *)(buffer), \
@@ -252,7 +256,7 @@ typedef io_queue_t output_queue_t;
*
* @iclass
*/
-#define oqGetFullI(oqp) (qSizeI(oqp) - qSpaceI(oqp))
+#define oqGetFullI(oqp) (qSizeX(oqp) - qSpaceI(oqp))
/**
* @brief Returns the empty space into an output queue.
@@ -276,7 +280,7 @@ typedef io_queue_t output_queue_t;
* @iclass
*/
#define oqIsEmptyI(oqp) ((bool)(((oqp)->q_wrptr == (oqp)->q_rdptr) && \
- ((oqp)->q_counter != 0)))
+ ((oqp)->q_counter != 0U)))
/**
* @brief Evaluates to @p TRUE if the specified output queue is full.
@@ -288,7 +292,7 @@ typedef io_queue_t output_queue_t;
*
* @iclass
*/
-#define oqIsFullI(oqp) ((bool)(qSpaceI(oqp) <= 0))
+#define oqIsFullI(oqp) ((bool)(qSpaceI(oqp) == 0U))
/**
* @brief Output queue write.
@@ -350,17 +354,17 @@ extern "C" {
qnotify_t infy, void *link);
void iqResetI(input_queue_t *iqp);
msg_t iqPutI(input_queue_t *iqp, uint8_t b);
- msg_t iqGetTimeout(input_queue_t *iqp, systime_t time);
+ msg_t iqGetTimeout(input_queue_t *iqp, systime_t timeout);
size_t iqReadTimeout(input_queue_t *iqp, uint8_t *bp,
- size_t n, systime_t time);
+ size_t n, systime_t timeout);
void oqObjectInit(output_queue_t *oqp, uint8_t *bp, size_t size,
qnotify_t onfy, void *link);
void oqResetI(output_queue_t *oqp);
- msg_t oqPutTimeout(output_queue_t *oqp, uint8_t b, systime_t time);
+ msg_t oqPutTimeout(output_queue_t *oqp, uint8_t b, systime_t timeout);
msg_t oqGetI(output_queue_t *oqp);
size_t oqWriteTimeout(output_queue_t *oqp, const uint8_t *bp,
- size_t n, systime_t time);
+ size_t n, systime_t timeout);
#ifdef __cplusplus
}
#endif
@@ -369,7 +373,7 @@ extern "C" {
/* If ChibiOS is being used and its own queues subsystem is activated then
this module will use the ChibiOS queues code.*/
-#define qSizeI(qp) chQSizeI(qp)
+#define qSizeX(qp) chQSizeX(qp)
#define qSpaceI(qp) chQSpaceI(qp)
#define qGetLink(qp) chQGetLinkX(qp)
#define iqGetFullI(iqp) chIQGetFullI(iqp)
@@ -395,7 +399,7 @@ extern "C" {
#define oqGetI(oqp) chOQGetI(oqp)
#define oqWriteTimeout(oqp, bp, n, time) chOQWriteTimeout(oqp, bp, n, time)
-#endif /* defined(_CHIBIOS_RT_) && CH_CFG_USE_QUEUES */
+#endif /* defined(_CHIBIOS_RT_) || (CH_CFG_USE_QUEUES == FALSE) */
#endif /* _HAL_QUEUES_H_ */
diff --git a/os/hal/include/i2c.h b/os/hal/include/i2c.h
index 0a8bdb5b5..96c1e6633 100644
--- a/os/hal/include/i2c.h
+++ b/os/hal/include/i2c.h
@@ -32,7 +32,7 @@
#ifndef _I2C_H_
#define _I2C_H_
-#if HAL_USE_I2C || defined(__DOXYGEN__)
+#if (HAL_USE_I2C == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -153,16 +153,16 @@ extern "C" {
i2caddr_t addr,
uint8_t *rxbuf, size_t rxbytes,
systime_t timeout);
-#if I2C_USE_MUTUAL_EXCLUSION
+#if I2C_USE_MUTUAL_EXCLUSION == TRUE
void i2cAcquireBus(I2CDriver *i2cp);
void i2cReleaseBus(I2CDriver *i2cp);
-#endif /* I2C_USE_MUTUAL_EXCLUSION */
+#endif
#ifdef __cplusplus
}
#endif
-#endif /* HAL_USE_I2C */
+#endif /* HAL_USE_I2C == TRUE */
#endif /* _I2C_H_ */
diff --git a/os/hal/include/i2s.h b/os/hal/include/i2s.h
index 4489d2cbf..b50cb7d6f 100644
--- a/os/hal/include/i2s.h
+++ b/os/hal/include/i2s.h
@@ -28,7 +28,7 @@
#ifndef _I2S_H_
#define _I2S_H_
-#if HAL_USE_I2S || defined(__DOXYGEN__)
+#if (HAL_USE_I2S == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -163,7 +163,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_I2S */
+#endif /* HAL_USE_I2S == TRUE */
#endif /* _I2S_H_ */
diff --git a/os/hal/include/icu.h b/os/hal/include/icu.h
index ad2f13a10..fc0b29e50 100644
--- a/os/hal/include/icu.h
+++ b/os/hal/include/icu.h
@@ -28,7 +28,7 @@
#ifndef _ICU_H_
#define _ICU_H_
-#if HAL_USE_ICU || defined(__DOXYGEN__)
+#if (HAL_USE_ICU == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -54,7 +54,7 @@ typedef enum {
ICU_STOP = 1, /**< Stopped. */
ICU_READY = 2, /**< Ready. */
ICU_WAITING = 3, /**< Waiting for first front. */
- ICU_ACTIVE = 4, /**< First front detected. */
+ ICU_ACTIVE = 4 /**< First front detected. */
} icustate_t;
/**
@@ -88,8 +88,8 @@ typedef void (*icucallback_t)(ICUDriver *icup);
*/
#define icuStartCaptureI(icup) do { \
icu_lld_start_capture(icup); \
- icup->state = ICU_WAITING; \
-} while (0)
+ (icup)->state = ICU_WAITING; \
+} while (false)
/**
* @brief Stops the input capture.
@@ -100,8 +100,8 @@ typedef void (*icucallback_t)(ICUDriver *icup);
*/
#define icuStopCaptureI(icup) do { \
icu_lld_stop_capture(icup); \
- icup->state = ICU_READY; \
-} while (0)
+ (icup)->state = ICU_READY; \
+} while (false)
/**
* @brief Enables notifications.
@@ -234,7 +234,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_ICU */
+#endif /* HAL_USE_ICU == TRUE */
#endif /* _ICU_H_ */
diff --git a/os/hal/include/mac.h b/os/hal/include/mac.h
index f6c4e0b5e..2051d42f7 100644
--- a/os/hal/include/mac.h
+++ b/os/hal/include/mac.h
@@ -27,7 +27,7 @@
#ifndef _MAC_H_
#define _MAC_H_
-#if HAL_USE_MAC || defined(__DOXYGEN__)
+#if (HAL_USE_MAC == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -96,7 +96,7 @@ typedef struct MACDriver MACDriver;
*
* @api
*/
-#if MAC_USE_EVENTS || defined(__DOXYGEN__)
+#if (MAC_USE_EVENTS == TRUE) || defined(__DOXYGEN__)
#define macGetReceiveEventSource(macp) (&(macp)->rdevent)
#endif
@@ -131,7 +131,7 @@ typedef struct MACDriver MACDriver;
#define macReadReceiveDescriptor(rdp, buf, size) \
mac_lld_read_receive_descriptor(rdp, buf, size)
-#if MAC_USE_ZERO_COPY || defined(__DOXYGEN__)
+#if (MAC_USE_ZERO_COPY == TRUE) || defined(__DOXYGEN__)
/**
* @brief Returns a pointer to the next transmit buffer in the descriptor
* chain.
@@ -187,18 +187,18 @@ extern "C" {
void macSetAddress(MACDriver *macp, const uint8_t *p);
msg_t macWaitTransmitDescriptor(MACDriver *macp,
MACTransmitDescriptor *tdp,
- systime_t time);
+ systime_t timeout);
void macReleaseTransmitDescriptor(MACTransmitDescriptor *tdp);
msg_t macWaitReceiveDescriptor(MACDriver *macp,
MACReceiveDescriptor *rdp,
- systime_t time);
+ systime_t timeout);
void macReleaseReceiveDescriptor(MACReceiveDescriptor *rdp);
bool macPollLinkStatus(MACDriver *macp);
#ifdef __cplusplus
}
#endif
-#endif /* HAL_USE_MAC */
+#endif /* HAL_USE_MAC == TRUE */
#endif /* _MAC_H_ */
diff --git a/os/hal/include/mmc_spi.h b/os/hal/include/mmc_spi.h
index dbee69039..5d19d1362 100644
--- a/os/hal/include/mmc_spi.h
+++ b/os/hal/include/mmc_spi.h
@@ -28,16 +28,16 @@
#ifndef _MMC_SPI_H_
#define _MMC_SPI_H_
-#if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
+#if (HAL_USE_MMC_SPI == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
-#define MMC_CMD0_RETRY 10
-#define MMC_CMD1_RETRY 100
-#define MMC_ACMD41_RETRY 100
-#define MMC_WAIT_DATA 10000
+#define MMC_CMD0_RETRY 10U
+#define MMC_CMD1_RETRY 100U
+#define MMC_ACMD41_RETRY 100U
+#define MMC_WAIT_DATA 10000U
/*===========================================================================*/
/* Driver pre-compile time settings. */
@@ -64,7 +64,7 @@
/* Derived constants and error checks. */
/*===========================================================================*/
-#if !HAL_USE_SPI || !SPI_USE_WAIT
+#if (HAL_USE_SPI == FALSE) || (SPI_USE_WAIT == FALSE)
#error "MMC_SPI driver requires HAL_USE_SPI and SPI_USE_WAIT"
#endif
@@ -191,7 +191,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_MMC_SPI */
+#endif /* HAL_USE_MMC_SPI == TRUE */
#endif /* _MMC_SPI_H_ */
diff --git a/os/hal/include/pal.h b/os/hal/include/pal.h
index e78ed3491..8a1477504 100644
--- a/os/hal/include/pal.h
+++ b/os/hal/include/pal.h
@@ -28,7 +28,7 @@
#ifndef _PAL_H_
#define _PAL_H_
-#if HAL_USE_PAL || defined(__DOXYGEN__)
+#if (HAL_USE_PAL == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -549,6 +549,6 @@ extern "C" {
#endif /* _PAL_H_ */
-#endif /* HAL_USE_PAL */
+#endif /* HAL_USE_PAL == TRUE */
/** @} */
diff --git a/os/hal/include/pwm.h b/os/hal/include/pwm.h
index cb948e850..6841e0e43 100644
--- a/os/hal/include/pwm.h
+++ b/os/hal/include/pwm.h
@@ -28,7 +28,7 @@
#ifndef _PWM_H_
#define _PWM_H_
-#if HAL_USE_PWM || defined(__DOXYGEN__)
+#if (HAL_USE_PWM == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -41,22 +41,22 @@
/**
* @brief Standard output modes mask.
*/
-#define PWM_OUTPUT_MASK 0x0F
+#define PWM_OUTPUT_MASK 0x0FU
/**
* @brief Output not driven, callback only.
*/
-#define PWM_OUTPUT_DISABLED 0x00
+#define PWM_OUTPUT_DISABLED 0x00U
/**
* @brief Positive PWM logic, active is logic level one.
*/
-#define PWM_OUTPUT_ACTIVE_HIGH 0x01
+#define PWM_OUTPUT_ACTIVE_HIGH 0x01U
/**
* @brief Inverse PWM logic, active is logic level zero.
*/
-#define PWM_OUTPUT_ACTIVE_LOW 0x02
+#define PWM_OUTPUT_ACTIVE_LOW 0x02U
/** @} */
/*===========================================================================*/
@@ -77,7 +77,7 @@
typedef enum {
PWM_UNINIT = 0, /**< Not initialized. */
PWM_STOP = 1, /**< Stopped. */
- PWM_READY = 2, /**< Ready. */
+ PWM_READY = 2 /**< Ready. */
} pwmstate_t;
/**
@@ -192,9 +192,9 @@ typedef void (*pwmcallback_t)(PWMDriver *pwmp);
* @iclass
*/
#define pwmEnableChannelI(pwmp, channel, width) do { \
- (pwmp)->enabled |= 1 << (channel); \
+ (pwmp)->enabled |= ((pwmchnmsk_t)1U << (pwmchnmsk_t)(channel)); \
pwm_lld_enable_channel(pwmp, channel, width); \
-} while (0)
+} while (false)
/**
* @brief Disables a PWM channel.
@@ -211,9 +211,9 @@ typedef void (*pwmcallback_t)(PWMDriver *pwmp);
* @iclass
*/
#define pwmDisableChannelI(pwmp, channel) do { \
- (pwmp)->enabled &= ~(1 << (channel)); \
+ (pwmp)->enabled &= ~((pwmchnmsk_t)1U << (pwmchnmsk_t)(channel)); \
pwm_lld_disable_channel(pwmp, channel); \
-} while (0)
+} while (false)
/**
* @brief Returns a PWM channel status.
@@ -225,7 +225,7 @@ typedef void (*pwmcallback_t)(PWMDriver *pwmp);
* @iclass
*/
#define pwmIsChannelEnabledI(pwmp, channel) \
- ((bool)((pwmp)->enabled & (1 << (channel))))
+ (((pwmp)->enabled & ((pwmchnmsk_t)1U << (pwmchnmsk_t)(channel))) != 0U)
/**
* @brief Enables the periodic activation edge notification.
@@ -304,7 +304,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_PWM */
+#endif /* HAL_USE_PWM == TRUE */
#endif /* _PWM_H_ */
diff --git a/os/hal/include/rtc.h b/os/hal/include/rtc.h
index 26e505fda..5d98edddb 100644
--- a/os/hal/include/rtc.h
+++ b/os/hal/include/rtc.h
@@ -32,9 +32,11 @@
#ifndef _RTC_H_
#define _RTC_H_
-#if HAL_USE_RTC || defined(__DOXYGEN__)
+#if (HAL_USE_RTC == TRUE) || defined(__DOXYGEN__)
+/*lint -save -e829 [21.10] The header is required.*/
#include <time.h>
+/*lint -restore*/
/*===========================================================================*/
/* Driver constants. */
@@ -43,32 +45,32 @@
/**
* @brief Base year of the calendar.
*/
-#define RTC_BASE_YEAR 1980
+#define RTC_BASE_YEAR 1980U
/**
* @name Date/Time bit masks for FAT format
* @{
*/
-#define RTC_FAT_TIME_SECONDS_MASK 0x0000001F
-#define RTC_FAT_TIME_MINUTES_MASK 0x000007E0
-#define RTC_FAT_TIME_HOURS_MASK 0x0000F800
-#define RTC_FAT_DATE_DAYS_MASK 0x001F0000
-#define RTC_FAT_DATE_MONTHS_MASK 0x01E00000
-#define RTC_FAT_DATE_YEARS_MASK 0xFE000000
+#define RTC_FAT_TIME_SECONDS_MASK 0x0000001FU
+#define RTC_FAT_TIME_MINUTES_MASK 0x000007E0U
+#define RTC_FAT_TIME_HOURS_MASK 0x0000F800U
+#define RTC_FAT_DATE_DAYS_MASK 0x001F0000U
+#define RTC_FAT_DATE_MONTHS_MASK 0x01E00000U
+#define RTC_FAT_DATE_YEARS_MASK 0xFE000000U
/** @} */
/**
* @name Day of week encoding
* @{
*/
-#define RTC_DAY_CATURDAY 0
-#define RTC_DAY_MONDAY 1
-#define RTC_DAY_TUESDAY 2
-#define RTC_DAY_WEDNESDAY 3
-#define RTC_DAY_THURSDAY 4
-#define RTC_DAY_FRIDAY 5
-#define RTC_DAY_SATURDAY 6
-#define RTC_DAY_SUNDAY 7
+#define RTC_DAY_CATURDAY 0U
+#define RTC_DAY_MONDAY 1U
+#define RTC_DAY_TUESDAY 2U
+#define RTC_DAY_WEDNESDAY 3U
+#define RTC_DAY_THURSDAY 4U
+#define RTC_DAY_FRIDAY 5U
+#define RTC_DAY_SATURDAY 6U
+#define RTC_DAY_SUNDAY 7U
/** @} */
/*===========================================================================*/
@@ -92,12 +94,14 @@ typedef struct RTCDriver RTCDriver;
* @brief Type of a structure representing an RTC date/time stamp.
*/
typedef struct {
+ /*lint -save -e46 [6.1] In this case uint32_t is fine.*/
uint32_t year: 8; /**< @brief Years since 1980. */
uint32_t month: 4; /**< @brief Months 1..12. */
uint32_t dstflag: 1; /**< @brief DST correction flag. */
uint32_t dayofweek: 3; /**< @brief Day of week 1..7. */
uint32_t day: 5; /**< @brief Day of the month 1..31. */
uint32_t millisecond: 27; /**< @brief Milliseconds since midnight.*/
+ /*lint -restore*/
} RTCDateTime;
#include "rtc_lld.h"
@@ -123,7 +127,7 @@ extern "C" {
const RTCAlarm *alarmspec);
void rtcGetAlarm(RTCDriver *rtcp, rtcalarm_t alarm, RTCAlarm *alarmspec);
#endif
-#if RTC_SUPPORTS_CALLBACKS
+#if RTC_SUPPORTS_CALLBACKS == TRUE
void rtcSetCallback(RTCDriver *rtcp, rtccb_t callback);
#endif
void rtcConvertDateTimeToStructTm(const RTCDateTime *timespec,
@@ -136,7 +140,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_RTC */
+#endif /* HAL_USE_RTC == TRUE */
#endif /* _RTC_H_ */
/** @} */
diff --git a/os/hal/include/sdc.h b/os/hal/include/sdc.h
index ebeb1ea88..d99a6f8a8 100644
--- a/os/hal/include/sdc.h
+++ b/os/hal/include/sdc.h
@@ -28,7 +28,7 @@
#ifndef _SDC_H_
#define _SDC_H_
-#if HAL_USE_SDC || defined(__DOXYGEN__)
+#if (HAL_USE_SDC == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -38,27 +38,27 @@
* @name SD card types
* @{
*/
-#define SDC_MODE_CARDTYPE_MASK 0xF /**< @brief Card type mask. */
-#define SDC_MODE_CARDTYPE_SDV11 0
-#define SDC_MODE_CARDTYPE_SDV20 1
-#define SDC_MODE_CARDTYPE_MMC 2
-#define SDC_MODE_HIGH_CAPACITY 0x10
+#define SDC_MODE_CARDTYPE_MASK 0xFU
+#define SDC_MODE_CARDTYPE_SDV11 0U
+#define SDC_MODE_CARDTYPE_SDV20 1U
+#define SDC_MODE_CARDTYPE_MMC 2U
+#define SDC_MODE_HIGH_CAPACITY 0x10U
/** @} */
/**
* @name SDC bus error conditions
* @{
*/
-#define SDC_NO_ERROR 0
-#define SDC_CMD_CRC_ERROR 1
-#define SDC_DATA_CRC_ERROR 2
-#define SDC_DATA_TIMEOUT 4
-#define SDC_COMMAND_TIMEOUT 8
-#define SDC_TX_UNDERRUN 16
-#define SDC_RX_OVERRUN 32
-#define SDC_STARTBIT_ERROR 64
-#define SDC_OVERFLOW_ERROR 128
-#define SDC_UNHANDLED_ERROR 0xFFFFFFFF
+#define SDC_NO_ERROR 0U
+#define SDC_CMD_CRC_ERROR 1U
+#define SDC_DATA_CRC_ERROR 2U
+#define SDC_DATA_TIMEOUT 4U
+#define SDC_COMMAND_TIMEOUT 8U
+#define SDC_TX_UNDERRUN 16U
+#define SDC_RX_OVERRUN 32U
+#define SDC_STARTBIT_ERROR 64U
+#define SDC_OVERFLOW_ERROR 128U
+#define SDC_UNHANDLED_ERROR 0xFFFFFFFFU
/** @} */
/*===========================================================================*/
@@ -119,7 +119,7 @@ typedef enum {
*/
typedef enum {
SDC_CLK_25MHz = 0,
- SDC_CLK_50MHz,
+ SDC_CLK_50MHz
} sdcbusclk_t;
#include "sdc_lld.h"
@@ -179,9 +179,9 @@ extern "C" {
bool sdcConnect(SDCDriver *sdcp);
bool sdcDisconnect(SDCDriver *sdcp);
bool sdcRead(SDCDriver *sdcp, uint32_t startblk,
- uint8_t *buffer, uint32_t n);
+ uint8_t *buf, uint32_t n);
bool sdcWrite(SDCDriver *sdcp, uint32_t startblk,
- const uint8_t *buffer, uint32_t n);
+ const uint8_t *buf, uint32_t n);
sdcflags_t sdcGetAndClearErrors(SDCDriver *sdcp);
bool sdcSync(SDCDriver *sdcp);
bool sdcGetInfo(SDCDriver *sdcp, BlockDeviceInfo *bdip);
@@ -190,7 +190,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_SDC */
+#endif /* HAL_USE_SDC == TRUE */
#endif /* _SDC_H_ */
diff --git a/os/hal/include/serial.h b/os/hal/include/serial.h
index aa2435494..3e0d1263e 100644
--- a/os/hal/include/serial.h
+++ b/os/hal/include/serial.h
@@ -28,7 +28,7 @@
#ifndef _SERIAL_H_
#define _SERIAL_H_
-#if HAL_USE_SERIAL || defined(__DOXYGEN__)
+#if (HAL_USE_SERIAL == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -304,7 +304,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_SERIAL */
+#endif /* HAL_USE_SERIAL == TRUE */
#endif /* _SERIAL_H_ */
diff --git a/os/hal/include/serial_usb.h b/os/hal/include/serial_usb.h
index a34710e6c..9d31bdd10 100644
--- a/os/hal/include/serial_usb.h
+++ b/os/hal/include/serial_usb.h
@@ -28,7 +28,7 @@
#ifndef _SERIAL_USB_H_
#define _SERIAL_USB_H_
-#if HAL_USE_SERIAL_USB || defined(__DOXYGEN__)
+#if (HAL_USE_SERIAL_USB == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -130,7 +130,7 @@
/* Derived constants and error checks. */
/*===========================================================================*/
-#if !HAL_USE_USB
+#if HAL_USE_USB == FALSE
#error "Serial over USB Driver requires HAL_USE_USB"
#endif
@@ -245,7 +245,7 @@ struct SerialUSBDriver {
extern "C" {
#endif
void sduInit(void);
- void sduObjectInit(SerialUSBDriver *sdp);
+ void sduObjectInit(SerialUSBDriver *sdup);
void sduStart(SerialUSBDriver *sdup, const SerialUSBConfig *config);
void sduStop(SerialUSBDriver *sdup);
void sduConfigureHookI(SerialUSBDriver *sdup);
@@ -257,7 +257,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_SERIAL_USB */
+#endif /* HAL_USE_SERIAL_USB == TRUE */
#endif /* _SERIAL_USB_H_ */
diff --git a/os/hal/include/spi.h b/os/hal/include/spi.h
index b4aa43e41..265ed32c3 100644
--- a/os/hal/include/spi.h
+++ b/os/hal/include/spi.h
@@ -28,7 +28,7 @@
#ifndef _SPI_H_
#define _SPI_H_
-#if HAL_USE_SPI || defined(__DOXYGEN__)
+#if (HAL_USE_SPI == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -211,7 +211,7 @@ typedef enum {
* @name Low level driver helper macros
* @{
*/
-#if SPI_USE_WAIT || defined(__DOXYGEN__)
+#if (SPI_USE_WAIT == TRUE) || defined(__DOXYGEN__)
/**
* @brief Waits for operation completion.
* @details This function waits for the driver to complete the current
@@ -224,7 +224,7 @@ typedef enum {
*
* @notapi
*/
-#define _spi_wait_s(spip) osalThreadSuspendS(&(spip)->thread)
+#define _spi_wait_s(spip) (void) osalThreadSuspendS(&(spip)->thread)
/**
* @brief Wakes up the waiting thread.
@@ -293,16 +293,16 @@ extern "C" {
void spiExchange(SPIDriver *spip, size_t n, const void *txbuf, void *rxbuf);
void spiSend(SPIDriver *spip, size_t n, const void *txbuf);
void spiReceive(SPIDriver *spip, size_t n, void *rxbuf);
-#endif /* SPI_USE_WAIT */
+#endif
#if SPI_USE_MUTUAL_EXCLUSION
void spiAcquireBus(SPIDriver *spip);
void spiReleaseBus(SPIDriver *spip);
-#endif /* SPI_USE_MUTUAL_EXCLUSION */
+#endif
#ifdef __cplusplus
}
#endif
-#endif /* HAL_USE_SPI */
+#endif /* HAL_USE_SPI == TRUE */
#endif /* _SPI_H_ */
diff --git a/os/hal/include/st.h b/os/hal/include/st.h
index dd2312b88..c3363bf98 100644
--- a/os/hal/include/st.h
+++ b/os/hal/include/st.h
@@ -87,9 +87,9 @@
extern "C" {
#endif
void stInit(void);
- void stStartAlarm(systime_t time);
+ void stStartAlarm(systime_t abstime);
void stStopAlarm(void);
- void stSetAlarm(systime_t time);
+ void stSetAlarm(systime_t abstime);
systime_t stGetAlarm(void);
#ifdef __cplusplus
}
diff --git a/os/hal/include/uart.h b/os/hal/include/uart.h
index b5b98ffd3..e6d785738 100644
--- a/os/hal/include/uart.h
+++ b/os/hal/include/uart.h
@@ -28,7 +28,7 @@
#ifndef _UART_H_
#define _UART_H_
-#if HAL_USE_UART || defined(__DOXYGEN__)
+#if (HAL_USE_UART == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -114,7 +114,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_UART */
+#endif /* HAL_USE_UART == TRUE */
#endif /* _UART_H_ */
diff --git a/os/hal/include/usb.h b/os/hal/include/usb.h
index c85506403..a18633ba5 100644
--- a/os/hal/include/usb.h
+++ b/os/hal/include/usb.h
@@ -28,54 +28,54 @@
#ifndef _USB_H_
#define _USB_H_
-#if HAL_USE_USB || defined(__DOXYGEN__)
+#if (HAL_USE_USB == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
#define USB_ENDPOINT_OUT(ep) (ep)
-#define USB_ENDPOINT_IN(ep) ((ep) | 0x80)
-
-#define USB_RTYPE_DIR_MASK 0x80
-#define USB_RTYPE_DIR_HOST2DEV 0x00
-#define USB_RTYPE_DIR_DEV2HOST 0x80
-#define USB_RTYPE_TYPE_MASK 0x60
-#define USB_RTYPE_TYPE_STD 0x00
-#define USB_RTYPE_TYPE_CLASS 0x20
-#define USB_RTYPE_TYPE_VENDOR 0x40
-#define USB_RTYPE_TYPE_RESERVED 0x60
-#define USB_RTYPE_RECIPIENT_MASK 0x1F
-#define USB_RTYPE_RECIPIENT_DEVICE 0x00
-#define USB_RTYPE_RECIPIENT_INTERFACE 0x01
-#define USB_RTYPE_RECIPIENT_ENDPOINT 0x02
-#define USB_RTYPE_RECIPIENT_OTHER 0x03
-
-#define USB_REQ_GET_STATUS 0
-#define USB_REQ_CLEAR_FEATURE 1
-#define USB_REQ_SET_FEATURE 3
-#define USB_REQ_SET_ADDRESS 5
-#define USB_REQ_GET_DESCRIPTOR 6
-#define USB_REQ_SET_DESCRIPTOR 7
-#define USB_REQ_GET_CONFIGURATION 8
-#define USB_REQ_SET_CONFIGURATION 9
-#define USB_REQ_GET_INTERFACE 10
-#define USB_REQ_SET_INTERFACE 11
-#define USB_REQ_SYNCH_FRAME 12
-
-#define USB_DESCRIPTOR_DEVICE 1
-#define USB_DESCRIPTOR_CONFIGURATION 2
-#define USB_DESCRIPTOR_STRING 3
-#define USB_DESCRIPTOR_INTERFACE 4
-#define USB_DESCRIPTOR_ENDPOINT 5
-#define USB_DESCRIPTOR_DEVICE_QUALIFIER 6
-#define USB_DESCRIPTOR_OTHER_SPEED_CFG 7
-#define USB_DESCRIPTOR_INTERFACE_POWER 8
-#define USB_DESCRIPTOR_INTERFACE_ASSOCIATION 11
-
-#define USB_FEATURE_ENDPOINT_HALT 0
-#define USB_FEATURE_DEVICE_REMOTE_WAKEUP 1
-#define USB_FEATURE_TEST_MODE 2
+#define USB_ENDPOINT_IN(ep) ((ep) | 0x80U)
+
+#define USB_RTYPE_DIR_MASK 0x80U
+#define USB_RTYPE_DIR_HOST2DEV 0x00U
+#define USB_RTYPE_DIR_DEV2HOST 0x80U
+#define USB_RTYPE_TYPE_MASK 0x60U
+#define USB_RTYPE_TYPE_STD 0x00U
+#define USB_RTYPE_TYPE_CLASS 0x20U
+#define USB_RTYPE_TYPE_VENDOR 0x40U
+#define USB_RTYPE_TYPE_RESERVED 0x60U
+#define USB_RTYPE_RECIPIENT_MASK 0x1FU
+#define USB_RTYPE_RECIPIENT_DEVICE 0x00U
+#define USB_RTYPE_RECIPIENT_INTERFACE 0x01U
+#define USB_RTYPE_RECIPIENT_ENDPOINT 0x02U
+#define USB_RTYPE_RECIPIENT_OTHER 0x03U
+
+#define USB_REQ_GET_STATUS 0U
+#define USB_REQ_CLEAR_FEATURE 1U
+#define USB_REQ_SET_FEATURE 3U
+#define USB_REQ_SET_ADDRESS 5U
+#define USB_REQ_GET_DESCRIPTOR 6U
+#define USB_REQ_SET_DESCRIPTOR 7U
+#define USB_REQ_GET_CONFIGURATION 8U
+#define USB_REQ_SET_CONFIGURATION 9U
+#define USB_REQ_GET_INTERFACE 10U
+#define USB_REQ_SET_INTERFACE 11U
+#define USB_REQ_SYNCH_FRAME 12U
+
+#define USB_DESCRIPTOR_DEVICE 1U
+#define USB_DESCRIPTOR_CONFIGURATION 2U
+#define USB_DESCRIPTOR_STRING 3U
+#define USB_DESCRIPTOR_INTERFACE 4U
+#define USB_DESCRIPTOR_ENDPOINT 5U
+#define USB_DESCRIPTOR_DEVICE_QUALIFIER 6U
+#define USB_DESCRIPTOR_OTHER_SPEED_CFG 7U
+#define USB_DESCRIPTOR_INTERFACE_POWER 8U
+#define USB_DESCRIPTOR_INTERFACE_ASSOCIATION 11U
+
+#define USB_FEATURE_ENDPOINT_HALT 0U
+#define USB_FEATURE_DEVICE_REMOTE_WAKEUP 1U
+#define USB_FEATURE_TEST_MODE 2U
#define USB_EARLY_SET_ADDRESS 0
#define USB_LATE_SET_ADDRESS 1
@@ -104,20 +104,20 @@
* @brief Helper macro for word values into descriptor strings.
*/
#define USB_DESC_WORD(w) \
- (uint8_t)((w) & 255), \
- (uint8_t)(((w) >> 8) & 255)
+ (uint8_t)((w) & 255U), \
+ (uint8_t)(((w) >> 8) & 255U)
/**
* @brief Helper macro for BCD values into descriptor strings.
*/
#define USB_DESC_BCD(bcd) \
- (uint8_t)((bcd) & 255), \
+ (uint8_t)((bcd) & 255U), \
(uint8_t)(((bcd) >> 8) & 255)
/*
* @define Device Descriptor size.
*/
-#define USB_DESC_DEVICE_SIZE 18
+#define USB_DESC_DEVICE_SIZE 18U
/**
* @brief Device Descriptor helper macro.
@@ -144,7 +144,7 @@
/**
* @brief Configuration Descriptor size.
*/
-#define USB_DESC_CONFIGURATION_SIZE 9
+#define USB_DESC_CONFIGURATION_SIZE 9U
/**
* @brief Configuration Descriptor helper macro.
@@ -164,7 +164,7 @@
/**
* @brief Interface Descriptor size.
*/
-#define USB_DESC_INTERFACE_SIZE 9
+#define USB_DESC_INTERFACE_SIZE 9U
/**
* @brief Interface Descriptor helper macro.
@@ -186,7 +186,7 @@
/**
* @brief Interface Association Descriptor size.
*/
-#define USB_DESC_INTERFACE_ASSOCIATION_SIZE 8
+#define USB_DESC_INTERFACE_ASSOCIATION_SIZE 8U
/**
* @brief Interface Association Descriptor helper macro.
@@ -207,7 +207,7 @@
/**
* @brief Endpoint Descriptor size.
*/
-#define USB_DESC_ENDPOINT_SIZE 7
+#define USB_DESC_ENDPOINT_SIZE 7U
/**
* @brief Endpoint Descriptor helper macro.
@@ -226,13 +226,13 @@
* @name Endpoint types and settings
* @{
*/
-#define USB_EP_MODE_TYPE 0x0003 /**< Endpoint type mask. */
-#define USB_EP_MODE_TYPE_CTRL 0x0000 /**< Control endpoint. */
-#define USB_EP_MODE_TYPE_ISOC 0x0001 /**< Isochronous endpoint. */
-#define USB_EP_MODE_TYPE_BULK 0x0002 /**< Bulk endpoint. */
-#define USB_EP_MODE_TYPE_INTR 0x0003 /**< Interrupt endpoint. */
-#define USB_EP_MODE_LINEAR_BUFFER 0x0000 /**< Linear buffer mode. */
-#define USB_EP_MODE_QUEUE_BUFFER 0x0010 /**< Queue buffer mode. */
+#define USB_EP_MODE_TYPE 0x0003U /**< Endpoint type mask. */
+#define USB_EP_MODE_TYPE_CTRL 0x0000U /**< Control endpoint. */
+#define USB_EP_MODE_TYPE_ISOC 0x0001U /**< Isochronous endpoint. */
+#define USB_EP_MODE_TYPE_BULK 0x0002U /**< Bulk endpoint. */
+#define USB_EP_MODE_TYPE_INTR 0x0003U /**< Interrupt endpoint. */
+#define USB_EP_MODE_LINEAR_BUFFER 0x0000U /**< Linear buffer mode. */
+#define USB_EP_MODE_QUEUE_BUFFER 0x0010U /**< Queue buffer mode. */
/** @} */
/*===========================================================================*/
@@ -383,15 +383,6 @@ typedef const USBDescriptor * (*usbgetdescriptor_t)(USBDriver *usbp,
#define usbGetDriverStateI(usbp) ((usbp)->state)
/**
- * @brief Fetches a 16 bits word value from an USB message.
- *
- * @param[in] p pointer to the 16 bits word
- *
- * @notapi
- */
-#define usbFetchWord(p) ((uint16_t)*(p) | ((uint16_t)*((p) + 1) << 8))
-
-/**
* @brief Connects the USB device.
*
* @param[in] usbp pointer to the @p USBDriver object
@@ -430,7 +421,8 @@ typedef const USBDescriptor * (*usbgetdescriptor_t)(USBDriver *usbp,
*
* @iclass
*/
-#define usbGetTransmitStatusI(usbp, ep) ((usbp)->transmitting & (1 << (ep)))
+#define usbGetTransmitStatusI(usbp, ep) \
+ (((usbp)->transmitting & (uint16_t)((unsigned)1U << (unsigned)(ep))) != 0U)
/**
* @brief Returns the status of an OUT endpoint.
@@ -443,7 +435,8 @@ typedef const USBDescriptor * (*usbgetdescriptor_t)(USBDriver *usbp,
*
* @iclass
*/
-#define usbGetReceiveStatusI(usbp, ep) ((usbp)->receiving & (1 << (ep)))
+#define usbGetReceiveStatusI(usbp, ep) \
+ (((usbp)->receiving & (uint16_t)((unsigned)1U << (unsigned)(ep))) != 0U)
/**
* @brief Returns the exact size of a receive transaction.
@@ -508,8 +501,9 @@ typedef const USBDescriptor * (*usbgetdescriptor_t)(USBDriver *usbp,
* @notapi
*/
#define _usb_isr_invoke_event_cb(usbp, evt) { \
- if (((usbp)->config->event_cb) != NULL) \
+ if (((usbp)->config->event_cb) != NULL) { \
(usbp)->config->event_cb(usbp, evt); \
+ } \
}
/**
@@ -520,8 +514,9 @@ typedef const USBDescriptor * (*usbgetdescriptor_t)(USBDriver *usbp,
* @notapi
*/
#define _usb_isr_invoke_sof_cb(usbp) { \
- if (((usbp)->config->sof_cb) != NULL) \
+ if (((usbp)->config->sof_cb) != NULL) { \
(usbp)->config->sof_cb(usbp); \
+ } \
}
/**
@@ -598,7 +593,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_USB */
+#endif /* HAL_USE_USB == TRUE */
#endif /* _USB_H_ */