PHYSICAL_ADDRESS
IoMapTransfer(
IN PADAPTER_OBJECT AdapterObject,
IN PMDL Mdl,
IN PVOID MapRegisterBase,
IN PVOID CurrentVa,
IN OUT PULONG Length,
IN BOOLEAN WriteToDevice
);
IoMapTransfer sets up a number of map registers (up to the number returned by HalGetAdapter) for the given adapter object to map a transfer from a locked-down buffer specified by Mdl, the given CurrentVa into the MDL, Length in bytes to be transferred, and transfer direction.
IoMapTransfer returns the logical address of the region mapped, which the driver of a busmaster adapter can use. Drivers of devices that use a system DMA controller cannot use this value and should ignore it.
The AdapterObject must have already been allocated to the driver in a preceding call to IoAllocateAdapterChannel.
The number of map registers that can be set up cannot exceed the maximum returned when the driver called HalGetAdapter.
The initial CurrentVa for the start of a packet-based DMA transfer can be obtained 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, CurrentVa and Length must be updated for each DMA operation.
The driver of a busmaster device with scatter/gather support can use the returned logical address and updated Length value to build a scatter/gather list, calling IoMapTransfer repeatedly until it has used all available map registers for the transfer operation.
Callers of IoMapTransfer must be running at IRQL <= DISPATCH_LEVEL.
ADDRESS_AND_SIZE_TO_SPAN_PAGES, HalAllocateCommonBuffer, HalGetAdapter, IoAllocateAdapterChannel, IoFlushAdapterBuffers, IoFreeAdapterChannel, IoFreeMapRegisters, KeFlushIoBuffers, MmGetMdlVirtualAddress