diff options
| author | Fabien Poussin <fabien.poussin@gmail.com> | 2017-09-10 23:25:30 +0200 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-10 23:25:30 +0200 | 
| commit | f16bd4416a021b4d36682a976ca4d7388a18b50b (patch) | |
| tree | fc5513caa5e6739f7bd2718a9f71b8128a2ffa39 | |
| parent | 5a9ac0f9406bf4a6f11fe03e62b7b0f4cb94a3d6 (diff) | |
| parent | 1cc29880400d5fd5ec3bb592a0d68354c78ec327 (diff) | |
| download | ChibiOS-Contrib-f16bd4416a021b4d36682a976ca4d7388a18b50b.tar.gz ChibiOS-Contrib-f16bd4416a021b4d36682a976ca4d7388a18b50b.tar.bz2 ChibiOS-Contrib-f16bd4416a021b4d36682a976ca4d7388a18b50b.zip  | |
Merge pull request #126 from marcoveeneman/tiva_spi_update
Aligned the Tiva port to the SPI driver improvements.
| -rw-r--r-- | os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.c | 6 | ||||
| -rw-r--r-- | os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.h | 36 | 
2 files changed, 34 insertions, 8 deletions
diff --git a/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.c b/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.c index 98defed..126959f 100644 --- a/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.c +++ b/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.c @@ -359,6 +359,7 @@ void spi_lld_stop(SPIDriver *spip)    }  } +#if (SPI_SELECT_MODE == SPI_SELECT_MODE_LLD) || defined(__DOXYGEN__)  /**   * @brief   Asserts the slave select signal and prepares for transfers.   * @@ -368,7 +369,7 @@ void spi_lld_stop(SPIDriver *spip)   */  void spi_lld_select(SPIDriver *spip)  { -  palClearPad(spip->config->ssport, spip->config->sspad); +  /* No implementation on Tiva.*/  }  /** @@ -381,8 +382,9 @@ void spi_lld_select(SPIDriver *spip)   */  void spi_lld_unselect(SPIDriver *spip)  { -  palSetPad(spip->config->ssport, spip->config->sspad); +  /* No implementation on Tiva.*/  } +#endif  /**   * @brief   Ignores data on the SPI bus. diff --git a/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.h b/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.h index 64560eb..4dcf6db 100644 --- a/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.h +++ b/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.h @@ -165,6 +165,10 @@  #define TIVA_UDMA_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.                                         */  /*===========================================================================*/ @@ -189,16 +193,34 @@ typedef struct {    /**     * @brief Operation complete callback or @p NULL.     */ -  spicallback_t         end_cb; -  /* End of the mandatory fields.*/ +  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 line port. +   * @brief The chip select port mask.     */ -  ioportid_t            ssport; +  uint8fast_t               ssmask; +#endif +#if (SPI_SELECT_MODE == SPI_SELECT_MODE_PAD) || defined(__DOXYGEN__)    /** -   * @brief The chip select line pad number. +   * @brief The chip select port.     */ -  uint16_t              sspad; +  ioportid_t                ssport; +  /** +   * @brief The chip select pad number. +   */ +  uint_fast8_t              sspad; +#endif +  /* End of the mandatory fields.*/    /**     * @brief SSI CR0 initialization data.     */ @@ -289,8 +311,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);  | 
