Build openpower-libhei as a static library

Build a static library that can be linked to by other applications.

Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
Change-Id: I4dec91928381712674e6621792830f811c44c30d
diff --git a/src/chip_data/hei_chip_data_stream.hpp b/src/chip_data/hei_chip_data_stream.hpp
index c9cbde7..e9cfc75 100644
--- a/src/chip_data/hei_chip_data_stream.hpp
+++ b/src/chip_data/hei_chip_data_stream.hpp
@@ -4,6 +4,7 @@
 #include <string.h>
 
 #include <hei_includes.hpp>
+#include <hei_macros.hpp>
 
 namespace libhei
 {
diff --git a/src/hei_includes.hpp b/src/hei_includes.hpp
index 2f225f1..bf771e5 100644
--- a/src/hei_includes.hpp
+++ b/src/hei_includes.hpp
@@ -23,7 +23,6 @@
 //  Assertion (at a minimum should work like assert() from <cassert>):
 //      HEI_ASSERT(expression)
 //
-#include <hei_user_defines.hpp>
 
 // Internal includes
 #include <hei_chip.hpp>
diff --git a/src/hei_macros.hpp b/src/hei_macros.hpp
new file mode 100644
index 0000000..cada4d7
--- /dev/null
+++ b/src/hei_macros.hpp
@@ -0,0 +1,20 @@
+#pragma once
+
+#include <assert.h>
+#include <inttypes.h> // for PRIu64
+
+#include <hei_user_interface.hpp>
+
+/** @brief Common defines used throughout this library */
+
+#define HEI_INF(...)                                                           \
+    {                                                                          \
+        libhei::hei_inf((char*)__VA_ARGS__);                                   \
+    }
+
+#define HEI_ERR(...)                                                           \
+    {                                                                          \
+        libhei::hei_err((char*)__VA_ARGS__);                                   \
+    }
+
+#define HEI_ASSERT(expression) assert(expression);
diff --git a/src/hei_user_interface.hpp b/src/hei_user_interface.hpp
index 9849ca1..9fa908d 100644
--- a/src/hei_user_interface.hpp
+++ b/src/hei_user_interface.hpp
@@ -6,6 +6,41 @@
  * The method for actions like hardware register access will vary per user
  * application. Therefore, the user application must define all of the APIs
  * listed below.
+ *
+ *  1.  ReturnCode libhei::registerRead(const Chip& i_chip, void* o_buffer,
+ *                      size_t& io_bufSize, uint64_t i_regType,
+ *                      uint64_t i_address);
+ *
+ *  2.  ReturnCode libhei::registerWrite(const Chip& i_chip, void* i_buffer,
+ *                            size_t& io_bufSize, uint64_t i_regType,
+ *                            uint64_t i_address);
+ *
+ *  3. void libhei::hei_inf(...)
+ *  4. void libhei::hei_err(...)
+ *
+ *  Example user application implementation of hei_inf(...) and hei_err(...)
+ *
+ *  void hei_inf(char* format, ...)
+ *  {
+ *      va_list args;
+ *
+ *      printf("I> ");
+ *      va_start(args, format);
+ *      vprintf(format, args);
+ *      va_end(args);
+ *      printf("\n");
+ *  }
+ *
+ *  void hei_err(char* format, ...)
+ *  {
+ *      va_list args;
+ *
+ *      printf("E> ");
+ *      va_start(args, format);
+ *      vprintf(format, args);
+ *      va_end(args);
+ *      printf("\n");
+ *  }
  */
 
 #include <hei_includes.hpp>
@@ -77,6 +112,12 @@
 ReturnCode registerWrite(const Chip& i_chip, void* i_buffer, size_t& io_bufSize,
                          uint64_t i_regType, uint64_t i_address);
 
+// used by HEI_INF macro in this library
+void hei_inf(char* format, ...); // implemented in user application
+
+// used by HEI_ERR macro in this library
+void hei_err(char* format, ...); // implemented in user application
+
 #endif
 
 } // end namespace libhei
diff --git a/src/isolator/hei_isolation_node.cpp b/src/isolator/hei_isolation_node.cpp
index e2bf61a..7f8422a 100644
--- a/src/isolator/hei_isolation_node.cpp
+++ b/src/isolator/hei_isolation_node.cpp
@@ -1,3 +1,4 @@
+#include <hei_macros.hpp>
 #include <isolator/hei_isolation_node.hpp>
 
 namespace libhei
diff --git a/src/register/hei_hardware_register.hpp b/src/register/hei_hardware_register.hpp
index ee57b2a..d8edfd8 100644
--- a/src/register/hei_hardware_register.hpp
+++ b/src/register/hei_hardware_register.hpp
@@ -1,6 +1,7 @@
 #pragma once
 
 #include <hei_includes.hpp>
+#include <hei_macros.hpp>
 #include <register/hei_register.hpp>
 #include <util/hei_bit_string.hpp>
 
diff --git a/src/register/prdfCaptureData.C b/src/register/prdfCaptureData.C
index d6777aa..a984f24 100755
--- a/src/register/prdfCaptureData.C
+++ b/src/register/prdfCaptureData.C
@@ -32,6 +32,7 @@
 //  Includes
 //----------------------------------------------------------------------
 
+#include <hei_macros.hpp>
 #include <register/hei_hardware_register.hpp>
 #include <util/hei_bit_string.hpp>
 
diff --git a/src/util/hei_bit_string.cpp b/src/util/hei_bit_string.cpp
index 8fc0776..2795cf1 100644
--- a/src/util/hei_bit_string.cpp
+++ b/src/util/hei_bit_string.cpp
@@ -2,7 +2,7 @@
  *  @brief BitString and BitStringBuffer class definitions
  */
 
-#include <hei_user_defines.hpp>
+#include <hei_macros.hpp>
 #include <util/hei_bit_string.hpp>
 
 #include <algorithm>