public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Schwebel <robert@schwebel.de>
To: linux-kernel@vger.kernel.org
Subject: Accessing odd bytes
Date: Fri, 14 Jun 2002 14:31:40 +0200	[thread overview]
Message-ID: <20020614143140.A7467@schwebel.de> (raw)

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

             reply	other threads:[~2002-06-14 12:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-14 12:31 Robert Schwebel [this message]
2002-06-14 14:02 ` Accessing odd bytes Richard B. Johnson
2002-06-14 14:40 ` Ian Stirling

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=20020614143140.A7467@schwebel.de \
    --to=robert@schwebel.de \
    --cc=linux-kernel@vger.kernel.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