aboutsummaryrefslogtreecommitdiff
path: root/global.h
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2020-01-03 17:08:06 +0100
committerWojtek Kosior <kwojtus@protonmail.com>2020-01-03 17:08:06 +0100
commit814d4a5357d849c4988422d48afa4aaa5432ce78 (patch)
tree77f4a169332f017873e64dcadbd7ed3467140c3f /global.h
parent42ad29d6475cc63797be5042b90e8b09fc8d93b9 (diff)
downloadrpi-MMU-example-814d4a5357d849c4988422d48afa4aaa5432ce78.tar.gz
rpi-MMU-example-814d4a5357d849c4988422d48afa4aaa5432ce78.zip
write to peripheral registers like humans
Diffstat (limited to 'global.h')
-rw-r--r--global.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/global.h b/global.h
index f5fe9a6..c461703 100644
--- a/global.h
+++ b/global.h
@@ -1,6 +1,8 @@
#ifndef GLOBAL_H
#define GLOBAL_H
+#include <stdint.h>
+
// board type, raspi2
#define RASPI 2
@@ -38,4 +40,14 @@
#define ARM_DISABLE_IRQS_2 (ARM_BASE + 0x220)
#define ARM_DISABLE_BASIC_IRQS (ARM_BASE + 0x224)
+inline static uint32_t rd32(uint32_t addr)
+{
+ return *(uint32_t volatile*) addr;
+}
+
+inline static void wr32(uint32_t addr, uint32_t value)
+{
+ *(uint32_t volatile*) addr = value;
+}
+
#endif // GLOBAL_H