WdfDeviceMapIoSpace function

[Applies to UMDF only]

The WdfDeviceMapIoSpace function maps the given physical address range to system address space and returns a pseudo base address.

Syntax

NTSTATUS WdfDeviceMapIoSpace(
  WDFDEVICE           Device,
  PHYSICAL_ADDRESS    PhysicalAddress,
  SIZE_T              NumberOfBytes,
  MEMORY_CACHING_TYPE CacheType,
  PVOID               *PseudoBaseAddress
);

Parameters

Device

A handle to a framework device object.

PhysicalAddress

Specifies the starting 64-bit physical address of the I/O range to be mapped.

NumberOfBytes

Specifies a value greater than zero, indicating the number of bytes to be mapped.

CacheType

Specifies a MEMORY_CACHING_TYPE value, which indicates the cache attribute to use to map the physical address range. The MEMORY_CACHING_TYPE enumeration type is defined in Wdfdevice.h.

PseudoBaseAddress

The address of a location that receives a pointer to the pseudo base address.

Return Value

If the operation succeeds, the function returns STATUS_SUCCESS.

The function might return other NTSTATUS values.

Remarks

This function is the UMDF version 2 equivalent of IWDFDevice3::MapIoSpace.

A driver must call this function during device start-up if it receives translated resources of type CmResourceTypeMemory in a CM_PARTIAL_RESOURCE_DESCRIPTOR structure. WdfDeviceMapIoSpace maps the physical address returned in the resource list to a framework-managed address referred to as the pseudo base address.

The driver can then use the pseudo base address to access device registers with WDF_READ_REGISTER_Xxx and WDF_WRITE_REGISTER_Xxx functions.

A driver that calls WdfDeviceMapIoSpace must set the UmdfDirectHardwareAccess INF directive to AllowDirectHardwareAccess.

If the driver sets the UmdfRegisterAccessMode INF directive to RegisterAccessUsingUserModeMapping, calling WdfDeviceMapIoSpace also maps the given physical address range to a user-mode base address range that the driver can subsequently access by calling WdfDeviceGetHardwareRegisterMappedAddress.

For more information about INF directives that UMDF drivers can use, see Specifying WDF Directives in INF Files.

For more information about parsing hardware resources starting in UMDF version 2, see Handling Hardware Resources in a UMDF Driver.

The PHYSICAL_ADDRESS type is defined in Wudfwdm.h, as follows:

typedef LARGE_INTEGER PHYSICAL_ADDRESS;

For an example that shows how a driver finds and maps memory-mapped register resources, see Reading and Writing to Device Registers.

Requirements

   
Minimum supported client Windows 8.1
Target Platform Universal
Minimum UMDF version 2.0
Header wdfdevice.h (include Wdf.h)
Library WUDFx02000.lib
DLL WUDFx02000.dll
IRQL PASSIVE_LEVEL

See Also

IWDFDevice3::MapIoSpace

WdfDeviceUnmapIoSpace