* PCI lib for 2.4
@ 2003-12-12 19:16 Damien Couroussé
2003-12-15 10:04 ` Martin Mares
0 siblings, 1 reply; 4+ messages in thread
From: Damien Couroussé @ 2003-12-12 19:16 UTC (permalink / raw)
To: linux-kernel
Hi all,
I'm a rookie in Linux development, and I have to develop a small driver
for a data-acquisition card on PCI port.
My problem is that my compiler does not recognize some functions such as
'pci_resource_start()', or 'pci_find_device()' ...
I used option 'gcc [...] -lpci' in order to link with pci lib, but
that's not better. It seems that I have many different versions of the
pci.h file : /usr/src/linux2.4.18-14/include/linux/pci/h is much bigger
and much more complete, and more interesting (or it seems to be) than my
/usr/include/linux/pci.h one, or even /usr/include/driver/pci/pci.h one.
If I do a 'locate pci.a', and then a 'grep pci_resource
filed-returned-by-locate', I do not have anything. That could mean the
functions I look for do not exist in my lib.
What do I have to do if I wan't to use the .../src/linux2.4.18... one?
Thanks for any help.
Please tell me if linux-kernel list does not directly concern my problem
or if there others that fit better.
Damien
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PCI lib for 2.4
2003-12-12 19:16 PCI lib for 2.4 Damien Couroussé
@ 2003-12-15 10:04 ` Martin Mares
0 siblings, 0 replies; 4+ messages in thread
From: Martin Mares @ 2003-12-15 10:04 UTC (permalink / raw)
To: Damien Couroussé; +Cc: linux-kernel
Hi!
> I'm a rookie in Linux development, and I have to develop a small driver
> for a data-acquisition card on PCI port.
>
> My problem is that my compiler does not recognize some functions such as
> 'pci_resource_start()', or 'pci_find_device()' ...
Is your driver a kernel module or a userspace program?
If it's a kernel module, you need to set the right CFLAGS (the same as the
kernel uses).
Have a nice fortnight
--
Martin `MJ' Mares <mj@ucw.cz> http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
COBOL -- Completely Outdated, Badly Overused Language
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PCI lib for 2.4
2003-12-15 10:56 ` Damien Couroussé
@ 2003-12-15 22:14 ` Peter Chubb
0 siblings, 0 replies; 4+ messages in thread
From: Peter Chubb @ 2003-12-15 22:14 UTC (permalink / raw)
To: Damien Couroussé; +Cc: Peter Chubb, linux-kernel
>>>>> "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*
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PCI lib for 2.4
[not found] <16348.59126.537876.178991@wombat.chubb.wattle.id.au>
@ 2003-12-15 10:56 ` Damien Couroussé
2003-12-15 22:14 ` Peter Chubb
0 siblings, 1 reply; 4+ messages in thread
From: Damien Couroussé @ 2003-12-15 10:56 UTC (permalink / raw)
To: Peter Chubb; +Cc: linux-kernel
Hi,
Actually, it will be first a user-space driver.
Maybe I wasn't clear:
I link the PCI library with '-lpci' option, but it seems the library is
not complete, ie I can't use the whole lib. For example, the compiler
cannot link pci_resource_start() func. or pci_fond_device(). I think
these are usually in all pci libraries... My lib does not support dma
abilities too.
My problem is that I have several pci.h files which contain these
function (the 'whole package?'), but I don't have the lib that fits
to...
For example
>>grep pci_resource_start /usr/lib/pcilib.a
returns nothing. I think it should.
I was just wondering how I will be able to retrieve the good lib, which
I can't find on my PC. Tried to update the Red Hat (and kernel), but
it didn't change anything in my lib. I guess someone installed sthg on
my PC, which removed the 'good' pci library, or changed it for an other
lighter version.
Is there anything related with CONFIG_... flags??
Damien
Le dimanche, 14 déc 2003, à 23:40 Europe/Paris, Peter Chubb a écrit :
>>>>>> "Damien" == Damien Courouss <Damien> writes:
>
> Damien> Hi all, I'm a rookie in Linux development, and I have to
> Damien> develop a small driver for a data-acquisition card on PCI
> Damien> port.
>
> Is this a user=space or in-kernel driver? A user-space driver will
> link with -lpci; an in-kernel driver needs to be built as if part
> of the kernel.
>
> --
> Dr Peter Chubb http://www.gelato.unsw.edu.au peterc AT
> gelato.unsw.edu.au
> The technical we do immediately, the political takes *forever*
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-12-15 22:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-12 19:16 PCI lib for 2.4 Damien Couroussé
2003-12-15 10:04 ` Martin Mares
[not found] <16348.59126.537876.178991@wombat.chubb.wattle.id.au>
2003-12-15 10:56 ` Damien Couroussé
2003-12-15 22:14 ` Peter Chubb
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).