From 7b3afcaf77f96e7d62f6cd1623ead7f17512d79f Mon Sep 17 00:00:00 2001 From: Omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Sat, 24 Feb 2024 22:47:46 +1100 Subject: repo init. partial port of existing code --- deps/fff/examples/driver_testing/include/driver.h | 11 +++++++++++ .../driver_testing/include/hardware_abstraction.h | 15 +++++++++++++++ deps/fff/examples/driver_testing/include/registers.h | 13 +++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 deps/fff/examples/driver_testing/include/driver.h create mode 100644 deps/fff/examples/driver_testing/include/hardware_abstraction.h create mode 100644 deps/fff/examples/driver_testing/include/registers.h (limited to 'deps/fff/examples/driver_testing/include') 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 + +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 + +#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_ */ -- cgit v1.2.3-70-g09d2