Expand Minimize

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(
  _In_   WDFDEVICE Device,
  _In_   PHYSICAL_ADDRESS PhysicalAddress,
  _In_   SIZE_T NumberOfBytes,
  _In_   MEMORY_CACHING_TYPE CacheType,
  _Out_  PVOID *PseudoBaseAddress
);

Parameters

Device [in]

A handle to a framework device object.

PhysicalAddress [in]

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

NumberOfBytes [in]

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

CacheType [in]

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 [out]

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 support

Windows 8.1

Minimum UMDF version

2.0

Header

Wdfdevice.h (include Wdf.h)

Library

WUDFx02000.dll

IRQL

PASSIVE_LEVEL

See also

WdfDeviceUnmapIoSpace
IWDFDevice3::MapIoSpace

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft. All rights reserved.