<html><head><style type="text/css"><!-- DIV {margin:0px} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div>Hello again,<br>well i didn't get any responses at all to my last post so I thought i'd try this again.<br><br>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:<br><br>int main (int argc, char *argv[]) {<br> int fd;<br> int *ptr;<br><br> fd = open("/dev/mem", O_RDWR);<br> if(fd == -1) {<br> printf("Err: cannot open /dev/mem\n");<br> return -1;<br> }<br><br> ptr = MAP_FAILED; // Initialize to bad value<br> ptr = (int *) mmap(0, 256, PROT_READ|PROT_WRITE, MAP_SHARED, fd, USER_LOGIC_BASEADDR);<br><br>
if(ptr==MAP_FAILED) {<br> printf("Err: cannot access address!\n");<br> return -1;<br> }<br><br> *ptr = 0xA0000000;<br> ...<br><br><br>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 <br>bus error<br><br>or<br><br>do_wp_page: bogus page at address 3001a000 (page 0xc2c4c004)<br>VM: killing process led_test.o<br><br>depending on whether I use MAP_SHARED or MAP_PRIVATE.<br><br>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?<br><br>If I'm being too vague or something please let me know and I'll resolve it immediately...<br><br>Thanks much, --scott<br><br><br>Other details:<br>linuxppc-2.4.26<br>busybox 1.1.0<br>powerpc-405-linux-gnu-gcc 3.4.1<br><br></div></div></body></html>