NDIS_STATUS
NdisMAllocateMapRegisters(
IN NDIS_HANDLE MiniportAdapterHandle,
IN UINT DmaChannel,
IN BOOLEAN Dma32BitAddresses,
IN ULONG PhysicalMapRegistersNeeded,
IN ULONG MaximumPhysicalMapping
);
NdisMAllocateMapRegisters reserves system resources during NIC driver initialization for subsequent busmaster DMA operations.
NdisMAllocateMapRegisters can return one of the following:
Drivers of busmaster DMA NICs call NdisMAllocateMapRegisters from their MiniportInitialize functions.
Such a driver’s MiniportInitialize function must call NdisMSetAttributes or NdisMSetAttributesEx before it calls NdisMAllocateMapRegisters. It should call NdisQueryMapRegisterCount before calling NdisMAllocateMapRegisters as well.
The given PhysicalMapRegistersNeeded is constrained by one of the following:
For a busmaster NIC, MaximumPhysicalMapping is the largest number of bytes in any virtual range described by an NDIS_BUFFER-type descriptor that can be passed to NdisMStartBufferPhysicalMapping subsequently.
Map registers are a limited system resource, so a miniport should never allocate more map registers than its NIC can use in a DMA transfer operation. NdisQueryMapRegisterCount returns the maximum number of map registers that can be allocated on the current platform for the type of I/O bus the NIC uses. MiniportInitialize should pass the minimum of the following values for PhysicalMapRegistersNeeded to NdisMAllocateMapRegisters:
The map registers allocated with NdisMAllocateMapRegisters are implicitly numbered from zero through (PhysicalMapRegistersNeeded - 1). When calling NdisMStartBufferPhysicalMapping, the driver of a busmaster NIC specifies which map register to use in each call by specifying that map register’s zero-based index.
The driver of a busmaster DMA NIC must call NdisMAllocateMapRegisters before it calls NdisMAllocateSharedMemory.
Drivers of NICs that use PIO or the host DMA controller as slave devices do not call NdisMAllocateMapRegisters during initialization.
Callers of NdisMAllocateMapRegisters run at IRQL PASSIVE_LEVEL.
MiniportInitialize, NdisMAllocateSharedMemory, NdisMFreeMapRegisters, NdisMRegisterDmaChannel, NdisMSetAttributes, NdisMSetAttributesEx, NdisMStartBufferPhysicalMapping, NdisQueryMapRegisterCount