The MapTransfer routine sets up map registers for an adapter object to map a DMA transfer from a locked-down buffer.
PHYSICAL_ADDRESS
MapTransfer(
IN PDMA_ADAPTER DmaAdapter,
IN PMDL Mdl,
IN PVOID MapRegisterBase,
IN PVOID CurrentVa,
IN OUT PULONG Length,
IN BOOLEAN WriteToDevice
);
MapTransfer returns the logical address of the region mapped, which the driver of a bus-master adapter can use. Drivers of devices that use a system DMA controller cannot use this value and should ignore it.
Declared in wdm.h and ntddk.h. Include wdm.h or ntddk.h.
MapTransfer is not a system routine that can be called directly by name. This routine is callable only by pointer from the address returned in a DMA_OPERATIONS structure. Drivers obtain the address of this routine by calling IoGetDmaAdapter.
The DmaAdapter must have already been allocated as a result of the driver's preceding call to AllocateAdapterChannel.
The number of map registers that can be set up cannot exceed the maximum returned when the driver called IoGetDmaAdapter.
A driver can get the initial CurrentVa for the start of a packet-based DMA transfer by calling MmGetMdlVirtualAddress. However, the value returned is an index into the Mdl, rather than a valid virtual address. If the driver must split a large transfer request into more than one DMA operation, it must update CurrentVa and Length for each DMA operation.
The driver of a bus-master device with scatter/gather support can use the returned logical address and updated Length value to build a scatter/gather list, calling MapTransfer repeatedly until it has used all available map registers for the transfer operation. However, such a driver could more simply use the GetScatterGatherList routine.
Callers of MapTransfer must be running at IRQL <= DISPATCH_LEVEL.
ADDRESS_AND_SIZE_TO_SPAN_PAGES, AllocateCommonBuffer, IoGetDmaAdapter, AllocateAdapterChannel, FlushAdapterBuffers, FreeAdapterChannel, FreeMapRegisters, KeFlushIoBuffers, MmGetMdlVirtualAddress