diff mbox

[KEYSTONE2,09/15] linux-ks2: event: add headers

Message ID 1426001473-14618-10-git-send-email-taras.kondratiuk@linaro.org
State New
Headers show

Commit Message

Taras Kondratiuk March 10, 2015, 3:31 p.m. UTC
Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
Signed-off-by: Taras Kondratiuk <taras@ti.com>
---
 platform/linux-keystone2/Makefile.am               |  4 +-
 platform/linux-keystone2/include/odp/event.h       | 67 ++++++++++++++++++++++
 .../linux-keystone2/include/odp/plat/event_types.h | 44 ++++++++++++++
 3 files changed, 113 insertions(+), 2 deletions(-)
 create mode 100644 platform/linux-keystone2/include/odp/event.h
 create mode 100644 platform/linux-keystone2/include/odp/plat/event_types.h
diff mbox

Patch

diff --git a/platform/linux-keystone2/Makefile.am b/platform/linux-keystone2/Makefile.am
index 296062b..69dd247 100644
--- a/platform/linux-keystone2/Makefile.am
+++ b/platform/linux-keystone2/Makefile.am
@@ -25,6 +25,7 @@  odpinclude_HEADERS = \
 		  $(srcdir)/include/odp/buffer.h \
 		  $(srcdir)/include/odp/buffer_pool.h \
 		  $(srcdir)/include/odp/crypto.h \
+		  $(srcdir)/include/odp/event.h \
 		  $(srcdir)/include/odp/packet_io.h \
 		  $(srcdir)/include/odp/packet.h \
 		  $(linux_generic_srcdir)/include/odp/align.h \
@@ -37,7 +38,6 @@  odpinclude_HEADERS = \
 		  $(linux_generic_srcdir)/include/odp/cpumask.h \
 		  $(linux_generic_srcdir)/include/odp/debug.h \
 		  $(linux_generic_srcdir)/include/odp/errno.h \
-		  $(linux_generic_srcdir)/include/odp/event.h \
 		  $(linux_generic_srcdir)/include/odp/hints.h \
 		  $(linux_generic_srcdir)/include/odp/init.h \
 		  $(linux_generic_srcdir)/include/odp/random.h \
@@ -60,6 +60,7 @@  odpplatincludedir = $(includedir)/odp/plat
 odpplatinclude_HEADERS = \
 		  $(srcdir)/include/odp/plat/align.h \
 		  $(srcdir)/include/odp/plat/debug.h \
+		  $(srcdir)/include/odp/plat/event_types.h \
 		  $(srcdir)/include/odp/plat/mcsdk_tune.h \
 		  $(srcdir)/include/odp/plat/osal.h \
 		  $(srcdir)/include/odp/plat/state.h \
@@ -70,7 +71,6 @@  odpplatinclude_HEADERS = \
 		  $(linux_generic_srcdir)/include/odp/plat/classification_types.h \
 		  $(linux_generic_srcdir)/include/odp/plat/cpumask_types.h \
 		  $(linux_generic_srcdir)/include/odp/plat/crypto_types.h \
-		  $(linux_generic_srcdir)/include/odp/plat/event_types.h \
 		  $(linux_generic_srcdir)/include/odp/plat/packet_types.h \
 		  $(linux_generic_srcdir)/include/odp/plat/packet_io_types.h \
 		  $(linux_generic_srcdir)/include/odp/plat/pool_types.h \
diff --git a/platform/linux-keystone2/include/odp/event.h b/platform/linux-keystone2/include/odp/event.h
new file mode 100644
index 0000000..1233e92
--- /dev/null
+++ b/platform/linux-keystone2/include/odp/event.h
@@ -0,0 +1,67 @@ 
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP event
+ */
+
+#ifndef ODP_EVENT_H_
+#define ODP_EVENT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/plat/event_types.h>
+#include <odp/plat/osal.h>
+
+/**
+ * @internal Convert ODP event to CPPI descriptor
+ *
+ * @param ev   Event handle
+ *
+ * @return CPPI descriptor
+ */
+static inline Cppi_HostDesc *_odp_ev_to_cppi_desc(odp_event_t ev)
+{
+	return (Cppi_HostDesc *)(uintptr_t)ev;
+}
+
+/**
+ * @internal Convert CPPI descriptor to ODP event
+ *
+ * @param desc  CPPI descriptor pointer
+ *
+ * @return ODP event handle
+ */
+static inline odp_event_t _cppi_desc_to_odp_ev(Cppi_HostDesc *desc)
+{
+	return (odp_event_t)desc;
+}
+
+/** @ingroup odp_event
+ *  @{
+ */
+
+static inline int odp_event_type(odp_event_t ev)
+{
+	Cppi_HostDesc *desc = _odp_ev_to_cppi_desc(ev);
+	return _cppi_desc_pkt_type(desc);
+}
+
+/**
+ * @}
+ */
+
+#include <odp/api/event.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-keystone2/include/odp/plat/event_types.h b/platform/linux-keystone2/include/odp/plat/event_types.h
new file mode 100644
index 0000000..b14456a
--- /dev/null
+++ b/platform/linux-keystone2/include/odp/plat/event_types.h
@@ -0,0 +1,44 @@ 
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP event types
+ */
+
+#ifndef ODP_PLAT_EVENT_TYPES_H_
+#define ODP_PLAT_EVENT_TYPES_H_
+
+#include <odp/std_types.h>
+#include <odp/plat/strong_types.h>
+
+/** @defgroup odp_event ODP EVENT
+ *  Operations on an event.
+ *  @{
+ */
+
+typedef odp_handle_t odp_event_t;
+
+#define ODP_EVENT_INVALID ((odp_event_t)0)
+
+#define ODP_EVENT_BUFFER         1
+#define ODP_EVENT_PACKET         2
+#define ODP_EVENT_TIMEOUT        3
+#define ODP_EVENT_CRYPTO_COMPL   4
+
+/** Get printable format of odp_event_t */
+static inline uint64_t odp_event_to_u64(odp_event_t hdl)
+{
+	return _odp_pri(hdl);
+}
+
+/**
+ * @}
+ */
+
+#endif