#include "xaxivdma_hw.h"
#include "xaxivdma_i.h"
#include "xstatus.h"
#include "xil_assert.h"
Classes | |
struct | XAxiVdma_Config |
struct | XAxiVdma_DmaSetup |
struct | XAxiVdma_FrameCounter |
struct | XAxiVdma_ChannelCallBack |
struct | XAxiVdma |
Defines | |
#define | XAXIVDMA_H_ |
#define | XAXIVDMA_WRITE 1 |
#define | XAXIVDMA_READ 2 |
#define | XAXIVDMA_CHAN_FSYNC 0 |
#define | XAXIVDMA_CHAN_OTHER_FSYNC 1 |
#define | XAXIVDMA_S2MM_TUSER_FSYNC 2 |
#define | XAXIVDMA_EXTERNAL_GENLOCK 0 |
#define | XAXIVDMA_INTERNAL_GENLOCK 1 |
#define | XAXIVDMA_GENLOCK_MASTER 0 |
#define | XAXIVDMA_GENLOCK_SLAVE 1 |
#define | XAXIVDMA_DYN_GENLOCK_MASTER 2 |
#define | XAXIVDMA_DYN_GENLOCK_SLAVE 3 |
#define | XAXIVDMA_HANDLER_GENERAL 1 |
#define | XAXIVDMA_HANDLER_ERROR 2 |
#define | XAXIVDMA_DEVICE_READY 0x11111111 |
#define | XAXIVDMA_ENABLE_DBG_THRESHOLD_REG 0x01 |
#define | XAXIVDMA_ENABLE_DBG_FRMSTORE_REG 0x02 |
#define | XAXIVDMA_ENABLE_DBG_FRM_CNTR 0x04 |
#define | XAXIVDMA_ENABLE_DBG_DLY_CNTR 0x08 |
#define | XAXIVDMA_ENABLE_DBG_ALL_FEATURES 0x0F |
#define | XST_VDMA_MISMATCH_ERROR 1430 |
Typedefs | |
typedef void(* | XAxiVdma_CallBack )(void *CallBackRef, u32 InterruptTypes) |
typedef void(* | XAxiVdma_ErrorCallBack )(void *CallBackRef, u32 ErrorMask) |
Functions | |
XAxiVdma_Config * | XAxiVdma_LookupConfig (u16 DeviceId) |
int | XAxiVdma_CfgInitialize (XAxiVdma *InstancePtr, XAxiVdma_Config *CfgPtr, u32 EffectiveAddr) |
void | XAxiVdma_Reset (XAxiVdma *InstancePtr, u16 Direction) |
int | XAxiVdma_ResetNotDone (XAxiVdma *InstancePtr, u16 Direction) |
int | XAxiVdma_IsBusy (XAxiVdma *InstancePtr, u16 Direction) |
u32 | XAxiVdma_CurrFrameStore (XAxiVdma *InstancePtr, u16 Direction) |
u32 | XAxiVdma_GetVersion (XAxiVdma *InstancePtr) |
u32 | XAxiVdma_GetStatus (XAxiVdma *InstancePtr, u16 Direction) |
int | XAxiVdma_SetLineBufThreshold (XAxiVdma *InstancePtr, int LineBufThreshold, u16 Direction) |
int | XAxiVdma_StartParking (XAxiVdma *InstancePtr, int FrameIndex, u16 Direction) |
void | XAxiVdma_StopParking (XAxiVdma *InstancePtr, u16 Direction) |
void | XAxiVdma_StartFrmCntEnable (XAxiVdma *InstancePtr, u16 Direction) |
void | XAxiVdma_IntrEnable (XAxiVdma *InstancePtr, u32 IntrType, u16 Direction) |
void | XAxiVdma_IntrDisable (XAxiVdma *InstancePtr, u32 IntrType, u16 Direction) |
u32 | XAxiVdma_IntrGetPending (XAxiVdma *InstancePtr, u16 Direction) |
void | XAxiVdma_IntrClear (XAxiVdma *InstancePtr, u32 IntrType, u16 Direction) |
int | XAxiVdma_SetBdAddrs (XAxiVdma *InstancePtr, u32 BdAddrPhys, u32 BdAddrVirt, int NumBds, u16 Direction) |
XAxiVdma_Channel * | XAxiVdma_GetChannel (XAxiVdma *InstancePtr, u16 Direction) |
int | XAxiVdma_SetFrmStore (XAxiVdma *InstancePtr, u8 FrmStoreNum, u16 Direction) |
void | XAxiVdma_GetFrmStore (XAxiVdma *InstancePtr, u8 *FrmStoreNum, u16 Direction) |
int | XAxiVdma_FsyncSrcSelect (XAxiVdma *InstancePtr, u32 Source, u16 Direction) |
int | XAxiVdma_GenLockSourceSelect (XAxiVdma *InstancePtr, u32 Source, u16 Direction) |
int | XAxiVdma_GetDmaChannelErrors (XAxiVdma *InstancePtr, u16 Direction) |
int | XAxiVdma_ClearDmaChannelErrors (XAxiVdma *InstancePtr, u16 Direction, u32 ErrorMask) |
int | XAxiVdma_MaskS2MMErrIntr (XAxiVdma *InstancePtr, u32 ErrorMask, u16 Direction) |
int | XAxiVdma_StartWriteFrame (XAxiVdma *InstancePtr, XAxiVdma_DmaSetup *DmaConfigPtr) |
int | XAxiVdma_StartReadFrame (XAxiVdma *InstancePtr, XAxiVdma_DmaSetup *DmaConfigPtr) |
int | XAxiVdma_DmaConfig (XAxiVdma *InstancePtr, u16 Direction, XAxiVdma_DmaSetup *DmaConfigPtr) |
int | XAxiVdma_DmaSetBufferAddr (XAxiVdma *InstancePtr, u16 Direction, u32 *BufferAddrSet) |
int | XAxiVdma_DmaStart (XAxiVdma *InstancePtr, u16 Direction) |
void | XAxiVdma_DmaStop (XAxiVdma *InstancePtr, u16 Direction) |
void | XAxiVdma_DmaRegisterDump (XAxiVdma *InstancePtr, u16 Direction) |
int | XAxiVdma_SetFrameCounter (XAxiVdma *InstancePtr, XAxiVdma_FrameCounter *FrameCounterCfgPtr) |
void | XAxiVdma_GetFrameCounter (XAxiVdma *InstancePtr, XAxiVdma_FrameCounter *FrameCounterCfgPtr) |
void | XAxiVdma_ReadIntrHandler (void *InstancePtr) |
void | XAxiVdma_WriteIntrHandler (void *InstancePtr) |
int | XAxiVdma_SetCallBack (XAxiVdma *InstancePtr, u32 HandlerType, void *CallBackFunc, void *CallBackRef, u16 Direction) |
#define XAXIVDMA_CHAN_FSYNC 0 |
Frame Sync Source Selection
#define XAXIVDMA_CHAN_OTHER_FSYNC 1 |
#define XAXIVDMA_DEVICE_READY 0x11111111 |
Flag to signal that device is ready to be used
#define XAXIVDMA_DYN_GENLOCK_MASTER 2 |
#define XAXIVDMA_DYN_GENLOCK_SLAVE 3 |
#define XAXIVDMA_ENABLE_DBG_ALL_FEATURES 0x0F |
#define XAXIVDMA_ENABLE_DBG_DLY_CNTR 0x08 |
#define XAXIVDMA_ENABLE_DBG_FRM_CNTR 0x04 |
#define XAXIVDMA_ENABLE_DBG_FRMSTORE_REG 0x02 |
#define XAXIVDMA_ENABLE_DBG_THRESHOLD_REG 0x01 |
Debug Configuration Parameter Constants (C_ENABLE_DEBUG_INFO_*)
#define XAXIVDMA_EXTERNAL_GENLOCK 0 |
GenLock Source Selection
#define XAXIVDMA_GENLOCK_MASTER 0 |
GenLock Mode Constants
#define XAXIVDMA_GENLOCK_SLAVE 1 |
#define XAXIVDMA_H_ |
#define XAXIVDMA_HANDLER_ERROR 2 |
Error Interrupt Type
#define XAXIVDMA_HANDLER_GENERAL 1 |
Interrupt type for setting up callback Non-Error Interrupt Type
#define XAXIVDMA_INTERNAL_GENLOCK 1 |
#define XAXIVDMA_READ 2 |
DMA transfer from memory
#define XAXIVDMA_S2MM_TUSER_FSYNC 2 |
#define XAXIVDMA_WRITE 1 |
VDMA data transfer direction DMA transfer into memory
#define XST_VDMA_MISMATCH_ERROR 1430 |
typedef void(* XAxiVdma_CallBack)(void *CallBackRef, u32 InterruptTypes) |
Callback type for general interrupts
CallBackRef | is a callback reference passed in by the upper layer when setting the callback functions, and passed back to the upper layer when the callback is called. | |
InterruptTypes | indicates the detailed type(s) of the interrupt. Its value equals 'OR'ing one or more XAXIVDMA_IXR_* values defined in xaxivdma_hw.h |
typedef void(* XAxiVdma_ErrorCallBack)(void *CallBackRef, u32 ErrorMask) |
Callback type for Error interrupt.
CallBackRef | is a callback reference passed in by the upper layer when setting the callback function, and it is passed back to the upper layer when the callback is called. | |
ErrorMask | is a bit mask indicating the cause of the error. Its value equals 'OR'ing one or more XAXIVDMA_IXR_* values defined in xaxivdma_hw.h |
int XAxiVdma_CfgInitialize | ( | XAxiVdma * | InstancePtr, | |
XAxiVdma_Config * | CfgPtr, | |||
u32 | EffectiveAddr | |||
) |
Initialize the driver with hardware configuration
InstancePtr | is the pointer to the DMA engine to work on | |
CfgPtr | is the pointer to the hardware configuration structure | |
EffectiveAddr | is the virtual address map for the device |
int XAxiVdma_ClearDmaChannelErrors | ( | XAxiVdma * | InstancePtr, | |
u16 | Direction, | |||
u32 | ErrorMask | |||
) |
Clear DMA Channel Errors.
InstancePtr | is the XAxiVdma instance to operate on | |
Direction | is the channel to work on, use XAXIVDMA_READ/WRITE | |
ErrorMask | is the mask of error bits to clear |
u32 XAxiVdma_CurrFrameStore | ( | XAxiVdma * | InstancePtr, | |
u16 | Direction | |||
) |
Get the current frame that hardware is working on
InstancePtr | is the pointer to the DMA engine to work on | |
Direction | is the channel to work on, use XAXIVDMA_READ/WRITE |
int XAxiVdma_DmaConfig | ( | XAxiVdma * | InstancePtr, | |
u16 | Direction, | |||
XAxiVdma_DmaSetup * | DmaConfigPtr | |||
) |
Configure one DMA channel using the configuration structure
InstancePtr | is the pointer to the DMA engine to work on | |
Direction | is the DMA channel to work on | |
DmaConfigPtr | is the pointer to the setup structure |
void XAxiVdma_DmaRegisterDump | ( | XAxiVdma * | InstancePtr, | |
u16 | Direction | |||
) |
Dump registers of one DMA channel
InstancePtr | is the pointer to the DMA engine to work on | |
Direction | is the DMA channel to work on |
int XAxiVdma_DmaSetBufferAddr | ( | XAxiVdma * | InstancePtr, | |
u16 | Direction, | |||
u32 * | BufferAddrSet | |||
) |
Configure buffer addresses for one DMA channel
InstancePtr | is the pointer to the DMA engine to work on | |
Direction | is the DMA channel to work on | |
BufferAddrSet | is the set of addresses for the transfers |
int XAxiVdma_DmaStart | ( | XAxiVdma * | InstancePtr, | |
u16 | Direction | |||
) |
Start one DMA channel
InstancePtr | is the pointer to the DMA engine to work on | |
Direction | is the DMA channel to work on |
void XAxiVdma_DmaStop | ( | XAxiVdma * | InstancePtr, | |
u16 | Direction | |||
) |
Stop one DMA channel
InstancePtr | is the pointer to the DMA engine to work on | |
Direction | is the DMA channel to work on |
int XAxiVdma_FsyncSrcSelect | ( | XAxiVdma * | InstancePtr, | |
u32 | Source, | |||
u16 | Direction | |||
) |
Configure Frame Sync Source and valid only when C_USE_FSYNC is enabled.
InstancePtr | is the pointer to the DMA engine to work on | |
Source | is the value to set the source of Frame Sync | |
Direction | is the DMA channel to work on |
int XAxiVdma_GenLockSourceSelect | ( | XAxiVdma * | InstancePtr, | |
u32 | Source, | |||
u16 | Direction | |||
) |
Configure Gen Lock Source
InstancePtr | is the pointer to the DMA engine to work on | |
Source | is the value to set the source of Gen Lock | |
Direction | is the DMA channel to work on |
XAxiVdma_Channel* XAxiVdma_GetChannel | ( | XAxiVdma * | InstancePtr, | |
u16 | Direction | |||
) |
Get a channel
InstancePtr | is the DMA engine to work on | |
Direction | is the direction for the channel to get |
int XAxiVdma_GetDmaChannelErrors | ( | XAxiVdma * | InstancePtr, | |
u16 | Direction | |||
) |
Check for DMA Channel Errors.
InstancePtr | is the XAxiVdma instance to operate on | |
Direction | is the channel to work on, use XAXIVDMA_READ/WRITE |
void XAxiVdma_GetFrameCounter | ( | XAxiVdma * | InstancePtr, | |
XAxiVdma_FrameCounter * | CfgPtr | |||
) |
Get the frame counter and delay counter for both channels
InstancePtr | is the pointer to the DMA engine to work on | |
CfgPtr | is the configuration structure to contain return values |
void XAxiVdma_GetFrmStore | ( | XAxiVdma * | InstancePtr, | |
u8 * | FrmStoreNum, | |||
u16 | Direction | |||
) |
Get the number of frame store buffers to use.
InstancePtr | is the XAxiVdma instance to operate on | |
FrmStoreNum | is the number of frame store buffers to use. | |
Direction | is the channel to work on, use XAXIVDMA_READ/WRITE |
u32 XAxiVdma_GetStatus | ( | XAxiVdma * | InstancePtr, | |
u16 | Direction | |||
) |
Get the status of a channel
InstancePtr | is the pointer to the DMA engine to work on | |
Direction | is the channel to work on, use XAXIVDMA_READ/WRITE |
u32 XAxiVdma_GetVersion | ( | XAxiVdma * | InstancePtr | ) |
Get the version of the hardware
InstancePtr | is the pointer to the DMA engine to work on |
void XAxiVdma_IntrClear | ( | XAxiVdma * | InstancePtr, | |
u32 | IntrType, | |||
u16 | Direction | |||
) |
Clear the pending interrupts specified by the bit mask
Interrupts not specified by the mask will not be affected
InstancePtr | is the pointer to the DMA engine to work on | |
Direction | is the DMA channel, use XAXIVDMA_READ or XAXIVDMA_WRITE | |
IntrType | is the bit mask for the interrups to be cleared |
void XAxiVdma_IntrDisable | ( | XAxiVdma * | InstancePtr, | |
u32 | IntrType, | |||
u16 | Direction | |||
) |
Disable specific interrupts for a channel
Interrupts not specified by the mask will not be affected
InstancePtr | is the pointer to the DMA engine to work on | |
IntrType | is the bit mask for the interrups to be disabled | |
Direction | is the DMA channel, use XAXIVDMA_READ or XAXIVDMA_WRITE |
void XAxiVdma_IntrEnable | ( | XAxiVdma * | InstancePtr, | |
u32 | IntrType, | |||
u16 | Direction | |||
) |
Enable specific interrupts for a channel
Interrupts not specified by the mask will not be affected
InstancePtr | is the pointer to the DMA engine to work on | |
Direction | is the DMA channel, use XAXIVDMA_READ or XAXIVDMA_WRITE | |
IntrType | is the bit mask for the interrups to be enabled |
u32 XAxiVdma_IntrGetPending | ( | XAxiVdma * | InstancePtr, | |
u16 | Direction | |||
) |
Get the pending interrupts of a channel
InstancePtr | is the pointer to the DMA engine to work on | |
Direction | is the DMA channel, use XAXIVDMA_READ or XAXIVDMA_WRITE |
int XAxiVdma_IsBusy | ( | XAxiVdma * | InstancePtr, | |
u16 | Direction | |||
) |
Check whether a DMA channel is busy
InstancePtr | is the pointer to the DMA engine to work on | |
Direction | is the channel to work on, use XAXIVDMA_READ/WRITE |
XAxiVdma_Config* XAxiVdma_LookupConfig | ( | u16 | DeviceId | ) |
Look up the hardware configuration for a device instance
DeviceId | is the unique device ID of the device to lookup for |
int XAxiVdma_MaskS2MMErrIntr | ( | XAxiVdma * | InstancePtr, | |
u32 | ErrorMask, | |||
u16 | Direction | |||
) |
Masks the S2MM error interrupt for the provided error mask value
InstancePtr | is the XAxiVdma instance to operate on | |
ErrorMask | is the mask of error bits for which S2MM error interrupt can be disabled. | |
Direction | is the channel to work on, use XAXIVDMA_READ/WRITE |
void XAxiVdma_ReadIntrHandler | ( | void * | InstancePtr | ) |
Interrupt handler for the read channel
InstancePtr | is the pointer to the DMA engine to work on |
void XAxiVdma_Reset | ( | XAxiVdma * | InstancePtr, | |
u16 | Direction | |||
) |
This function resets one DMA channel
The registers will be default values after the reset
InstancePtr | is the pointer to the DMA engine to work on | |
Direction | is the channel to work on, use XAXIVDMA_READ/WRITE |
int XAxiVdma_ResetNotDone | ( | XAxiVdma * | InstancePtr, | |
u16 | Direction | |||
) |
This function checks one DMA channel for reset completion
InstancePtr | is the pointer to the DMA engine to work on | |
Direction | is the channel to work on, use XAXIVDMA_READ/WRITE |
int XAxiVdma_SetBdAddrs | ( | XAxiVdma * | InstancePtr, | |
u32 | BdAddrPhys, | |||
u32 | BdAddrVirt, | |||
int | NumBds, | |||
u16 | Direction | |||
) |
Set BD addresses to be different.
In some systems, it is convenient to put BDs into a certain region of the memory. This function enables that.
InstancePtr | is the pointer to the DMA engine to work on | |
BdAddrPhys | is the physical starting address for BDs | |
BdAddrVirt | is the Virtual starting address for BDs. For systems that do not use MMU, then virtual address is the same as physical address | |
NumBds | is the number of BDs to setup with. This is required to be the same as the number of frame stores for that channel | |
Direction | is the channel direction |
We assume that the memory region starting from BdAddrPhys and BdAddrVirt are large enough to hold all the BDs.
int XAxiVdma_SetCallBack | ( | XAxiVdma * | InstancePtr, | |
u32 | HandlerType, | |||
void * | CallBackFunc, | |||
void * | CallBackRef, | |||
u16 | Direction | |||
) |
Set call back function and call back reference pointer for one channel
InstancePtr | is the pointer to the DMA engine to work on | |
HandlerType | is the interrupt type that this callback handles | |
CallBackFunc | is the call back function pointer | |
CallBackRef | is the call back reference pointer | |
Direction | is the DMA channel, use XAXIVDMA_READ or XAXIVDMA_WRITE |
int XAxiVdma_SetFrameCounter | ( | XAxiVdma * | InstancePtr, | |
XAxiVdma_FrameCounter * | CfgPtr | |||
) |
Set the frame counter and delay counter for both channels
InstancePtr | is the pointer to the DMA engine to work on | |
CfgPtr | is the pointer to the configuration structure |
int XAxiVdma_SetFrmStore | ( | XAxiVdma * | InstancePtr, | |
u8 | FrmStoreNum, | |||
u16 | Direction | |||
) |
Set the number of frame store buffers to use.
InstancePtr | is the XAxiVdma instance to operate on | |
FrmStoreNum | is the number of frame store buffers to use. | |
Direction | is the channel to work on, use XAXIVDMA_READ/WRITE |
int XAxiVdma_SetLineBufThreshold | ( | XAxiVdma * | InstancePtr, | |
int | LineBufThreshold, | |||
u16 | Direction | |||
) |
Configure Line Buffer Threshold
InstancePtr | is the pointer to the DMA engine to work on | |
LineBufThreshold | is the value to set threshold | |
Direction | is the DMA channel to work on |
void XAxiVdma_StartFrmCntEnable | ( | XAxiVdma * | InstancePtr, | |
u16 | Direction | |||
) |
Start frame count enable on one channel
This is needed to start limiting the number of frames to transfer so that software can check the data etc after hardware stops transfer.
InstancePtr | is the pointer to the DMA engine to work on | |
Direction | is the channel to work on, use XAXIVDMA_READ/WRITE |
int XAxiVdma_StartParking | ( | XAxiVdma * | InstancePtr, | |
int | FrameIndex, | |||
u16 | Direction | |||
) |
Start parking mode on a certain frame
InstancePtr | is the pointer to the DMA engine to work on | |
FrameIndex | is the frame to park on | |
Direction | is the channel to work on, use XAXIVDMA_READ/WRITE |
int XAxiVdma_StartReadFrame | ( | XAxiVdma * | InstancePtr, | |
XAxiVdma_DmaSetup * | DmaConfigPtr | |||
) |
Start a read operation
Read corresponds to send data from memory to device
InstancePtr | is the pointer to the DMA engine to work on | |
DmaConfigPtr | is the pointer to the setup structure |
int XAxiVdma_StartWriteFrame | ( | XAxiVdma * | InstancePtr, | |
XAxiVdma_DmaSetup * | DmaConfigPtr | |||
) |
Start a write operation
Write corresponds to send data from device to memory
InstancePtr | is the pointer to the DMA engine to work on | |
DmaConfigPtr | is the pointer to the setup structure |
void XAxiVdma_StopParking | ( | XAxiVdma * | InstancePtr, | |
u16 | Direction | |||
) |
Exit parking mode, the channel will return to circular buffer mode
InstancePtr | is the pointer to the DMA engine to work on | |
Direction | is the channel to work on, use XAXIVDMA_READ/WRITE |
void XAxiVdma_WriteIntrHandler | ( | void * | InstancePtr | ) |
Interrupt handler for the write channel
InstancePtr | is the pointer to the DMA engine to work on |
Copyright © 1995-2014 Xilinx, Inc. All rights reserved.