#include "xaxicdma_bd.h"
#include <string.h>
#include "xil_cache.h"
Classes | ||||||||||
struct | XAxiCdma_IntrHandlerList | |||||||||
struct | XAxiCdma_Config | |||||||||
struct | XAxiCdma | |||||||||
Defines | ||||||||||
#define | XAXICDMA_COALESCE_NO_CHANGE 0xFFFFFFFF | |||||||||
#define | XAXICDMA_ALL_BDS 0x7FFFFFFF | |||||||||
#define | XAXICDMA_SG_MODE 1 | |||||||||
#define | XAXICDMA_SIMPLE_MODE 2 | |||||||||
#define | XAXICDMA_MAXIMUM_MAX_HANDLER 20 | |||||||||
#define | XAXICDMA_KEYHOLE_READ 0 | |||||||||
#define | XAXICDMA_KEYHOLE_WRITE 1 | |||||||||
#define | XAXICDMA_CACHE_FLUSH(BdPtr) Xil_DCacheFlushRange((BdPtr), XAXICDMA_BD_HW_NUM_BYTES); | |||||||||
#define | XAXICDMA_CACHE_INVALIDATE(BdPtr) Xil_DCacheInvalidateRange((BdPtr), XAXICDMA_BD_HW_NUM_BYTES) | |||||||||
Typedefs | ||||||||||
Call Back function | ||||||||||
If interrupt is enabled, and the application wants to be notified about the completion of a transfer, the application should register its call back function to the driver. The call back function is registered through the transfer submission.
| ||||||||||
typedef void(* | XAxiCdma_CallBackFn )(void *CallBackRef, u32 IrqMask, int *NumBdPtr) | |||||||||
Functions | ||||||||||
XAxiCdma_Config * | XAxiCdma_LookupConfig (u32 DeviceId) | |||||||||
int | XAxiCdma_CfgInitialize (XAxiCdma *InstancePtr, XAxiCdma_Config *CfgPtr, u32 EffectiveAddr) | |||||||||
void | XAxiCdma_Reset (XAxiCdma *InstancePtr) | |||||||||
int | XAxiCdma_ResetIsDone (XAxiCdma *InstancePtr) | |||||||||
int | XAxiCdma_IsBusy (XAxiCdma *InstancePtr) | |||||||||
int | XAxiCdma_SetCoalesce (XAxiCdma *InstancePtr, u32 Counter, u32 Delay) | |||||||||
void | XAxiCdma_GetCoalesce (XAxiCdma *InstancePtr, u32 *CounterPtr, u32 *DelayPtr) | |||||||||
u32 | XAxiCdma_GetError (XAxiCdma *InstancePtr) | |||||||||
void | XAxiCdma_IntrEnable (XAxiCdma *InstancePtr, u32 Mask) | |||||||||
u32 | XAxiCdma_IntrGetEnabled (XAxiCdma *InstancePtr) | |||||||||
void | XAxiCdma_IntrDisable (XAxiCdma *InstancePtr, u32 Mask) | |||||||||
void | XAxiCdma_IntrHandler (void *HandlerRef) | |||||||||
int | XAxiCdma_SimpleTransfer (XAxiCdma *InstancePtr, u32 SrcAddr, u32 DstAddr, int Length, XAxiCdma_CallBackFn SimpleCallBack, void *CallbackRef) | |||||||||
int | XAxiCdma_SelectKeyHole (XAxiCdma *InstancePtr, u32 Direction, u32 Select) | |||||||||
int | XAxiCdma_BdRingCntCalc (u32 Alignment, u32 Bytes, u32 BuffAddr) | |||||||||
int | XAxiCdma_BdRingMemCalc (u32 Alignment, int NumBd) | |||||||||
int | XAxiCdma_BdRingGetCnt (XAxiCdma *InstancePtr) | |||||||||
int | XAxiCdma_BdRingGetFreeCnt (XAxiCdma *InstancePtr) | |||||||||
void | XAxiCdma_BdRingSnapShotCurrBd (XAxiCdma *InstancePtr) | |||||||||
XAxiCdma_Bd * | XAxiCdma_BdRingGetCurrBd (XAxiCdma *InstancePtr) | |||||||||
XAxiCdma_Bd * | XAxiCdma_BdRingNext (XAxiCdma *InstancePtr, XAxiCdma_Bd *BdPtr) | |||||||||
XAxiCdma_Bd * | XAxiCdma_BdRingPrev (XAxiCdma *InstancePtr, XAxiCdma_Bd *BdPtr) | |||||||||
int | XAxiCdma_BdRingCreate (XAxiCdma *InstancePtr, u32 PhysAddr, u32 VirtAddr, u32 Alignment, int BdCount) | |||||||||
int | XAxiCdma_BdRingClone (XAxiCdma *InstancePtr, XAxiCdma_Bd *TemplateBdPtr) | |||||||||
int | XAxiCdma_BdRingAlloc (XAxiCdma *InstancePtr, int NumBd, XAxiCdma_Bd **BdSetPtr) | |||||||||
int | XAxiCdma_BdRingUnAlloc (XAxiCdma *InstancePtr, int NumBd, XAxiCdma_Bd *BdSetPtr) | |||||||||
int | XAxiCdma_BdRingToHw (XAxiCdma *InstancePtr, int NumBd, XAxiCdma_Bd *BdSetPtr, XAxiCdma_CallBackFn CallBack, void *CallBackRef) | |||||||||
int | XAxiCdma_BdRingFromHw (XAxiCdma *InstancePtr, int BdLimit, XAxiCdma_Bd **BdSetPtr) | |||||||||
int | XAxiCdma_BdRingFree (XAxiCdma *InstancePtr, int NumBd, XAxiCdma_Bd *BdSetPtr) | |||||||||
void | XAxiCdma_DumpRegisters (XAxiCdma *InstancePtr) |
#define XAXICDMA_ALL_BDS 0x7FFFFFFF |
#define XAXICDMA_CACHE_FLUSH | ( | BdPtr | ) | Xil_DCacheFlushRange((BdPtr), XAXICDMA_BD_HW_NUM_BYTES); |
#define XAXICDMA_CACHE_INVALIDATE | ( | BdPtr | ) | Xil_DCacheInvalidateRange((BdPtr), XAXICDMA_BD_HW_NUM_BYTES) |
#define XAXICDMA_COALESCE_NO_CHANGE 0xFFFFFFFF |
#define XAXICDMA_KEYHOLE_READ 0 |
#define XAXICDMA_KEYHOLE_WRITE 1 |
#define XAXICDMA_MAXIMUM_MAX_HANDLER 20 |
#define XAXICDMA_SG_MODE 1 |
#define XAXICDMA_SIMPLE_MODE 2 |
typedef void(* XAxiCdma_CallBackFn)(void *CallBackRef, u32 IrqMask, int *NumBdPtr) |
int XAxiCdma_BdRingAlloc | ( | XAxiCdma * | InstancePtr, | |
int | NumBd, | |||
XAxiCdma_Bd ** | BdSetPtr | |||
) |
This function requests number of BDs from the BD ring.
InstancePtr | is the driver instance we are working on | |
NumBd | is the number of BDs to request | |
BdSetPtr | is the pointer to the set of BDs returned |
int XAxiCdma_BdRingClone | ( | XAxiCdma * | InstancePtr, | |
XAxiCdma_Bd * | TemplateBdPtr | |||
) |
This function clones all BDs in the BD ring to be the same as the given BD.
InstancePtr | is the driver instance we are working on | |
TemplateBdPtr | is the BD to be copied from |
int XAxiCdma_BdRingCntCalc | ( | u32 | Alignment, | |
u32 | Bytes, | |||
u32 | BdBuffAddr | |||
) |
This function calculates how many BDs can be built using given number of bytes of memory, according to alignment provided.
Alignment | is the preferred alignment for the BDs | |
Bytes | is the number of bytes of memory to build BDs with | |
BdBuffAddr | is the buffer address allocated for the BDs. This is to check the alignment of the buffer to make sure the the buffer is aligned to the BD alignment. An invalid buffer address results in 0. |
int XAxiCdma_BdRingCreate | ( | XAxiCdma * | InstancePtr, | |
u32 | PhysAddr, | |||
u32 | VirtAddr, | |||
u32 | Alignment, | |||
int | BdCount | |||
) |
This function creates the BD ring for the driver instance. If a BD ring pre-exist of this ring, the previous ring is lost.
InstancePtr | is the driver instance we are working on | |
PhysAddr | is the physical address of the memory for the BD ring | |
VirtAddr | is the virtual address of the memory for the BD ring | |
Alignment | is the alignment for the BDs | |
BdCount | is the number of BDs to create in the ring |
int XAxiCdma_BdRingFree | ( | XAxiCdma * | InstancePtr, | |
int | NumBd, | |||
XAxiCdma_Bd * | BdSetPtr | |||
) |
This function returns the BDs back to the free pool of the BD ring.
InstancePtr | is the driver instance we are working on | |
NumBd | is the number of BDs to free | |
BdSetPtr | is the set of BDs to be freed |
int XAxiCdma_BdRingFromHw | ( | XAxiCdma * | InstancePtr, | |
int | BdLimit, | |||
XAxiCdma_Bd ** | BdSetPtr | |||
) |
This function tries to retrieve completed BDs from the hardware.
InstancePtr | is the driver instance we are working on | |
BdLimit | is the maximum number of completed BDs to retrieve | |
BdSetPtr | is the set of completed BDs |
int XAxiCdma_BdRingGetCnt | ( | XAxiCdma * | InstancePtr | ) |
This function gets the total number of BDs in the BD ring.
InstancePtr | is the driver instance we are working on |
XAxiCdma_Bd* XAxiCdma_BdRingGetCurrBd | ( | XAxiCdma * | InstancePtr | ) |
This function grabs a copy of the current BD pointer from the hardware.
InstancePtr | is the driver instance we are working on |
int XAxiCdma_BdRingGetFreeCnt | ( | XAxiCdma * | InstancePtr | ) |
This function gets the number of free BDs.
InstancePtr | is the driver instance we are working on |
int XAxiCdma_BdRingMemCalc | ( | u32 | Alignment, | |
int | NumBd | |||
) |
This function calculates how much memory is needed to build requested number of BDs.
Alignment | is the preferred alignment for the BDs | |
NumBd | is the number of BDs to be built |
XAxiCdma_Bd* XAxiCdma_BdRingNext | ( | XAxiCdma * | InstancePtr, | |
XAxiCdma_Bd * | BdPtr | |||
) |
This function gets the next BD of the current BD on the BD ring.
InstancePtr | is the driver instance we are working on | |
BdPtr | is the current BD |
XAxiCdma_Bd* XAxiCdma_BdRingPrev | ( | XAxiCdma * | InstancePtr, | |
XAxiCdma_Bd * | BdPtr | |||
) |
This function gets the previous BD of the current BD on the BD ring.
InstancePtr | is the driver instance we are working on | |
BdPtr | is the current BD |
void XAxiCdma_BdRingSnapShotCurrBd | ( | XAxiCdma * | InstancePtr | ) |
This function grabs a copy of the current BD pointer from the hardware. It is normally used to prepare for the hardware reset. The snapshot of the current BD pointer should be reloaded once the reset is done.
InstancePtr | is the driver instance we are working on |
int XAxiCdma_BdRingToHw | ( | XAxiCdma * | InstancePtr, | |
int | NumBd, | |||
XAxiCdma_Bd * | BdSetPtr, | |||
XAxiCdma_CallBackFn | CallBackFn, | |||
void * | CallBackRef | |||
) |
This function tries to enqueue the number of BDs to the hardware.
InstancePtr | is the driver instance we are working on | |
NumBd | is the number of BDs to enqueue | |
BdSetPtr | is the set of BDs to be enqueued | |
CallBackFn | is the callback function for this transfer, NULL is fine | |
CallBackRef | is the callback reference pointer |
int XAxiCdma_BdRingUnAlloc | ( | XAxiCdma * | InstancePtr, | |
int | NumBd, | |||
XAxiCdma_Bd * | BdSetPtr | |||
) |
This function tries to free the number of BDs back to the ring.
InstancePtr | is the driver instance we are working on | |
NumBd | is the number of BDs to return | |
BdSetPtr | is the set of BDs to be returned |
int XAxiCdma_CfgInitialize | ( | XAxiCdma * | InstancePtr, | |
XAxiCdma_Config * | CfgPtr, | |||
u32 | EffectiveAddr | |||
) |
This function initializes the driver. It should be called before any other function calls to the driver.
It sets up the driver according to the hardware build. It resets the hardware at the end.
InstancePtr | is the driver instance that is working on | |
CfgPtr | is the pointer to the hardware configuration structure | |
EffectiveAddr | is the virtual address of the hardware instance. If address translation is not in use, please use the physical address |
void XAxiCdma_DumpRegisters | ( | XAxiCdma * | InstancePtr | ) |
This function dumps the registers of this DMA instance
InstancePtr | is the driver instance we are working on |
void XAxiCdma_GetCoalesce | ( | XAxiCdma * | InstancePtr, | |
u32 * | CounterPtr, | |||
u32 * | DelayPtr | |||
) |
This function gets the current setting of the interrupt coalescing threshold counter and the delay counter.
InstancePtr | is the driver instance we are working on | |
CounterPtr | is the return value for the coalescing counter setting | |
DelayPtr | is the return value for the delay counter setting |
u32 XAxiCdma_GetError | ( | XAxiCdma * | InstancePtr | ) |
This function gets the status on error bits.
InstancePtr | is the driver instance we are working on |
void XAxiCdma_IntrDisable | ( | XAxiCdma * | InstancePtr, | |
u32 | Mask | |||
) |
This function disables interrupts specified by the Mask. Interrupts that are not in the mask are not affected.
InstancePtr | is the driver instance we are working on | |
Mask | is the mask for the interrupts to be disabled |
void XAxiCdma_IntrEnable | ( | XAxiCdma * | InstancePtr, | |
u32 | Mask | |||
) |
This function enables interrupts specified by the Mask. Interrupts that are not in the mask are not affected.
InstancePtr | is the driver instance we are working on | |
Mask | is the mask for the interrupts to be enabled |
u32 XAxiCdma_IntrGetEnabled | ( | XAxiCdma * | InstancePtr | ) |
This function gets the mask for the interrupts that are currently enabled
InstancePtr | is the driver instance we are working on |
void XAxiCdma_IntrHandler | ( | void * | HandlerRef | ) |
This function is the interrupt handler for the driver, it handles all the interrupts. For the completion of a transfer that has a callback function, the callback function is called.
HandlerRef | is a reference pointer passed to the interrupt registration function. It will be a pointer to the driver instance we are working on |
int XAxiCdma_IsBusy | ( | XAxiCdma * | InstancePtr | ) |
This function checks whether the hardware is doing transfer
InstancePtr | is the driver instance we are working on |
XAxiCdma_Config* XAxiCdma_LookupConfig | ( | u32 | DeviceId | ) |
Look up the hardware configuration for a device instance
DeviceId | is the unique device ID of the device to lookup for |
void XAxiCdma_Reset | ( | XAxiCdma * | InstancePtr | ) |
This function conducts hardware reset
Current transfer will finish gracefully. However, all queued SG transfers that have not started will be flushed from the hardware.
InstancePtr | is the driver instance we are working on |
int XAxiCdma_ResetIsDone | ( | XAxiCdma * | InstancePtr | ) |
This function checks whether the hardware reset is done
InstancePtr | is the driver instance we are working on |
int XAxiCdma_SelectKeyHole | ( | XAxiCdma * | InstancePtr, | |
u32 | Direction, | |||
u32 | Select | |||
) |
This function configures KeyHole Write/Read Feature
InstancePtr | is the driver instance we are working on | |
Direction | is WRITE/READ Select is the option to enable (TRUE) or disable (FALSE). |
int XAxiCdma_SetCoalesce | ( | XAxiCdma * | InstancePtr, | |
u32 | Counter, | |||
u32 | Delay | |||
) |
This function tries to set the interrupt coalescing threshold counter and the delay counter. If to set only one of the counters, set the value of the other counter to be XAXICDMA_COALESCE_NO_CHANGE.
InstancePtr | is the driver instance we are working on | |
Counter | is the coalescing threshold to set to, the valid range is 1 to XAXICDMA_COALESCE_MAX. | |
Delay | is the delay timeout counter to set to, the valid range is 0 to XAXICDMA_DELAY_MAX. Setting a value of 0 disables the delay interrupt. |
int XAxiCdma_SimpleTransfer | ( | XAxiCdma * | InstancePtr, | |
u32 | SrcAddr, | |||
u32 | DstAddr, | |||
int | Length, | |||
XAxiCdma_CallBackFn | SimpleCallBack, | |||
void * | CallBackRef | |||
) |
This function does one simple transfer submission
It checks in the following sequence:
InstancePtr | is the pointer to the driver instance | |
SrcAddr | is the address of the source buffer | |
DstAddr | is the address of the destination buffer | |
Length | is the length of the transfer | |
SimpleCallBack | is the callback function for the simple transfer | |
CallBackRef | is the callback reference pointer |
Copyright © 1995-2014 Xilinx, Inc. All rights reserved.