aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/util.h')
-rw-r--r--src/lib/util.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/util.h b/src/lib/util.h
index e425cc0..c1ba15d 100644
--- a/src/lib/util.h
+++ b/src/lib/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"{