LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-09-2005, 12:36 AM   #1
nelnel
Member
 
Registered: May 2005
Posts: 47

Rep: Reputation: 15
get the PCI address in program


Hi,

i have written a PCI card module and successfully insert it. Now i need to continue to code the program to control the PCI card.

But i just hard code the IO address of the PCI card to send the inp(), outp() command to control the HW action. It doesn't make sence to hard code the PCI in a specified PCI slot.

How could i retieve the IO address auto. in th program. Then the PCI card can fit on different Slot and computer setting??

Thx alot.

B.R.
 
Old 12-09-2005, 03:29 AM   #2
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Hello,
Your are using inp, outp?
My advice would be that you should first read Linux device drivers :
http://www.xml.com/ldd/chapter/book/ch15.html#t1
and have a look at the ftp server of oreilly, there are sample for simple pci drivers
also
drivers/pci/search.c
drivers/pci/pci.c
include/linux/pci.h
Generate the documentation for your kernel, make pdfdoc on Linux 2.6.

Eventhough you will manage by using inp/outp , you should use memory map. its faaaar easier and makes your code readable. The PCI adress space is mapped into the processor adress space and then you can access its IO space very easily, like accessing an array.

I developped several pci drivers and they were only a few lines!

Finding the pci is also explained in Linux device drivers. pci_get_device (defined in search.c) in 2.6

From Linux 2.0 to 2.6 no big changes were made, only if I remember something for registering your driverin the kernel.
Good luck have fun
 
  


Reply



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
PCI-DMA not syncing: high address but no IOMMU joe_merchant Linux - Hardware 4 09-30-2008 05:16 AM
How to get IP address of client from server.c program nazsarwat Programming 1 04-22-2005 03:57 PM
read gateway address from C program cranium2004 Programming 6 11-20-2004 06:20 PM
Help me with this socket address bind program. rnice Linux - Networking 0 09-17-2004 07:33 PM
Program returning ip-address? smellofsunshine Linux - Software 4 08-11-2003 05:59 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:02 PM.

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