Skip to content

Commit

Permalink
axidma: Extend AXI DMA examples to support data buffers above 4GB
Browse files Browse the repository at this point in the history
Use UINTPTR for storing and typecasting buffer address.

Signed-off-by: Radhey Shyam Pandey <radheys@xilinx.com>
Acked-by: Kedareswara rao Appana <appanad@xilinx.com>
  • Loading branch information
radheyxilinx authored and saddepal committed Feb 15, 2018
1 parent b3a4155 commit 52642da
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
Expand Up @@ -76,6 +76,8 @@
* available in all examples. This is a fix for CR-965028.
* ms 04/05/17 Added tabspace for return statements in functions
* for proper documentation while generating doxygen.
* 9.6 rsp 02/14/18 Support data buffers above 4GB. Use UINTPTR for storing
* and typecasting buffer address(CR-992638).
* </pre>
*
* ***************************************************************************
Expand Down Expand Up @@ -949,8 +951,8 @@ static int RxSetup(XAxiDma * AxiDmaInstPtr)
XAxiDma_Bd *BdCurPtr;
int BdCount;
int FreeBdCount;
u32 RxBufferPtr;
u32 RxBdSpacePtr;
UINTPTR RxBufferPtr;
UINTPTR RxBdSpacePtr;
int Index;
int RingIndex;

Expand Down Expand Up @@ -1109,14 +1111,14 @@ static int TxSetup(XAxiDma * AxiDmaInstPtr)
int Status;
u32 BdCount;

u32 TxBdSpacePtr = TX_BD_SPACE_BASE;
UINTPTR TxBdSpacePtr = TX_BD_SPACE_BASE;

/* Disable all TX interrupts before TxBD space setup */
XAxiDma_BdRingIntDisable(TxRingPtr, XAXIDMA_IRQ_ALL_MASK);

/* Setup TxBD space */
BdCount = XAxiDma_BdRingCntCalc(XAXIDMA_BD_MINIMUM_ALIGNMENT,
(u32)TX_BD_SPACE_HIGH - (u32)TX_BD_SPACE_BASE + 1);
(UINTPTR)TX_BD_SPACE_HIGH - (UINTPTR)TX_BD_SPACE_BASE + 1);

