NdisAllocateSharedMemory

VOID
    NdisAllocateSharedMemory(
        IN NDIS_HANDLE  NdisAdapterHandle,
        IN ULONG  Length,
        IN BOOLEAN  Cached,
        OUT PVOID  *VirtualAddress,
        OUT PNDIS_PHYSICAL_ADDRESS  PhysicalAddress
        );

NdisAllocateSharedMemory is called by the NIC driver to request the operating system to allocate memory the NIC driver shares with a busmaster network interface card during DMA operations.

Parameters

NdisAdapterHandle
Specifies the handle that the NDIS interface library associates with the network interface card.
Length
Specifies the size, in bytes, of the memory.
Cached
Specifies TRUE if the driver requests cached memory.
VirtualAddress
Points to a caller-supplied memory location at which this function writes the base virtual address of the allocated memory. If memory of the specified type is not available, the pointer value is NULL.
PhysicalAddress
Points to a caller-supplied variable in which this function returns the corresponding physical address for the shared memory.

Comments

NIC drivers call this function during initialization. The operating system allocates the memory as physically contiguous, either cached or noncached. Because this function writes the physical address of the shared memory, the NIC driver must not call NdisGetBufferPhysicalMapping.

If the allocated memory is cached and the cache needs flushing, the NIC driver must call NdisAllocateBuffer to allocate a buffer descriptor for the memory. It then calls NdisFlushBuffer to flush the cache.

Callers of NdisAllocateSharedMemory run at IRQL PASSIVE_LEVEL.

See Also

NdisAllocateBuffer, NdisFlushBuffer, NdisFreeSharedMemory