DMA

IoGetDmaAdapter

Returns a pointer to an adapter object that represents either the DMA channel to which the driver's device is connected or the driver's bus-master adapter. Also returns the maximum number of map registers the driver can specify for each DMA transfer.

MmGetMdlVirtualAddress

Returns the base virtual address of a buffer described by a given MDL. The returned address, used as an index to a physical address entry in the MDL, can be input to MapTransfer.

MmGetSystemAddressForMdlSafe

Returns a nonpaged system-space virtual address for the base of the memory area described by an MDL. It maps the physical pages described by the MDL into system space, if they are not already mapped to system space.

ADDRESS_AND_SIZE_TO_SPAN_PAGES

Returns the number of pages spanned by the virtual range defined by a virtual address and a length in bytes. A driver can use this macro to determine whether a transfer request must be split into partial transfers.

AllocateAdapterChannel

Reserves exclusive access to a DMA channel and map registers for a device. When the channel and registers are available, this routine calls a driver-supplied AdapterControl routine to carry out an I/O operation through either the system DMA controller or a bus-master adapter.

AllocateCommonBuffer

Allocates and maps a logically contiguous region of memory that is simultaneously accessible from both the processor and a device. This routine returns TRUE if the requested length was allocated.

BuildMdlFromScatterGatherList

Builds an MDL corresponding to a scatter/gather list.

BuildScatterGatherList

Prepares the system for scatter/gather DMA for a device and calls a driver-supplied routine to carry out the I/O operation. This function provides the same functionality as GetScatterGatherList, except it uses a driver-supplied buffer to hold the scatter/gather list.

CalculateScatterGatherList

Computes the buffer size needed to hold a scatter/gather list for a memory buffer.

FlushAdapterBuffers

Forces any data remaining in either a bus-master adapter's or the system DMA controller's internal buffers to be written into memory or to the device.

FreeAdapterChannel

Releases an adapter object that represents a system DMA channel, and optionally releases any allocated map registers.

FreeCommonBuffer

Releases and unmaps a previously allocated common buffer. Arguments must match those passed in an earlier call to AllocateCommonBuffer.

FreeMapRegisters

Releases a set of map registers that were saved from a call to AllocateAdapterChannel. A driver calls this routine after using the registers in one or more calls to MapTransfer, flushing the cache by calling FlushAdapterBuffers, and completing the bus-master DMA transfer.

GetDmaAlignment

Returns the buffer alignment requirements for a DMA controller or device.

GetScatterGatherList

Prepares the system for scatter/gather DMA for a device and calls a driver-supplied routine to carry out the I/O operation. For devices that support scatter/gather DMA, this routine combines the functionality of AllocateAdapterChannel and MapTransfer.

KeFlushIoBuffers

Flushes the memory region described by an MDL from all processors' caches into memory.

MapTransfer

Sets up map registers for an adapter object previously allocated by AllocateAdapterChannel to map a transfer from a locked-down buffer. Returns the logical address of the mapped region and, for bus-master devices that support scatter/gather, the number of bytes mapped.

PutDmaAdapter

Frees an adapter object previously allocated by IoGetDmaAdapter.

PutScatterGatherList

Frees map registers and scatter/gather list previously allocated by GetScatterGatherList.

ReadDmaCounter

Returns the number of bytes yet to be transferred during the current system DMA operation (in autoinitialize mode).

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft