Syntax:
PLX_STATUS
PlxPci_DeviceOpen(
PLX_DEVICE_KEY *pKey,
PLX_DEVICE_OBJECT *pDevice
);
PLX Chip Support:
All devices
Description:
Selects a specific PCI device for later use with PLX API calls. The device is selected based on the criteria in
PLX_DEVICE_KEY.
Parameters:
pKey
Pointer to a PLX_DEVICE_KEY structure which contains one or more search criteria.
pDevice
Pointer to a PLX_DEVICE_OBJECT structure which will describe the selected PCI device.
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 device object is invalid or the key does not match an installed device |
ApiInvalidDriverVersion | The PLX driver version does not match the API library version |
ApiObjectAlreadyAllocated | The device object is already open or in use |
Notes:
Use PlxPci_DeviceFind to query the driver for installed PCI devices and fill in the PLX_DEVICE_KEY
information.
If the function returns ApiSuccess, any missing key information will be filled in.
Usage:
PLX_STATUS rc;
PLX_DEVICE_KEY DeviceKey;
PLX_DEVICE_OBJECT Device;
// Clear key structure to select first device
memset(&DeviceKey, PCI_FIELD_IGNORE, sizeof(PLX_DEVICE_KEY));
// Open device
rc =
PlxPci_DeviceOpen(
&DeviceKey,
&Device
);
if (rc != ApiSuccess)
{
// Error
}
else
{
Cons_printf(
"Selected: %04x %04x [b:%02x s:%02x f:%02x]\n",
DeviceKey.DeviceId, DeviceKey.VendorId,
DeviceKey.bus, DeviceKey.slot, DeviceKey.function
);
}