aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
authorspacecoaster <spacecoaster@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-09-23 16:46:14 +0000
committerspacecoaster <spacecoaster@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-09-23 16:46:14 +0000
commit844094dc44cb49b534191cde1d60a05b7d6e00d9 (patch)
treefcb5a1e7e66c0fb6ef39ed696377fd838c216c71 /os/hal
parent49d1458e83e217e8e50ecf9b89eab427d0c9affc (diff)
downloadChibiOS-844094dc44cb49b534191cde1d60a05b7d6e00d9.tar.gz
ChibiOS-844094dc44cb49b534191cde1d60a05b7d6e00d9.tar.bz2
ChibiOS-844094dc44cb49b534191cde1d60a05b7d6e00d9.zip
[KINETIS] K20x SPI use separate rx/tx dummy bytes.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7310 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/ports/KINETIS/K20x/spi_lld.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/os/hal/ports/KINETIS/K20x/spi_lld.c b/os/hal/ports/KINETIS/K20x/spi_lld.c
index b06dceb15..77d8f5e65 100644
--- a/os/hal/ports/KINETIS/K20x/spi_lld.c
+++ b/os/hal/ports/KINETIS/K20x/spi_lld.c
@@ -70,12 +70,15 @@ SPIDriver SPID1;
/* Driver local variables and types. */
/*===========================================================================*/
+/* Use a dummy byte as the source/destination when a buffer is not provided */
+/* Note: The MMC driver relies on 0xFF being sent for dummy bytes. */
+static volatile uint16_t dmaRxDummy;
+static uint16_t dmaTxDummy = 0xFFFF;
+
/*===========================================================================*/
/* Driver local functions. */
/*===========================================================================*/
-volatile uint8_t dmaDummy;
-
static void spi_start_xfer(SPIDriver *spip, bool polling)
{
/*
@@ -91,15 +94,12 @@ static void spi_start_xfer(SPIDriver *spip, bool polling)
spip->spi->RSER = SPIx_RSER_RFDF_DIRS | SPIx_RSER_RFDF_RE |
SPIx_RSER_TFFF_RE | SPIx_RSER_TFFF_DIRS;
- /* Use dmaDummy as the source/destination when a buffer is not provided */
- dmaDummy = 0;
-
/* Configure RX DMA */
if (spip->rxbuf) {
DMA->TCD[KINETIS_SPI0_RX_DMA_CHANNEL].DADDR = (uint32_t)spip->rxbuf;
DMA->TCD[KINETIS_SPI0_RX_DMA_CHANNEL].DOFF = spip->word_size;
} else {
- DMA->TCD[KINETIS_SPI0_RX_DMA_CHANNEL].DADDR = (uint32_t)&dmaDummy;
+ DMA->TCD[KINETIS_SPI0_RX_DMA_CHANNEL].DADDR = (uint32_t)&dmaRxDummy;
DMA->TCD[KINETIS_SPI0_RX_DMA_CHANNEL].DOFF = 0;
}
DMA->TCD[KINETIS_SPI0_RX_DMA_CHANNEL].BITER_ELINKNO = spip->count;
@@ -113,7 +113,7 @@ static void spi_start_xfer(SPIDriver *spip, bool polling)
DMA->TCD[KINETIS_SPI0_TX_DMA_CHANNEL].SADDR = (uint32_t)spip->txbuf;
DMA->TCD[KINETIS_SPI0_TX_DMA_CHANNEL].SOFF = spip->word_size;
} else {
- DMA->TCD[KINETIS_SPI0_TX_DMA_CHANNEL].SADDR = (uint32_t)&dmaDummy;
+ DMA->TCD[KINETIS_SPI0_TX_DMA_CHANNEL].SADDR = (uint32_t)&dmaTxDummy;
DMA->TCD[KINETIS_SPI0_TX_DMA_CHANNEL].SOFF = 0;
}
DMA->TCD[KINETIS_SPI0_TX_DMA_CHANNEL].BITER_ELINKNO = spip->count;