From 18fb8f676f0f650d83f69bc29ab45b04b73e86c1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 8 Mar 2011 10:09:57 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2808 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/STM8S/spi_lld.c | 42 ++++++++++++++++++++-------------------- os/hal/platforms/STM8S/spi_lld.h | 26 ++++++++++++------------- 2 files changed, 34 insertions(+), 34 deletions(-) (limited to 'os/hal/platforms/STM8S') diff --git a/os/hal/platforms/STM8S/spi_lld.c b/os/hal/platforms/STM8S/spi_lld.c index c950f0bd4..436a94f2b 100644 --- a/os/hal/platforms/STM8S/spi_lld.c +++ b/os/hal/platforms/STM8S/spi_lld.c @@ -70,12 +70,12 @@ CH_IRQ_HANDLER(10) { handle the case where a frame arrives immediately after reading the DR register.*/ while ((SPI->SR & SPI_SR_RXNE) != 0) { - if (SPID1.spd_rxptr != NULL) - *SPID1.spd_rxptr++ = SPI->DR; + if (SPID1.rxptr != NULL) + *SPID1.rxptr++ = SPI->DR; else (void)SPI->DR; - if (--SPID1.spd_rxcnt == 0) { - chDbgAssert(SPID1.spd_txcnt == 0, + if (--SPID1.rxcnt == 0) { + chDbgAssert(SPID1.txcnt == 0, "IRQ10, #1", "counter out of synch"); /* Stops all the IRQ sources.*/ SPI->ICR = 0; @@ -89,8 +89,8 @@ CH_IRQ_HANDLER(10) { } /* Loading the DR register.*/ if ((SPI->SR & SPI_SR_TXE) != 0) { - if (SPID1.spd_txptr != NULL) - SPI->DR = *SPID1.spd_txptr++; + if (SPID1.txptr != NULL) + SPI->DR = *SPID1.txptr++; else SPI->DR = 0xFF; } @@ -130,7 +130,7 @@ void spi_lld_start(SPIDriver *spip) { /* Configuration.*/ SPI->CR2 = 0; - SPI->CR1 = spip->spd_config->spc_cr1 | SPI_CR1_MSTR | SPI_CR1_SPE; + SPI->CR1 = spip->config->cr1 | SPI_CR1_MSTR | SPI_CR1_SPE; } /** @@ -162,7 +162,7 @@ void spi_lld_stop(SPIDriver *spip) { */ void spi_lld_select(SPIDriver *spip) { - palClearPad(spip->spd_config->spc_ssport, spip->spd_config->spc_sspad); + palClearPad(spip->config->ssport, spip->config->sspad); } /** @@ -175,7 +175,7 @@ void spi_lld_select(SPIDriver *spip) { */ void spi_lld_unselect(SPIDriver *spip) { - palSetPad(spip->spd_config->spc_ssport, spip->spd_config->spc_sspad); + palSetPad(spip->config->ssport, spip->config->sspad); } /** @@ -191,9 +191,9 @@ void spi_lld_unselect(SPIDriver *spip) { */ void spi_lld_ignore(SPIDriver *spip, size_t n) { - spip->spd_rxptr = NULL; - spip->spd_txptr = NULL; - spip->spd_rxcnt = spip->spd_txcnt = n; + spip->rxptr = NULL; + spip->txptr = NULL; + spip->rxcnt = spip->txcnt = n; SPI->ICR = SPI_ICR_TXEI | SPI_ICR_RXEI | SPI_ICR_ERRIE; } @@ -215,9 +215,9 @@ void spi_lld_ignore(SPIDriver *spip, size_t n) { void spi_lld_exchange(SPIDriver *spip, size_t n, const void *txbuf, void *rxbuf) { - spip->spd_rxptr = rxbuf; - spip->spd_txptr = txbuf; - spip->spd_rxcnt = spip->spd_txcnt = n; + spip->rxptr = rxbuf; + spip->txptr = txbuf; + spip->rxcnt = spip->txcnt = n; SPI->ICR = SPI_ICR_TXEI | SPI_ICR_RXEI | SPI_ICR_ERRIE; } @@ -236,9 +236,9 @@ void spi_lld_exchange(SPIDriver *spip, size_t n, */ void spi_lld_send(SPIDriver *spip, size_t n, const void *txbuf) { - spip->spd_rxptr = NULL; - spip->spd_txptr = txbuf; - spip->spd_rxcnt = spip->spd_txcnt = n; + spip->rxptr = NULL; + spip->txptr = txbuf; + spip->rxcnt = spip->txcnt = n; SPI->ICR = SPI_ICR_TXEI | SPI_ICR_RXEI | SPI_ICR_ERRIE; } @@ -257,9 +257,9 @@ void spi_lld_send(SPIDriver *spip, size_t n, const void *txbuf) { */ void spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf) { - spip->spd_rxptr = rxbuf; - spip->spd_txptr = NULL; - spip->spd_rxcnt = spip->spd_txcnt = n; + spip->rxptr = rxbuf; + spip->txptr = NULL; + spip->rxcnt = spip->txcnt = n; SPI->ICR = SPI_ICR_TXEI | SPI_ICR_RXEI | SPI_ICR_ERRIE; } diff --git a/os/hal/platforms/STM8S/spi_lld.h b/os/hal/platforms/STM8S/spi_lld.h index 1f665d01a..b81241fd0 100644 --- a/os/hal/platforms/STM8S/spi_lld.h +++ b/os/hal/platforms/STM8S/spi_lld.h @@ -87,20 +87,20 @@ typedef struct { /** * @brief Operation complete callback or @p NULL. */ - spicallback_t spc_endcb; + spicallback_t end_cb; /* End of the mandatory fields.*/ /** * @brief The chip select line port. */ - ioportid_t spc_ssport; + ioportid_t ssport; /** * @brief The chip select line pad number. */ - uint16_t spc_sspad; + uint16_t sspad; /** * @brief SPI initialization data. */ - uint8_t spc_cr1; + uint8_t cr1; } SPIConfig; /** @@ -110,25 +110,25 @@ struct SPIDriver { /** * @brief Driver state. */ - spistate_t spd_state; + spistate_t state; /** * @brief Current configuration data. */ - const SPIConfig *spd_config; + const SPIConfig *config; #if SPI_USE_WAIT || defined(__DOXYGEN__) /** * @brief Waiting thread. */ - Thread *spd_thread; + Thread *thread; #endif /* SPI_USE_WAIT */ #if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) #if CH_USE_MUTEXES || defined(__DOXYGEN__) /** * @brief Mutex protecting the bus. */ - Mutex spd_mutex; + Mutex mutex; #elif CH_USE_SEMAPHORES - Semaphore spd_semaphore; + Semaphore semaphore; #endif #endif /* SPI_USE_MUTUAL_EXCLUSION */ #if defined(SPI_DRIVER_EXT_FIELDS) @@ -138,19 +138,19 @@ struct SPIDriver { /** * @brief Number of bytes yet to be received. */ - uint16_t spd_rxcnt; + uint16_t rxcnt; /** * @brief Receive pointer or @p NULL. */ - uint8_t *spd_rxptr; + uint8_t *rxptr; /** * @brief Number of bytes yet to be transmitted. */ - uint16_t spd_txcnt; + uint16_t txcnt; /** * @brief Transmit pointer or @p NULL. */ - const uint8_t *spd_txptr; + const uint8_t *txptr; }; /*===========================================================================*/ -- cgit v1.2.3