aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/LLD/SPIv1/hal_spi_lld.h
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2018-12-08 11:23:21 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2018-12-08 11:23:21 +0000
commitf3249c78d9353bca99172f5cbbc6b7fb0c64c665 (patch)
tree66d4f82230e664021b0999ce97a827660432346f /os/hal/ports/STM32/LLD/SPIv1/hal_spi_lld.h
parent53093a74b030cffbb4ebd78adaa4707ea4ecf9db (diff)
downloadChibiOS-f3249c78d9353bca99172f5cbbc6b7fb0c64c665.tar.gz
ChibiOS-f3249c78d9353bca99172f5cbbc6b7fb0c64c665.tar.bz2
ChibiOS-f3249c78d9353bca99172f5cbbc6b7fb0c64c665.zip
LLD drivers organization changes: RTC, SPI.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12463 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os/hal/ports/STM32/LLD/SPIv1/hal_spi_lld.h')
-rw-r--r--os/hal/ports/STM32/LLD/SPIv1/hal_spi_lld.h132
1 files changed, 21 insertions, 111 deletions
diff --git a/os/hal/ports/STM32/LLD/SPIv1/hal_spi_lld.h b/os/hal/ports/STM32/LLD/SPIv1/hal_spi_lld.h
index 62b9c061c..09a6eec01 100644
--- a/os/hal/ports/STM32/LLD/SPIv1/hal_spi_lld.h
+++ b/os/hal/ports/STM32/LLD/SPIv1/hal_spi_lld.h
@@ -409,123 +409,33 @@
/* Driver data structures and types. */
/*===========================================================================*/
-/**
- * @brief Type of a structure representing an SPI driver.
- */
-typedef struct SPIDriver SPIDriver;
-
-/**
- * @brief SPI notification callback type.
- *
- * @param[in] spip pointer to the @p SPIDriver object triggering the
- * callback
- */
-typedef void (*spicallback_t)(SPIDriver *spip);
+/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
/**
- * @brief Driver configuration structure.
+ * @brief Low level fields of the SPI driver structure.
*/
-typedef struct {
-#if (SPI_SUPPORTS_CIRCULAR == TRUE) || defined(__DOXYGEN__)
- /**
- * @brief Enables the circular buffer mode.
- */
- bool circular;
-#endif
- /**
- * @brief Operation complete callback or @p NULL.
- */
- spicallback_t end_cb;
-#if (SPI_SELECT_MODE == SPI_SELECT_MODE_LINE) || defined(__DOXYGEN__)
- /**
- * @brief The chip select line.
- */
- ioline_t ssline;
-#endif
-#if (SPI_SELECT_MODE == SPI_SELECT_MODE_PORT) || defined(__DOXYGEN__)
- /**
- * @brief The chip select port.
- */
- ioportid_t ssport;
- /**
- * @brief The chip select port mask.
- */
- ioportmask_t ssmask;
-#endif
-#if (SPI_SELECT_MODE == SPI_SELECT_MODE_PAD) || defined(__DOXYGEN__)
- /**
- * @brief The chip select port.
- */
- ioportid_t ssport;
- /**
- * @brief The chip select pad number.
- */
- uint_fast8_t sspad;
-#endif
- /* End of the mandatory fields.*/
- /**
- * @brief SPI CR1 register initialization data.
- */
- uint16_t cr1;
- /**
- * @brief SPI CR2 register initialization data.
- */
- uint16_t cr2;
-} SPIConfig;
+#define spi_lld_driver_fields \
+ /* Pointer to the SPIx registers block.*/ \
+ SPI_TypeDef *spi; \
+ /* Receive DMA stream.*/ \
+ const stm32_dma_stream_t *dmarx; \
+ /* Transmit DMA stream.*/ \
+ const stm32_dma_stream_t *dmatx; \
+ /* RX DMA mode bit mask.*/ \
+ uint32_t rxdmamode; \
+ /* TX DMA mode bit mask.*/ \
+ uint32_t txdmamode
/**
- * @brief Structure representing an SPI driver.
+ * @brief Low level fields of the SPI configuration structure.
*/
-struct SPIDriver {
- /**
- * @brief Driver state.
- */
- spistate_t state;
- /**
- * @brief Current configuration data.
- */
- const SPIConfig *config;
-#if SPI_USE_WAIT || defined(__DOXYGEN__)
- /**
- * @brief Waiting thread.
- */
- thread_reference_t thread;
-#endif /* SPI_USE_WAIT */
-#if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
- /**
- * @brief Mutex protecting the bus.
- */
- mutex_t mutex;
-#endif /* SPI_USE_MUTUAL_EXCLUSION */
-#if defined(SPI_DRIVER_EXT_FIELDS)
- SPI_DRIVER_EXT_FIELDS
-#endif
- /* End of the mandatory fields.*/
- /**
- * @brief Pointer to the SPIx registers block.
- */
- SPI_TypeDef *spi;
- /**
- * @brief Receive DMA stream.
- */
- const stm32_dma_stream_t *dmarx;
- /**
- * @brief Transmit DMA stream.
- */
- const stm32_dma_stream_t *dmatx;
- /**
- * @brief RX DMA mode bit mask.
- */
- uint32_t rxdmamode;
- /**
- * @brief TX DMA mode bit mask.
- */
- uint32_t txdmamode;
-};
-
-/*===========================================================================*/
-/* Driver macros. */
-/*===========================================================================*/
+#define spi_lld_config_fields \
+ /* SPI CR1 register initialization data.*/ \
+ uint16_t cr1; \
+ /* SPI CR2 register initialization data.*/ \
+ uint16_t cr2
/*===========================================================================*/
/* External declarations. */