Accessing PCI-E resources on 460EX
Henry Bausley
hbausley at deltatau.com
Wed Nov 5 05:40:22 EST 2008
Did you try mmap2. It probable is not in glibc so you will have to call
it using syscall.
#include <sys/syscall.h>
unsigned *pdata = (unsigned *)syscall(__NR_mmap2,0,0x100000,PROT_READ|
PROT_WRITE,MAP_SHARED,fd, 0xe80000 );
The address is in page offsets that why the address is 0xe80000.
On Tue, 2008-11-04 at 00:53 +0200, Felix Radensky wrote:
> Ayman El-Khashab wrote:
> >
> > What works for me is using the mmap64 as in the following example to
> > map the physical address, fd is the file descriptor for /dev/mem
> >
> > off64_t offset = static_cast<off64_t>(your physical address);
> > void * const p =
> > mmap64(0,256,PROT_WRITE|PROT_READ,MAP_SHARED,fd,offset);
> >
> > The only thing to note is that the address you pass should be aligned
> > to the page boundry even though some devices are not.
> >
>
> Thanks, Ayman. I've tried that, but I'm still getting the same error.
> My physical address is 0xe80000000, length is 0x100000.
>
> Felix.
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded at ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
More information about the Linuxppc-embedded
mailing list