PFLUSH_ADAPTER_BUFFERS callback function (wdm.h)
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.
Syntax
PFLUSH_ADAPTER_BUFFERS PflushAdapterBuffers;
BOOLEAN PflushAdapterBuffers(
[in] PDMA_ADAPTER DmaAdapter,
[in] PMDL Mdl,
[in] PVOID MapRegisterBase,
[in] PVOID CurrentVa,
[in] ULONG Length,
[in] BOOLEAN WriteToDevice
)
{...}
Parameters
[in] DmaAdapter
Pointer to the DMA_ADAPTER structure returned by IoGetDmaAdapter that represents the bus-master adapter or DMA controller.
[in] Mdl
Pointer to the MDL that describes the buffer previously passed in the driver's call to MapTransfer.
[in] MapRegisterBase
Specifies the map registers allocated for the DMA operation. The system passes this value to the driver's AdapterControl routine.
[in] CurrentVa
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.
[in] Length
Specifies the length, in bytes, of the buffer.
[in] WriteToDevice
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.
Remarks
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.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Available starting with Windows 2000. |
Target Platform | Desktop |
Header | wdm.h (include Wdm.h, Ntddk.h, Ntifs.h) |
IRQL | <= DISPATCH_LEVEL |
DDI compliance rules | IrqlDispatch(wdm) |