Syntax:
PLX_STATUS
PlxPci_DeviceFind(
PLX_DEVICE_KEY *pKey,
U16 DeviceNumber
);
PLX Chip Support:
All devices
Description:
Locates a specific PCIe device and fills in the corresponding device key information.
定位特定的PCIe设备并填写相应的设备密钥信息。
Parameters:
pKey
Pointer to a PLX_DEVICE_KEY structure containing the search criteria
DeviceNumber
The 0-based index of the device number to select. Refer to Notes section below for details.
Return Codes:
Code | Description |
ApiSuccess | The function returned successfully |
ApiNullParam | One or more parameters is NULL |
ApiNoActiveDriver | A valid PLX driver is not loaded in the system |
ApiInvalidDeviceInfo | The key does not match an installed device |
Notes:
The fields in the PLX_DEVICE_KEY structure will be used to locate a device. If a field is set to
PCI_FIELD_IGNORE, then it is ignored in the comparison. If a device matches the criteria, all ignored fields in
the key will be filled in with their respective value.
The DeviceNumber parameter is an index that specifies which device to select, where ‘0’ is the first device. If
multiple devices match the criteria, the DeviceNumber specifies which device to select.
Usage:
PLX_STATUS rc;
PLX_DEVICE_KEY DeviceKey;
// Clear key structure to find first device
memset(&DeviceKey, PCI_FIELD_IGNORE, sizeof(PLX_DEVICE_KEY));
rc =
PlxPci_DeviceFind(
&DeviceKey,
0 // Select 1st device matching criteria
);
if (rc != ApiSuccess)
{
// ERROR – Unable to locate matching device
}
// Search for the third device matching a specific Vendor ID
memset(&DeviceKey, PCI_FIELD_IGNORE, sizeof(PLX_DEVICE_KEY));
// Specify Vendor ID
DeviceKey.VendorId = 0x10b5; // PLX Vendor ID
rc =
PlxPci_DeviceFind(
&DeviceKey,
2 // Select 3rd device matching criteria
);
if (rc != ApiSuccess)
{
// ERROR – Unable to locate matching device
}