xaxidma.c File Reference
#include "xaxidma.h"
Detailed Description
This file implements DMA engine-wise initialization and control functions. For more information on the implementation of this driver, see xaxidma.h.
MODIFICATION HISTORY:
Ver Who Date Changes
----- ---- -------- -------------------------------------------------------
1.00a jz 05/18/10 First release
2.00a jz 08/10/10 Second release, added in xaxidma_g.c, xaxidma_sinit.c,
updated tcl file, added xaxidma_porting_guide.h
3.00a jz 11/22/10 Support IP core parameters change
4.00a rkv 02/22/11 Added support for simple DMA mode
New API added for simple DMA mode are
- XAxiDma_Busy
- XAxiDma_SimpleTransfer
6.00a srt 01/24/12 Added support for Multi-Channel DMA mode.
Changed APIs:
* XAxiDma_Start(XAxiDma * InstancePtr, int RingIndex)
* XAxiDma_Started(XAxiDma * InstancePtr, int RingIndex)
* XAxiDma_Pause(XAxiDma * InstancePtr, int RingIndex)
* XAxiDma_Resume(XAxiDma * InstancePtr, int RingIndex)
* XAxiDma_SimpleTransfer(XAxiDma *InstancePtr,
u32 BuffAddr, u32 Length,
int Direction, int RingIndex)
- New API:
* XAxiDma_SelectKeyHole(XAxiDma *InstancePtr,
int Direction, int Select)
7.00a srt 06/18/12 All the APIs changed in v6_00_a are reverted back for
backward compatibility.
7.01a srt 10/26/12 Fixed issue with driver as it fails with IP version
< 6.00a as the parameter C_NUM_*_CHANNELS is not
applicable.
8.0 srt 01/29/14 Added support for Micro DMA Mode and Cyclic mode of
operations.
- New API:
* XAxiDma_SelectCyclicMode(XAxiDma *InstancePtr,
int Direction, int Select)
Define Documentation
#define XAXIDMA_RESET_TIMEOUT 500 |
Function Documentation
u32 XAxiDma_Busy |
( |
XAxiDma * |
InstancePtr, |
|
|
int |
Direction | |
|
) |
| | |
This function checks whether specified DMA channel is busy
- Parameters:
-
| InstancePtr | is the driver instance we are working on |
| Direction | is DMA transfer direction, valid values are
- XAXIDMA_DMA_TO_DEVICE.
- XAXIDMA_DEVICE_TO_DMA.
|
- Returns:
- - TRUE if channel is busy
- Note:
- None.
This function initializes a DMA engine. This function must be called prior to using a DMA engine. Initializing a engine includes setting up the register base address, setting up the instance data, and ensuring the hardware is in a quiescent state.
- Parameters:
-
| InstancePtr | is a pointer to the DMA engine instance to be worked on. |
| Config | is a pointer to an XAxiDma_Config structure. It contains the information about the hardware build, including base address,and whether status control stream (StsCntrlStrm), MM2S and S2MM are included in the build. |
- Returns:
- XST_SUCCESS for successful initialization
- XST_INVALID_PARAM if pointer to the configuration structure is NULL
- XST_DMA_ERROR if reset operation failed at the end of initialization
- Note:
- We assume the hardware building tool will check and error out for a hardware build that has no transfer channels.
int XAxiDma_Pause |
( |
XAxiDma * |
InstancePtr |
) |
|
Pause DMA transactions on both channels.
If the engine is running and doing transfers, this function does not stop the DMA transactions immediately, because then hardware will throw away our previously queued transfers. All submitted transfers will finish. Transfers submitted after this function will not start until XAxiDma_BdRingStart() or XAxiDma_Resume() is called.
- Parameters:
-
| InstancePtr | is a pointer to the DMA engine instance to be worked on. |
- Returns:
- XST_SUCCESS if successful
- XST_NOT_SGDMA, if the driver instance is not initialized
- Note:
- None
void XAxiDma_Reset |
( |
XAxiDma * |
InstancePtr |
) |
|
Reset both TX and RX channels of a DMA engine.
Reset one channel resets the whole AXI DMA engine.
Any DMA transaction in progress will finish gracefully before engine starts reset. Any other transactions that have been submitted to hardware will be discarded by the hardware.
- Parameters:
-
| InstancePtr | is a pointer to the DMA engine instance to be worked on. |
- Returns:
- None
- Note:
- After the reset:
- All interrupts are disabled.
- Engine is halted
int XAxiDma_ResetIsDone |
( |
XAxiDma * |
InstancePtr |
) |
|
Check whether reset is done
- Parameters:
-
| InstancePtr | is a pointer to the DMA engine instance to be worked on. |
- Returns:
- 1 if reset is done.
- 0 if reset is not done
- Note:
- None
int XAxiDma_Resume |
( |
XAxiDma * |
InstancePtr |
) |
|
Resume DMA transactions on both channels.
- Parameters:
-
| InstancePtr | is a pointer to the DMA engine instance to be worked on. |
- Returns:
- XST_SUCCESS for success
- XST_NOT_SGDMA if the driver instance has not been initialized
- XST_DMA_ERROR if one of the channels fails to start
- Note:
- None
int XAxiDma_SelectCyclicMode |
( |
XAxiDma * |
InstancePtr, |
|
|
int |
Direction, |
|
|
int |
Select | |
|
) |
| | |
This function Enable or Disable Cyclic Mode Feature
- Parameters:
-
| InstancePtr | is the driver instance we are working on |
| Direction | is DMA transfer direction, valid values are
- XAXIDMA_DMA_TO_DEVICE.
- XAXIDMA_DEVICE_TO_DMA. Select is the option to enable (TRUE) or disable (FALSE).
|
- Returns:
- - XST_SUCCESS for success
- Note:
- None.
int XAxiDma_SelectKeyHole |
( |
XAxiDma * |
InstancePtr, |
|
|
int |
Direction, |
|
|
int |
Select | |
|
) |
| | |
This function Enable or Disable KeyHole Feature
- Parameters:
-
| InstancePtr | is the driver instance we are working on |
| Direction | is DMA transfer direction, valid values are
- XAXIDMA_DMA_TO_DEVICE.
- XAXIDMA_DEVICE_TO_DMA. Select is the option to enable (TRUE) or disable (FALSE).
|
- Returns:
- - XST_SUCCESS for success
- Note:
- None.
int XAxiDma_SimpleTransfer |
( |
XAxiDma * |
InstancePtr, |
|
|
u32 |
BuffAddr, |
|
|
u32 |
Length, |
|
|
int |
Direction | |
|
) |
| | |
This function does one simple transfer submission
It checks in the following sequence:
- if engine is busy, cannot submit
- if engine is in SG mode , cannot submit
- Parameters:
-
| InstancePtr | is the pointer to the driver instance |
| BuffAddr | is the address of the source/destination buffer |
| Length | is the length of the transfer |
| Direction | is DMA transfer direction, valid values are
- XAXIDMA_DMA_TO_DEVICE.
- XAXIDMA_DEVICE_TO_DMA.
|
- Returns:
- XST_SUCCESS for success of submission
- XST_FAILURE for submission failure, maybe caused by: Another simple transfer is still going
- XST_INVALID_PARAM if:Length out of valid range [1:8M] Or, address not aligned when DRE is not built in
- Note:
- This function is used only when system is configured as Simple mode.
Copyright © 1995-2014 Xilinx, Inc. All rights reserved.