Export (0) Print
Expand All

FlushAdapterBuffers routine

The FlushAdapterBuffers routine flushes any data remaining in the system DMA controller's internal cache or in a bus-master adapter's internal cache at the end of a DMA transfer operation.


BOOLEAN FlushAdapterBuffers(
  _In_  PDMA_ADAPTER DmaAdapter,
  _In_  PMDL Mdl,
  _In_  PVOID MapRegisterBase,
  _In_  PVOID CurrentVa,
  _In_  ULONG Length,
  _In_  BOOLEAN WriteToDevice


DmaAdapter [in]

Pointer to the DMA_ADAPTER structure returned by IoGetDmaAdapter that represents the bus-master adapter or DMA controller.

Mdl [in]

Pointer to the MDL that describes the buffer previously passed in the driver's call to MapTransfer.

MapRegisterBase [in]

Specifies the map registers allocated for the DMA operation. The system passes this value to the driver's AdapterControl routine.

CurrentVa [in]

Pointer to the current virtual address in the buffer, described by the Mdl, where the I/O operation occurred. This value must be the same as the initial CurrentVa value passed to MapTransfer.

Length [in]

Specifies the length, in bytes, of the buffer.

WriteToDevice [in]

Specifies the direction of the DMA transfer operation: TRUE for a transfer from a buffer in system memory to the driver's device.

Return value

FlushAdapterBuffers returns TRUE if any data remaining in the DMA controller's or bus-master adapter's internal cache has been successfully flushed into system memory or out to the device.


FlushAdapterBuffers 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.

To ensure that a DMA transfer is complete, every driver that performs DMA operations must call FlushAdapterBuffers before completing the IRP that requested the DMA transfer and before freeing the map registers.

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.



Available starting with Windows 2000.


Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)



DDI compliance rules


See also




Send comments about this topic to Microsoft

© 2014 Microsoft