[rtems commit] bsp/atsam: Use standard XDMA throughout

Sebastian Huber sebh at rtems.org
Tue Dec 20 07:50:07 UTC 2016


Module:    rtems
Branch:    master
Commit:    71f29c1206633447da18eaff4293f856aaca640d
Changeset: http://git.rtems.org/rtems/commit/?id=71f29c1206633447da18eaff4293f856aaca640d

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Dec 20 08:49:32 2016 +0100

bsp/atsam: Use standard XDMA throughout

---

 c/src/lib/libbsp/arm/atsam/libraries/libchip/include/xdmad.h  |  5 -----
 c/src/lib/libbsp/arm/atsam/libraries/libchip/source/afe_dma.c |  4 +---
 c/src/lib/libbsp/arm/atsam/libraries/libchip/source/dac_dma.c |  4 +---
 c/src/lib/libbsp/arm/atsam/libraries/libchip/source/spi_dma.c |  4 +---
 c/src/lib/libbsp/arm/atsam/libraries/libchip/source/twid.c    | 11 +----------
 .../lib/libbsp/arm/atsam/libraries/libchip/source/uart_dma.c  |  3 ---
 .../lib/libbsp/arm/atsam/libraries/libchip/source/usart_dma.c |  4 ----
 c/src/lib/libbsp/arm/atsam/libraries/libchip/source/xdmad.c   |  3 ++-
 8 files changed, 6 insertions(+), 32 deletions(-)

diff --git a/c/src/lib/libbsp/arm/atsam/libraries/libchip/include/xdmad.h b/c/src/lib/libbsp/arm/atsam/libraries/libchip/include/xdmad.h
index 20def44..3b5e083 100644
--- a/c/src/lib/libbsp/arm/atsam/libraries/libchip/include/xdmad.h
+++ b/c/src/lib/libbsp/arm/atsam/libraries/libchip/include/xdmad.h
@@ -222,11 +222,6 @@ extern sXdmad XDMAD_Instance;
  *----------------------------------------------------------------------------*/
 /** \addtogroup dmad_functions DMA Driver Functions
         @{*/
-extern void XDMAD_Initialize(sXdmad *pXdmad,
-							  uint8_t bPollingMode);
-
-extern void XDMAD_Handler(void *arg);
-
 extern uint32_t XDMAD_AllocateChannel(sXdmad *pXdmad,
 									   uint8_t bSrcID, uint8_t bDstID);
 extern eXdmadRC XDMAD_FreeChannel(sXdmad *pXdmad, uint32_t dwChannel);
