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

Re: Help with some low level access

On Tue, 4 Feb 2003, Ross Vumbaca wrote:
> Geert Uytterhoeven wrote:
> > On Mon, 3 Feb 2003, vinai wrote:
> > 
> >>I'm not anywhere near an expert on this, so take what I say with a pound
> >>of salt or so ... :)  I was reading up on the PCI specifications to try
> >>to understand a little bit about drivers, and it was mentioned that the
> >>x86 architecture use I/O space to access devices, whereas with PowerPC
> >>systems, everything is accessed through memory space mapping ...
> > 
> > 
> > So you should mmap() /dev/mem and access the memory range that contains PCI I/O
> > space on your box. This is machine dependent. An example (for CHRP LongTrail)
> > can be found at http://home.tvd.be/cr26864/Linux/PPC/sio.c
> > 
> > In theory we could let ioperm() take care of mapping /dev/mem and setting up
> > _IO_BASE, based on information from /proc.
> >>>#include <stdio.h>
> >>>#include <sys/io.h>
> >>>
> >>>int main() {
> >>>         ioperm(0x00, 0xff, 1);
> >>>         printf ("Status register: %x\n", inb(0x08));
> >>>         return 0;
> >>>}
> Thanks, I'm not actually accessing PCI I/O space though, I am trying to 
> access the ISA space (the Intel ISA DMA controller at 0x00).

ISA I/O space is the low part of PCI I/O space.
ISA memory space is something different (not available on Macs).

> The above code (not using ioperm) works if I put it into the kernel, e.g 
> in the dma.c driver, but I wanted to use it from user space when I need 
> it (which is why I have ioperm), not to put it in the kernel. There does 
> not seem to be any sys/io.h with the PowerPC libc, and no inb or ioperm 
> functions for user space programs (???), the above program won't build 
> on PowerPC.

Does my sio.c still build?



Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

Reply to: