aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2015-03-09 10:48:08 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2015-03-09 10:48:08 +0000
commitb7985b957d0c259e9869763199c5cbf8ae9f4709 (patch)
treecb1cff3966c06b52cbba51cceb4b659dd9f25562 /os
parentce7f7103df5f634f7b57d90e115c5824adcb68a0 (diff)
downloadChibiOS-b7985b957d0c259e9869763199c5cbf8ae9f4709.tar.gz
ChibiOS-b7985b957d0c259e9869763199c5cbf8ae9f4709.tar.bz2
ChibiOS-b7985b957d0c259e9869763199c5cbf8ae9f4709.zip
MISRA pass on low level device drivers templates.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7739 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/hal/src/ext.c2
-rw-r--r--os/hal/templates/adc_lld.c18
-rw-r--r--os/hal/templates/adc_lld.h12
-rw-r--r--os/hal/templates/can_lld.c40
-rw-r--r--os/hal/templates/can_lld.h63
-rw-r--r--os/hal/templates/ext_lld.c18
-rw-r--r--os/hal/templates/ext_lld.h7
-rw-r--r--os/hal/templates/gpt_lld.c16
-rw-r--r--os/hal/templates/gpt_lld.h15
-rw-r--r--os/hal/templates/i2c_lld.c18
-rw-r--r--os/hal/templates/i2c_lld.h12
-rw-r--r--os/hal/templates/i2s_lld.h12
-rw-r--r--os/hal/templates/icu_lld.c12
-rw-r--r--os/hal/templates/icu_lld.h10
-rw-r--r--os/hal/templates/mac_lld.c22
-rw-r--r--os/hal/templates/mac_lld.h13
-rw-r--r--os/hal/templates/pal_lld.c4
-rw-r--r--os/hal/templates/pal_lld.h4
-rw-r--r--os/hal/templates/pwm_lld.c12
-rw-r--r--os/hal/templates/pwm_lld.h17
-rw-r--r--os/hal/templates/rtc_lld.h21
-rw-r--r--os/hal/templates/sdc_lld.c61
-rw-r--r--os/hal/templates/sdc_lld.h18
-rw-r--r--os/hal/templates/serial_lld.c18
-rw-r--r--os/hal/templates/serial_lld.h8
-rw-r--r--os/hal/templates/spi_lld.c18
-rw-r--r--os/hal/templates/spi_lld.h16
-rw-r--r--os/hal/templates/st_lld.h12
-rw-r--r--os/hal/templates/uart_lld.c18
-rw-r--r--os/hal/templates/uart_lld.h7
-rw-r--r--os/hal/templates/usb_lld.c18
-rw-r--r--os/hal/templates/usb_lld.h7
32 files changed, 261 insertions, 288 deletions
diff --git a/os/hal/src/ext.c b/os/hal/src/ext.c
index feacdc0ef..35568f8a3 100644
--- a/os/hal/src/ext.c
+++ b/os/hal/src/ext.c
@@ -190,7 +190,9 @@ void extSetChannelModeI(EXTDriver *extp,
/* Note that here the access is enforced as non-const, known access
violation.*/
+ /*lint -save -e9005 [11.8] Known issue, the driver needs rework here.*/
oldcp = (EXTChannelConfig *)&extp->config->channels[channel];
+ /*lint -restore*/
/* Overwiting the old channels configuration then the channel is reconfigured
by the low level driver.*/
diff --git a/os/hal/templates/adc_lld.c b/os/hal/templates/adc_lld.c
index da80b8a7f..9259bead6 100644
--- a/os/hal/templates/adc_lld.c
+++ b/os/hal/templates/adc_lld.c
@@ -24,7 +24,7 @@
#include "hal.h"
-#if HAL_USE_ADC || defined(__DOXYGEN__)
+#if (HAL_USE_ADC == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
@@ -37,7 +37,7 @@
/**
* @brief ADC1 driver identifier.
*/
-#if PLATFORM_ADC_USE_ADC1 || defined(__DOXYGEN__)
+#if (PLATFORM_ADC_USE_ADC1 == TRUE) || defined(__DOXYGEN__)
ADCDriver ADCD1;
#endif
@@ -64,10 +64,10 @@ ADCDriver ADCD1;
*/
void adc_lld_init(void) {
-#if PLATFORM_ADC_USE_ADC1
+#if PLATFORM_ADC_USE_ADC1 == TRUE
/* Driver initialization.*/
adcObjectInit(&ADCD1);
-#endif /* PLATFORM_ADC_USE_ADC1 */
+#endif
}
/**
@@ -81,11 +81,11 @@ void adc_lld_start(ADCDriver *adcp) {
if (adcp->state == ADC_STOP) {
/* Enables the peripheral.*/
-#if PLATFORM_ADC_USE_ADC1
+#if PLATFORM_ADC_USE_ADC1 == TRUE
if (&ADCD1 == adcp) {
}
-#endif /* PLATFORM_ADC_USE_ADC1 */
+#endif
}
/* Configures the peripheral.*/
@@ -104,11 +104,11 @@ void adc_lld_stop(ADCDriver *adcp) {
/* Resets the peripheral.*/
/* Disables the peripheral.*/
-#if PLATFORM_ADC_USE_ADC1
+#if PLATFORM_ADC_USE_ADC1 == TRUE
if (&ADCD1 == adcp) {
}
-#endif /* PLATFORM_ADC_USE_ADC1 */
+#endif
}
}
@@ -136,6 +136,6 @@ void adc_lld_stop_conversion(ADCDriver *adcp) {
(void)adcp;
}
-#endif /* HAL_USE_ADC */
+#endif /* HAL_USE_ADC == TRUE */
/** @} */
diff --git a/os/hal/templates/adc_lld.h b/os/hal/templates/adc_lld.h
index 6863d0f09..3e6688a27 100644
--- a/os/hal/templates/adc_lld.h
+++ b/os/hal/templates/adc_lld.h
@@ -25,7 +25,7 @@
#ifndef _ADC_LLD_H_
#define _ADC_LLD_H_
-#if HAL_USE_ADC || defined(__DOXYGEN__)
+#if (HAL_USE_ADC == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -162,18 +162,18 @@ struct ADCDriver {
* @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__)
+#if (ADC_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
/**
* @brief Mutex protecting the peripheral.
*/
mutex_t mutex;
-#endif /* ADC_USE_MUTUAL_EXCLUSION */
+#endif
#if defined(ADC_DRIVER_EXT_FIELDS)
ADC_DRIVER_EXT_FIELDS
#endif
@@ -188,7 +188,7 @@ struct ADCDriver {
/* External declarations. */
/*===========================================================================*/
-#if PLATFORM_ADC_USE_ADC1 && !defined(__DOXYGEN__)
+#if (PLATFORM_ADC_USE_ADC1 == TRUE) && !defined(__DOXYGEN__)
extern ADCDriver ADCD1;
#endif
@@ -204,7 +204,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_ADC */
+#endif /* HAL_USE_ADC == TRUE */
#endif /* _ADC_LLD_H_ */
diff --git a/os/hal/templates/can_lld.c b/os/hal/templates/can_lld.c
index 27fc5e79f..f276c4271 100644
--- a/os/hal/templates/can_lld.c
+++ b/os/hal/templates/can_lld.c
@@ -24,7 +24,7 @@
#include "hal.h"
-#if HAL_USE_CAN || defined(__DOXYGEN__)
+#if (HAL_USE_CAN == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
@@ -37,7 +37,7 @@
/**
* @brief CAN1 driver identifier.
*/
-#if PLATFORM_CAN_USE_CAN1 || defined(__DOXYGEN__)
+#if (PLATFORM_CAN_USE_CAN1 == TRUE) || defined(__DOXYGEN__)
CANDriver CAND1;
#endif
@@ -64,10 +64,10 @@ CANDriver CAND1;
*/
void can_lld_init(void) {
-#if PLATFORM_CAN_USE_CAN1
+#if PLATFORM_CAN_USE_CAN1 == TRUE
/* Driver initialization.*/
canObjectInit(&CAND1);
-#endif /* PLATFORM_CAN_USE_CAN1 */
+#endif
}
/**
@@ -81,11 +81,11 @@ void can_lld_start(CANDriver *canp) {
if (canp->state == CAN_STOP) {
/* Enables the peripheral.*/
-#if PLATFORM_CAN_USE_CAN1
+#if PLATFORM_CAN_USE_CAN1 == TRUE
if (&CAND1 == canp) {
}
-#endif /* PLATFORM_CAN_USE_CAN1 */
+#endif
}
/* Configures the peripheral.*/
@@ -104,11 +104,11 @@ void can_lld_stop(CANDriver *canp) {
/* Resets the peripheral.*/
/* Disables the peripheral.*/
-#if PLATFORM_CAN_USE_CAN1
+#if PLATFORM_CAN_USE_CAN1 == TRUE
if (&CAND1 == canp) {
}
-#endif /* PLATFORM_CAN_USE_CAN1 */
+#endif
}
}
@@ -130,15 +130,15 @@ bool can_lld_is_tx_empty(CANDriver *canp, canmbx_t mailbox) {
switch (mailbox) {
case CAN_ANY_MAILBOX:
- return FALSE;
+ return false;
case 1:
- return FALSE;
+ return false;
case 2:
- return FALSE;
+ return false;
case 3:
- return FALSE;
+ return false;
default:
- return FALSE;
+ return false;
}
}
@@ -180,13 +180,13 @@ bool can_lld_is_rx_nonempty(CANDriver *canp, canmbx_t mailbox) {
switch (mailbox) {
case CAN_ANY_MAILBOX:
- return FALSE;
+ return false;
case 1:
- return FALSE;
+ return false;
case 2:
- return FALSE;
+ return false;
default:
- return FALSE;
+ return false;
}
}
@@ -209,7 +209,7 @@ void can_lld_receive(CANDriver *canp,
}
-#if CAN_USE_SLEEP_MODE || defined(__DOXYGEN__)
+#if (CAN_USE_SLEEP_MODE == TRUE) || defined(__DOXYGEN__)
/**
* @brief Enters the sleep mode.
*
@@ -235,8 +235,8 @@ void can_lld_wakeup(CANDriver *canp) {
(void)canp;
}
-#endif /* CAN_USE_SLEEP_MODE */
+#endif /* CAN_USE_SLEEP_MOD == TRUEE */
-#endif /* HAL_USE_CAN */
+#endif /* HAL_USE_CAN == TRUE */
/** @} */
diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h
index 648d62d7d..fc479fdca 100644
--- a/os/hal/templates/can_lld.h
+++ b/os/hal/templates/can_lld.h
@@ -25,7 +25,7 @@
#ifndef _CAN_LLD_H_
#define _CAN_LLD_H_
-#if HAL_USE_CAN || defined(__DOXYGEN__)
+#if (HAL_USE_CAN == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -52,6 +52,7 @@
/**
* @brief CAN1 driver enable switch.
* @details If set to @p TRUE the support for CAN1 is included.
+ * @note The default is @p FALSE.
*/
#if !defined(PLATFORM_CAN_USE_CAN1) || defined(__DOXYGEN__)
#define PLATFORM_CAN_USE_CAN1 FALSE
@@ -77,19 +78,16 @@ typedef uint32_t canmbx_t;
* machine data endianness, it can be still useful for a quick filling.
*/
typedef struct {
- struct {
- uint8_t DLC:4; /**< @brief Data length. */
- uint8_t RTR:1; /**< @brief Frame type. */
- uint8_t IDE:1; /**< @brief Identifier type. */
- };
+ /*lint -save -e46 [6.1] Standard types are fine too.*/
+ uint8_t DLC:4; /**< @brief Data length. */
+ uint8_t RTR:1; /**< @brief Frame type. */
+ uint8_t IDE:1; /**< @brief Identifier type. */
union {
- struct {
- uint32_t SID:11; /**< @brief Standard identifier.*/
- };
- struct {
- uint32_t EID:29; /**< @brief Extended identifier.*/
- };
+ uint32_t SID:11; /**< @brief Standard identifier.*/
+ uint32_t EID:29; /**< @brief Extended identifier.*/
+ uint32_t _align1;
};
+ /*lint -restore*/
union {
uint8_t data8[8]; /**< @brief Frame data. */
uint16_t data16[4]; /**< @brief Frame data. */
@@ -103,23 +101,18 @@ typedef struct {
* machine data endianness, it can be still useful for a quick filling.
*/
typedef struct {
- struct {
- uint8_t FMI; /**< @brief Filter id. */
- uint16_t TIME; /**< @brief Time stamp. */
- };
- struct {
- uint8_t DLC:4; /**< @brief Data length. */
- uint8_t RTR:1; /**< @brief Frame type. */
- uint8_t IDE:1; /**< @brief Identifier type. */
- };
+ /*lint -save -e46 [6.1] Standard types are fine too.*/
+ uint8_t FMI; /**< @brief Filter id. */
+ uint16_t TIME; /**< @brief Time stamp. */
+ uint8_t DLC:4; /**< @brief Data length. */
+ uint8_t RTR:1; /**< @brief Frame type. */
+ uint8_t IDE:1; /**< @brief Identifier type. */
union {
- struct {
- uint32_t SID:11; /**< @brief Standard identifier.*/
- };
- struct {
- uint32_t EID:29; /**< @brief Extended identifier.*/
- };
+ uint32_t SID:11; /**< @brief Standard identifier.*/
+ uint32_t EID:29; /**< @brief Extended identifier.*/
+ uint32_t _align1;
};
+ /*lint -restore*/
union {
uint8_t data8[8]; /**< @brief Frame data. */
uint16_t data16[4]; /**< @brief Frame data. */
@@ -181,7 +174,7 @@ typedef struct {
* error(s) that have occurred.
*/
event_source_t error_event;
-#if CAN_USE_SLEEP_MODE || defined (__DOXYGEN__)
+#if (CAN_USE_SLEEP_MODE == TRUE) || defined (__DOXYGEN__)
/**
* @brief Entering sleep state event.
*/
@@ -190,7 +183,7 @@ typedef struct {
* @brief Exiting sleep state event.
*/
event_source_t wakeup_event;
-#endif /* CAN_USE_SLEEP_MODE */
+#endif
/* End of the mandatory fields.*/
} CANDriver;
@@ -202,7 +195,7 @@ typedef struct {
/* External declarations. */
/*===========================================================================*/
-#if PLATFORM_CAN_USE_CAN1 && !defined(__DOXYGEN__)
+#if (PLATFORM_CAN_USE_CAN1 == TRUE) && !defined(__DOXYGEN__)
extern CANDriver CAND1;
#endif
@@ -215,20 +208,20 @@ extern "C" {
bool can_lld_is_tx_empty(CANDriver *canp, canmbx_t mailbox);
void can_lld_transmit(CANDriver *canp,
canmbx_t mailbox,
- const CANTxFrame *crfp);
+ const CANTxFrame *ctfp);
bool can_lld_is_rx_nonempty(CANDriver *canp, canmbx_t mailbox);
void can_lld_receive(CANDriver *canp,
canmbx_t mailbox,
- CANRxFrame *ctfp);
-#if CAN_USE_SLEEP_MODE
+ CANRxFrame *crfp);
+#if CAN_USE_SLEEP_MODE == TRUE
void can_lld_sleep(CANDriver *canp);
void can_lld_wakeup(CANDriver *canp);
-#endif /* CAN_USE_SLEEP_MODE */
+#endif
#ifdef __cplusplus
}
#endif
-#endif /* HAL_USE_CAN */
+#endif /* HAL_USE_CAN == TRUE */
#endif /* _CAN_LLD_H_ */
diff --git a/os/hal/templates/ext_lld.c b/os/hal/templates/ext_lld.c
index ea92610e7..508154e8e 100644
--- a/os/hal/templates/ext_lld.c
+++ b/os/hal/templates/ext_lld.c
@@ -24,7 +24,7 @@
#include "hal.h"
-#if HAL_USE_EXT || defined(__DOXYGEN__)
+#if (HAL_USE_EXT == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
@@ -37,7 +37,7 @@
/**
* @brief EXT1 driver identifier.
*/
-#if PLATFORM_EXT_USE_EXT1 || defined(__DOXYGEN__)
+#if (PLATFORM_EXT_USE_EXT1 == TRUE) || defined(__DOXYGEN__)
EXTDriver EXTD1;
#endif
@@ -64,10 +64,10 @@ EXTDriver EXTD1;
*/
void ext_lld_init(void) {
-#if PLATFORM_EXT_USE_EXT1
+#if PLATFORM_EXT_USE_EXT1 == TRUE
/* Driver initialization.*/
extObjectInit(&EXTD1);
-#endif /* PLATFORM_EXT_USE_EXT1 */
+#endif
}
/**
@@ -81,11 +81,11 @@ void ext_lld_start(EXTDriver *extp) {
if (extp->state == EXT_STOP) {
/* Enables the peripheral.*/
-#if PLATFORM_EXT_USE_EXT1
+#if PLATFORM_EXT_USE_EXT1 == TRUE
if (&EXTD1 == extp) {
}
-#endif /* PLATFORM_EXT_USE_EXT1 */
+#endif
}
/* Configures the peripheral.*/
@@ -104,11 +104,11 @@ void ext_lld_stop(EXTDriver *extp) {
/* Resets the peripheral.*/
/* Disables the peripheral.*/
-#if PLATFORM_EXT_USE_EXT1
+#if PLATFORM_EXT_USE_EXT1 == TRUE
if (&EXTD1 == extp) {
}
-#endif /* PLATFORM_EXT_USE_EXT1 */
+#endif
}
}
@@ -142,6 +142,6 @@ void ext_lld_channel_disable(EXTDriver *extp, expchannel_t channel) {
}
-#endif /* HAL_USE_EXT */
+#endif /* HAL_USE_EXT == TRUE */
/** @} */
diff --git a/os/hal/templates/ext_lld.h b/os/hal/templates/ext_lld.h
index f31f347ae..6e3b0f2f9 100644
--- a/os/hal/templates/ext_lld.h
+++ b/os/hal/templates/ext_lld.h
@@ -25,7 +25,7 @@
#ifndef _EXT_LLD_H_
#define _EXT_LLD_H_
-#if HAL_USE_EXT || defined(__DOXYGEN__)
+#if (HAL_USE_EXT == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -47,6 +47,7 @@
/**
* @brief EXT driver enable switch.
* @details If set to @p TRUE the support for EXT1 is included.
+ * @note The default is @p FALSE.
*/
#if !defined(PLATFORM_EXT_USE_EXT1) || defined(__DOXYGEN__)
#define PLATFORM_EXT_USE_EXT1 FALSE
@@ -126,7 +127,7 @@ struct EXTDriver {
/* External declarations. */
/*===========================================================================*/
-#if PLATFORM_EXT_USE_EXT1 && !defined(__DOXYGEN__)
+#if (PLATFORM_EXT_USE_EXT1 == TRUE) && !defined(__DOXYGEN__)
extern EXTDriver EXTD1;
#endif
@@ -142,7 +143,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_EXT */
+#endif /* HAL_USE_EXT == TRUE */
#endif /* _EXT_LLD_H_ */
diff --git a/os/hal/templates/gpt_lld.c b/os/hal/templates/gpt_lld.c
index f658431a3..f43dea857 100644
--- a/os/hal/templates/gpt_lld.c
+++ b/os/hal/templates/gpt_lld.c
@@ -24,7 +24,7 @@
#include "hal.h"
-#if HAL_USE_GPT || defined(__DOXYGEN__)
+#if (HAL_USE_GPT == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
@@ -37,7 +37,7 @@
/**
* @brief GPTD1 driver identifier.
*/
-#if PLATFORM_GPT_USE_GPT1 || defined(__DOXYGEN__)
+#if (PLATFORM_GPT_USE_GPT1 == TRUE) || defined(__DOXYGEN__)
GPTDriver GPTD1;
#endif
@@ -64,7 +64,7 @@ GPTDriver GPTD1;
*/
void gpt_lld_init(void) {
-#if PLATFORM2_GPT_USE_TIM1
+#if PLATFORM_GPT_USE_GPT1 == TRUE
/* Driver initialization.*/
gptObjectInit(&GPTD1);
#endif
@@ -81,11 +81,11 @@ void gpt_lld_start(GPTDriver *gptp) {
if (gptp->state == GPT_STOP) {
/* Enables the peripheral.*/
-#if PLATFORM_GPT_USE_GPT1
+#if PLATFORM_GPT_USE_GPT1 == TRUE
if (&GPTD1 == gptp) {
}
-#endif /* PLATFORM_GPT_USE_GPT1 */
+#endif
}
/* Configures the peripheral.*/
@@ -104,11 +104,11 @@ void gpt_lld_stop(GPTDriver *gptp) {
/* Resets the peripheral.*/
/* Disables the peripheral.*/
-#if PLATFORM_GPT_USE_GPT1
+#if PLATFORM_GPT_USE_GPT1 == TRUE
if (&GPTD1 == gptp) {
}
-#endif /* PLATFORM_GPT_USE_GPT1 */
+#endif
}
}
@@ -158,6 +158,6 @@ void gpt_lld_polled_delay(GPTDriver *gptp, gptcnt_t interval) {
}
-#endif /* HAL_USE_GPT */
+#endif /* HAL_USE_GPT == TRUE */
/** @} */
diff --git a/os/hal/templates/gpt_lld.h b/os/hal/templates/gpt_lld.h
index 9dd1f4a9a..97671cf42 100644
--- a/os/hal/templates/gpt_lld.h
+++ b/os/hal/templates/gpt_lld.h
@@ -25,7 +25,7 @@
#ifndef _GPT_LLD_H_
#define _GPT_LLD_H_
-#if HAL_USE_GPT || defined(__DOXYGEN__)
+#if (HAL_USE_GPT == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -42,10 +42,10 @@
/**
* @brief GPTD1 driver enable switch.
* @details If set to @p TRUE the support for GPTD1 is included.
- * @note The default is @p TRUE.
+ * @note The default is @p FALSE.
*/
-#if !defined(STM32_GPT_USE_TIM1) || defined(__DOXYGEN__)
-#define STM32_GPT_USE_TIM1 FALSE
+#if !defined(PLATFORM_GPT_USE_GPT1) || defined(__DOXYGEN__)
+#define PLATFORM_GPT_USE_GPT1 FALSE
#endif
/** @} */
@@ -130,23 +130,24 @@ struct GPTDriver {
/* External declarations. */
/*===========================================================================*/
-#if STM32_GPT_USE_TIM1 && !defined(__DOXYGEN__)
+#if (PLATFORM_GPT_USE_GPT1 == TRUE) && !defined(__DOXYGEN__)
extern GPTDriver GPTD1;
#endif
+
#ifdef __cplusplus
extern "C" {
#endif
void gpt_lld_init(void);
void gpt_lld_start(GPTDriver *gptp);
void gpt_lld_stop(GPTDriver *gptp);
- void gpt_lld_start_timer(GPTDriver *gptp, gptcnt_t period);
+ void gpt_lld_start_timer(GPTDriver *gptp, gptcnt_t interval);
void gpt_lld_stop_timer(GPTDriver *gptp);
void gpt_lld_polled_delay(GPTDriver *gptp, gptcnt_t interval);
#ifdef __cplusplus
}
#endif
-#endif /* HAL_USE_GPT */
+#endif /* HAL_USE_GPT == TRUE */
#endif /* _GPT_LLD_H_ */
diff --git a/os/hal/templates/i2c_lld.c b/os/hal/templates/i2c_lld.c
index 79e2baeea..1d7b68044 100644
--- a/os/hal/templates/i2c_lld.c
+++ b/os/hal/templates/i2c_lld.c
@@ -24,7 +24,7 @@
#include "hal.h"
-#if HAL_USE_I2C || defined(__DOXYGEN__)
+#if (HAL_USE_I2C == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
@@ -37,7 +37,7 @@
/**
* @brief I2C1 driver identifier.
*/
-#if PLATFORM_I2C_USE_I2C1 || defined(__DOXYGEN__)
+#if (PLATFORM_I2C_USE_I2C1 == TRUE) || defined(__DOXYGEN__)
I2CDriver I2CD1;
#endif
@@ -64,9 +64,9 @@ I2CDriver I2CD1;
*/
void i2c_lld_init(void) {
-#if PLATFORM_I2C_USE_I2C1
+#if PLATFORM_I2C_USE_I2C1 == TRUE
i2cObjectInit(&I2CD1);
-#endif /* PLATFORM_I2C_USE_I2C1 */
+#endif
}
/**
@@ -80,11 +80,11 @@ void i2c_lld_start(I2CDriver *i2cp) {
if (i2cp->state == I2C_STOP) {
/* Enables the peripheral.*/
-#if PLATFORM_I2C_USE_I2C1
+#if PLATFORM_I2C_USE_I2C1 == TRUE
if (&I2CD1 == i2cp) {
}
-#endif /* PLATFORM_I2C_USE_I2C1 */
+#endif
}
}
@@ -101,11 +101,11 @@ void i2c_lld_stop(I2CDriver *i2cp) {
if (i2cp->state != I2C_STOP) {
/* Disables the peripheral.*/
-#if PLATFORM_I2C_USE_I2C1
+#if PLATFORM_I2C_USE_I2C1 == TRUE
if (&I2CD1 == i2cp) {
}
-#endif /* PLATFORM_I2C_USE_I2C1 */
+#endif
}
}
@@ -182,6 +182,6 @@ msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr,
return MSG_OK;
}
-#endif /* HAL_USE_I2C */
+#endif /* HAL_USE_I2C == TRUE */
/** @} */
diff --git a/os/hal/templates/i2c_lld.h b/os/hal/templates/i2c_lld.h
index 8269d3209..33ea7b32a 100644
--- a/os/hal/templates/i2c_lld.h
+++ b/os/hal/templates/i2c_lld.h
@@ -25,7 +25,7 @@
#ifndef _I2C_LLD_H_
#define _I2C_LLD_H_
-#if HAL_USE_I2C || defined(__DOXYGEN__)
+#if (HAL_USE_I2C == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -98,9 +98,9 @@ struct I2CDriver {
* @brief Error flags.
*/
i2cflags_t errors;
-#if I2C_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
+#if (I2C_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
mutex_t mutex;
-#endif /* I2C_USE_MUTUAL_EXCLUSION */
+#endif
#if defined(I2C_DRIVER_EXT_FIELDS)
I2C_DRIVER_EXT_FIELDS
#endif
@@ -124,11 +124,9 @@ struct I2CDriver {
/* External declarations. */
/*===========================================================================*/
-#if !defined(__DOXYGEN__)
-#if PLATFORM_I2C_USE_I2C1
+#if (PLATFORM_I2C_USE_I2C1 == TRUE) && !defined(__DOXYGEN__)
extern I2CDriver I2CD1;
#endif
-#endif
#ifdef __cplusplus
extern "C" {
@@ -147,7 +145,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_I2C */
+#endif /* HAL_USE_I2C == TRUE */
#endif /* _I2C_LLD_H_ */
diff --git a/os/hal/templates/i2s_lld.h b/os/hal/templates/i2s_lld.h
index 07f85833e..cd2b0d31b 100644
--- a/os/hal/templates/i2s_lld.h
+++ b/os/hal/templates/i2s_lld.h
@@ -25,7 +25,7 @@
#ifndef _I2S_LLD_H_
#define _I2S_LLD_H_
-#if HAL_USE_I2S || defined(__DOXYGEN__)
+#if (HAL_USE_I2S == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -40,9 +40,9 @@
* @{
*/
/**
- * @brief I2S2 driver enable switch.
- * @details If set to @p TRUE the support for I2S2 is included.
- * @note The default is @p TRUE.
+ * @brief I2SD1 driver enable switch.
+ * @details If set to @p TRUE the support for I2S1 is included.
+ * @note The default is @p FALSE.
*/
#if !defined(PLATFORM_I2S_USE_I2S1) || defined(__DOXYGEN__)
#define PLATFORM_I2S_USE_I2S1 FALSE
@@ -120,7 +120,7 @@ struct I2SDriver {
/* External declarations. */
/*===========================================================================*/
-#if PLATFORM_I2S_USE_I2S1 && !defined(__DOXYGEN__)
+#if (PLATFORM_I2S_USE_I2S1 == TRUE) && !defined(__DOXYGEN__)
extern I2SDriver I2SD1;
#endif
@@ -136,7 +136,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_I2S */
+#endif /* HAL_USE_I2S == TRUE */
#endif /* _I2S_LLD_H_ */
diff --git a/os/hal/templates/icu_lld.c b/os/hal/templates/icu_lld.c
index a35d48bf9..195d71620 100644
--- a/os/hal/templates/icu_lld.c
+++ b/os/hal/templates/icu_lld.c
@@ -24,7 +24,7 @@
#include "hal.h"
-#if HAL_USE_ICU || defined(__DOXYGEN__)
+#if (HAL_USE_ICU == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
@@ -38,7 +38,7 @@
* @brief ICUD1 driver identifier.
* @note The driver ICUD1 allocates the complex timer TIM1 when enabled.
*/
-#if PLATFORM_ICU_USE_ICU1 || defined(__DOXYGEN__)
+#if (PLATFORM_ICU_USE_ICU1 == TRUE) || defined(__DOXYGEN__)
ICUDriver ICUD1;
#endif
@@ -65,7 +65,7 @@ ICUDriver ICUD1;
*/
void icu_lld_init(void) {
-#if PLATFORM_ICU_USE_ICU1
+#if PLATFORM_ICU_USE_ICU1 == TRUE
/* Driver initialization.*/
icuObjectInit(&ICUD1);
#endif
@@ -82,7 +82,7 @@ void icu_lld_start(ICUDriver *icup) {
if (icup->state == ICU_STOP) {
/* Clock activation and timer reset.*/
-#if PLATFORM_ICU_USE_ICU1
+#if PLATFORM_ICU_USE_ICU1 == TRUE
if (&ICUD1 == icup) {
}
@@ -101,7 +101,7 @@ void icu_lld_stop(ICUDriver *icup) {
if (icup->state == ICU_READY) {
/* Clock deactivation.*/
-#if PLATFORM_ICU_USE_ICU1
+#if PLATFORM_ICU_USE_ICU1 == TRUE
if (&ICUD1 == icup) {
}
@@ -180,6 +180,6 @@ void icu_lld_disable_notifications(ICUDriver *icup) {
(void)icup;
}
-#endif /* HAL_USE_ICU */
+#endif /* HAL_USE_ICU == TRUE */
/** @} */
diff --git a/os/hal/templates/icu_lld.h b/os/hal/templates/icu_lld.h
index 6dcef0214..4994cabb8 100644
--- a/os/hal/templates/icu_lld.h
+++ b/os/hal/templates/icu_lld.h
@@ -25,7 +25,7 @@
#ifndef _ICU_LLD_H_
#define _ICU_LLD_H_
-#if HAL_USE_ICU || defined(__DOXYGEN__)
+#if (HAL_USE_ICU == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -42,7 +42,7 @@
/**
* @brief ICUD1 driver enable switch.
* @details If set to @p TRUE the support for ICUD1 is included.
- * @note The default is @p TRUE.
+ * @note The default is @p FALSE.
*/
#if !defined(PLATFORM_ICU_USE_ICU1) || defined(__DOXYGEN__)
#define PLATFORM_ICU_USE_ICU1 FALSE
@@ -62,7 +62,7 @@
*/
typedef enum {
ICU_INPUT_ACTIVE_HIGH = 0, /**< Trigger on rising edge. */
- ICU_INPUT_ACTIVE_LOW = 1, /**< Trigger on falling edge. */
+ ICU_INPUT_ACTIVE_LOW = 1 /**< Trigger on falling edge. */
} icumode_t;
/**
@@ -167,7 +167,7 @@ struct ICUDriver {
/* External declarations. */
/*===========================================================================*/
-#if PLATFORM_ICU_USE_ICU1 && !defined(__DOXYGEN__)
+#if (PLATFORM_ICU_USE_ICU1 == TRUE) && !defined(__DOXYGEN__)
extern ICUDriver ICUD1;
#endif
@@ -186,7 +186,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_ICU */
+#endif /* HAL_USE_ICU == TRUE */
#endif /* _ICU_LLD_H_ */
diff --git a/os/hal/templates/mac_lld.c b/os/hal/templates/mac_lld.c
index 3ad6761e1..23ca1d97e 100644
--- a/os/hal/templates/mac_lld.c
+++ b/os/hal/templates/mac_lld.c
@@ -26,7 +26,7 @@
#include "hal.h"
-#if HAL_USE_MAC || defined(__DOXYGEN__)
+#if (HAL_USE_MAC == TRUE) || defined(__DOXYGEN__)
#include "mii.h"
@@ -41,7 +41,7 @@
/**
* @brief MAC1 driver identifier.
*/
-#if PLATFORM_MAC_USE_MAC1 || defined(__DOXYGEN__)
+#if (PLATFORM_MAC_USE_MAC1 == TRUE) || defined(__DOXYGEN__)
MACDriver ETHD1;
#endif
@@ -68,10 +68,10 @@ MACDriver ETHD1;
*/
void mac_lld_init(void) {
-#if PLATFORM_MAC_USE_MAC1
+#if PLATFORM_MAC_USE_MAC1 == TRUE
/* Driver initialization.*/
macObjectInit(&MACD1);
-#endif /* PLATFORM_MAC_USE_MAC1 */
+#endif
}
/**
@@ -85,11 +85,11 @@ void mac_lld_start(MACDriver *macp) {
if (macp->state == MAC_STOP) {
/* Enables the peripheral.*/
-#if PLATFORM_MAC_USE_MAC1
+#if PLATFORM_MAC_USE_MAC1 == TRUE
if (&MACD1 == macp) {
}
-#endif /* PLATFORM_MAC_USE_MAC1 */
+#endif
}
/* Configures the peripheral.*/
@@ -108,11 +108,11 @@ void mac_lld_stop(MACDriver *macp) {
/* Resets the peripheral.*/
/* Disables the peripheral.*/
-#if PLATFORM_MAC_USE_MAC1
+#if PLATFORM_MAC_USE_MAC1 == TRUE
if (&MACD1 == macp) {
}
-#endif /* PLATFORM_MAC_USE_MAC1 */
+#endif
}
}
@@ -251,7 +251,7 @@ size_t mac_lld_read_receive_descriptor(MACReceiveDescriptor *rdp,
return 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.
@@ -306,8 +306,8 @@ const uint8_t *mac_lld_get_next_receive_buffer(MACReceiveDescriptor *rdp,
return NULL;
}
-#endif /* MAC_USE_ZERO_COPY */
+#endif /* MAC_USE_ZERO_COPY == TRUE */
-#endif /* HAL_USE_MAC */
+#endif /* HAL_USE_MAC == TRUE */
/** @} */
diff --git a/os/hal/templates/mac_lld.h b/os/hal/templates/mac_lld.h
index b5ca15695..349b41550 100644
--- a/os/hal/templates/mac_lld.h
+++ b/os/hal/templates/mac_lld.h
@@ -25,7 +25,7 @@
#ifndef _MAC_LLD_H_
#define _MAC_LLD_H_
-#if HAL_USE_MAC || defined(__DOXYGEN__)
+#if (HAL_USE_MAC == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -47,6 +47,7 @@
/**
* @brief MAC driver enable switch.
* @details If set to @p TRUE the support for MAC1 is included.
+ * @note The default is @p FALSE.
*/
#if !defined(PLATFORM_MAC_USE_MAC1) || defined(__DOXYGEN__)
#define PLATFORM_MAC_USE_MAC1 FALSE
@@ -92,7 +93,7 @@ struct MACDriver {
* @brief Receive semaphore.
*/
threads_queue_t rdqueue;
-#if MAC_USE_EVENTS || defined(__DOXYGEN__)
+#if (MAC_USE_EVENTS == TRUE) || defined(__DOXYGEN__)
/**
* @brief Receive event.
*/
@@ -139,7 +140,7 @@ typedef struct {
/* External declarations. */
/*===========================================================================*/
-#if PLATFORM_MAC_USE_MAC1 && !defined(__DOXYGEN__)
+#if (PLATFORM_MAC_USE_MAC1 == TRUE) && !defined(__DOXYGEN__)
extern MACDriver ETHD1;
#endif
@@ -162,18 +163,18 @@ extern "C" {
size_t mac_lld_read_receive_descriptor(MACReceiveDescriptor *rdp,
uint8_t *buf,
size_t size);
-#if MAC_USE_ZERO_COPY
+#if MAC_USE_ZERO_COPY == TRUE
uint8_t *mac_lld_get_next_transmit_buffer(MACTransmitDescriptor *tdp,
size_t size,
size_t *sizep);
const uint8_t *mac_lld_get_next_receive_buffer(MACReceiveDescriptor *rdp,
size_t *sizep);
-#endif /* MAC_USE_ZERO_COPY */
+#endif
#ifdef __cplusplus
}
#endif
-#endif /* HAL_USE_MAC */
+#endif /* HAL_USE_MAC == TRUE */
#endif /* _MAC_LLD_H_ */
diff --git a/os/hal/templates/pal_lld.c b/os/hal/templates/pal_lld.c
index d92fe215e..1dd3cd5de 100644
--- a/os/hal/templates/pal_lld.c
+++ b/os/hal/templates/pal_lld.c
@@ -24,7 +24,7 @@
#include "hal.h"
-#if HAL_USE_PAL || defined(__DOXYGEN__)
+#if (HAL_USE_PAL == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
@@ -85,6 +85,6 @@ void _pal_lld_setgroupmode(ioportid_t port,
}
-#endif /* HAL_USE_PAL */
+#endif /* HAL_USE_PAL == TRUE */
/** @} */
diff --git a/os/hal/templates/pal_lld.h b/os/hal/templates/pal_lld.h
index dd04b869f..71a85d1d9 100644
--- a/os/hal/templates/pal_lld.h
+++ b/os/hal/templates/pal_lld.h
@@ -25,7 +25,7 @@
#ifndef _PAL_LLD_H_
#define _PAL_LLD_H_
-#if HAL_USE_PAL || defined(__DOXYGEN__)
+#if (HAL_USE_PAL == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Unsupported modes and specific modes */
@@ -375,7 +375,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_PAL */
+#endif /* HAL_USE_PAL == TRUE */
#endif /* _PAL_LLD_H_ */
diff --git a/os/hal/templates/pwm_lld.c b/os/hal/templates/pwm_lld.c
index 2030a2b43..91fb147dc 100644
--- a/os/hal/templates/pwm_lld.c
+++ b/os/hal/templates/pwm_lld.c
@@ -24,7 +24,7 @@
#include "hal.h"
-#if HAL_USE_PWM || defined(__DOXYGEN__)
+#if (HAL_USE_PWM == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
@@ -38,7 +38,7 @@
* @brief PWMD1 driver identifier.
* @note The driver PWMD1 allocates the complex timer TIM1 when enabled.
*/
-#if PLATFORM_PWM_USE_PWM1 || defined(__DOXYGEN__)
+#if (PLATFORM_PWM_USE_PWM1 == TRUE) || defined(__DOXYGEN__)
PWMDriver PWMD1;
#endif
@@ -65,7 +65,7 @@ PWMDriver PWMD1;
*/
void pwm_lld_init(void) {
-#if PLATFORM_PWM_USE_PWM1
+#if PLATFORM_PWM_USE_PWM1 == TRUE
/* Driver initialization.*/
pwmObjectInit(&PWMD1);
#endif
@@ -84,7 +84,7 @@ void pwm_lld_start(PWMDriver *pwmp) {
if (pwmp->state == PWM_STOP) {
/* Clock activation and timer reset.*/
-#if PLATFORM_PWM_USE_PWM1
+#if PLATFORM_PWM_USE_PWM1 == TRUE
if (&PWMD1 == pwmp) {
}
@@ -103,7 +103,7 @@ void pwm_lld_stop(PWMDriver *pwmp) {
/* If in ready state then disables the PWM clock.*/
if (pwmp->state == PWM_READY) {
-#if PLATFORM_PWM_USE_PWM1
+#if PLATFORM_PWM_USE_PWM1 == TRUE
if (&PWMD1 == pwmp) {
}
@@ -215,6 +215,6 @@ void pwm_lld_disable_channel_notification(PWMDriver *pwmp,
(void)channel;
}
-#endif /* HAL_USE_PWM */
+#endif /* HAL_USE_PWM == TRUE */
/** @} */
diff --git a/os/hal/templates/pwm_lld.h b/os/hal/templates/pwm_lld.h
index 70c2f1f88..e37598a0c 100644
--- a/os/hal/templates/pwm_lld.h
+++ b/os/hal/templates/pwm_lld.h
@@ -25,7 +25,7 @@
#ifndef _PWM_LLD_H_
#define _PWM_LLD_H_
-#if HAL_USE_PWM || defined(__DOXYGEN__)
+#if (HAL_USE_PWM == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -45,13 +45,12 @@
* @{
*/
/**
- * @brief If advanced timer features switch.
- * @details If set to @p TRUE the advanced features for TIM1 and TIM8 are
- * enabled.
- * @note The default is @p TRUE.
+ * @brief PWMD1 driver enable switch.
+ * @details If set to @p TRUE the support for PWM1 is included.
+ * @note The default is @p FALSE.
*/
-#if !defined(PLATFORM_PWM_USE_ADVANCED) || defined(__DOXYGEN__)
-#define PLATFORM_PWM_USE_ADVANCED FALSE
+#if !defined(PLATFORM_PWM_USE_PWM1) || defined(__DOXYGEN__)
+#define PLATFORM_PWM_USE_PWM1 FALSE
#endif
/** @} */
@@ -185,7 +184,7 @@ struct PWMDriver {
/* External declarations. */
/*===========================================================================*/
-#if PLATFORM_PWM_USE_PWM1 && !defined(__DOXYGEN__)
+#if (PLATFORM_PWM_USE_PWM1 == TRUE) && !defined(__DOXYGEN__)
extern PWMDriver PWMD1;
#endif
@@ -209,7 +208,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_PWM */
+#endif /* HAL_USE_PWM == TRUE */
#endif /* _PWM_LLD_H_ */
diff --git a/os/hal/templates/rtc_lld.h b/os/hal/templates/rtc_lld.h
index 397aeb5af..3a52022e9 100644
--- a/os/hal/templates/rtc_lld.h
+++ b/os/hal/templates/rtc_lld.h
@@ -29,7 +29,7 @@
#ifndef _RTC_LLD_H_
#define _RTC_LLD_H_
-#if HAL_USE_RTC || defined(__DOXYGEN__)
+#if (HAL_USE_RTC == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -62,6 +62,14 @@
* @name PLATFORM configuration options
* @{
*/
+/**
+ * @brief RTCD1 driver enable switch.
+ * @details If set to @p TRUE the support for RTC1 is included.
+ * @note The default is @p FALSE.
+ */
+#if !defined(PLATFORM_RTC_USE_RTC1) || defined(__DOXYGEN__)
+#define PLATFORM_RTC_USE_RTC1 FALSE
+#endif
/** @} */
/*===========================================================================*/
@@ -120,7 +128,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.
*/
@@ -138,11 +146,12 @@ struct RTCDriver {
/* External declarations. */
/*===========================================================================*/
-#if !defined(__DOXYGEN__)
+#if (PLATFORM_RTC_USE_RTC1 == TRUE) && !defined(__DOXYGEN__)
extern RTCDriver RTCD1;
-#if RTC_HAS_STORAGE
-extern struct RTCDriverVMT _rtc_lld_vmt;
#endif
+
+#if (RTC_HAS_STORAGE == TRUE) && !defined(__DOXYGEN__)
+extern struct RTCDriverVMT _rtc_lld_vmt;
#endif
#ifdef __cplusplus
@@ -166,7 +175,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_RTC */
+#endif /* HAL_USE_RTC == TRUE */
#endif /* _RTC_LLD_H_ */
diff --git a/os/hal/templates/sdc_lld.c b/os/hal/templates/sdc_lld.c
index 10ca534cd..5290e8f57 100644
--- a/os/hal/templates/sdc_lld.c
+++ b/os/hal/templates/sdc_lld.c
@@ -24,7 +24,7 @@
#include "hal.h"
-#if HAL_USE_SDC || defined(__DOXYGEN__)
+#if (HAL_USE_SDC == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
@@ -37,7 +37,7 @@
/**
* @brief SDCD1 driver identifier.
*/
-#if PLATFORM_SDC_USE_SDC1 || defined(__DOXYGEN__)
+#if (PLATFORM_SDC_USE_SDC1 == TRUE) || defined(__DOXYGEN__)
SDCDriver SDCD1;
#endif
@@ -64,7 +64,9 @@ SDCDriver SDCD1;
*/
void sdc_lld_init(void) {
+#if PLATFORM_SDC_USE_SDC1 == TRUE
sdcObjectInit(&SDCD1);
+#endif
}
/**
@@ -154,6 +156,9 @@ void sdc_lld_set_bus_mode(SDCDriver *sdcp, sdcbusmode_t mode) {
case SDC_MODE_8BIT:
break;
+ default:
+ osalDbgAssert(false, "invalid bus mode");
+ break;
}
}
@@ -263,56 +268,6 @@ bool sdc_lld_send_cmd_long_crc(SDCDriver *sdcp, uint8_t cmd, uint32_t arg,
*
* @notapi
*/
-bool sdc_lld_read_aligned(SDCDriver *sdcp, uint32_t startblk,
- uint8_t *buf, uint32_t n) {
-
- (void)sdcp;
- (void)startblk;
- (void)buf;
- (void)n;
-
- return HAL_SUCCESS;
-}
-
-/**
- * @brief Writes one or more blocks.
- *
- * @param[in] sdcp pointer to the @p SDCDriver object
- * @param[in] startblk first block to write
- * @param[out] buf pointer to the write buffer
- * @param[in] n number of blocks to write
- *
- * @return The operation status.
- * @retval HAL_SUCCESS operation succeeded.
- * @retval HAL_FAILED operation failed.
- *
- * @notapi
- */
-bool sdc_lld_write_aligned(SDCDriver *sdcp, uint32_t startblk,
- const uint8_t *buf, uint32_t n) {
-
- (void)sdcp;
- (void)startblk;
- (void)buf;
- (void)n;
-
- return HAL_SUCCESS;
-}
-
-/**
- * @brief Reads one or more blocks.
- *
- * @param[in] sdcp pointer to the @p SDCDriver object
- * @param[in] startblk first block to read
- * @param[out] buf pointer to the read buffer
- * @param[in] n number of blocks to read
- *
- * @return The operation status.
- * @retval HAL_SUCCESS operation succeeded.
- * @retval HAL_FAILED operation failed.
- *
- * @notapi
- */
bool sdc_lld_read(SDCDriver *sdcp, uint32_t startblk,
uint8_t *buf, uint32_t n) {
@@ -367,6 +322,6 @@ bool sdc_lld_sync(SDCDriver *sdcp) {
return HAL_SUCCESS;
}
-#endif /* HAL_USE_SDC */
+#endif /* HAL_USE_SDC == TRUE */
/** @} */
diff --git a/os/hal/templates/sdc_lld.h b/os/hal/templates/sdc_lld.h
index 8378750a1..da1bee6fa 100644
--- a/os/hal/templates/sdc_lld.h
+++ b/os/hal/templates/sdc_lld.h
@@ -25,7 +25,7 @@
#ifndef _SDC_LLD_H_
#define _SDC_LLD_H_
-#if HAL_USE_SDC || defined(__DOXYGEN__)
+#if (HAL_USE_SDC == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -39,6 +39,14 @@
* @name PLATFORM configuration options
* @{
*/
+/**
+ * @brief PWMD1 driver enable switch.
+ * @details If set to @p TRUE the support for PWM1 is included.
+ * @note The default is @p FALSE.
+ */
+#if !defined(PLATFORM_SDC_USE_SDC1) || defined(__DOXYGEN__)
+#define PLATFORM_SDC_USE_SDC1 FALSE
+#endif
/** @} */
/*===========================================================================*/
@@ -135,7 +143,7 @@ struct SDCDriver {
/* External declarations. */
/*===========================================================================*/
-#if !defined(__DOXYGEN__)
+#if (PLATFORM_SDC_USE_SDC1 == TRUE) && !defined(__DOXYGEN__)
extern SDCDriver SDCD1;
#endif
@@ -159,9 +167,9 @@ extern "C" {
bool sdc_lld_read_special(SDCDriver *sdcp, uint8_t *buf, size_t bytes,
uint8_t cmd, uint32_t argument);
bool sdc_lld_read(SDCDriver *sdcp, uint32_t startblk,
- uint8_t *buf, uint32_t blocks);
+ uint8_t *buf, uint32_t n);
bool sdc_lld_write(SDCDriver *sdcp, uint32_t startblk,
- const uint8_t *buf, uint32_t blocks);
+ const uint8_t *buf, uint32_t n);
bool sdc_lld_sync(SDCDriver *sdcp);
bool sdc_lld_is_card_inserted(SDCDriver *sdcp);
bool sdc_lld_is_write_protected(SDCDriver *sdcp);
@@ -169,7 +177,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_SDC */
+#endif /* HAL_USE_SDC == TRUE */
#endif /* _SDC_LLD_H_ */
diff --git a/os/hal/templates/serial_lld.c b/os/hal/templates/serial_lld.c
index 83b38c80d..0d7cfc57e 100644
--- a/os/hal/templates/serial_lld.c
+++ b/os/hal/templates/serial_lld.c
@@ -24,7 +24,7 @@
#include "hal.h"
-#if HAL_USE_SERIAL || defined(__DOXYGEN__)
+#if (HAL_USE_SERIAL == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
@@ -35,7 +35,7 @@
/*===========================================================================*/
/** @brief USART1 serial driver identifier.*/
-#if PLATFORM_SERIAL_USE_USART1 || defined(__DOXYGEN__)
+#if (PLATFORM_SERIAL_USE_USART1 == TRUE) || defined(__DOXYGEN__)
SerialDriver SD1;
#endif
@@ -69,7 +69,7 @@ static const SerialConfig default_config = {
*/
void sd_lld_init(void) {
-#if PLATFORM_SERIAL_USE_USART1
+#if PLATFORM_SERIAL_USE_USART1 == TRUE
sdObjectInit(&SD1, NULL, notify1);
#endif
}
@@ -86,18 +86,20 @@ void sd_lld_init(void) {
*/
void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
- if (config == NULL)
+ if (config == NULL) {
config = &default_config;
+ }
+
if (sdp->state == SD_STOP) {
-#if PLATFORM_SERIAL_USE_USART1
+#if PLATFORM_SERIAL_USE_USART1 == TRUE
if (&SD1 == sdp) {
}
#endif
}
/* Configures the peripheral.*/
-
+ (void)config; /* Warning suppression, remove this.*/
}
/**
@@ -112,7 +114,7 @@ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
void sd_lld_stop(SerialDriver *sdp) {
if (sdp->state == SD_READY) {
-#if PLATFORM_SERIAL_USE_USART1
+#if PLATFORM_SERIAL_USE_USART1 == TRUE
if (&SD1 == sdp) {
}
@@ -120,6 +122,6 @@ void sd_lld_stop(SerialDriver *sdp) {
}
}
-#endif /* HAL_USE_SERIAL */
+#endif /* HAL_USE_SERIAL == TRUE */
/** @} */
diff --git a/os/hal/templates/serial_lld.h b/os/hal/templates/serial_lld.h
index ff84548de..af24dc339 100644
--- a/os/hal/templates/serial_lld.h
+++ b/os/hal/templates/serial_lld.h
@@ -25,7 +25,7 @@
#ifndef _SERIAL_LLD_H_
#define _SERIAL_LLD_H_
-#if HAL_USE_SERIAL || defined(__DOXYGEN__)
+#if (HAL_USE_SERIAL == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -42,7 +42,7 @@
/**
* @brief USART1 driver enable switch.
* @details If set to @p TRUE the support for USART1 is included.
- * @note The default is @p TRUE.
+ * @note The default is @p FALSE.
*/
#if !defined(PLATFORM_SERIAL_USE_USART1) || defined(__DOXYGEN__)
#define PLATFORM_SERIAL_USE_USART1 FALSE
@@ -98,7 +98,7 @@ typedef struct {
/* External declarations. */
/*===========================================================================*/
-#if PLATFORM_SERIAL_USE_USART1 && !defined(__DOXYGEN__)
+#if (PLATFORM_SERIAL_USE_USART1 == TRUE) && !defined(__DOXYGEN__)
extern SerialDriver SD1;
#endif
@@ -112,7 +112,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_SERIAL */
+#endif /* HAL_USE_SERIAL == TRUE */
#endif /* _SERIAL_LLD_H_ */
diff --git a/os/hal/templates/spi_lld.c b/os/hal/templates/spi_lld.c
index 44039d3c1..fe35ad525 100644
--- a/os/hal/templates/spi_lld.c
+++ b/os/hal/templates/spi_lld.c
@@ -24,7 +24,7 @@
#include "hal.h"
-#if HAL_USE_SPI || defined(__DOXYGEN__)
+#if (HAL_USE_SPI == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
@@ -37,7 +37,7 @@
/**
* @brief SPI1 driver identifier.
*/
-#if PLATFORM_SPI_USE_SPI1 || defined(__DOXYGEN__)
+#if (PLATFORM_SPI_USE_SPI1 == TRUE) || defined(__DOXYGEN__)
SPIDriver SPID1;
#endif
@@ -64,10 +64,10 @@ SPIDriver SPID1;
*/
void spi_lld_init(void) {
-#if PLATFORM_SPI_USE_SPI1
+#if PLATFORM_SPI_USE_SPI1 == TRUE
/* Driver initialization.*/
spiObjectInit(&SPID1);
-#endif /* PLATFORM_SPI_USE_SPI1 */
+#endif
}
/**
@@ -81,11 +81,11 @@ void spi_lld_start(SPIDriver *spip) {
if (spip->state == SPI_STOP) {
/* Enables the peripheral.*/
-#if PLATFORM_SPI_USE_SPI1
+#if PLATFORM_SPI_USE_SPI1 == TRUE
if (&SPID1 == spip) {
}
-#endif /* PLATFORM_SPI_USE_SPI1 */
+#endif
}
/* Configures the peripheral.*/
@@ -102,11 +102,11 @@ void spi_lld_stop(SPIDriver *spip) {
if (spip->state == SPI_READY) {
/* Disables the peripheral.*/
-#if PLATFORM_SPI_USE_SPI1
+#if PLATFORM_SPI_USE_SPI1 == TRUE
if (&SPID1 == spip) {
}
-#endif /* PLATFORM_SPI_USE_SPI1 */
+#endif
}
}
@@ -242,6 +242,6 @@ uint16_t spi_lld_polled_exchange(SPIDriver *spip, uint16_t frame) {
return 0;
}
-#endif /* HAL_USE_SPI */
+#endif /* HAL_USE_SPI == TRUE */
/** @} */
diff --git a/os/hal/templates/spi_lld.h b/os/hal/templates/spi_lld.h
index 379f1b059..c5984e1ed 100644
--- a/os/hal/templates/spi_lld.h
+++ b/os/hal/templates/spi_lld.h
@@ -25,7 +25,7 @@
#ifndef _SPI_LLD_H_
#define _SPI_LLD_H_
-#if HAL_USE_SPI || defined(__DOXYGEN__)
+#if (HAL_USE_SPI == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -41,6 +41,8 @@
*/
/**
* @brief SPI1 driver enable switch.
+ * @details If set to @p TRUE the support for SPI1 is included.
+ * @note The default is @p FALSE.
*/
#if !defined(PLATFORM_SPI_USE_SPI1) || defined(__DOXYGEN__)
#define PLATFORM_SPI_USE_SPI1 FALSE
@@ -95,18 +97,18 @@ struct SPIDriver {
* @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
+#if (SPI_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
/**
* @brief Mutex protecting the peripheral.
*/
mutex_t mutex;
-#endif /* SPI_USE_MUTUAL_EXCLUSION */
+#endif
#if defined(SPI_DRIVER_EXT_FIELDS)
SPI_DRIVER_EXT_FIELDS
#endif
@@ -121,7 +123,7 @@ struct SPIDriver {
/* External declarations. */
/*===========================================================================*/
-#if PLATFORM_SPI_USE_SPI1 && !defined(__DOXYGEN__)
+#if (PLATFORM_SPI_USE_SPI1 == TRUE) && !defined(__DOXYGEN__)
extern SPIDriver SPID1;
#endif
@@ -143,7 +145,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_SPI */
+#endif /* HAL_USE_SPI == TRUE */
#endif /* _SPI_LLD_H_ */
diff --git a/os/hal/templates/st_lld.h b/os/hal/templates/st_lld.h
index cded1fabd..eefd691df 100644
--- a/os/hal/templates/st_lld.h
+++ b/os/hal/templates/st_lld.h
@@ -80,13 +80,13 @@ static inline systime_t st_lld_get_counter(void) {
* @note Makes sure that no spurious alarms are triggered after
* this call.
*
- * @param[in] time the time to be set for the first alarm
+ * @param[in] abstime the time to be set for the first alarm
*
* @notapi
*/
-static inline void st_lld_start_alarm(systime_t time) {
+static inline void st_lld_start_alarm(systime_t abstime) {
- (void)time;
+ (void)abstime;
}
/**
@@ -101,13 +101,13 @@ static inline void st_lld_stop_alarm(void) {
/**
* @brief Sets the alarm time.
*
- * @param[in] time the time to be set for the next alarm
+ * @param[in] abstime the time to be set for the next alarm
*
* @notapi
*/
-static inline void st_lld_set_alarm(systime_t time) {
+static inline void st_lld_set_alarm(systime_t abstime) {
- (void)time;
+ (void)abstime;
}
/**
diff --git a/os/hal/templates/uart_lld.c b/os/hal/templates/uart_lld.c
index 5617b7e2d..7b93db51f 100644
--- a/os/hal/templates/uart_lld.c
+++ b/os/hal/templates/uart_lld.c
@@ -24,7 +24,7 @@
#include "hal.h"
-#if HAL_USE_UART || defined(__DOXYGEN__)
+#if (HAL_USE_UART == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
@@ -37,7 +37,7 @@
/**
* @brief UART1 driver identifier.
*/
-#if PLATFORM_UART_USE_UART1 || defined(__DOXYGEN__)
+#if (PLATFORM_UART_USE_UART1 == TRUE) || defined(__DOXYGEN__)
UARTDriver UARTD1;
#endif
@@ -64,10 +64,10 @@ UARTDriver UARTD1;
*/
void uart_lld_init(void) {
-#if PLATFORM_UART_USE_UART1
+#if PLATFORM_UART_USE_UART1 == TRUE
/* Driver initialization.*/
uartObjectInit(&UARTD1);
-#endif /* PLATFORM_UART_USE_UART1 */
+#endif
}
/**
@@ -81,11 +81,11 @@ void uart_lld_start(UARTDriver *uartp) {
if (uartp->state == UART_STOP) {
/* Enables the peripheral.*/
-#if PLATFORM_UART_USE_UART1
+#if PLATFORM_UART_USE_UART1 == TRUE
if (&UARTD1 == uartp) {
}
-#endif /* PLATFORM_UART_USE_UART1 */
+#endif
}
/* Configures the peripheral.*/
@@ -104,11 +104,11 @@ void uart_lld_stop(UARTDriver *uartp) {
/* Resets the peripheral.*/
/* Disables the peripheral.*/
-#if PLATFORM_UART_USE_UART1
+#if PLATFORM_UART_USE_UART1 == TRUE
if (&UARTD1 == uartp) {
}
-#endif /* PLATFORM_UART_USE_UART1 */
+#endif
}
}
@@ -186,6 +186,6 @@ size_t uart_lld_stop_receive(UARTDriver *uartp) {
return 0;
}
-#endif /* HAL_USE_UART */
+#endif /* HAL_USE_UART == TRUE */
/** @} */
diff --git a/os/hal/templates/uart_lld.h b/os/hal/templates/uart_lld.h
index 2a3128941..13d105b16 100644
--- a/os/hal/templates/uart_lld.h
+++ b/os/hal/templates/uart_lld.h
@@ -25,7 +25,7 @@
#ifndef _UART_LLD_H_
#define _UART_LLD_H_
-#if HAL_USE_UART || defined(__DOXYGEN__)
+#if (HAL_USE_UART == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -42,6 +42,7 @@
/**
* @brief UART driver enable switch.
* @details If set to @p TRUE the support for UART1 is included.
+ * @note The default is @p FALSE.
*/
#if !defined(PLATFORM_UART_USE_UART1) || defined(__DOXYGEN__)
#define PLATFORM_UART_USE_UART1 FALSE
@@ -156,7 +157,7 @@ struct UARTDriver {
/* External declarations. */
/*===========================================================================*/
-#if PLATFORM_UART_USE_UART1 && !defined(__DOXYGEN__)
+#if (PLATFORM_UART_USE_UART1 == TRUE) && !defined(__DOXYGEN__)
extern UARTDriver UARTD1;
#endif
@@ -174,7 +175,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_UART */
+#endif /* HAL_USE_UART == TRUE */
#endif /* _UART_LLD_H_ */
diff --git a/os/hal/templates/usb_lld.c b/os/hal/templates/usb_lld.c
index bfb214d7f..ac3ec32b4 100644
--- a/os/hal/templates/usb_lld.c
+++ b/os/hal/templates/usb_lld.c
@@ -24,7 +24,7 @@
#include "hal.h"
-#if HAL_USE_USB || defined(__DOXYGEN__)
+#if (HAL_USE_USB == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
@@ -37,7 +37,7 @@
/**
* @brief USB1 driver identifier.
*/
-#if PLATFORM_USB_USE_USB1 || defined(__DOXYGEN__)
+#if (PLATFORM_USB_USE_USB1 == TRUE) || defined(__DOXYGEN__)
USBDriver USBD1;
#endif
@@ -98,10 +98,10 @@ static const USBEndpointConfig ep0config = {
*/
void usb_lld_init(void) {
-#if PLATFORM_USB_USE_USB1
+#if PLATFORM_USB_USE_USB1 == TRUE
/* Driver initialization.*/
usbObjectInit(&USBD1);
-#endif /* PLATFORM_USB_USE_USB1 */
+#endif
}
/**
@@ -115,11 +115,11 @@ void usb_lld_start(USBDriver *usbp) {
if (usbp->state == USB_STOP) {
/* Enables the peripheral.*/
-#if PLATFORM_USB_USE_USB1
+#if PLATFORM_USB_USE_USB1 == TRUE
if (&USBD1 == usbp) {
}
-#endif /* PLATFORM_USB_USE_USB1 */
+#endif
}
/* Configures the peripheral.*/
@@ -138,11 +138,11 @@ void usb_lld_stop(USBDriver *usbp) {
/* Resets the peripheral.*/
/* Disables the peripheral.*/
-#if PLATFORM_USB_USE_USB1
+#if PLATFORM_USB_USE_USB1 == TRUE
if (&USBD1 == usbp) {
}
-#endif /* PLATFORM_USB_USE_USB1 */
+#endif
}
}
@@ -385,6 +385,6 @@ void usb_lld_clear_in(USBDriver *usbp, usbep_t ep) {
}
-#endif /* HAL_USE_USB */
+#endif /* HAL_USE_USB == TRUE */
/** @} */
diff --git a/os/hal/templates/usb_lld.h b/os/hal/templates/usb_lld.h
index c02a37fca..8d0d4c860 100644
--- a/os/hal/templates/usb_lld.h
+++ b/os/hal/templates/usb_lld.h
@@ -25,7 +25,7 @@
#ifndef _USB_LLD_H_
#define _USB_LLD_H_
-#if HAL_USE_USB || defined(__DOXYGEN__)
+#if (HAL_USE_USB == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
@@ -62,6 +62,7 @@
/**
* @brief USB driver enable switch.
* @details If set to @p TRUE the support for USB1 is included.
+ * @note The default is @p FALSE.
*/
#if !defined(PLATFORM_USB_USE_USB1) || defined(__DOXYGEN__)
#define PLATFORM_USB_USE_USB1 FALSE
@@ -351,7 +352,7 @@ struct USBDriver {
/* External declarations. */
/*===========================================================================*/
-#if PLATFORM_USB_USE_USB1 && !defined(__DOXYGEN__)
+#if (PLATFORM_USB_USE_USB1 == TRUE) && !defined(__DOXYGEN__)
extern USBDriver USBD1;
#endif
@@ -380,7 +381,7 @@ extern "C" {
}
#endif
-#endif /* HAL_USE_USB */
+#endif /* HAL_USE_USB == TRUE */
#endif /* _USB_LLD_H_ */