[sw, base] Introduce a MMIO access library
This change introduces a library of functions for explicitly manipulating
volatile MMIO memory (comparable to Rust's read_volatile and write_volatile).
This allows us to:
- Track volatile access somewhat better, rather than just casting
integers into pointers all over the place.
- Better-control the implementation of volatile reads and writes. If we
decide we don't trust the compiler's lowering, we can provide our own
inline-assembly implementation.
This API potentially could be revised in future to handle non-atomic R-M-W
operations differently.
Signed-off-by: Miguel Young de la Sota <mcyoung@google.com>
diff --git a/sw/device/lib/base/meson.build b/sw/device/lib/base/meson.build
index 3c74044..7776626 100644
--- a/sw/device/lib/base/meson.build
+++ b/sw/device/lib/base/meson.build
@@ -11,4 +11,12 @@
sources: ['memory.c'],
c_args: ['-fno-builtin'],
)
-)
\ No newline at end of file
+)
+
+# MMIO register manipulation library
+sw_lib_mmio = declare_dependency(
+ link_with: static_library(
+ 'mmio_ot',
+ sources: ['mmio.c'],
+ )
+)