aboutsummaryrefslogtreecommitdiff
path: root/examples/driver_testing/hardware_abstraction.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/driver_testing/hardware_abstraction.h')
-rw-r--r--examples/driver_testing/hardware_abstraction.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/driver_testing/hardware_abstraction.h b/examples/driver_testing/hardware_abstraction.h
new file mode 100644
index 0000000..affa92e
--- /dev/null
+++ b/examples/driver_testing/hardware_abstraction.h
@@ -0,0 +1,15 @@
+#ifndef HARDWARE_ABSTRACTION
+#define HARDWARE_ABSTRACTION
+
+#include <stdint.h>
+
+#ifndef TESTING
+#define IO_MEM_RD8(ADDR) (*((volatile uint8_t *)(ADDR)))
+#define IO_MEM_WR8(ADDR, VAL_8) (*((volatile uint8_t *)(ADDR)) = (VAL_8))
+#else
+/* In testing use fake functions to record calls to IO memory */
+uint8_t IO_MEM_RD8(uint32_t reg);
+void IO_MEM_WR8(uint32_t reg, uint8_t val);
+#endif
+
+#endif /* Include guard */