Hi Wolfgang, On Tuesday 17 May 2011 10:57 AM, Wolfgang Denk wrote: > Dear Simon Glass, > > In message<banlktine7bfsyousgxwg0rg3ownbpn_...@mail.gmail.com> you wrote: >> >> There are a few very primitive macros in setbits and clrbits. I would >> very much like to see at least: > > Maybe we can agree to use these existing macros then instead of > inventing new ones with the same functionality. > >> - define a field once in a header in an easy format along with any >> enums which define allowable values if applicable >> - pack and unpack a value into a field: so set a bitfield to 13, for exampl= >> e >> - obtain a mask for a field (i.e. with all bits set) >> - equivalent of writel and readl for a bitfield (writel in fact being >> read/modify/write so perhaps a different name) >> >> Some of these exist, some don't. > > Do you know of examples of such more complex definitions in the Linux > kernel code? >
In fact I had searched for a macro for similar needs as my set_bit_field() is addressing in Linux Kernel too but didn't find any. Please note that my requirement is not for doing IO but doing bit field operations on a C integer variable: 1. Prepare a variable field by field to be finally written to a register using writel() 2. Extract a field from a variable that typically holds the value of a register after a readl() I couldn't find any utility macros/functions for doing something like this. Please somebody correct me if I am wrong. best regards, Aneesh _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot