Plx使用手册学习------6 PlxPci_DeviceFind

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:

CodeDescription
ApiSuccessThe function returned successfully
ApiNullParamOne or more parameters is NULL
ApiNoActiveDriverA valid PLX driver is not loaded in the system
ApiInvalidDeviceInfoThe 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
}

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值