Integrate openpower-libhei with openpower-hw-diags
Pull down openpower-libhei as a subproject and build the isolator
support into openpower-hw-diags.
Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: I6eeacc802363fec6f0f113e75eb268a8c1774b7c
diff --git a/src/hei_user_defines.hpp b/src/hei_user_defines.hpp
new file mode 100644
index 0000000..797f22e
--- /dev/null
+++ b/src/hei_user_defines.hpp
@@ -0,0 +1,25 @@
+#pragma once
+
+/**
+ * @file hei_user_defines.hpp
+ * @brief The purpose of this file is to create common defines that
+ * will be used throughout this library.
+ */
+
+#include <assert.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+#define HEI_INF(...) \
+ { \
+ printf("HWDIAGS I> " __VA_ARGS__); \
+ printf("\n"); \
+ }
+
+#define HEI_ERR(...) \
+ { \
+ printf("HWDIAGS E> " __VA_ARGS__); \
+ printf("\n"); \
+ }
+
+#define HEI_ASSERT(expression) assert(expression);
diff --git a/src/main.cpp b/src/main.cpp
index eaf2d4c..0de89fa 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,6 +1,7 @@
-
#include <stdio.h>
+#include <hei_main.hpp>
+
int main()
{
printf("Hello, World!\n");
diff --git a/src/meson.build b/src/meson.build
index ae1b040..407f66f 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1 +1,9 @@
-executable('openpower-hw-diags', 'main.cpp', install : true)
+# If libhei is not provided by the system then build using the subproject
+libhei_dep = dependency('libhei', fallback : ['libhei', 'libhei_dep'])
+
+# create openpower-hw-diags application
+executable('openpower-hw-diags',
+ 'main.cpp',
+ 'user_interface.cpp',
+ dependencies : libhei_dep,
+ install : true)
diff --git a/src/user_interface.cpp b/src/user_interface.cpp
new file mode 100644
index 0000000..e51b206
--- /dev/null
+++ b/src/user_interface.cpp
@@ -0,0 +1,43 @@
+/**
+ * @file These are implementations of the user interfaces declared in
+ * hei_user_interface.hpp
+ */
+
+#include <hei_user_interface.hpp>
+
+namespace libhei
+{
+
+//------------------------------------------------------------------------------
+
+ReturnCode registerRead(const Chip& i_chip, void* o_buffer, size_t& io_bufSize,
+ uint64_t i_regType, uint64_t i_address)
+{
+ ReturnCode rc = RC_SUCCESS;
+
+ // HEI_INF("registerRead(%p,%p,%lx,%lx,%lx)", i_chip.getChip(),
+ // o_buffer, io_bufSize, i_regType, i_address);
+
+ return rc;
+}
+
+//------------------------------------------------------------------------------
+
+#ifndef __HEI_READ_ONLY
+
+ReturnCode registerWrite(const Chip& i_chip, void* i_buffer, size_t& io_bufSize,
+ uint64_t i_regType, uint64_t i_address)
+{
+ ReturnCode rc = RC_SUCCESS;
+
+ // HEI_INF("registerWrite(%p,%p,%lx,%lx,%lx)", i_chip.getChip(),
+ // i_buffer, io_bufSize, i_regType, i_address);
+
+ return rc;
+}
+
+#endif
+
+//------------------------------------------------------------------------------
+
+} // namespace libhei