LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-02-2008, 08:27 AM   #1
missblue
LQ Newbie
 
Registered: Jul 2007
Posts: 11

Rep: Reputation: 0
pci.h


Hi

I want to use commands like "pci_get_device, pci_resource_start, pci_resource_end,..." to find base address of my IO card. I know pci.h should be included like this: <linux/pci.h>
There's a file with this name in usr/include/linux but the commands are not defined in this header file.
There is also another file with the same name in
usr/src/linux-2.6.../include/linux
the commands are defined in this file.
Could you please tell me how to include this file & all of its dependancies?
 
Old 04-02-2008, 09:33 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 77
Are you writing kernel code? If so the latter will automatically be in the include path if you use a kernel Makefile to build your source.
 
Old 04-05-2008, 03:28 AM   #3
missblue
LQ Newbie
 
Registered: Jul 2007
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks for your reply,

I'm using host-target configuration & a software that sends my codes to linux platform then compile them. I don't know exactly what it does but I guess it uses gcc to compile the codes.
 
Old 04-05-2008, 08:51 PM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 77
I guess I wasn’t clear. Whatever code makes use of <linux/pci.h> is for a kernel module, it will automatically access the appropriate header when use a kernel makefile. If it is userspace code, it will not have access to the appropriate header.

The userspace version of the header is exactly the same as the kernelspace version, except all declarations armored like so
Code:
#ifdef __KERNEL__

foo;
bar;

#endif /* __KERNEL__ */
should be removed. In that case, even if you could modify your include path to gcc (e.g., “gcc -I/lib/modules/`uname -r`/build/include”) your code would not be able to use the declarations unless it was kernel code.
 
Old 04-06-2008, 03:19 AM   #5
missblue
LQ Newbie
 
Registered: Jul 2007
Posts: 11

Original Poster
Rep: Reputation: 0
So, is there any way to access PCI Bus (find base address, read & write data) without writing kernel code?
 
Old 04-06-2008, 02:50 PM   #6
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 77
I don’t think so. But you can access a lot of information about the PCI bus in /proc and /sys. Also, if you want to do port IO, you can read and write to /dev/port (having used lseek to get the appropriate port number). Here is a short document about doing that.
 
Old 04-06-2008, 06:17 PM   #7
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
that is correct. If you don't want to write kernel code, the only information you can get is found in /proc and /sys. Of course, that information is extensive, depending upon the driver that supports the PCI device, but you won't get at the hardware unless you write kernel code.
 
Old 04-08-2008, 01:37 AM   #8
missblue
LQ Newbie
 
Registered: Jul 2007
Posts: 11

Original Poster
Rep: Reputation: 0
It seems the alternative method(dev/port) is not suitable for realtime performance, is it?
I think I have to write kernel code, could you please give me some information about it?
 
Old 04-09-2008, 02:51 PM   #9
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 77
Quote:
Originally Posted by missblue View Post
I think I have to write kernel code, could you please give me some information about it?
Consult any linux 2.6 kernel module programming guide.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to allocate PCI Ethernet controller. Too many PCI devices already configured. tirtildim Linux - Software 2 04-17-2008 08:18 AM
Best high performance PCI or PCI-X fiber gigabit NIC joegoober Linux - Networking 0 11-01-2007 12:51 PM
PCI-X Raid card wont fit in motherboards PCI Express x16 slot???? abefroman Linux - Hardware 4 12-01-2006 09:24 AM
Geexbox hangs with limiting direct PCI/PCI transfers flagjunky Linux - Laptop and Netbook 0 10-11-2006 03:21 PM
PCI-PCMCIA Bridge, anyone any experince? (Bufallo WLI-PCI-OP) al_mckin Linux - Hardware 1 08-26-2004 01:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration