다음을 통해 공유


NdisFlushBuffer (Windows Embedded CE 6.0)

1/6/2010

This function flushes the memory region described by a specified buffer descriptor from all processor caches.

Syntax

VOID NdisFlushBuffer(
  PNDIS_BUFFER Buffer,
  BOOLEAN WriteToDevice
);

Parameters

  • Buffer
    [in] Pointer to a buffer description mapping a buffer from which or into which data is transferred as a bus master DMA operation.
  • WriteToDevice
    [in] Specifies TRUE if the NIC driver calls this function to flush a buffer before making a transfer from host memory to the NIC.

    If the NIC driver specifies FALSE, it must ensure that the buffer begins and ends on a cache-line boundary.

    Note

    This flag is currently ignored.

Return Value

None.

Remarks

Drivers of busmaster DMA NICs call this function to maintain data integrity in shared memory. Flushing the buffer ensures coherency between the host memory cache and processor physical memory before a DMA transfer to or from the network interface card.

The driver flushes such a buffer when data that it shares with its NIC might be cached. For any transfer between host memory and a bus master DMA NIC, the miniport must flush the buffer before the transfer starts. Such a driver also must ensure that host memory is not accessed until the transfer completes.

NdisFlushBuffer is an expensive operation on Windows Embedded CE, because it flushes all data caches, not just the one for the affected page. For better performance and resource utilization, use non-cached memory instead. The following list shows two alternative techniques.

Requirements

Header ndis.h
Library ndis.lib
Windows Embedded CE Windows CE .NET 4.0 and later

See Also

Reference

NDIS Library Functions
MiniportHandleInterrupt
NdisMAllocateSharedMemory
NdisMUpdateSharedMemory

Other Resources

VirtualAlloc
VirtualCopy