Messages in this thread | | | From | Peter Chubb <> | Date | Tue, 16 Dec 2003 09:14:06 +1100 | Subject | Re: PCI lib for 2.4 |
| |
>>>>> "Damien" == Damien Courouss <Damien> writes:
Damien> Hi, Actually, it will be first a user-space driver.
Damien> Maybe I wasn't clear:
The user-space libpci.a has headers in /usr/include/pci/pci.h Do #include <pci/pci.h> to get at them. On debian, at least, you need the pciutils-dev package. Unfortunately, there are no manual pages (yet?)
And *do* look at the example code that comes with libpci.a
pci_resource_start() and so on are kernel functions; you get the same info in a different way using libpci.a -- Look at the source of lspci to see what you can do.
(In brief: struct pci_access *pacc; struct pci_dev *dev;
pacc = pci_alloc();
pci_init(pacc); pci_scan_bus(pacc); for (dev = pacc->devices; dev; dev = dev->next) { if (dev->vendor_id == PCI_VENDOR_ID_AAA && dev->device_id == PCI_DEVICE_ID_AAA_BBB) break; } if (dev == NULL){ fprintf(stderr, "No AAA BBB device\n"); exit(1); } pciconf = xmalloc(sizeof *pciconf); pciconf->pciconfig.accesstype = PCI_CONFIG; pciconf->pciconfig.devp = dev;
pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES | PCI_FILL_IRQ);
/* * Get the first 64-bytes of config space */ pci_read_block(dev, 0, config, 64); )
-- Dr Peter Chubb http://www.gelato.unsw.edu.au peterc AT gelato.unsw.edu.au The technical we do immediately, the political takes *forever* - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |