diff options
Diffstat (limited to 'libmaple/util.h')
-rw-r--r-- | libmaple/util.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libmaple/util.h b/libmaple/util.h index e425cc0..c1ba15d 100644 --- a/libmaple/util.h +++ b/libmaple/util.h @@ -54,6 +54,12 @@ #define REG_GET(reg) *(volatile uint32_t*)(reg) +#define __set_bits(addr, mask) *(volatile uint32_t*)(addr) |= (uint32_t)(mask) +#define __clear_bits(addr, mask) (*(volatile uint32_t*)(addr) &= (uint32_t)~(mask)) +#define __get_bits(addr, mask) (*(volatile uint32_t*)(addr) & (uint32_t)(mask)) + +#define __read(reg) *(volatile uint32_t*)(reg) +#define __write(reg, value) *(volatile uint32_t*)(reg) = (value) #ifdef __cplusplus extern "C"{ |