From 7a6a1679a413987ffa47f2f9892e241f3448f5f0 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 24 May 2012 18:31:34 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4232 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/STM32/spi_lld.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'os/hal/platforms/STM32/spi_lld.c') diff --git a/os/hal/platforms/STM32/spi_lld.c b/os/hal/platforms/STM32/spi_lld.c index eeeb47f53..113b89fe1 100644 --- a/os/hal/platforms/STM32/spi_lld.c +++ b/os/hal/platforms/STM32/spi_lld.c @@ -273,13 +273,20 @@ void spi_lld_start(SPIDriver *spip) { } /* Configuration-specific DMA setup.*/ - if ((spip->config->cr1 & SPI_CR1_DFF) == 0) { /* 8 bits transfers. */ +#if defined(STM32F0XX) + if ((spip->config->cr1 & SPI_CR2_DS) < + (SPI_CR2_DS_2 | SPI_CR2_DS_1 | SPI_CR2_DS_0)) { +#else /* !defined(STM32F0XX) */ + if ((spip->config->cr1 & SPI_CR1_DFF) == 0) { +#endif /* !defined(STM32F0XX) */ + /* Frame width is 8 bits or smaller.*/ spip->rxdmamode = (spip->rxdmamode & ~STM32_DMA_CR_SIZE_MASK) | STM32_DMA_CR_PSIZE_BYTE | STM32_DMA_CR_MSIZE_BYTE; spip->txdmamode = (spip->txdmamode & ~STM32_DMA_CR_SIZE_MASK) | STM32_DMA_CR_PSIZE_BYTE | STM32_DMA_CR_MSIZE_BYTE; } - else { /* 16 bits transfers. */ + else { + /* Frame width is larger than 8 bits.*/ spip->rxdmamode = (spip->rxdmamode & ~STM32_DMA_CR_SIZE_MASK) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD; spip->txdmamode = (spip->txdmamode & ~STM32_DMA_CR_SIZE_MASK) | -- cgit v1.2.3