diff mbox

[PATCHv3,4/9] linux-generic: events: add strong typing support

Message ID 1422737449-11540-5-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer Jan. 31, 2015, 8:50 p.m. UTC
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 include/odp/api/event.h                               | 12 ++++++++++++
 platform/linux-generic/include/odp/plat/event_types.h | 14 ++++++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/include/odp/api/event.h b/include/odp/api/event.h
index 50c031a..6b60b83 100644
--- a/include/odp/api/event.h
+++ b/include/odp/api/event.h
@@ -69,6 +69,18 @@  extern "C" {
  */
 int odp_event_type(odp_event_t event);
 
+/**
+ * Get printable value for an odp_event_t
+ *
+ * @param hdl  odp_event_t handle to be printed
+ * @return     uint64_t value that can be used to print/display this
+ *             handle
+ *
+ * @note This routine is intended to be used for diagnostic purposes
+ * to enable applications to generate a printable value that represents
+ * an odp_event_t handle.
+ */
+uint64_t odp_event_t_print(odp_event_t hdl);
 
 /**
  * @}
diff --git a/platform/linux-generic/include/odp/plat/event_types.h b/platform/linux-generic/include/odp/plat/event_types.h
index 4a0756b..84d8e08 100644
--- a/platform/linux-generic/include/odp/plat/event_types.h
+++ b/platform/linux-generic/include/odp/plat/event_types.h
@@ -18,17 +18,17 @@ 
 extern "C" {
 #endif
 
-
-#include <odp/plat/buffer_types.h>
+#include <odp/std_types.h>
+#include <odp/plat/strong_types.h>
 
 /** @defgroup odp_event ODP EVENT
  *  Operations on an event.
  *  @{
  */
 
-typedef odp_buffer_t odp_event_t;
+typedef odp_handle_t odp_event_t;
 
-#define ODP_EVENT_INVALID ODP_BUFFER_INVALID
+#define ODP_EVENT_INVALID _odp_cast_scalar(odp_event_t, 0xffffffff)
 
 #define ODP_EVENT_TYPE_INVALID (-1)
 #define ODP_EVENT_BUFFER         1
@@ -36,6 +36,12 @@  typedef odp_buffer_t odp_event_t;
 #define ODP_EVENT_TIMEOUT        3
 #define ODP_EVENT_CRYPTO_COMPL   4
 
+/** Get printable format of odp_event_t */
+static inline uint64_t odp_event_t_print(odp_event_t hdl)
+{
+	return _odp_pri(hdl);
+}
+
 /**
  * @}
  */