diff --git a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/afe_dma.c b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/afe_dma.c
index b137d01..e47055c 100644
--- a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/afe_dma.c
+++ b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/afe_dma.c
@@ -103,8 +103,6 @@ static uint8_t _AfeConfigureDmaChannels(AfeDma *pAfed)
 {
 
 	/* Driver initialize */
-	XDMAD_Initialize(pAfed->pXdmad, 0);
-
 	XDMAD_FreeChannel(pAfed->pXdmad, afeDmaRxChannel);
 
 	/* Allocate a DMA channel for AFE0/1 RX. */
@@ -207,7 +205,7 @@ uint32_t Afe_ConfigureDma(AfeDma *pAfed ,
 	pAfed->afeId  = AfeId;
 	pAfed->semaphore = 1;
 	pAfed->pCurrentCommand = 0;
-	pAfed->pXdmad = pXdmad;
+	assert(pXdmad == &XDMAD_Instance);
 	return 0;
 }
 
diff --git a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/dac_dma.c b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/dac_dma.c
index 912c4ef..e18dbb4 100644
--- a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/dac_dma.c
+++ b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/dac_dma.c
@@ -96,8 +96,6 @@ static uint8_t _DacConfigureDmaChannels(DacDma *pDacd)
 {
 
 	/* Driver initialize */
-	XDMAD_Initialize(pDacd->pXdmad, 0);
-
 	XDMAD_FreeChannel(pDacd->pXdmad, dacDmaTxChannel);
 
 	/* Allocate a DMA channel for DAC0/1 TX. */
@@ -195,7 +193,7 @@ uint32_t Dac_ConfigureDma(DacDma *pDacd ,
 	pDacd->dacId  = DacId;
 	pDacd->semaphore = 1;
 	pDacd->pCurrentCommand = 0;
-	pDacd->pXdmad = pXdmad;
+	assert(pXdmad == &XDMAD_Instance);
 	return 0;
 }
 
diff --git a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/spi_dma.c b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/spi_dma.c
index 1ce3fcd..5f03958 100644
--- a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/spi_dma.c
+++ b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/spi_dma.c
@@ -139,8 +139,6 @@ static void SPID_Rx_Cb(uint32_t channel, Spid *pArg)
 static uint8_t _spid_configureDmaChannels(Spid *pSpid)
 {
 	/* Driver initialize */
-	XDMAD_Initialize(pSpid->pXdmad, 0);
-
 	XDMAD_FreeChannel(pSpid->pXdmad, spiDmaTxChannel);
 	XDMAD_FreeChannel(pSpid->pXdmad, spiDmaRxChannel);
 
@@ -290,7 +288,7 @@ uint32_t SPID_Configure(Spid *pSpid ,
 	pSpid->spiId  = spiId;
 	pSpid->semaphore = 1;
 	pSpid->pCurrentCommand = 0;
-	pSpid->pXdmad = pXdmad;
+	assert(pXdmad == &XDMAD_Instance);
 
 	/* Enable the SPI Peripheral ,Execute a software reset of the SPI,
 	    Configure SPI in Master Mode*/
diff --git a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/twid.c b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/twid.c
index 91196df..4f77069 100644
--- a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/twid.c
+++ b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/twid.c
@@ -508,16 +508,7 @@ void TWID_DmaInitialize(TwihsDma *pTwidma, Twihs *pTwi, uint8_t bPolling)
 	pTwidma->pTwid->pTwi = pTwi;
 	pTwidma->pTwid->pTransfer = 0;
 
-	if (!bPolling) {
-		/* Enable XDMA interrupt and give it priority over any other peripheral
-		interrupt */
-		NVIC_ClearPendingIRQ(XDMAC_IRQn);
-		NVIC_SetPriority(XDMAC_IRQn, 1);
-		NVIC_EnableIRQ(XDMAC_IRQn);
-	}
-
-	/* Initialize XDMA driver instance with polling mode */
-	XDMAD_Initialize(pTwidma->pTwiDma, bPolling);
+	assert(!bPolling);
 }
 
 /**
diff --git a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/uart_dma.c b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/uart_dma.c
index 7406b71..606dc83 100644
--- a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/uart_dma.c
+++ b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/uart_dma.c
@@ -390,9 +390,6 @@ uint32_t UARTD_Configure(UartDma *pUartd ,
 	    Configure UART in Master Mode*/
 	UART_Configure (pUartd->pUartHw, uartMode, baud, clk);
 
-	/* Driver initialize */
-	XDMAD_Initialize(pUartd->pXdmad, 0);
-
 	/* Check if DMA IRQ is enable; if not clear pending IRQs in init it */
 	if (!(NVIC_GetActive(XDMAC_IRQn)))
 		NVIC_ClearPendingIRQ(XDMAC_IRQn);
diff --git a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/usart_dma.c b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/usart_dma.c
index 62755d9..51488e6 100644
--- a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/usart_dma.c
+++ b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/usart_dma.c
@@ -369,14 +369,10 @@ uint32_t USARTD_Configure(UsartDma *pUsartd ,
 		pUsartd->pUsartHw = USART2;
 
 
-	pUsartd->pXdmad->pXdmacs = XDMAC;
 	/* Enable the USART Peripheral ,Execute a software reset of the USART,
 	    Configure USART in Master Mode*/
 	USART_Configure (pUsartd->pUsartHw, UsartMode, BaudRate, UsartClk);
 
-	/* Driver initialize */
-	XDMAD_Initialize(pUsartd->pXdmad, 0);
-
 	/* Check if DMA IRQ is enable; if not clear pending IRQs in init it */
 	if (!(NVIC_GetActive(XDMAC_IRQn)))
 		NVIC_ClearPendingIRQ(XDMAC_IRQn);
diff --git a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/xdmad.c b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/xdmad.c
index 36f9e27..0be891d 100644
--- a/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/xdmad.c
+++ b/c/src/lib/libbsp/arm/atsam/libraries/libchip/source/xdmad.c
@@ -73,6 +73,7 @@
 /*----------------------------------------------------------------------------
  *        Local functions
  *----------------------------------------------------------------------------*/
+static void XDMAD_Handler(void *arg);
 /**
  * \brief Try to allocate a DMA channel for on given controller.
  * \param pDmad  Pointer to DMA driver instance.
@@ -302,7 +303,7 @@ eXdmadRC XDMAD_PrepareChannel(sXdmad *pXdmad, uint32_t dwChannel)
  * \brief xDMA interrupt handler
  * \param arg Pointer to DMA driver instance.
  */
-void XDMAD_Handler(void *arg)
+static void XDMAD_Handler(void *arg)
 {
 	sXdmad *pDmad;
 	Xdmac *pXdmac;




More information about the vc mailing list