dmaps
Vitis Drivers API Documentation
|
Data Structures | |
struct | XDmaPs_Config |
This typedef contains configuration information for the device. More... | |
struct | XDmaPs_ChanCtrl |
DMA channle control structure. More... | |
struct | XDmaPs_BD |
DMA block descriptor stucture. More... | |
struct | XDmaPs_Cmd |
A DMA command consisits of a channel control struct, a block descriptor, a user defined program, a pointer pointing to generated DMA program, and execution result. More... | |
struct | XDmaPs_ProgBuf |
The XDmaPs_ProgBuf is the struct for a DMA program buffer. More... | |
struct | XDmaPs_ChannelData |
The XDmaPs_ChannelData is a struct to book keep individual channel of the DMAC. More... | |
struct | XDmaPs |
The XDmaPs driver instance data structure. More... | |
Macros | |
#define | XDmaPs_WriteReg(BaseAddress, RegOffset, RegisterValue) Xil_Out32((BaseAddress) + (RegOffset), (RegisterValue)) |
Write a DMAC register. More... | |
Typedefs | |
typedef void(* | XDmaPsDoneHandler )(unsigned int Channel, XDmaPs_Cmd *DmaCmd, void *CallbackRef) |
It's the done handler a user can set for a channel. More... | |
typedef void(* | XDmaPsFaultHandler )(unsigned int Channel, XDmaPs_Cmd *DmaCmd, void *CallbackRef) |
It's the fault handler a user can set for a channel. More... | |
Functions | |
int | XDmaPs_CfgInitialize (XDmaPs *InstPtr, XDmaPs_Config *Config, u32 EffectiveAddr) |
Initializes a specific XDmaPs instance such that it is ready to be used. More... | |
int | XDmaPs_ResetManager (XDmaPs *InstPtr) |
Reset the DMA Manager. More... | |
int | XDmaPs_ResetChannel (XDmaPs *InstPtr, unsigned int Channel) |
Reset the specified DMA Channel. More... | |
void | XDmaPs_FaultISR (XDmaPs *InstPtr) |
Driver fault interrupt service routine This is the one that connects the GIC. More... | |
int | XDmaPs_SetDoneHandler (XDmaPs *InstPtr, unsigned Channel, XDmaPsDoneHandler DoneHandler, void *CallbackRef) |
Set the done handler for a channel. More... | |
int | XDmaPs_SetFaultHandler (XDmaPs *InstPtr, XDmaPsFaultHandler FaultHandler, void *CallbackRef) |
Set the fault handler for a channel. More... | |
int | XDmaPs_Instr_DMARMB (char *DmaProg) |
Construction function for DMARMB instruction. More... | |
int | XDmaPs_Instr_DMAWMB (char *DmaProg) |
Construction function for DMAWMB instruction. More... | |
u32 | XDmaPs_ToCCRValue (XDmaPs_ChanCtrl *ChanCtrl) |
Conversion function from PL330 bus transfer descriptors to CCR value. More... | |
int | XDmaPs_ConstructSingleLoop (char *DmaProgStart, int CacheLength, char *DmaProgLoopStart, int LoopCount) |
Construct a loop with only DMALD and DMAST as the body using loop counter 0. More... | |
int | XDmaPs_ConstructNestedLoop (char *DmaProgStart, int CacheLength, char *DmaProgLoopStart, unsigned int LoopCountOuter, unsigned int LoopCountInner) |
Construct a nested loop with only DMALD and DMAST in the inner loop body. More... | |
int | XDmaPs_GenDmaProg (XDmaPs *InstPtr, unsigned int Channel, XDmaPs_Cmd *Cmd) |
Generate a DMA program based for the DMA command, the buffer will be pointed by the GeneratedDmaProg field of the command. More... | |
int | XDmaPs_FreeDmaProg (XDmaPs *InstPtr, unsigned int Channel, XDmaPs_Cmd *Cmd) |
Free the DMA program buffer that is pointed by the GeneratedDmaProg field of the command. More... | |
int | XDmaPs_Start (XDmaPs *InstPtr, unsigned int Channel, XDmaPs_Cmd *Cmd, int HoldDmaProg) |
Start a DMA command. More... | |
int | XDmaPs_IsActive (XDmaPs *InstPtr, unsigned int Channel) |
Checks whether the DMA channel is active or idle. More... | |
void | XDmaPs_DoneISR_0 (XDmaPs *InstPtr) |
Driver done interrupt service routine for channel 0. More... | |
void | XDmaPs_DoneISR_1 (XDmaPs *InstPtr) |
Driver done interrupt service routine for channel 1. More... | |
void | XDmaPs_DoneISR_2 (XDmaPs *InstPtr) |
Driver done interrupt service routine for channel 2. More... | |
void | XDmaPs_DoneISR_3 (XDmaPs *InstPtr) |
Driver done interrupt service routine for channel 3. More... | |
void | XDmaPs_DoneISR_4 (XDmaPs *InstPtr) |
Driver done interrupt service routine for channel 4. More... | |
void | XDmaPs_DoneISR_5 (XDmaPs *InstPtr) |
Driver done interrupt service routine for channel 5. More... | |
void | XDmaPs_DoneISR_6 (XDmaPs *InstPtr) |
Driver done interrupt service routine for channel 6. More... | |
void | XDmaPs_DoneISR_7 (XDmaPs *InstPtr) |
Driver done interrupt service routine for channel 7. More... | |
void | XDmaPs_Print_DmaProg (XDmaPs_Cmd *Cmd) |
Print the Dma Prog Contents. More... | |
XDmaPs_Config * | XDmaPs_LookupConfig (u16 DeviceId) |
Looks up the device configuration based on the unique device ID. More... | |
int | XDmaPs_SelfTest (XDmaPs *InstPtr) |
This function runs a self-test on the driver and hardware device. More... | |
void | XDmaPs_ResetHw (u32 BaseAddress) |
This function perform the reset sequence to the given dmaps interface by configuring the appropriate control bits in the dmaps specifc registers the dmaps reset squence involves the following steps Disable all the interuupts Clear the pending interrupts Kill all the active channel threads Kill the manager thread. More... | |
Variables | |
XDmaPs_Config | XDmaPs_ConfigTable [] |
Each XDmaPs device in the system has an entry in this table. More... | |
XDmaPs_Config | XDmaPs_ConfigTable [] |
Each XDmaPs device in the system has an entry in this table. More... | |
#define XDmaPs_WriteReg | ( | BaseAddress, | |
RegOffset, | |||
RegisterValue | |||
) | Xil_Out32((BaseAddress) + (RegOffset), (RegisterValue)) |
Write a DMAC register.
BaseAddress | contains the base address of the device. |
RegOffset | contains the offset from the base address of the device. |
RegisterValue | is the value to be written to the register. |
Referenced by XDmaPs_ResetHw(), and XDmaPs_Start().
typedef void(* XDmaPsDoneHandler)(unsigned int Channel, XDmaPs_Cmd *DmaCmd, void *CallbackRef) |
It's the done handler a user can set for a channel.
typedef void(* XDmaPsFaultHandler)(unsigned int Channel, XDmaPs_Cmd *DmaCmd, void *CallbackRef) |
It's the fault handler a user can set for a channel.
int XDmaPs_CfgInitialize | ( | XDmaPs * | InstPtr, |
XDmaPs_Config * | Config, | ||
u32 | EffectiveAddr | ||
) |
Initializes a specific XDmaPs instance such that it is ready to be used.
The data format of the device is setup for 8 data bits, 1 stop bit, and no parity by default. The baud rate is set to a default value specified by Config->DefaultBaudRate if set, otherwise it is set to 19.2K baud. The receive FIFO threshold is set for 8 bytes. The default operating mode of the driver is polled mode.
InstPtr | is a pointer to the XDmaPs instance. |
Config | is a reference to a structure containing information about a specific XDmaPs driver. |
EffectiveAddr | is the device base address in the virtual memory address space. The caller is responsible for keeping the address mapping from EffectiveAddr to the device physical base address unchanged once this function is invoked. Unexpected errors may occur if the address mapping changes after this function is called. If address translation is not used, pass in the physical address instead. |
- XST_SUCCESS on initialization completion
References XDmaPs_Config::BaseAddress, XDmaPs::CacheLength, XDmaPs_ChannelData::ChanId, XDmaPs::Chans, XDmaPs::Config, XDmaPs_Config::DeviceId, XDmaPs_ChannelData::DevId, and XDmaPs::IsReady.
Referenced by XDmaPs_Example_W_Intr().
int XDmaPs_ConstructNestedLoop | ( | char * | DmaProgStart, |
int | CacheLength, | ||
char * | DmaProgLoopStart, | ||
unsigned int | LoopCountOuter, | ||
unsigned int | LoopCountInner | ||
) |
Construct a nested loop with only DMALD and DMAST in the inner loop body.
It uses loop counter 1 for the outer loop and loop counter 0 for the inner loop.
DmaProgStart | is the very start address of the DMA program. This is used to calculate whether the loop is in a cache line. |
CacheLength | is the icache line length, in terms of bytes. If it's zero, the performance enhancement feature will be turned off. |
DmaProgLoopStart | The starting address of the loop (DMALP). |
LoopCountOuter | The outer loop count. Loop count - 1 will be used to initialize the loop counter. |
LoopCountInner | The inner loop count. Loop count - 1 will be used to initialize the loop counter. |
References XDmaPs_ConstructSingleLoop().
int XDmaPs_ConstructSingleLoop | ( | char * | DmaProgStart, |
int | CacheLength, | ||
char * | DmaProgLoopStart, | ||
int | LoopCount | ||
) |
Construct a loop with only DMALD and DMAST as the body using loop counter 0.
The function also makes sure the loop body and the lpend is in the same cache line.
DmaProgStart | is the very start address of the DMA program. This is used to calculate whether the loop is in a cache line. |
CacheLength | is the icache line length, in terms of bytes. If it's zero, the performance enhancement feature will be turned off. |
DmaProgLoopStart | The starting address of the loop (DMALP). |
LoopCount | The inner loop count. Loop count - 1 will be used to initialize the loop counter. |
Referenced by XDmaPs_ConstructNestedLoop().
void XDmaPs_DoneISR_0 | ( | XDmaPs * | InstPtr | ) |
Driver done interrupt service routine for channel 0.
To avoid linkage error,modify all inline functions from extern inline to static inline for IAR compiler.
We need this done ISR mainly because the driver needs to release the DMA program buffer. This is the one that connects the GIC
InstPtr | is the DMA instance. |
Driver done interrupt service routines for the channels. We need this done ISR mainly because the driver needs to release the DMA program buffer. This is the one that connects the GIC
Referenced by SetupInterruptSystem(), and XDmaPs_Example_W_Intr().
void XDmaPs_DoneISR_1 | ( | XDmaPs * | InstPtr | ) |
Driver done interrupt service routine for channel 1.
We need this done ISR mainly because the driver needs to release the DMA program buffer. This is the one that connects the GIC
InstPtr | is the DMA instance. |
Referenced by SetupInterruptSystem(), and XDmaPs_Example_W_Intr().
void XDmaPs_DoneISR_2 | ( | XDmaPs * | InstPtr | ) |
Driver done interrupt service routine for channel 2.
We need this done ISR mainly because the driver needs to release the DMA program buffer. This is the one that connects the GIC
InstPtr | is the DMA instance. |
Referenced by SetupInterruptSystem(), and XDmaPs_Example_W_Intr().
void XDmaPs_DoneISR_3 | ( | XDmaPs * | InstPtr | ) |
Driver done interrupt service routine for channel 3.
We need this done ISR mainly because the driver needs to release the DMA program buffer. This is the one that connects the GIC
InstPtr | is the DMA instance. |
Referenced by SetupInterruptSystem(), and XDmaPs_Example_W_Intr().
void XDmaPs_DoneISR_4 | ( | XDmaPs * | InstPtr | ) |
Driver done interrupt service routine for channel 4.
We need this done ISR mainly because the driver needs to release the DMA program buffer. This is the one that connects the GIC
InstPtr | is the DMA instance. |
Referenced by SetupInterruptSystem(), and XDmaPs_Example_W_Intr().
void XDmaPs_DoneISR_5 | ( | XDmaPs * | InstPtr | ) |
Driver done interrupt service routine for channel 5.
We need this done ISR mainly because the driver needs to release the DMA program buffer. This is the one that connects the GIC
InstPtr | is the DMA instance. |
Referenced by SetupInterruptSystem(), and XDmaPs_Example_W_Intr().
void XDmaPs_DoneISR_6 | ( | XDmaPs * | InstPtr | ) |
Driver done interrupt service routine for channel 6.
We need this done ISR mainly because the driver needs to release the DMA program buffer. This is the one that connects the GIC
InstPtr | is the DMA instance. |
Referenced by SetupInterruptSystem(), and XDmaPs_Example_W_Intr().
void XDmaPs_DoneISR_7 | ( | XDmaPs * | InstPtr | ) |
Driver done interrupt service routine for channel 7.
We need this done ISR mainly because the driver needs to release the DMA program buffer. This is the one that connects the GIC
InstPtr | is the DMA instance. |
Referenced by SetupInterruptSystem(), and XDmaPs_Example_W_Intr().
void XDmaPs_FaultISR | ( | XDmaPs * | InstPtr | ) |
Driver fault interrupt service routine This is the one that connects the GIC.
Driver fault interrupt service routine.
InstPtr | is the DMA instance. |
References XDmaPs_Config::BaseAddress, XDmaPs_Cmd::ChanFaultPCAddr, XDmaPs_Cmd::ChanFaultType, XDmaPs::Chans, XDmaPs::Config, XDmaPs_Config::DeviceId, XDmaPs_ChannelData::DmaCmdFromHw, XDmaPs_ChannelData::DmaCmdToHw, XDmaPs_Cmd::DmaStatus, XDmaPs::FaultHandler, XDmaPs::FaultRef, XDmaPs_Cmd::GeneratedDmaProg, XDmaPs_ChannelData::HoldDmaProg, and XDmaPs_ChannelData::ProgBufPool.
Referenced by SetupInterruptSystem(), and XDmaPs_Example_W_Intr().
int XDmaPs_FreeDmaProg | ( | XDmaPs * | InstPtr, |
unsigned int | Channel, | ||
XDmaPs_Cmd * | Cmd | ||
) |
Free the DMA program buffer that is pointed by the GeneratedDmaProg field of the command.
InstPtr | is then DMA instance. |
Channel | is the DMA channel number. |
Cmd | is the DMA command. |
References XDmaPs::Chans, XDmaPs_Cmd::GeneratedDmaProg, XDmaPs_Cmd::GeneratedDmaProgLength, and XDmaPs_ChannelData::ProgBufPool.
int XDmaPs_GenDmaProg | ( | XDmaPs * | InstPtr, |
unsigned int | Channel, | ||
XDmaPs_Cmd * | Cmd | ||
) |
Generate a DMA program based for the DMA command, the buffer will be pointed by the GeneratedDmaProg field of the command.
InstPtr | is then DMA instance. |
Channel | is the DMA channel number. |
Cmd | is the DMA command. |
References XDmaPs_Cmd::BD, XDmaPs::CacheLength, XDmaPs_Cmd::ChanCtrl, XDmaPs::Chans, XDmaPs_BD::DstAddr, XDmaPs_ChanCtrl::DstBurstLen, XDmaPs_ChanCtrl::DstBurstSize, XDmaPs_ChanCtrl::DstInc, XDmaPs_Cmd::GeneratedDmaProg, XDmaPs_Cmd::GeneratedDmaProgLength, XDmaPs_ChannelData::ProgBufPool, XDmaPs_BD::SrcAddr, XDmaPs_ChanCtrl::SrcBurstLen, XDmaPs_ChanCtrl::SrcBurstSize, XDmaPs_ChanCtrl::SrcInc, and XDmaPs_Print_DmaProg().
Referenced by XDmaPs_Start().
int XDmaPs_Instr_DMARMB | ( | char * | DmaProg | ) |
Construction function for DMARMB instruction.
This function fills the program buffer with the constructed instruction.
DmaProg | is the DMA program buffer, it's the starting address for the instruction being constructed |
int XDmaPs_Instr_DMAWMB | ( | char * | DmaProg | ) |
Construction function for DMAWMB instruction.
This function fills the program buffer with the constructed instruction.
DmaProg | is the DMA program buffer, it's the starting address for the instruction being constructed |
int XDmaPs_IsActive | ( | XDmaPs * | InstPtr, |
unsigned int | Channel | ||
) |
Checks whether the DMA channel is active or idle.
InstPtr | is the DMA instance. |
Channel | is the DMA channel number. |
References XDmaPs::Chans, and XDmaPs_ChannelData::DmaCmdToHw.
Referenced by XDmaPs_Start().
XDmaPs_Config * XDmaPs_LookupConfig | ( | u16 | DeviceId | ) |
Looks up the device configuration based on the unique device ID.
The table contains the configuration info for each device in the system.
DeviceId | contains the ID of the device |
A pointer to the configuration structure or NULL if the specified device is not in the system.
None.
Referenced by XDmaPs_Example_W_Intr().
void XDmaPs_Print_DmaProg | ( | XDmaPs_Cmd * | Cmd | ) |
Print the Dma Prog Contents.
Cmd | is the command buffer. |
References XDmaPs_Cmd::GeneratedDmaProg, XDmaPs_Cmd::GeneratedDmaProgLength, XDmaPs_Cmd::UserDmaProg, and XDmaPs_Cmd::UserDmaProgLength.
Referenced by XDmaPs_GenDmaProg().
int XDmaPs_ResetChannel | ( | XDmaPs * | InstPtr, |
unsigned int | Channel | ||
) |
Reset the specified DMA Channel.
InstPtr | is the DMA instance. |
Channel | is the channel to be reset. |
References XDmaPs_Config::BaseAddress, and XDmaPs::Config.
void XDmaPs_ResetHw | ( | u32 | BaseAddress | ) |
This function perform the reset sequence to the given dmaps interface by configuring the appropriate control bits in the dmaps specifc registers the dmaps reset squence involves the following steps Disable all the interuupts Clear the pending interrupts Kill all the active channel threads Kill the manager thread.
BaseAddress | of the interface |
References XDmaPs_WriteReg.
int XDmaPs_ResetManager | ( | XDmaPs * | InstPtr | ) |
Reset the DMA Manager.
InstPtr | is the DMA instance. |
References XDmaPs_Config::BaseAddress, and XDmaPs::Config.
int XDmaPs_SelfTest | ( | XDmaPs * | InstPtr | ) |
This function runs a self-test on the driver and hardware device.
This self test performs a local loopback and verifies data can be sent and received.
The time for this test is proportional to the baud rate that has been set prior to calling this function.
The mode and control registers are restored before return.
InstPtr | is a pointer to the XDmaPs instance |
- XST_SUCCESS if the test was successful - XST_FAILURE if the test failed
This function can hang if the hardware is not functioning properly.
References XDmaPs_Config::BaseAddress, and XDmaPs::Config.
int XDmaPs_SetDoneHandler | ( | XDmaPs * | InstPtr, |
unsigned | Channel, | ||
XDmaPsDoneHandler | DoneHandler, | ||
void * | CallbackRef | ||
) |
Set the done handler for a channel.
InstPtr | is the DMA instance. |
Channel | is the channel number. |
DoneHandler | is the done interrupt handler. |
CallbackRef | is the callback reference data. |
References XDmaPs::Chans, XDmaPs_ChannelData::DoneHandler, and XDmaPs_ChannelData::DoneRef.
Referenced by XDmaPs_Example_W_Intr().
int XDmaPs_SetFaultHandler | ( | XDmaPs * | InstPtr, |
XDmaPsFaultHandler | FaultHandler, | ||
void * | CallbackRef | ||
) |
Set the fault handler for a channel.
InstPtr | is the DMA instance. |
FaultHandler | is the fault interrupt handler. |
CallbackRef | is the callback reference data. |
References XDmaPs::FaultHandler, and XDmaPs::FaultRef.
int XDmaPs_Start | ( | XDmaPs * | InstPtr, |
unsigned int | Channel, | ||
XDmaPs_Cmd * | Cmd, | ||
int | HoldDmaProg | ||
) |
Start a DMA command.
The command can only be invoked when the channel is idle. The driver takes the command, generates DMA program if needed, then pass the program to DMAC to execute.
InstPtr | is then DMA instance. |
Channel | is the DMA channel number. |
Cmd | is the DMA command. |
HoldDmaProg | is tag indicating whether the driver can release the allocated DMA buffer or not. If a user wants to examine the generated DMA program, the flag should be set to 1. After the DMA program is finished, a user needs to explicity free the buffer. |
References XDmaPs_Config::BaseAddress, XDmaPs_Cmd::BD, XDmaPs_Cmd::ChanCtrl, XDmaPs::Chans, XDmaPs::Config, XDmaPs_ChannelData::DmaCmdToHw, XDmaPs_Cmd::DmaStatus, XDmaPs_BD::DstAddr, XDmaPs_ChanCtrl::DstInc, XDmaPs_Cmd::GeneratedDmaProg, XDmaPs_ChannelData::HoldDmaProg, XDmaPs_BD::Length, XDmaPs_BD::SrcAddr, XDmaPs_ChanCtrl::SrcInc, XDmaPs_Cmd::UserDmaProg, XDmaPs_GenDmaProg(), XDmaPs_IsActive(), and XDmaPs_WriteReg.
Referenced by XDmaPs_Example_W_Intr().
u32 XDmaPs_ToCCRValue | ( | XDmaPs_ChanCtrl * | ChanCtrl | ) |
Conversion function from PL330 bus transfer descriptors to CCR value.
All the values passed to the functions are in terms of assembly languages, not in terms of the register bit encoding.
ChanCtrl | is the Instance of XDmaPs_ChanCtrl. |
References XDmaPs_ChanCtrl::DstBurstLen, XDmaPs_ChanCtrl::DstBurstSize, XDmaPs_ChanCtrl::DstCacheCtrl, XDmaPs_ChanCtrl::DstInc, XDmaPs_ChanCtrl::DstProtCtrl, XDmaPs_ChanCtrl::EndianSwapSize, XDmaPs_ChanCtrl::SrcBurstLen, XDmaPs_ChanCtrl::SrcBurstSize, XDmaPs_ChanCtrl::SrcCacheCtrl, XDmaPs_ChanCtrl::SrcInc, and XDmaPs_ChanCtrl::SrcProtCtrl.
XDmaPs_Config XDmaPs_ConfigTable[] |
Each XDmaPs device in the system has an entry in this table.
XDmaPs_Config XDmaPs_ConfigTable[] |
Each XDmaPs device in the system has an entry in this table.