From: "colorant" <colorant@163.com>
To: linux-omap-open-source@linux.omap.com
Subject: Question About __REG32 marco
Date: Tue, 20 Nov 2007 18:39:48 +0800 [thread overview]
Message-ID: <005c01c82b61$ac9f1cf0$16110a0a@LongCheer.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 909 bytes --]
Hi
In include/asm-arm/arch-omap/io.h
The __REG32 macro is defined as following:
typedef struct { volatile u32 offset[4096]; } __regbase32;
#define __REGV32(vaddr) ((__regbase32 *)((vaddr)&~4095)) \
->offset[((vaddr)&4095)>>2]
#define __REG32(paddr) __REGV32(io_p2v(paddr))
My question is :
1:
Why this macro need to be defined in this way ? Why borther to use an array ?
Can't we just use something like :
*(volatile u32 *)(vaddr&~0x3) to get the value from vaddr with word align ?
2:
Why this offset array need to be 4096 in size ? shouldn't it be 1024 ? since it already point to a u32 value. and the >>2 make the macro never got chance to reach a index great than 1024 !
I can only find this macro in omap arch, so I put up the question here 8 )
Thanks
Raymond
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next reply other threads:[~2007-11-20 10:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-20 10:39 colorant [this message]
2007-11-20 14:54 ` Question About __REG32 marco Woodruff, Richard
2007-11-20 21:26 ` David Brownell
2007-11-21 0:40 ` colorant
2007-11-21 0:46 ` David Brownell
2007-11-21 5:18 ` colorant
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='005c01c82b61$ac9f1cf0$16110a0a@LongCheer.net' \
--to=colorant@163.com \
--cc=linux-omap-open-source@linux.omap.com \
/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