HalGetBusDataByOffset (Compact 2013)

3/26/2014

This function retrieves information, starting at the offset, about a slot or address on an I/O bus.

Syntax

ULONG HalGetBusDataByOffset( 
  BUS_DATA_TYPE BusDataType, 
  ULONG BusNumber, 
  ULONG SlotNumber, 
  PVOID Buffer, 
  ULONG Offset, 
  ULONG Length 
);

Parameters

  • BusDataType
    [in] Bus data to retrieve. The upper bound on the bus types supported is always MaximumBusDataType.
  • BusNumber
    [in] Zero-based and system-assigned number of the bus in systems with several buses of the same BusDataType.
  • SlotNumber
    [in] Logical slot number or location of the device. If you specify PCIConfiguration as the BusDataType, this value is a PCI_SLOT_NUMBER value, which is the slot and function numbers combined.
  • Buffer
    [in] Pointer to a caller-supplied buffer for configuration information specific to BusDataType.

    If you specify PCIConfiguration, the buffer contains the PCI_COMMON_CONFIG information for the specifed SlotNumber and function number. The specified Offset and Length determine how much information to supply. Certain members of PCI_COMMON_CONFIG have read-only values The caller is responsible for preserving the system-supplied values of read-only members.

  • Offset
    [in] 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
    [in] Maximum number of bytes in the Buffer.

Return Value

Returns the number of bytes of data it wrote in the specified buffer. If the specified BusDataType is not valid for the current platform, this function returns 0.

The following table shows the return values for this function that HalGetBusDataByOffset uses to indicate an error when the input BusType is PCIConfiguration.

Value

Description

0

The specified PCI bus does not exist.

2

The specified PCI bus exists, but there is no device at the specified PCI SlotNumber. The Buffer also contains the value PCI_INVLAID_VENDOR_ID at the PCI_COMMON_CONFIG VendorId member.

Remarks

Device drivers call this function during initialization to locate their devices on a particular I/O bus. You can use the returned bus-type-specific configuration data in later calls to other configuration and initialization functions, such as HalTranslateBusAddress.

When accessing the device-specific area of the PCI configuration space, HalGetBusDataByOffset guarantees that this function never reads or writes data outside the range specified by the input Offset and Length. Even if the input Length is exactly a 1-byte or 2-byte word, this function never accesses any data outside the requested range.

Requirements

Header

ceddk.h

Library

CEDDK.lib

See Also

Reference

Ceddk.dll Bus Access Functions
BUS_DATA_TYPE
HalGetBusData
HalSetBusData
HalSetBusDataByOffset
HalTranslateBusAddress
PCI_COMMON_CONFIG