ADM-XRC SDK 2.8.1 User Guide (Linux)
© Copyright 2001-2009 Alpha Data
Prototype
ADMXRC2_STATUS ADMXRC2_DoDMA( ADMXRC2_HANDLE Card, ADMXRC2_DMADESC DmaDesc, unsigned long Offset, unsigned long Length, uint32_t Local, ADMXRC2_DMADIR Direction, unsigned int Channel, uint32_t DMAModeWord, uint32_t Flags, unsigned long* Timeout, void* Ignored);
Arguments
Argument | Type | Purpose |
Card | In | Handle of card to configure |
DmaDesc | In | Handle to DMA descriptor representing application buffer |
Offset | In | Offset within application buffer |
Length | In | Number of bytes to transfer |
Local | In | Address of beginning of transfer on local bus |
Direction | In | Direction of DMA transfer |
Channel | In | DMA channel to use for the transfer |
DMAModeWord | In | Mode word to use for the DMA transfer |
Flags | In | Miscellaneous flags |
Timeout | In/out | Timeout for DMA transfer |
Ignored | In | Pass NULL |
Return value
Value | Meaning |
ADMXRC2_SUCCESS | The DMA transfer was performed successfully |
ADMXRC2_INVALID_HANDLE | Card is not a valid handle to a card |
ADMXRC2_INVALID_DMADESC | DMADesc is not a valid DMA descriptor |
ADMXRC2_INVALID_PARAMETER | An invalid parameter was passed |
ADMXRC2_DEVICE_BUSY | Could not begin DMA immediately as requested |
Description
This function is used to perform a DMA transfer from an application buffer to the FPGA or from the FPGA to an application buffer. DMA transfers are queued in a first come, first served manner unless the Flags parameter (see below) specifies otherwise. When a thread calls ADMXRC2_DoDMA, it is blocked until the DMA transfer has been completed.
The DmaDesc parameter must be a valid DMA descriptor obtained via a call to ADMXRC2_SetupDMA. This, along with Offset, implicitly specifies the application buffer that is the source or destination of data for the DMA transfer.
The Offset parameter is the offset into the user buffer at where the DMA transfer is to begin transferring data. This permits one DMA descriptor to map a large buffer; DMA transfers can then be performed on subregions of the large buffer by specifying appropriate Offset and Length values.
The Length parameter specifies the number of bytes of data to transfer.
The Local parameter specifies the starting local bus address of the transfer. The DMAModeWord parameter may specify that the local bus address is invariant for the duration of the DMA transfer - see ADMXRC2_BuildDMAModeWord.
The Direction parameter specifies whether the transfer is from application buffer to FPGA or FPGA to application buffer, and should be a value from the enumerated type ADMXRC2_DMADIR.
The Channel parameter is a zero-based index that specifies which DMA channel should be used for the operation. The number of DMA channels provided by a card is given by the NumDMAChan member of the ADMXRC2_CARD_INFO structure. Unless ADMXRC2_DMACHAN_ANY is specified, the maximum legal value of Channel is (NumDMAChan - 1).
If ADMXRC2_DMACHAN_ANY is specified for Channel, the DMA transfer will be performed on the first available DMA channel. However, pending DMA transfers on a specific a DMA channel will always be given priority. It is possible for a DMA transfer that specifies ADMXRC2_DMACHAN_ANY to be delayed indefinitely if all DMA channels are kept busy by other threads.
The DMAModeWord parameter is a word that is programmed into the DMA hardware to specify the mode of operation for the DMA channel specified by the Channel parameter. The ADMXRC2_BuildDMAModeWord function should be used to obtain a suitable value for this parameter.
The Flags parameter may be any combination of the following:
Flag | Meaning |
ADMXRC2_DMAFLAG_DONOTQUEUE | If the DMA operation cannot be started immediately, the error ADMXRC_DEVICE_BUSY is returned rather than queuing the DMA operation. |
The Timeout parameter must currently be NULL, as timeouts on DMA operations are not yet supported.