libtropic
C library for TROPIC01 chip
bits.h File Reference

Struct and function declarations for dealing with bit assignment. More...

Macros

#define BITS_PER_LONG   32
 
#define __AC(X, Y)   (X##Y)
 
#define _AC(X, Y)   __AC(X, Y)
 
#define _U(x)   (_AC(x, U))
 
#define U(x)   (_U(x))
 
#define BIT(nr)   (1U << (nr))
 
#define BIT64(nr)   (((u64)(1)) << ((u64)(nr)))
 
#define GENMASK_INPUT_CHECK(h, l)   0
 
#define __GENMASK(h, l)   (((~U(0)) - (U(1) << (l)) + 1) & (~U(0) >> (BITS_PER_LONG - 1 - (h))))
 
#define GENMASK(h, l)   (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
 
#define __bf_shf(x)   (__builtin_ffsll(x) - 1)
 
#define FIELD_GET(_mask, _reg)   ((typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)))
 
#define FIELD_PREP(_mask, _val)   (((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask))
 
#define FIELD_SET(_reg, _mask, _val)
 

Detailed Description

Author
Ondrej Ille
License
For the license see file LICENSE.txt file in the root directory of this source tree.