From: Henry Bausley <hbausley@deltatau.com>
To: Felix Radensky <felix@embedded-sol.com>
Cc: linuxppc-embedded@ozlabs.org
Subject: Re: Accessing PCI-E resources on 460EX
Date: Tue, 04 Nov 2008 10:40:22 -0800 [thread overview]
Message-ID: <1225824022.12185.11.camel@lt-linuxhenry> (raw)
In-Reply-To: <490F80E1.1060909@embedded-sol.com>
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@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
next prev parent reply other threads:[~2008-11-04 19:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-03 21:09 Accessing PCI-E resources on 460EX Felix Radensky
2008-11-03 21:31 ` Ayman El-Khashab
2008-11-03 22:53 ` Felix Radensky
2008-11-04 18:40 ` Henry Bausley [this message]
2008-12-01 7:54 ` Benjamin Herrenschmidt
2008-12-01 11:08 ` Felix Radensky
2008-12-01 21:04 ` Benjamin Herrenschmidt
2008-12-02 22:38 ` Felix Radensky
2008-12-04 9:22 ` Felix Radensky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1225824022.12185.11.camel@lt-linuxhenry \
--to=hbausley@deltatau.com \
--cc=felix@embedded-sol.com \
--cc=linuxppc-embedded@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).