[U-Boot] [PATCH 2/3] dnet: driver for Dave DNET ethernet controller
Wolfgang Denk
wd at denx.de
Thu Feb 5 22:32:01 CET 2009
Dear Ilya Yanok,
In message <498A5F2F.1030603 at emcraft.com> you wrote:
>
> > Please do not operate on base register plus magic offset - implement a
> > proper C structure instead to describe the controller hardware.
>
> I've done as you requested but I'm really in doubt why do you like it?
> In the kernel offsets are preferred over C structures... And there is
With "in the kernel" you probaly mean "in the ARM architecture code of
the kernel". Compare for example PowerPC...
> nothing magical in offsets actually... we usually have offsets in specs
> not C structures...
Just to name one reason (but a very important one): using a struct
allows for strict type checking by the compiler. If you use address +
offset you will not get any help from the compiler when you for
example read 8 bit from a register that must be accessed as a 32 bit
entity.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Q: How many DEC repairman does it take to fix a flat ?
A: Five; four to hold the car up and one to swap tires.
More information about the U-Boot
mailing list