lkml.org 
[lkml]   [2002]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectAccessing odd bytes
I have a strange effect on an embedded system (AMD Elan SC410,
Linux-2.4.18) while accessing a static RAM. The RAM is mapped to the bus
at 0x0200'0000. If I map it to user space this way:

pSRAM = (unsigned short *)mmap(0, 0x00040000, PROT_READ + PROT_WRITE, MAP_SHARED, FD, 0x2000000);

and fill it like this:

pByte=(char*)pSRAM;
for (i=0; i<10; i++) {
*pByte++=(char)i;
}

pByte=(char*)pSRAM;
for (i=0; i<10; i++) {
printf("i: %02i -> %03i\n", i, *pByte++);
}

I see a mirroring effect:

i: 00 -> 001
i: 01 -> 001
i: 02 -> 003
i: 03 -> 003
i: 04 -> 005
i: 05 -> 005
i: 06 -> 007
i: 07 -> 007
i: 08 -> 009
i: 09 -> 009

Now I'm wondering how the kernel/processor handles odd byte access
exceptions. Can anybody give me a pointer where I could search or what my
problem could be?

Robert
--
+--------------------------------------------------------+
| Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de |
| Pengutronix - Linux Solutions for Science and Industry |
| Braunschweiger Str. 79, 31134 Hildesheim, Germany |
| Phone: +49-5121-28619-0 | Fax: +49-5121-28619-4 |
+--------------------------------------------------------+
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:26    [W:0.178 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site