次の方法で共有


NdisMRegisterIoPortRange (Compact 2013)

3/26/2014

This function sets up driver access to device I/O ports with the NdisRawReadPortXXX and NdisRawWritePortXXX functions and claims the range of I/O port addresses in the registry for that driver's network adapter.

Syntax

NDIS_STATUS NdisMRegisterIoPortRange(
  PVOID* PortOffset,
  NDIS_HANDLE MiniportAdapterHandle,
  UINT InitialPort,
  UINT NumberOfPorts
);

Parameters

  • PortOffset
    [out] Specifies a caller-supplied variable in which this function returns the mapped base virtual address for the specified bus-relative I/O port range that is specified by InitialPort and NumberOfPorts.
  • InitialPort
    [in] Specifies the bus-relative base port address for a range of ports to be mapped.
  • NumberOfPorts
    [in] Specifies the number of ports in the range to be mapped.

Return Value

The following table shows the return values for this function.

Value

Description

NDIS_STATUS_SUCCESS

The specified range of I/O ports was mapped successfully; the value at PortOffset is valid, and the mapped range has been claimed in the registry for the network adapter.

NDIS_STATUS_RESOURCE_CONFLICT

An attempt to claim the I/O port range in the registry has failed, possibly because another driver already claimed the range for its device. This function logs an error if this occurs.

NDIS_STATUS_RESOURCES

The port range could not be mapped, or NDIS could not allocate resources to check the registry for hardware-resource conflicts.

NDIS_STATUS_FAILURE

Either the bus type or bus number is out of range, or the specified InitialPort and NumberOfPorts were invalid, possibly not within the I/O port space of the current platform.

Remarks

A miniport driver calls NdisMRegisterIoPortRange from its MiniportInitializeEx function. MiniportInitializeEx must call NdisMSetMiniportAttributes before it calls NdisMRegisterIoPortRange.

NdisMRegisterIoPortRange maps a bus-relative device address range that the miniport driver can use later to access an I/O port range on a network adapter by calling the NdisRawXxx functions. A successful call claims the specified range of I/O ports in the registry for the caller's network adapter.

Because the parameters that are passed to the NdisRawXxx have been mapped, these functions run significantly faster than the corresponding NdisImmediate..PortXxx. After a successful call to NdisMRegisterIoPortRange, a miniport driver cannot call any of the NdisImmediate..PortXxx functions with either bus-relative addresses or mapped virtual addresses within such an I/O port range.

If its call to NdisMRegisterIoPortRange fails, MiniportInitializeEx should release all resources it already allocated for a network adapter and fail initialization for that network adapter.

Drivers of network adapters with device registers in the host memory space call NdisMMapIoSpace and, subsequently, the NdisRead/WriteRegisterXxx functions to access the network adapter registers.

Requirements

Header

ndis.h

Library

ndis.dll

See Also

Reference

NDIS I/O Port Interface
MiniportInitializeEx
MiniportInitialize
NdisMMapIoSpace
NdisMSetAttributes
NdisMSetAttributesEx
NdisMDeregisterIoPortRange
NdisRawReadPortBufferUchar
NdisRawReadPortBufferUlong
NdisRawReadPortBufferUshort
NdisRawReadPortUchar
NdisRawReadPortUlong
NdisRawReadPortUshort
NdisRawWritePortUchar
NdisRawWritePortUlong
NdisRawWritePortUshort
NdisRawWritePortBufferUchar
NdisRawWritePortBufferUlong
NdisRawWritePortBufferUshort
NdisReadRegisterUchar
NdisReadRegisterUlong
NdisReadRegisterUshort
NdisWriteRegisterUchar
NdisWriteRegisterUlong
NdisWriteRegisterUshort