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


ADMXRC_MapDirectMaster

Prototype

ADMXRC_STATUS
ADMXRC_MapDirectMaster(
    ADMXRC_HANDLE     Card,
    ADMXRC_DMADESC    DMADesc,
    unsigned long     Offset,
    unsigned long     Length,
    ADMXRC_BUFFERMAP* Map);

Arguments

Argument Type Purpose
Card In Handle of card that the bitstream targets
Buffer In Specifies application buffer to map
Offset In Where to begin mapping within the application buffer
Length In Size of region of application buffer to map
Map In/Out Structure to receive map information

Return value

Value Meaning
ADMXRC_SUCCESS The bitstream file was successfully loaded
ADMXRC_INVALID_HANDLE The Card parameter did not refer to an open card
ADMXRC_INVALID_DMADESC The DMA descriptor representing the application buffer was not valid
ADMXRC_INVALID_PARAMETER The Offset or Length parameters were outside the bounds of the application buffer

Description

This function builds an array of PCI addresses of the pages of memory that comprise a buffer in the application's address space.

The Card parameter should be the handle of the card that was used to create the DMA descriptor DmaDesc. DMA descriptors are obtained via the ADMXRC_SetupDMA API call.

The Offset and Length parameters identify a region within the buffer that DmaDesc refers to.

The Map parameter must point to an ADMXRC_BUFFERMAP structure.

If the call to ADMXRC_MapDirectMaster is successful, the array of page addresses may used by the FPGA in order to allow the FPGA to perform direct master access to the user buffer represented by DmaDesc. It is up to the application programmer to provide a mechanism by which the returned PCI page addresses are transferred to the FPGA. A simple mechanism is a bank of registers within the FPGA; the host simply writes the PCI page addresses to these registers using direct slave transfers.

Prior to calling ADMXRC_MapDirectMaster, the MaxPages and PagesPci members must be initialized by the application. PagesPci should point to an application-allocated buffer that will receive the PCI addresses of the pages comprising the specified region of the application buffer. This region is specified by the Offset and Length parameters. MaxPages should be initialized to the number of unsigned long elements in the array that PagesPci points to.

If ADMXRC_MapDirectMaster succeeds, the PageLength, PagesSpanned, BytesSpanned and InitOffset members of the ADMXRC_BUFFERMAP that Map points to will be filled in with valid values.

It is possible that the number of pages in the array Map->PagesPci will not be sufficient to map the entire region specified by Length and Offset. There are two cases:

 


 Top of page