public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Accessing odd bytes
@ 2002-06-14 12:31 Robert Schwebel
  2002-06-14 14:02 ` Richard B. Johnson
  2002-06-14 14:40 ` Ian Stirling
  0 siblings, 2 replies; 3+ messages in thread
From: Robert Schwebel @ 2002-06-14 12:31 UTC (permalink / raw)
  To: linux-kernel

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    |
 +--------------------------------------------------------+

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-06-14 14:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-14 12:31 Accessing odd bytes Robert Schwebel
2002-06-14 14:02 ` Richard B. Johnson
2002-06-14 14:40 ` Ian Stirling

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox