aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/src/spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/src/spi.c')
-rw-r--r--os/hal/src/spi.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/os/hal/src/spi.c b/os/hal/src/spi.c
index 7f7a9f021..2bbdc0ea7 100644
--- a/os/hal/src/spi.c
+++ b/os/hal/src/spi.c
@@ -27,7 +27,7 @@
#include "hal.h"
-#if HAL_USE_SPI || defined(__DOXYGEN__)
+#if (HAL_USE_SPI == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
@@ -72,12 +72,12 @@ void spiObjectInit(SPIDriver *spip) {
spip->state = SPI_STOP;
spip->config = NULL;
-#if SPI_USE_WAIT
+#if SPI_USE_WAIT == TRUE
spip->thread = NULL;
-#endif /* SPI_USE_WAIT */
-#if SPI_USE_MUTUAL_EXCLUSION
+#endif
+#if SPI_USE_MUTUAL_EXCLUSION == TRUE
osalMutexObjectInit(&spip->mutex);
-#endif /* SPI_USE_MUTUAL_EXCLUSION */
+#endif
#if defined(SPI_DRIVER_EXT_INIT_HOOK)
SPI_DRIVER_EXT_INIT_HOOK(spip);
#endif
@@ -175,7 +175,7 @@ void spiUnselect(SPIDriver *spip) {
*/
void spiStartIgnore(SPIDriver *spip, size_t n) {
- osalDbgCheck((spip != NULL) && (n > 0));
+ osalDbgCheck((spip != NULL) && (n > 0U));
osalSysLock();
osalDbgAssert(spip->state == SPI_READY, "not ready");
@@ -203,7 +203,8 @@ void spiStartIgnore(SPIDriver *spip, size_t n) {
void spiStartExchange(SPIDriver *spip, size_t n,
const void *txbuf, void *rxbuf) {
- osalDbgCheck((spip != NULL) && (n > 0) && (rxbuf != NULL) && (txbuf != NULL));
+ osalDbgCheck((spip != NULL) && (n > 0U) &&
+ (rxbuf != NULL) && (txbuf != NULL));
osalSysLock();
osalDbgAssert(spip->state == SPI_READY, "not ready");
@@ -228,7 +229,7 @@ void spiStartExchange(SPIDriver *spip, size_t n,
*/
void spiStartSend(SPIDriver *spip, size_t n, const void *txbuf) {
- osalDbgCheck((spip != NULL) && (n > 0) && (txbuf != NULL));
+ osalDbgCheck((spip != NULL) && (n > 0U) && (txbuf != NULL));
osalSysLock();
osalDbgAssert(spip->state == SPI_READY, "not ready");
@@ -253,7 +254,7 @@ void spiStartSend(SPIDriver *spip, size_t n, const void *txbuf) {
*/
void spiStartReceive(SPIDriver *spip, size_t n, void *rxbuf) {
- osalDbgCheck((spip != NULL) && (n > 0) && (rxbuf != NULL));
+ osalDbgCheck((spip != NULL) && (n > 0U) && (rxbuf != NULL));
osalSysLock();
osalDbgAssert(spip->state == SPI_READY, "not ready");
@@ -261,7 +262,7 @@ void spiStartReceive(SPIDriver *spip, size_t n, void *rxbuf) {
osalSysUnlock();
}
-#if SPI_USE_WAIT || defined(__DOXYGEN__)
+#if (SPI_USE_WAIT == TRUE) || defined(__DOXYGEN__)
/**
* @brief Ignores data on the SPI bus.
* @details This synchronous function performs the transmission of a series of
@@ -278,7 +279,7 @@ void spiStartReceive(SPIDriver *spip, size_t n, void *rxbuf) {
*/
void spiIgnore(SPIDriver *spip, size_t n) {
- osalDbgCheck((spip != NULL) && (n > 0));
+ osalDbgCheck((spip != NULL) && (n > 0U));
osalSysLock();
osalDbgAssert(spip->state == SPI_READY, "not ready");
@@ -309,7 +310,7 @@ void spiIgnore(SPIDriver *spip, size_t n) {
void spiExchange(SPIDriver *spip, size_t n,
const void *txbuf, void *rxbuf) {
- osalDbgCheck((spip != NULL) && (n > 0) &&
+ osalDbgCheck((spip != NULL) && (n > 0U) &&
(rxbuf != NULL) && (txbuf != NULL));
osalSysLock();
@@ -338,7 +339,7 @@ void spiExchange(SPIDriver *spip, size_t n,
*/
void spiSend(SPIDriver *spip, size_t n, const void *txbuf) {
- osalDbgCheck((spip != NULL) && (n > 0) && (txbuf != NULL));
+ osalDbgCheck((spip != NULL) && (n > 0U) && (txbuf != NULL));
osalSysLock();
osalDbgAssert(spip->state == SPI_READY, "not ready");
@@ -366,7 +367,7 @@ void spiSend(SPIDriver *spip, size_t n, const void *txbuf) {
*/
void spiReceive(SPIDriver *spip, size_t n, void *rxbuf) {
- osalDbgCheck((spip != NULL) && (n > 0) && (rxbuf != NULL));
+ osalDbgCheck((spip != NULL) && (n > 0U) && (rxbuf != NULL));
osalSysLock();
osalDbgAssert(spip->state == SPI_READY, "not ready");
@@ -375,9 +376,9 @@ void spiReceive(SPIDriver *spip, size_t n, void *rxbuf) {
_spi_wait_s(spip);
osalSysUnlock();
}
-#endif /* SPI_USE_WAIT */
+#endif /* SPI_USE_WAIT == TRUE */
-#if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
+#if (SPI_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
/**
* @brief Gains exclusive access to the SPI bus.
* @details This function tries to gain ownership to the SPI bus, if the bus
@@ -411,8 +412,8 @@ void spiReleaseBus(SPIDriver *spip) {
osalMutexUnlock(&spip->mutex);
}
-#endif /* SPI_USE_MUTUAL_EXCLUSION */
+#endif /* SPI_USE_MUTUAL_EXCLUSION == TRUE */
-#endif /* HAL_USE_SPI */
+#endif /* HAL_USE_SPI == TRUE */
/** @} */