Re: Problem with PCI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 17 Sep 2001, Chester Rebeiro wrote:

> I'm trying to use the linux kernel API's for PCI in a program as shown
> below...

You should write a kernel module for doing this, you cannot call
kernel API functions from a user-space program. You can only access system
calls using the standard C library.

Read Rubini's book (http://www.xml.com/ldd/chapter/book/index.html) for
more details about writing device drivers.

BTW, the function is pci_find_device().

Catalin.


> The code is compiling but not linking...
> it is giving the following linker error
> ----------------------------------------------------------------------
> /tmp/cce56FvJ.o: In function `main':
> /tmp/cce56FvJ.o(.text+0x29): undefined reference to `pci_find_deivice'
> -----------------------------------------------------------------------
> #include <linux/config.h>
> #include <linux/pci.h>
> #define VENDOR_ID 0x8086
> #define DEVICE_ID 0x1234
>
> int main(int argc, char **argv) {
>  	struct pci_dev* d;
> 	d = (struct pci_dev *) pci_find_deivice(VENDOR_ID,DEVICE_ID,d);
> 	return 0;
> }
> ---------------------------------------------------------------------
> I would appriciate it if someone could tell me how to link it or what
> libraries i need to link this program
>
> Thanks in advance !!!
> Chester

-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux