[En-Nut-Discussion] Do we need something like sbv/sbi to complement sbi/cbi?

Harald Kipp harald.kipp at egnite.de
Fri Dec 30 11:50:45 CET 2011


Hi Uwe,

On 29.12.2011 17:11, Uwe Bonnes wrote:
> #define sbv(_reg, _mask)         outr(_reg, inr(_reg) | _mask)
> #define cbv(_reg, _mask)         outr(_reg, inr(_reg) & ~_mask)
> #define bv_is_set(_reg, _mask)  ((inr(_reg) & _mask)) != 0)
> 
> Are these macros the right thing?

I'd suggest a minor modification

#define sbv(_reg, _mask)         outr(_reg, inr(_reg) | (_mask))
#define cbv(_reg, _mask)         outr(_reg, inr(_reg) & ~(_mask))
#define bv_is_set(_reg, _mask)  ((inr(_reg) & (_mask))) != 0)

Just in case someone uses something like

 sbv(MYREG, 0x0011 | 0x2200).

Regards,

Harald



More information about the En-Nut-Discussion mailing list