
28 May
2010
28 May
'10
7:34 p.m.
Dear Vipin Kumar,
In message AANLkTilwwiY7k1ZH5oPYukIiY9updRtHgFpGivEhgTgV@mail.gmail.com you wrote:
The u-boot source has been following a strict rule to use structures to define peripheral registers for some time now
I was wondering if there really is an advantage over the macro definitions which is being used in Linux until today or this is just a coding guideline to maintain consistency in the code
The advantage is that the compiler can perform strict type checking (assuming a proper set of accessor functions is available); using base address + offset notation you will not get any compile time warnings when trying to access - say - a 16 bit wide register in 32 bit mode, etc.
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@denx.de
In the beginning there was nothing.
And the Lord said "Let There Be Light!"
And still there was nothing, but at least now you could see it.