From: "Kerl, John" <John.Kerl@Avnet.com>
To: "Charles Frey" <charlesf@wciatl.com>,
<linuxppc-embedded@lists.linuxppc.org>
Subject: RE: ppc405ep GPIO register mmap'ing invalid argument
Date: Tue, 27 Apr 2004 16:19:50 -0700 [thread overview]
Message-ID: <C7FFFEA58B43D311920D0004ACE5333F132B016D@amer25.avnet.com> (raw)
Check the manpage: length must be a multiple of getpagesize().
Which your 4 evidently is not.
-----Original Message-----
From: owner-linuxppc-embedded@lists.linuxppc.org
[mailto:owner-linuxppc-embedded@lists.linuxppc.org]
Sent: Tuesday, April 27, 2004 3:57 PM
To: linuxppc-embedded@lists.linuxppc.org
Subject: ppc405ep GPIO register mmap'ing invalid argument
Hey,
I'm trying to read and write from the GPIO_OR register on an ibm 405ep
(0xEF600700), and just as I've seen on this list and other places on the
net, I do this:
if ((m_fp = open("/dev/mem", O_RDWR)) < 0)
{
printf("Can't open /dev/mem\n");
return(-1);
}
offset = 0xef600700 / getpagesize();
data = mmap(0, 4, PROT_READ | PROT_WRITE, MAP_SHARED, m_fp, offset);
And it always fails with "Invalid Argument". The mmap man page seems to
suggest you have to pass the address as a multiple of the pagesize, so that
why I do that. But I've also tried passing 0xEF600700 straight in, and
I've tried setting length to a getpagesize() as well (as opposed to 4) to
see if I was asking for too little, but still is fails the same way. At
first I thought this just wasn't a valid operation, but I've seen so many
examples now that I don't believe that's it. Can anybody point me in the
right direction?
As a somewhat related question, I can "cat /dev/mem > test.bin" and it
comes out to be something like 67 megs, and this board has 64 megs of RAM.
I'm confused as to why the entire 4 GB memory space doesn't come out?
Thanks!
-Charles
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
next reply other threads:[~2004-04-27 23:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-27 23:19 Kerl, John [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-04-27 23:23 ppc405ep GPIO register mmap'ing invalid argument Kerl, John
2004-04-27 23:21 Kerl, John
2004-04-27 22:57 Charles Frey
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=C7FFFEA58B43D311920D0004ACE5333F132B016D@amer25.avnet.com \
--to=john.kerl@avnet.com \
--cc=charlesf@wciatl.com \
--cc=linuxppc-embedded@lists.linuxppc.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).