From: scott <scotto2hot-green@yahoo.com>
To: linuxppc-embedded@ozlabs.org
Subject: using /dev/mem to talk to peripherals on VIIP system
Date: Fri, 28 Jul 2006 10:35:19 -0700 (PDT) [thread overview]
Message-ID: <20060728173519.55388.qmail@web33312.mail.mud.yahoo.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1845 bytes --]
Hello again,
well i didn't get any responses at all to my last post so I thought i'd try this again.
I have kernel 2.4.26 installed on a Xilinx XUP board and everything works well except I can't seem to communicate with peripherals on the OPB or PLB bus through devfs. devfs is on and mounted and everything, and I'm able open a file handle to it w/ the following code:
int main (int argc, char *argv[]) {
int fd;
int *ptr;
fd = open("/dev/mem", O_RDWR);
if(fd == -1) {
printf("Err: cannot open /dev/mem\n");
return -1;
}
ptr = MAP_FAILED; // Initialize to bad value
ptr = (int *) mmap(0, 256, PROT_READ|PROT_WRITE, MAP_SHARED, fd, USER_LOGIC_BASEADDR);
if(ptr==MAP_FAILED) {
printf("Err: cannot access address!\n");
return -1;
}
*ptr = 0xA0000000;
...
mmap also seems to work, and returns a virtual address that is supposed to point to the location in physical memory at USER_LOGIC_BASEADDR. when I try to use ptr, however, I either get
bus error
or
do_wp_page: bogus page at address 3001a000 (page 0xc2c4c004)
VM: killing process led_test.o
depending on whether I use MAP_SHARED or MAP_PRIVATE.
These errors occur if I try to access any device on either PLB or OPB - even the OPB UART (which i KNOW is working). This technique DOES work, however, for address ranges in RAM. This indicates to me that it's some sort of higher level memory management problem w/ linuxppc such that it doesn't realize these address ranges are valid. I assume this is a function of the BSP that gets generated in EDK? Anybody have any idea how I can tell linux to let me use these addresses? Any other thoughts?
If I'm being too vague or something please let me know and I'll resolve it immediately...
Thanks much, --scott
Other details:
linuxppc-2.4.26
busybox 1.1.0
powerpc-405-linux-gnu-gcc 3.4.1
[-- Attachment #2: Type: text/html, Size: 2335 bytes --]
next reply other threads:[~2006-07-28 17:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-28 17:35 scott [this message]
2006-07-28 17:51 ` using /dev/mem to talk to peripherals on VIIP system Dan Malek
2006-07-28 19:54 ` scott
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=20060728173519.55388.qmail@web33312.mail.mud.yahoo.com \
--to=scotto2hot-green@yahoo.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