DxTransfer routine

The DxTransfer callback function informs the driver to bus master data from a surface to the buffer specified in the memory descriptor list (MDL).

Syntax


PDX_TRANSFER DxTransfer;

DWORD DxTransfer(
  PVOID HwDeviceExtension,
  PDDTRANSFERININFO TransferInInfo,
  PDDTRANSFEROUTINFO TransferOutInfo
)
{ ... }

Parameters

HwDeviceExtension

Points to the miniport driver's device extension.

TransferInInfo

Points to a DDTRANSFERININFO structure that contains the transfer information for the surface.

TransferOutInfo

Points to a DDTRANSFEROUTINFO structure that contains the polarity of the field being captured.

Return value

DxTransfer returns DX_OK if it succeeds; otherwise, it returns one of the following error values:

DXERR_GENERIC
DXERR_OUTOFCAPS
DXERR_UNSUPPORTED

Remarks

The MDL is defined in WDM documentation.

As shown in the following code sample, the video miniport driver can use the pointer to the MDL in the lpDestMDL member of the DDTRANSFERININFO structure at the TransferInInfo parameter to bus master data to the physical memory pages that make up a scattered buffer:


DWORD 
DxTransfer(
    DEVICE_EXT *pDeviceExt, 
    PDDTRANSFERININFO pTransferInInfo, 
    PDDTRANSFEROUTINFO pTransferOutInfo
    )
{
    PMDL pMdl;
    UINT uiNbPages;
    PPFN_NUMBER pPages;
    PVOID MappedSystemVa;
    ULONG ByteCount;

    pMdl = pTransferInInfo->lpDestMDL;
    MappedSystemVa = MmGetMdlVirtualAddress(pMdl);
    ByteCount = MmGetMdlByteCount(pMdl);
    uiNbPages = ADDRESS_AND_SIZE_TO_SPAN_PAGES(MappedSystemVa,
                                               ByteCount);
    pPages = MmGetMdlPfnArray(pMdl)
    for (i=0; i<uiNbPages; i++) {
        //
        // Transfer to page[i]
        //
        pPages[i];
    }
}

See the ADDRESS_AND_SIZE_TO_SPAN_PAGES, MmGetMdlByteCount, MmGetMdlPfnArray, and MmGetMdlVirtualAddress kernel-mode macros for more information.

DxTransfer is called at hardware interrupt time. This means the driver cannot wait for a previous bus master to complete and it cannot call any functions that are not safe to call at interrupt time (that is, most of them).

In addition, the driver should not fail the call just because the hardware is currently busy. Instead, the driver should maintain an internal queue.

Requirements

Header

Dxmini.h (include Dxmini.h)

See also

ADDRESS_AND_SIZE_TO_SPAN_PAGES
DDTRANSFERININFO
DDTRANSFEROUTINFO
MmGetMdlByteCount
MmGetMdlPfnArray
MmGetMdlVirtualAddress

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft. All rights reserved.