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))
63static 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));
83static 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));
103static 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));
123static 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));
145static 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));
165static 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));
185static 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));
205static 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));
225static 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));
245static 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));
static void bit_clear8(volatile uint8_t *ptr, uint8_t bit)
Clear a single bit in the 8 bit byte pointed to by ptr.
#define BME_BF_MASK(bit, width)
Bit field extraction bitmask.
static void bit_set16(volatile uint16_t *ptr, uint8_t bit)
Set a single bit in the 16 bit word pointed to by ptr.
#define BME_OR_MASK
OR decoration bitmask.
static void bit_clear32(volatile uint32_t *ptr, uint8_t bit)
Clear a single bit in the 32 bit word pointed to by ptr.
static void bit_set8(volatile uint8_t *ptr, uint8_t bit)
Set a single bit in the 8 bit byte pointed to by ptr.
static volatile void * bme_bf_addr(volatile void *ptr, uintptr_t bit, uintptr_t width)
Bit field address macro.
static volatile uint8_t * bme_bitfield8(volatile uint8_t *ptr, uint8_t bit, uint8_t width)
Access a bitfield (8 bit load/store)
static volatile uint16_t * bme_bitfield16(volatile uint16_t *ptr, uint8_t bit, uint8_t width)
Access a bitfield (16 bit load/store)
static void bit_set32(volatile uint32_t *ptr, uint8_t bit)
Set a single bit in the 32 bit word pointed to by ptr.
#define BME_AND_MASK
AND decoration bitmask.
static volatile uint32_t * bme_bitfield32(volatile uint32_t *ptr, uint8_t bit, uint8_t width)
Access a bitfield (32 bit load/store)
static void bit_clear16(volatile uint16_t *ptr, uint8_t bit)
Clear a single bit in the 16 bit word pointed to by ptr.