[U-Boot] [RESEND PATCH v2 1/5] Tegra2: Add macros to calculate bitfield shifts and masks

Wolfgang Denk wd at denx.de
Tue Jul 12 23:18:32 CEST 2011


Dear Anton Staaf,

In message <CAF6FioVcfgxzep7dhgxYR+cjaf0nQ8LYBxKvEaqycz8NOoSWDA at mail.gmail.com> you wrote:
>
> That makes sense to me.  Would an alternative that uses the "width" and
> "size" of the field be acceptable?  Then there is a well understood (on both
> types of architectures) mapping from these values to the mask and shift
> required to access portions of a register and/or variable in memory.

"width" and "size" seem indentical to me here.  Do you mean "width"
and "offset" or so?  The problem still remains.  People who are used
to number bits from left to right will also tend to count bit offsets
in the same direction.

In the end, the most simple and truly portable way is specifying the
masks directly.  What's wrong with definitions like

	#define SCFR1_IPS_DIV_MASK      0x03800000
	#define SCFR1_PCI_DIV_MASK      0x00700000
	#define SCFR1_LPC_DIV_MASK      0x00003800

etc.?

I can actually read these much faster that any of these bit field
definitions.

> --00504502e3b9570ace04a7e593ca
> Content-Type: text/html; charset=ISO-8859-1
> Content-Transfer-Encoding: quoted-printable

Please stop posting HTML.

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
News is what a chap who doesn't care much  about  anything  wants  to
read. And it's only news until he's read it. After that it's dead.
                           - Evelyn Waugh _Scoop_ (1938) bk. 1, ch. 5


More information about the U-Boot mailing list