public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* Question About __REG32 marco
@ 2007-11-20 10:39 colorant
  2007-11-20 14:54 ` Woodruff, Richard
  2007-11-20 21:26 ` David Brownell
  0 siblings, 2 replies; 6+ messages in thread
From: colorant @ 2007-11-20 10:39 UTC (permalink / raw)
  To: linux-omap-open-source

[-- 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 --]



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

end of thread, other threads:[~2007-11-21  5:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-20 10:39 Question About __REG32 marco colorant
2007-11-20 14:54 ` 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

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