aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM32/spi_lld.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-10-11 18:55:06 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-10-11 18:55:06 +0000
commit441509bc2c585151a5d5974337d6fd2e156eab2a (patch)
treeda3717d5decdd19548c46c8438340d9704140854 /os/hal/platforms/STM32/spi_lld.c
parent7c2a8e13d969029fb675e67c57349c1deaa09284 (diff)
downloadChibiOS-441509bc2c585151a5d5974337d6fd2e156eab2a.tar.gz
ChibiOS-441509bc2c585151a5d5974337d6fd2e156eab2a.tar.bz2
ChibiOS-441509bc2c585151a5d5974337d6fd2e156eab2a.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2247 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32/spi_lld.c')
-rw-r--r--os/hal/platforms/STM32/spi_lld.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/os/hal/platforms/STM32/spi_lld.c b/os/hal/platforms/STM32/spi_lld.c
index bb69f8c5f..cbb7859a3 100644
--- a/os/hal/platforms/STM32/spi_lld.c
+++ b/os/hal/platforms/STM32/spi_lld.c
@@ -53,6 +53,9 @@ SPIDriver SPID3;
/* Driver local variables. */
/*===========================================================================*/
+static uint16_t dummytx;
+static uint16_t dummyrx;
+
/*===========================================================================*/
/* Driver local functions. */
/*===========================================================================*/
@@ -84,7 +87,7 @@ SPIDriver SPID3;
*/
static void serve_interrupt(SPIDriver *spip) {
- /* Stops everything.*/
+ /* Stop everything.*/
dma_stop(spip);
/* If a callback is defined then invokes it.*/
@@ -216,6 +219,8 @@ CH_IRQ_HANDLER(DMA2_Ch2_IRQHandler) {
*/
void spi_lld_init(void) {
+ dummytx = 0xFFFF;
+
#if STM32_SPI_USE_SPI1
RCC->APB2RSTR = RCC_APB2RSTR_SPI1RST;
RCC->APB2RSTR = 0;
@@ -388,8 +393,6 @@ void spi_lld_unselect(SPIDriver *spip) {
* @notapi
*/
void spi_lld_ignore(SPIDriver *spip, size_t n) {
- uint16_t dummyrx;
- uint16_t dummytx = 0xFFFF;
dmaChannelSetup(spip->spd_dmarx, n, &dummyrx,
spip->spd_dmaccr | DMA_CCR1_TCIE);
@@ -437,7 +440,6 @@ void spi_lld_exchange(SPIDriver *spip, size_t n,
* @notapi
*/
void spi_lld_send(SPIDriver *spip, size_t n, const void *txbuf) {
- uint16_t dummyrx;
dmaChannelSetup(spip->spd_dmarx, n, &dummyrx,
spip->spd_dmaccr | DMA_CCR1_TCIE);
@@ -460,7 +462,6 @@ void spi_lld_send(SPIDriver *spip, size_t n, const void *txbuf) {
* @notapi
*/
void spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf) {
- uint16_t dummytx = 0xFFFF;
dmaChannelSetup(spip->spd_dmarx, n, rxbuf,
spip->spd_dmaccr | DMA_CCR1_TCIE | DMA_CCR1_MINC);