Status = XAxiDma_BdRingCreate(TxRingPtr, TxBdSpacePtr,
TxBdSpacePtr,
Expand Down Expand Up @@ -1197,7 +1199,7 @@ static int SendPacket(XAxiDma * AxiDmaInstPtr, u8 TDest, u8 TId, u8 Value)
XAxiDma_Bd *BdPtr, *BdCurPtr;
int Status;
int Index, Pkts;
u32 BufferAddr;
UINTPTR BufferAddr;

/*
* Each packet is limited to TxRingPtr->MaxTransferLen
Expand Down
Expand Up @@ -76,6 +76,8 @@
* for proper documentation while generating doxygen.
* 9.5 adk 17/10/17 Marked the BD region as Normal Non-Cacheable for A53
* (CR#987026).
* 9.6 rsp 02/14/18 Support data buffers above 4GB.Use UINTPTR for storing
* and typecasting buffer address(CR-992638).
* </pre>
*
* ***************************************************************************
Expand Down Expand Up @@ -311,7 +313,7 @@ static int RxSetup(XAxiDma * AxiDmaInstPtr)
XAxiDma_Bd *BdCurPtr;
u32 BdCount;
u32 FreeBdCount;
u32 RxBufferPtr;
UINTPTR RxBufferPtr;
int i;

RxRingPtr = XAxiDma_GetRxRing(&AxiDma);
Expand Down Expand Up @@ -493,7 +495,7 @@ static int SendPackets(XAxiDma * AxiDmaInstPtr)
XAxiDma_Bd *BdPtr;
int Status;
int i;
u32 BufAddr;
UINTPTR BufAddr;
XAxiDma_Bd *CurBdPtr;

/* Create pattern in the packet to transmit
Expand Down Expand Up @@ -617,7 +619,7 @@ static int CheckData(void)
* Data Cache is enabled
*/
#ifndef __aarch64__
Xil_DCacheInvalidateRange((u32)RxPacket, MAX_PKT_LEN *
Xil_DCacheInvalidateRange((UINTPTR)RxPacket, MAX_PKT_LEN *
NUMBER_OF_PACKETS);
#endif

Expand Down
Expand Up @@ -80,6 +80,8 @@
* available in all examples. This is a fix for CR-965028.
* ms 04/05/17 Added tabspace for return statements in functions
* for proper documentation while generating doxygen.
* 9.6 rsp 02/14/18 Support data buffers above 4GB.Use UINTPTR for storing
* and typecasting buffer address(CR-992638).
* </pre>
*
* ***************************************************************************
Expand Down Expand Up @@ -436,7 +438,7 @@ static int CheckData(int Length, u8 StartValue)
* Data Cache is enabled
*/
#ifndef __aarch64__
Xil_DCacheInvalidateRange((u32)RxPacket, Length);
Xil_DCacheInvalidateRange((UINTPTR)RxPacket, Length);
#endif

for(Index = 0; Index < Length; Index++) {
Expand Down Expand Up @@ -881,7 +883,7 @@ static int RxSetup(XAxiDma * AxiDmaInstPtr)
XAxiDma_Bd *BdCurPtr;
int BdCount;
int FreeBdCount;
u32 RxBufferPtr;
UINTPTR RxBufferPtr;
int Index;

RxRingPtr = XAxiDma_GetRxRing(&AxiDma);
Expand Down Expand Up @@ -1013,7 +1015,7 @@ static int TxSetup(XAxiDma * AxiDmaInstPtr)

/* Setup TxBD space */
BdCount = XAxiDma_BdRingCntCalc(XAXIDMA_BD_MINIMUM_ALIGNMENT,
(u32)TX_BD_SPACE_HIGH - (u32)TX_BD_SPACE_BASE + 1);
(UINTPTR)TX_BD_SPACE_HIGH - (UINTPTR)TX_BD_SPACE_BASE + 1);

Status = XAxiDma_BdRingCreate(TxRingPtr, TX_BD_SPACE_BASE,
TX_BD_SPACE_BASE,
Expand Down Expand Up @@ -1088,7 +1090,7 @@ static int SendPacket(XAxiDma * AxiDmaInstPtr)
XAxiDma_Bd *BdPtr, *BdCurPtr;
int Status;
int Index, Pkts;
u32 BufferAddr;
UINTPTR BufferAddr;

/*
* Each packet is limited to TxRingPtr->MaxTransferLen
Expand Down
Expand Up @@ -62,6 +62,8 @@
* Ver Who Date Changes
* ----- ---- -------- -------------------------------------------------------
* 9.4 adk 25/07/17 Initial version.
* 9.6 rsp 02/14/18 Support data buffers above 4GB.Use UINTPTR for storing
* and typecasting buffer address(CR-992638).
* </pre>
*
* ***************************************************************************
Expand Down Expand Up @@ -423,7 +425,7 @@ static int CheckData(int Length, u8 StartValue)
* Data Cache is enabled
*/
#ifndef __aarch64__
Xil_DCacheInvalidateRange((u32)RxPacket, Length);
Xil_DCacheInvalidateRange((UINTPTR)RxPacket, Length);
#endif

for(Index = 0; Index < Length; Index++) {
Expand Down Expand Up @@ -805,7 +807,7 @@ static int RxSetup(XAxiDma * AxiDmaInstPtr)
XAxiDma_Bd *BdCurPtr;
int BdCount;
int FreeBdCount;
u32 RxBufferPtr;
UINTPTR RxBufferPtr;
int Index;

RxRingPtr = XAxiDma_GetRxRing(&AxiDma);
Expand Down Expand Up @@ -1010,7 +1012,7 @@ static int SendPacket(XAxiDma * AxiDmaInstPtr)
XAxiDma_Bd *BdPtr, *BdCurPtr;
int Status;
int Index, Pkts;
u32 BufferAddr;
UINTPTR BufferAddr;

/*
* Each packet is limited to TxRingPtr->MaxTransferLen
Expand Down
Expand Up @@ -74,6 +74,8 @@
* 9.3 ms 01/23/17 Modified xil_printf statement in main function to
* ensure that "Successfully ran" and "Failed" strings are
* available in all examples. This is a fix for CR-965028.
* 9.6 rsp 02/14/18 Support data buffers above 4GB.Use UINTPTR for typecasting
* buffer address (CR-992638).
* </pre>
*
* ***************************************************************************
Expand Down Expand Up @@ -438,7 +440,7 @@ static int CheckData(int Length, u8 StartValue)
* Data Cache is enabled
*/
#ifndef __aarch64__
Xil_DCacheInvalidateRange((u32)RxPacket, Length);
Xil_DCacheInvalidateRange((UINTPTR)RxPacket, Length);
#endif

for(Index = 0; Index < Length; Index++) {
Expand Down

0 comments on commit 52642da

Please sign in to comment.