Поделиться через


NdisMMapIoSpace (Windows Embedded CE 6.0)

1/6/2010

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

Syntax

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

Parameters

  • VirtualAddress
    [out] Pointer to a caller-supplied variable that is set to the converted virtual address if the call is successful.
  • PhysicalAddress
    [in] Specifies the bus-relative base physical address of the device memory range to be mapped.
  • Length
    [in] Specifies the number of bytes to be mapped.

Return Value

Value Description

NDIS_STATUS_SUCCESS

The mapping was successful.

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

Drivers of NICs that have on-board memory call this function 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.

Requirements

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

See Also

Reference

NDIS Library Functions
MiniportInitialize
NdisMUnmapIoSpace
NdisOpenConfiguration
NdisReadPciSlotInformation