RtGetBusDataByOffset

RtGetBusDataByOffset obtains details, starting at the given offset, about a given slot on an I/O bus.

Syntax

ULONG RtGetBusDataByOffset(
    BUS_DATA_TYPE BusDataType,
    ULONG BusNumber,
    ULONG SlotNumber,
    PVOID pBuffer,
    ULONG Offset,
    ULONG Length
);

Parameters

BusDataType

Type of bus data to be retrieved. Currently, its value can be Pos, or PCIConfiguration. The upper bound on the bus types supported is always MaximumBusDataType.

BusNumber

Zero-based and system-assigned number of the bus in systems with more than one bus of the same BusDataType.

SlotNumber

Logical slot number. When PCIConfiguration is specified, this is a PCI_SLOT_NUMBER_TYPE value.

pBuffer

A pointer to a caller-supplied buffer for configuration information specific to BusDataType.

When PCIConfiguration is specified, the buffer will contain some or all of the PCI_COMMON_CONFIG information for the given SlotNumber. The specified Offset and Length determine how

Offset

If the BusDataType is Pos, the offset is zero. Otherwise, it specifies the byte offset in the PCI_COMMON_CONFIG structure for which the requested information should be returned. Callers can use the system-defined constant, PCI_COMMON_HDR_LENGTH, to specify the device-specific area of PCI_COMMON_CONFIG.

Length

Maximum number of bytes to return in the buffer.

Return Value

The number of bytes of data if the read to the given buffer (pBuffer) succeeded, zero if the given BusDataType is not valid for the current platform.

When the input BusDataType is PCIConfiguration, RtGetBusDataByOffset can return either of the following values to indicate an error:

Value

Meaning

0 (zero)

The specified PCIBus does not exist.

2

The specified PCIBus exists, but there is no device at the given PCI SlotNumber. The buffer also contains the value PCI_INVALID_VENDOR_ID at the PCI_COMMON_CONFIG VENDORID member.

When the input BusDataType is PNPISAConfiguration, RtGetBusDataByOffset can return any of the following values:

Value

Meaning

0 (zero)

The specified BusDataType is not valid for the current platform.

1

An unsupported BusNumber value was specified.

2

There is no device at the specified SlotNumber.

3

An error has occurred.

Remarks

This call can be used to locate devices on a particular I/O bus in the machine. The bus-type-specific configuration data returned can later be used in other calls, such as RtSetBusDataByOffset and RtTranslateBusAddress.

When accessing the device-specific area of the PCI configuration space, RtGetBusDataByOffset guarantees the following:

For more information, consult the Windows Driver Development Kit.

Requirements

Minimum Supported Version RTX64 2013
Header Rtapi.h
Library RtApi.lib (Windows), Rtx_Rtss.lib (RTSS)

See Also:

HalGetBusDataByOffset (in the Windows Driver Development Kit)

RtSetBusDataByOffset

RtTranslateBusAddress