30 #if !BITBAND_FUNCTIONS_PROVIDED
36 #define CPU_HAS_BITBAND 1 || 0 (1 if CPU implements bit-banding, 0 if not)
48 #define CPU_HAS_SRAM_BITBAND 1 || 0
51 #if CPU_HAS_BITBAND || DOXYGEN
54 #ifndef CPU_HAS_SRAM_BITBAND
55 #define CPU_HAS_SRAM_BITBAND 1
73 static inline volatile void *
bitband_addr(
volatile void *ptr, uintptr_t bit)
75 return (
volatile void *)((((uintptr_t)ptr) & 0xF0000000ul) + 0x2000000ul +
76 ((((uintptr_t)ptr) & 0xFFFFFul) << 5) + (bit << 2));
94 static inline void bit_set32(
volatile uint32_t *ptr, uint8_t bit)
114 static inline void bit_set16(
volatile uint16_t *ptr, uint8_t bit)
134 static inline void bit_set8(
volatile uint8_t *ptr, uint8_t bit)
154 static inline void bit_clear32(
volatile uint32_t *ptr, uint8_t bit)
174 static inline void bit_clear16(
volatile uint16_t *ptr, uint8_t bit)
194 static inline void bit_clear8(
volatile uint8_t *ptr, uint8_t bit)
211 static inline bool bit_check32(
volatile uint32_t *ptr, uint8_t bit)
228 static inline bool bit_check16(
volatile uint16_t *ptr, uint8_t bit)
245 static inline bool bit_check8(
volatile uint8_t *ptr, uint8_t bit)
254 static inline void bit_set32(
volatile uint32_t *ptr, uint8_t bit)
256 *ptr |= (1 << (bit));
259 static inline void bit_set16(
volatile uint16_t *ptr, uint8_t bit)
261 *ptr |= (1 << (bit));
264 static inline void bit_set8(
volatile uint8_t *ptr, uint8_t bit)
266 *ptr |= (1 << (bit));
269 static inline void bit_clear32(
volatile uint32_t *ptr, uint8_t bit)
271 *ptr &= ~(1 << (bit));
274 static inline void bit_clear16(
volatile uint16_t *ptr, uint8_t bit)
276 *ptr &= ~(1 << (bit));
279 static inline void bit_clear8(
volatile uint8_t *ptr, uint8_t bit)
281 *ptr &= ~(1 << (bit));
284 static inline bool bit_check32(
volatile uint32_t *ptr, uint8_t bit)
286 return *ptr & (1 << bit);
289 static inline bool bit_check16(
volatile uint16_t *ptr, uint8_t bit)
291 return *ptr & (1 << bit);
294 static inline bool bit_check8(
volatile uint8_t *ptr, uint8_t bit)
296 return *ptr & (1 << 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.
static volatile void * bitband_addr(volatile void *ptr, uintptr_t bit)
Convert bit band region address and bit number to bit band alias address.
static void bit_set16(volatile uint16_t *ptr, uint8_t bit)
Set a single bit in the 16 bit word pointed to by ptr.
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 bool bit_check16(volatile uint16_t *ptr, uint8_t bit)
Checks if a single bit in the 16 bit word pointed to by ptr is set.
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 void bit_set32(volatile uint32_t *ptr, uint8_t bit)
Set a single bit in the 32 bit word pointed to by ptr.
static bool bit_check8(volatile uint8_t *ptr, uint8_t bit)
Checks if a single bit in the 8 bit byte pointed to by ptr is set.
static bool bit_check32(volatile uint32_t *ptr, uint8_t bit)
Checks if a single bit in the 32 bit word pointed to by ptr is set.
static void bit_clear16(volatile uint16_t *ptr, uint8_t bit)
Clear a single bit in the 16 bit word pointed to by ptr.