SoundMapPortAddress

PUCHAR
SoundMapPortAddress(
INTERFACE_TYPE
BusType,
ULONG
BusNumber,
ULONG
PortBase,
ULONG
Length,
PULONG
MemType
);

The SoundMapPortAddress function translates a bus-specific address into the corresponding system-logical address and then, if the logical address is in memory address space, maps the address to a virtual address.

Parameters

BusType

Bus type. INTERFACE_TYPE is defined in ntddk.h.

BusNumber

Bus number, as returned from SoundGetBusNumber.

PortBase

Port number.

Length

Number of ports.

MemType

Address of a location to receive a value indicating the memory type. A value of zero indicates the return value is a memory address. A value of one indicates the return value is an I/O space address.

Return Value

Returns the base virtual address.

Comments

Use SoundMapPortAddress to obtain addresses that are suitable for use with HAL Port I/O routines, such as READ_PORT_UCHAR.

If a value of zero is received in the address pointed to by memtype, then the returned virtual address is a mapped address. In this case the driver must call MmUnmapIoSpace to unmap the address range, prior to being unloaded.

This function calls HalTranslateBusAddress and MmMapIoSpace.