39 #define mem32(x) ((volatile uint32_t *)(x))
40 #define mem16(x) ((volatile uint16_t *)(x))
42 #define CAT2(x, y, z) x##y##z
45 #define STR2(x) STR(x)
47 #define bit(bit) (1 << bit)
48 #define bit_is_set(val, bit) (((val & (1 << bit)) >> bit) == 1)
49 #define clear_bit(val, bit) (val = (val & ~(1 << bit)))
50 #define set_bit(val, bit) (val = (val | (1 << bit)))
52 #define ones(num) ( (1ULL << num) - 1 )
53 #define bit_mask(length, shift) (ones(length) << shift)
54 #define get_field(val, field) ((val & field##_MASK) >> field)
56 #define bitfield(name, length, shift) ( define #name length )