aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-03-28 12:09:21 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-03-28 12:09:21 +0000
commit03331a3fd71c5ea74485e482ea1b5cb7f35890bf (patch)
tree34172179e8aa1102c209a734c291d60fb0af783b /os
parentf571b507132cc77e401dee68535c2b9f3370c60c (diff)
downloadChibiOS-03331a3fd71c5ea74485e482ea1b5cb7f35890bf.tar.gz
ChibiOS-03331a3fd71c5ea74485e482ea1b5cb7f35890bf.tar.bz2
ChibiOS-03331a3fd71c5ea74485e482ea1b5cb7f35890bf.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5513 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/hal/platforms/SPC5xx/DSPI_v1/spi_lld.c18
-rw-r--r--os/hal/platforms/SPC5xx/EDMA_v1/spc5_edma.h12
2 files changed, 11 insertions, 19 deletions
diff --git a/os/hal/platforms/SPC5xx/DSPI_v1/spi_lld.c b/os/hal/platforms/SPC5xx/DSPI_v1/spi_lld.c
index 52b52acac..b7e7a07fa 100644
--- a/os/hal/platforms/SPC5xx/DSPI_v1/spi_lld.c
+++ b/os/hal/platforms/SPC5xx/DSPI_v1/spi_lld.c
@@ -114,7 +114,7 @@ static const edma_channel_config_t spi_dspi0_tx_dma_config = {
* @brief DMA configuration for DSPI0 RX.
*/
static const edma_channel_config_t spi_dspi0_rx_dma_config = {
- SPC5_DSPI0_TX_DMA_DEV_ID, SPC5_SPI_DSPI0_DMA_PRIO, SPC5_SPI_DSPI0_DMA_PRIO,
+ SPC5_DSPI0_RX_DMA_DEV_ID, SPC5_SPI_DSPI0_DMA_PRIO, SPC5_SPI_DSPI0_DMA_PRIO,
spi_serve_rx_irq, spi_serve_dma_error_irq, &SPID1
};
#endif /* SPC5_SPI_USE_DSPI0 */
@@ -132,7 +132,7 @@ static const edma_channel_config_t spi_dspi1_tx_dma_config = {
* @brief DMA configuration for DSPI1 RX.
*/
static const edma_channel_config_t spi_dspi1_rx_dma_config = {
- SPC5_DSPI1_TX_DMA_DEV_ID, SPC5_SPI_DSPI1_DMA_PRIO, SPC5_SPI_DSPI1_DMA_PRIO,
+ SPC5_DSPI1_RX_DMA_DEV_ID, SPC5_SPI_DSPI1_DMA_PRIO, SPC5_SPI_DSPI1_DMA_PRIO,
spi_serve_rx_irq, spi_serve_dma_error_irq, &SPID2
};
#endif /* SPC5_SPI_USE_DSPI1 */
@@ -150,7 +150,7 @@ static const edma_channel_config_t spi_dspi2_tx_dma_config = {
* @brief DMA configuration for DSPI2 RX.
*/
static const edma_channel_config_t spi_dspi2_rx_dma_config = {
- SPC5_DSPI2_TX_DMA_DEV_ID, SPC5_SPI_DSPI2_DMA_PRIO, SPC5_SPI_DSPI2_DMA_PRIO,
+ SPC5_DSPI2_RX_DMA_DEV_ID, SPC5_SPI_DSPI2_DMA_PRIO, SPC5_SPI_DSPI2_DMA_PRIO,
spi_serve_rx_irq, spi_serve_dma_error_irq, &SPID3
};
#endif /* SPC5_SPI_USE_DSPI2 */
@@ -168,7 +168,7 @@ static const edma_channel_config_t spi_dspi3_tx_dma_config = {
* @brief DMA configuration for DSPI3 RX.
*/
static const edma_channel_config_t spi_dspi3_rx_dma_config = {
- SPC5_DSPI3_TX_DMA_DEV_ID, SPC5_SPI_DSPI3_DMA_PRIO, SPC5_SPI_DSPI3_DMA_PRIO,
+ SPC5_DSPI3_RX_DMA_DEV_ID, SPC5_SPI_DSPI3_DMA_PRIO, SPC5_SPI_DSPI3_DMA_PRIO,
spi_serve_rx_irq, spi_serve_dma_error_irq, &SPID4
};
#endif /* SPC5_SPI_USE_DSPI3 */
@@ -487,6 +487,10 @@ void spi_lld_start(SPIDriver *spip) {
spip->rx_channel = edmaChannelAllocate(&spi_dspi3_rx_dma_config);
}
#endif /* SPC5_SPI_USE_DSPI3 */
+
+ chDbgAssert((spip->tx_channel != EDMA_ERROR) &&
+ (spip->rx_channel != EDMA_ERROR),
+ "spi_lld_start(), #1", "channel cannot be allocated");
}
/* Configures the peripheral.*/
@@ -607,6 +611,9 @@ void spi_lld_ignore(SPIDriver *spip, size_t n) {
void spi_lld_exchange(SPIDriver *spip, size_t n,
const void *txbuf, void *rxbuf) {
+ /* Starting transfer.*/
+ spip->dspi->MCR.B.HALT = 0;
+
/* DMAs require a different setup depending on the frame size.*/
if (spip->dspi->CTAR[0].B.FMSZ < 8) {
/* Setting up the RX DMA channel.*/
@@ -636,9 +643,6 @@ void spi_lld_exchange(SPIDriver *spip, size_t n,
spi_start_dma_tx16(spip, n, txbuf);
}
}
-
- /* Starting transfer.*/
- spip->dspi->MCR.B.HALT = 0;
}
/**
diff --git a/os/hal/platforms/SPC5xx/EDMA_v1/spc5_edma.h b/os/hal/platforms/SPC5xx/EDMA_v1/spc5_edma.h
index 1957056b2..9d2bcce82 100644
--- a/os/hal/platforms/SPC5xx/EDMA_v1/spc5_edma.h
+++ b/os/hal/platforms/SPC5xx/EDMA_v1/spc5_edma.h
@@ -294,18 +294,6 @@ typedef struct {
edmaTCDSetWord7(tcdp, iter, mode); \
}
-#if 0
-tcdp->word[0] = (uint32_t)(src); \
-tcdp->word[1] = ((uint32_t)(ssize) << 24) | ((uint32_t)(dsize) << 16) | \
- (uint32_t)(soff); \
-tcdp->word[2] = (uint32_t)(nbytes); \
-tcdp->word[3] = (uint32_t)(slast); \
-tcdp->word[0] = (uint32_t)(dst); \
-tcdp->word[5] = ((uint32_t)(iter) << 16) | (uint32_t)(doff); \
-tcdp->word[6] = (uint32_t)(dlast); \
-tcdp->word[7] = ((uint32_t)(iter) << 16) | (uint32_t)(mode);
-#endif
-
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/