35 #define BITBAND_FUNCTIONS_PROVIDED 1
37 #define BME_AND_MASK (1 << 26)
38 #define BME_OR_MASK (1 << 27)
39 #define BME_XOR_MASK (3 << 26)
40 #define BME_LAC1_MASK(BIT) ((1 << 27) | ((BIT) << 21))
41 #define BME_LAS1_MASK(BIT) ((3 << 26) | ((BIT) << 21))
49 #define BME_BF_MASK(bit, width) ((1 << 28) | ((bit) << 23) | (((width) - 1 ) << 19))
63 static inline volatile void *
bme_bf_addr(
volatile void *ptr, uintptr_t bit, uintptr_t width)
65 return (
volatile void *)(((uintptr_t)ptr) |
BME_BF_MASK(bit, width));
83 static inline volatile uint32_t *
bme_bitfield32(
volatile uint32_t *ptr, uint8_t bit, uint8_t width)
85 return (
volatile uint32_t *)(
bme_bf_addr(ptr, bit, width));
103 static inline volatile uint16_t *
bme_bitfield16(
volatile uint16_t *ptr, uint8_t bit, uint8_t width)
105 return (
volatile uint16_t *)(
bme_bf_addr(ptr, bit, width));
123 static inline volatile uint8_t *
bme_bitfield8(
volatile uint8_t *ptr, uint8_t bit, uint8_t width)
125 return (
volatile uint8_t *)(
bme_bf_addr(ptr, bit, width));
145 static inline void bit_set32(
volatile uint32_t *ptr, uint8_t bit)
147 *((
volatile uint32_t *)(((uintptr_t)ptr) |
BME_OR_MASK)) = (uint32_t)((1ul << bit));
165 static inline void bit_set16(
volatile uint16_t *ptr, uint8_t bit)
167 *((
volatile uint16_t *)(((uintptr_t)ptr) |
BME_OR_MASK)) = (uint16_t)((1ul << bit));
185 static inline void bit_set8(
volatile uint8_t *ptr, uint8_t bit)
187 *((
volatile uint8_t *)(((uintptr_t)ptr) |
BME_OR_MASK)) = (uint8_t)((1ul << bit));
205 static inline void bit_clear32(
volatile uint32_t *ptr, uint8_t bit)
207 *((
volatile uint32_t *)(((uintptr_t)ptr) |
BME_AND_MASK)) = (uint32_t)(~(1ul << bit));
225 static inline void bit_clear16(
volatile uint16_t *ptr, uint8_t bit)
227 *((
volatile uint16_t *)(((uintptr_t)ptr) |
BME_AND_MASK)) = (uint16_t)(~(1ul << bit));
245 static inline void bit_clear8(
volatile uint8_t *ptr, uint8_t bit)
247 *((
volatile uint8_t *)(((uintptr_t)ptr) |
BME_AND_MASK)) = (uint8_t)(~(1ul << bit));