From 9d9a04e4645b9f4b70e74dd4245a1412e82c902a Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 3 Sep 2017 15:48:09 +0000 Subject: SPI driver improvements. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10545 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/STM32/LLD/SPIv1/hal_spi_lld.h | 32 ++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'os/hal/ports/STM32/LLD/SPIv1/hal_spi_lld.h') 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 2f3435ea2..b2755f31b 100644 --- a/os/hal/ports/STM32/LLD/SPIv1/hal_spi_lld.h +++ b/os/hal/ports/STM32/LLD/SPIv1/hal_spi_lld.h @@ -396,6 +396,10 @@ #define STM32_DMA_REQUIRED #endif +#if SPI_SELECT_MODE == SPI_SELECT_MODE_LLD +#error "SPI_SELECT_MODE_LLD not supported by this driver" +#endif + /*===========================================================================*/ /* Driver data structures and types. */ /*===========================================================================*/ @@ -421,15 +425,33 @@ typedef struct { * @brief Operation complete callback or @p NULL. */ spicallback_t end_cb; - /* End of the mandatory fields.*/ +#if (SPI_SELECT_MODE == SPI_SELECT_MODE_LINE) || defined(__DOXYGEN__) + /** + * @brief The chip select line. + */ + ioportid_t ssline; +#endif +#if (SPI_SELECT_MODE == SPI_SELECT_MODE_PORT) || defined(__DOXYGEN__) /** - * @brief The chip select line port. + * @brief The chip select port. */ ioportid_t ssport; /** - * @brief The chip select line pad number. + * @brief The chip select port mask. */ - uint16_t sspad; + uint8fast_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. */ @@ -528,8 +550,10 @@ extern "C" { void spi_lld_init(void); void spi_lld_start(SPIDriver *spip); void spi_lld_stop(SPIDriver *spip); +#if (SPI_SELECT_MODE == SPI_SELECT_MODE_LLD) || defined(__DOXYGEN__) void spi_lld_select(SPIDriver *spip); void spi_lld_unselect(SPIDriver *spip); +#endif void spi_lld_ignore(SPIDriver *spip, size_t n); void spi_lld_exchange(SPIDriver *spip, size_t n, const void *txbuf, void *rxbuf); -- cgit v1.2.3