I am new to Neutrino development and I haven’t started writing code yet. I
have some questions on the pci_xxx library functions. The
pci_attach_device() call seems to be the standard way to detect a PCI device
and allocate resources for it.
-
The reference page says
“The server can scan based on a class code, vendor/device ID, or bus number
and device/function number.”
However, in the pci_dev_info structure, BusNumber and DevFunc are labelled
as output only. Which one is right? How exactly do the PCI_SEARCH_XXX flags
work? They are not used in the examples. -
I have several types of proprietary devices that (by mistake) all have
the same VendorID and DeviceID but each type has different Subsystem ID and
Subvendor ID. How would I initialize the devices of only one type? Would the
following loop work?
inf.VendorId = MY_VENDORID;
inf.DeviceId = MY_DEVICEID;
for (idx = 0; (hdl = pci_attach_device(NULL, 0, idx, &inf)) != NULL; idx++)
{
if (inf.SubsystemId == SUBSYSTEMID_1 && inf.SubsystemVendorId ==
SUBSYSTEMVENDORID_1) {
pci_attach_device(hdl, PCI_INIT_ALL, idx, &inf);
}
else {
pci_detach_device(hdl);
}
}
- What about the pci_find_device() call? What is it useful for?
-Kim