NdisMMapIoSpace

This function maps a specified bus-relative range of physical addresses or registers onto a system-space virtual range of addresses.

NDIS_STATUS NdisMMapIoSpace(
OUT PVOID *VirtualAddress, 
IN NDIS_HANDLE MiniportAdapterHandle, 
IN NDIS_PHYSICAL_ADDRESS PhysicalAddress, 
IN UINT Length );

Parameters

  • VirtualAddress
    Pointer to a caller-supplied variable that is set to the converted virtual address if the call is successful.
  • MiniportAdapterHandle
    Handle input to the MiniportInitialize function.
  • PhysicalAddress
    Specifies the bus-relative base physical address of the device memory range to be mapped.
  • Length
    Specifies the number of bytes to be mapped.

Return Values

NDIS_STATUS_SUCCESS indicates success. One of the following values indicates failure:

  • NDIS_STATUS_RESOURCE_CONFLICT
    An attempt to claim the device memory range in the registry has failed, possibly because another driver has already claimed the range for its device. This function logs an error if this occurs.
  • NDIS_STATUS_RESOURCES
    The memory could not be mapped or sufficient virtual memory could not be allocated.
  • NDIS_STATUS_FAILURE
    Either the bus type or bus number is out of range, or the specified PhysicalAddress and Length are invalid, possibly not within the I/O space of the current platform.

Remarks

This function is called by drivers of NICs that have on-board memory or a bank of device registers appearing in the I/O space of the host. For example, the driver of an NIC that uses PI/O calls this function.

A successful call to this function claims hardware resources in the registry for the driver's NIC. Consequently, only MiniportInitialize functions call this function.

This function sets the variable at VirtualAddress to NULL if it does not return NDIS_STATUS_SUCCESS.

MiniportInitialize gets the PhysicalAddress value either from the driver's Parameters registry key or by calling a bus-type-specific NdisXXX configuration function. The specified physical address range must fall within the I/O space of the current platform. It is a programming error to call this function with a host physical memory address.

A miniport must call the reciprocal NdisMUnmapIoSpace function to release its claim on system resources if MiniportInitialize subsequently fails to initialize the NIC, if its NIC is removed from the machine, and/or when the driver is unloading.

A driver that calls this function runs at IRQL PASSIVE_LEVEL.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 2.0 and later Ndis.h    

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

NdisMUnmapIoSpace, NdisOpenConfiguration, NdisReadPciSlotInformation

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.