ADM-XRC SDK 2.8.1 User Guide (Linux)
© Copyright 2001-2009 Alpha Data


ADMXRC_DoDMA

Prototype

ADMXRC_STATUS
ADMXRC_DoDMA(
    ADMXRC_HANDLE  Card,
    ADMXRC_DMADESC DmaDesc,
    unsigned long  Offset,
    unsigned long  Length,
    DWORD          Local,
    DWORD          Direction,
    DWORD          Channel,
    DWORD          DMAModeWord,
    DWORD          Flags,
    DWORD*         Timeout,
    PHANDLE        Event);

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
Event In/out Event to use to wait for completion

Return value

Value Meaning
ADMXRC_SUCCESS The DMA transfer was performed successfully
ADMXRC_INVALID_HANDLE Card is not a valid handle to a card
ADMXRC_INVALID_DMADESC DMADesc is not a valid DMA descriptor
ADMXRC_INVALID_PARAMETER An invalid parameter was passed
ADMXRC_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 ADMXRC_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 ADMXRC_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 ADMXRC_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 ADMXRC_DMA_DIRECTION.

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 ADMXRC_CARD_INFO structure. Unless ADMXRC_DMACHAN_ANY is specified, the maximum legal value of Channel is (NumDMAChan - 1).

If ADMXRC_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 ADMXRC_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 ADMXRC_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
ADMXRC_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.

The Event parameter should be a pointer to a Win32 event handle. See multithreading issues for further information.

 


 Top of page