summaryrefslogtreecommitdiff
path: root/deps/fff/examples/driver_testing/include
diff options
context:
space:
mode:
authorOmniscient <17525998+omnisci3nce@users.noreply.github.com>2024-02-24 22:47:46 +1100
committerOmniscient <17525998+omnisci3nce@users.noreply.github.com>2024-02-24 22:47:46 +1100
commit7b3afcaf77f96e7d62f6cd1623ead7f17512d79f (patch)
treeb5f82c64e9c06a84e4d095ab4ac48712e860b673 /deps/fff/examples/driver_testing/include
parentb047be5252aeb981faea077409c1768fda0301d9 (diff)
repo init. partial port of existing code
Diffstat (limited to 'deps/fff/examples/driver_testing/include')
-rw-r--r--deps/fff/examples/driver_testing/include/driver.h11
-rw-r--r--deps/fff/examples/driver_testing/include/hardware_abstraction.h15
-rw-r--r--deps/fff/examples/driver_testing/include/registers.h13
3 files changed, 39 insertions, 0 deletions
diff --git a/deps/fff/examples/driver_testing/include/driver.h b/deps/fff/examples/driver_testing/include/driver.h
new file mode 100644
index 0000000..b7406d4
--- /dev/null
+++ b/deps/fff/examples/driver_testing/include/driver.h
@@ -0,0 +1,11 @@
+
+#ifndef DRIVER
+#define DRIVER
+
+#include <stdint.h>
+
+void driver_write(uint8_t val);
+uint8_t driver_read();
+void driver_init_device();
+
+#endif /*include guard*/
diff --git a/deps/fff/examples/driver_testing/include/hardware_abstraction.h b/deps/fff/examples/driver_testing/include/hardware_abstraction.h
new file mode 100644
index 0000000..affa92e
--- /dev/null
+++ b/deps/fff/examples/driver_testing/include/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 */
diff --git a/deps/fff/examples/driver_testing/include/registers.h b/deps/fff/examples/driver_testing/include/registers.h
new file mode 100644
index 0000000..5c9e5a9
--- /dev/null
+++ b/deps/fff/examples/driver_testing/include/registers.h
@@ -0,0 +1,13 @@
+#ifndef REGISTERS_H_
+#define REGISTERS_H_
+
+#define DRIVER_OUTPUT_REGISTER 0xFFAAu
+#define DRIVER_INPUT_REGISTER 0XFFABu
+#define DRIVER_PERIPHERAL_ENABLE_REG 0xFFACu
+#define DRIVER_PERIPHERAL_INITIALIZE_REG 0xFFACu
+
+#define HARDWARE_VERSION_REGISTER 0xFF00u
+#define HARDWARE_REV_A 0x00u
+#define HARDWARE_REV_B 0x01u
+
+#endif /* REGISTERS_H_ */