This function reserves system resources during NIC driver initialization for subsequent busmaster DMA operations.
Header file: | Ndis.h |
Windows CE versions: | 2.0 and later |
NDIS_STATUS NdisMAllocateMapRegisters(
IN NDIS_HANDLE MiniportAdapterHandle, IN UINT DmaChannel,
IN BOOLEAN Dma32BitAddresses, IN ULONG PhysicalMapRegistersNeeded,
IN ULONG MaximumPhysicalMapping );
NDIS_STATUS_SUCCESS indicates success. NDIS_STATUS_RESOURCES indicates that either the caller specified incompatible parameters when MiniportInitialize called the NdisMSetAttributesEx function or the requested number of map registers could not be allocated due to system resource constraints.
Drivers of busmaster DMA NICs call this function from their MiniportInitialize functions.
Such a driver’s MiniportInitialize function must call NdisMSetAttributes or NdisMSetAttributesEx before it calls this function. It should call the NdisQueryMapRegisterCount function before calling this function as well.
The specified PhysicalMapRegistersNeeded is constrained by one of the following:
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. The NdisQueryMapRegisterCount function returns the maximum number of map registers that can be allocated on the current platform for the type of I/O bus that the NIC uses. MiniportInitialize should pass the minimum of the following values for PhysicalMapRegistersNeeded to this function:
The map registers allocated with this function are implicitly numbered from 0 through ( PhysicalMapRegistersNeeded – 1 ). When calling the NdisMStartBufferPhysicalMapping function, the driver of a busmaster NIC specifies which map register to use in each call by specifying that map register’s 0-based index.
The driver of a busmaster DMA NIC must call this function before it calls the NdisMAllocateSharedMemory function.
Drivers of NICs that use PIO or the host DMA controller as slave devices do not call this function during initialization.
A driver that calls this function runs at IRQL PASSIVE_LEVEL.
NdisMFreeMapRegisters, NdisMSetAttributes, NdisMSetAttributesEx, NdisQueryMapRegisterCount