[U-Boot] [PATCH v3 02/10] armv7: add miscellaneous utility macros

Wolfgang Denk wd at denx.de
Tue Jun 14 12:51:14 CEST 2011


Dear Aneesh V,

In message <4DF71FBF.6030408 at ti.com> you wrote:
> 
> As I start re-working on my patches I realize that there is no
> alternative to get_bit_field(). clrsetbits_le32() works as an
> alternative for set_bit_field() but I couldn't find anything in io.h
> that could replace get_bit_field(). The only option I seem to have is
> to mask and shift directly every time. Is that what you prefer over
> get_bit_field()?

I don't understand this comment.

You should NOT use clrsetbits_*() instead of set_bit_field() -
depending on what you want to do, clrbits_*() or setbits_*() are
better choices for simple operations.

Also please notice that none of clrbits_*(), setbits_*() or
clrsetbits_*() perform any masking or shifting.  If you don't want to
do this explicitly when using the macro, you can hide it in
respective definitions of the mask values.  I showed how this could be
done in the examples I posted in the thread with Simon.



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
Cleverness and Style have no place in getting a project completed.
                                                  -- Tom Christiansen


More information about the U-Boot mailing list