Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 07-10-2004, 03:19 PM   #1
LQ Newbie
Registered: Jul 2004
Posts: 1

Rep: Reputation: 0
Question Gpio Twiddling In Embedded Linux? or How to access PCI memory space regs?

i am working with a Intel 440MX-based embedded system -- specifically, it uses the Intel 82443MX integrated north/south device ("Banister"). the CPU is a mobile Celeron/400MHz.

i would like to be able to toggle the 440MX GPIO pins from a userland application running under linux (2.4 kernel). i.e., i need to toggle GPIO1 (pin E4) through GPIO20 (pin K3).

according to the 440MX/82443 datasheet and application programming guides, the GPIO pins are accessible through PCI config function 0, registers B0-B3, D4-DB, and E0-E3. this is from section 6-15 of

my question is, how do i access the PCI registers from userland C? i have seen some examples using inb/outb, but for the most part they are geared towards addressing the parallel port. i can look up the exact register values for the 440MX, that's not the problem -- the question is how does one implement userland-to-PCI-space read/write routines using the linux inb/outb primitives?

additionally, i understand some measures need to be taken to allow a userland application to write directly to PCI memory (ostensibly bypassing memory bounds checking). can anyone suggest some links which demonstrate how this is implemented as well?

any pointers appreciated.

thanks and regards,
Old 07-11-2004, 02:17 AM   #2
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
im not sure if there is a library out there that lets you do that, but u wouldn't be able to open /dev/kmem and write to the configuration space. that's controller dependent, and linux kernel has special kernel functions exported to let you do it in independent way, ie pci_read_config_byte() [/drivers/pci/pci.c]. what you could do is write a simple module that creates a device file and performs ioctls() that moves data to/from pci space for the process.

Last edited by infamous41md; 07-11-2004 at 02:46 AM.


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
Problem installing - - Intersil Prism2 wireless lan pci card (embedded inside the com developmental Linux - Newbie 2 01-03-2005 04:02 PM
How to access USB falsh memory on linux ziox Linux - Hardware 4 07-19-2004 01:39 PM
Accessing PCI memory space HTS Programming 7 04-30-2004 10:55 AM
orinoco mini/pci embedded wireless card PlatinumRik Linux - Wireless Networking 0 08-03-2003 09:46 PM
RH 8.0 Mapping Virtual Memory to get access to VMIC Reflective Memory PCI card. Merlin53 Linux - Hardware 0 05-05-2003 12:50 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:22 AM.

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