summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-12-13 15:18:00 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-12-14 13:09:27 +0100
commitf74e2959ded6b0e1e750b539df27ba18eeceb46f (patch)
treee3f67aee65f28451e029bf256a7c412158f7d74a
parent0396f60e59865337f1e9011156585c1892ef76f1 (diff)
downloadrtems-f74e2959ded6b0e1e750b539df27ba18eeceb46f.tar.bz2
bsp/atsam: Speed up SPI DMA transfer start
-rw-r--r--c/src/lib/libbsp/arm/atsam/libraries/libchip/include/xdmac.h6
-rw-r--r--c/src/lib/libbsp/arm/atsam/spi/atsam_spi_bus.c13
2 files changed, 10 insertions, 9 deletions
diff --git a/c/src/lib/libbsp/arm/atsam/libraries/libchip/include/xdmac.h b/c/src/lib/libbsp/arm/atsam/libraries/libchip/include/xdmac.h
index 34d4faaef7..058bcf90c3 100644
--- a/c/src/lib/libbsp/arm/atsam/libraries/libchip/include/xdmac.h
+++ b/c/src/lib/libbsp/arm/atsam/libraries/libchip/include/xdmac.h
@@ -122,6 +122,12 @@
extern "C" {
#endif
+static inline void XDMAC_StartTransfer(Xdmac *pXdmac, uint8_t iChannel)
+{
+ pXdmac->XDMAC_GE = (XDMAC_GE_EN0 << iChannel);
+ pXdmac->XDMAC_GIE = (XDMAC_GIE_IE0 << iChannel);
+}
+
extern uint32_t XDMAC_GetType(Xdmac *pXdmac);
extern uint32_t XDMAC_GetConfig(Xdmac *pXdmac);
extern uint32_t XDMAC_GetArbiter(Xdmac *pXdmac);
diff --git a/c/src/lib/libbsp/arm/atsam/spi/atsam_spi_bus.c b/c/src/lib/libbsp/arm/atsam/spi/atsam_spi_bus.c
index c88cec9868..247f8869f5 100644
--- a/c/src/lib/libbsp/arm/atsam/spi/atsam_spi_bus.c
+++ b/c/src/lib/libbsp/arm/atsam/spi/atsam_spi_bus.c
@@ -354,8 +354,8 @@ static uint32_t atsam_send_command(
)
{
Spid *spid = &bus->SpiDma;
-
Spi *pSpiHw = spid->pSpiHw;
+ Xdmac *pXdmac = bus->SpiDma.pXdmad->pXdmacs;
if (
atsam_configure_link_list(
@@ -382,14 +382,9 @@ static uint32_t atsam_send_command(
bus->spi_switched_on = true;
- /* Start DMA 0(RX) && 1(TX) */
- if (XDMAD_StartTransfer(spid->pXdmad, bus->dma_rx_channel)) {
- return SPID_ERROR_LOCK;
- }
-
- if (XDMAD_StartTransfer(spid->pXdmad, bus->dma_tx_channel)) {
- return SPID_ERROR_LOCK;
- }
+ /* Start DMA */
+ XDMAC_StartTransfer(pXdmac, bus->dma_rx_channel);
+ XDMAC_StartTransfer(pXdmac, bus->dma_tx_channel);
return 0;
}