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
);
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.
Declared in wdm.h and ntddk.h. Include wdm.h or ntddk.h.
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.
Callers of FlushAdapterBuffers must be running at IRQL <= DISPATCH_LEVEL.
AllocateAdapterChannel, IoGetDmaAdapter, KeFlushIoBuffers, MapTransfer, MmGetMdlVirtualAddress, DMA_OPERATIONS