diff mbox series

[v4,1/8] abi: event: added the first ABI spec file

Message ID 1485850046-28457-2-git-send-email-petri.savolainen@linaro.org
State Accepted
Commit 25ed19ceb50d77614644f6d4a28a0b23dbf1e94f
Headers show
Series First ABI files | expand

Commit Message

Petri Savolainen Jan. 31, 2017, 8:07 a.m. UTC
Used event API as the first example of an ABI spec file. Used
the same default architecture file initially for all
architectures. Default ABI files avoid multiple copies
of the same definition.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
 configure.ac                                       | 22 ++++++++++++
 example/Makefile.inc                               |  1 +
 helper/Makefile.am                                 |  1 +
 helper/test/Makefile.am                            |  1 +
 include/odp/arch/arm32-linux/odp/api/abi/event.h   |  7 ++++
 include/odp/arch/arm64-linux/odp/api/abi/event.h   |  7 ++++
 include/odp/arch/default/api/abi/event.h           | 42 ++++++++++++++++++++++
 include/odp/arch/mips64-linux/odp/api/abi/event.h  |  7 ++++
 include/odp/arch/power64-linux/odp/api/abi/event.h |  7 ++++
 include/odp/arch/x86_32-linux/odp/api/abi/event.h  |  7 ++++
 include/odp/arch/x86_64-linux/odp/api/abi/event.h  |  7 ++++
 platform/Makefile.inc                              |  8 +++++
 platform/linux-generic/Makefile.am                 |  1 +
 .../include/odp/api/plat/event_types.h             | 19 +++++-----
 platform/linux-generic/odp_event.c                 |  5 +++
 test/Makefile.inc                                  |  1 +
 test/linux-generic/Makefile.inc                    |  1 +
 17 files changed, 133 insertions(+), 11 deletions(-)
 create mode 100644 include/odp/arch/arm32-linux/odp/api/abi/event.h
 create mode 100644 include/odp/arch/arm64-linux/odp/api/abi/event.h
 create mode 100644 include/odp/arch/default/api/abi/event.h
 create mode 100644 include/odp/arch/mips64-linux/odp/api/abi/event.h
 create mode 100644 include/odp/arch/power64-linux/odp/api/abi/event.h
 create mode 100644 include/odp/arch/x86_32-linux/odp/api/abi/event.h
 create mode 100644 include/odp/arch/x86_64-linux/odp/api/abi/event.h

-- 
2.8.1
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index daa9b31..6153efd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,6 +119,26 @@  then
 fi
 
 ##########################################################################
+# Architecture for ABI support
+##########################################################################
+AS_CASE([$host],
+  [x86*],     [ARCH_ABI=x86_64-linux],
+  [i686*],    [ARCH_ABI=x86_32-linux],
+  [mips64*],  [ARCH_ABI=mips64-linux],
+  [powerpc*], [ARCH_ABI=power64-linux],
+  [aarch64*], [ARCH_ABI=arm64-linux],
+  [arm*],     [ARCH_ABI=arm32-linux],
+  [ARCH_ABI=undefined]
+)
+AC_SUBST([ARCH_ABI])
+
+if test "${ARCH_ABI}" == "undefined";
+then
+    echo "ARCH_ABI is undefined, please add your ARCH_ABI based on host=${host}"
+    exit 1
+fi
+
+##########################################################################
 # Set correct pkgconfig version
 ##########################################################################
 PKGCONFIG_VERSION=$(echo $VERSION | awk -F '.git' '{print $1}')
@@ -343,7 +363,9 @@  AC_MSG_RESULT([
 	Helper Library version:	${ODPHELPER_LIBSO_VERSION}
 
 	implementation_name:	${IMPLEMENTATION_NAME}
+	host:			${host}
 	ARCH_DIR		${ARCH_DIR}
+	ARCH_ABI		${ARCH_ABI}
 	with_platform:		${with_platform}
 	with_helper_platform:	${with_helper_platform}
 	helper_extn:		${helper_extn}
diff --git a/example/Makefile.inc b/example/Makefile.inc
index ea596d5..854e8af 100644
--- a/example/Makefile.inc
+++ b/example/Makefile.inc
@@ -6,6 +6,7 @@  AM_CFLAGS += \
 	-I$(top_srcdir)/example \
 	-I$(top_srcdir)/platform/@with_platform@/include \
 	-I$(top_srcdir)/include/ \
+	-I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ \
 	-I$(top_srcdir)/helper/include \
 	-I$(top_builddir)/platform/@with_platform@/include \
 	-I$(top_builddir)/include
diff --git a/helper/Makefile.am b/helper/Makefile.am
index d484679..6b65eb1 100644
--- a/helper/Makefile.am
+++ b/helper/Makefile.am
@@ -7,6 +7,7 @@  LIB   = $(top_builddir)/lib
 AM_CFLAGS += -I$(srcdir)/include
 AM_CFLAGS += -I$(top_srcdir)/platform/@with_platform@/include
 AM_CFLAGS += -I$(top_srcdir)/include
+AM_CFLAGS += -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@
 AM_CFLAGS += -I$(top_builddir)/platform/@with_platform@/include
 AM_CFLAGS += -I$(top_builddir)/include
 
diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am
index 1c50282..1337657 100644
--- a/helper/test/Makefile.am
+++ b/helper/test/Makefile.am
@@ -12,6 +12,7 @@  INCFLAGS = \
 	-I$(top_srcdir)/helper/include \
 	-I$(top_srcdir)/helper/platform/@with_helper_platform@/include \
 	-I$(top_srcdir)/include \
+	-I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ \
 	-I$(top_srcdir)/platform/@with_platform@/include \
 	-I$(top_builddir)/include \
 	-I$(top_srcdir)/helper
diff --git a/include/odp/arch/arm32-linux/odp/api/abi/event.h b/include/odp/arch/arm32-linux/odp/api/abi/event.h
new file mode 100644
index 0000000..5d2ac75
--- /dev/null
+++ b/include/odp/arch/arm32-linux/odp/api/abi/event.h
@@ -0,0 +1,7 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/arch/default/api/abi/event.h>
diff --git a/include/odp/arch/arm64-linux/odp/api/abi/event.h b/include/odp/arch/arm64-linux/odp/api/abi/event.h
new file mode 100644
index 0000000..5d2ac75
--- /dev/null
+++ b/include/odp/arch/arm64-linux/odp/api/abi/event.h
@@ -0,0 +1,7 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/arch/default/api/abi/event.h>
diff --git a/include/odp/arch/default/api/abi/event.h b/include/odp/arch/default/api/abi/event.h
new file mode 100644
index 0000000..4f6596b
--- /dev/null
+++ b/include/odp/arch/default/api/abi/event.h
@@ -0,0 +1,42 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#ifndef ODP_ABI_EVENT_H_
+#define ODP_ABI_EVENT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+/** @internal Dummy type for strong typing */
+typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_event_t;
+
+/** @ingroup odp_event
+ *  @{
+ */
+
+typedef _odp_abi_event_t *odp_event_t;
+
+#define ODP_EVENT_INVALID  ((odp_event_t)0xffffffff)
+
+typedef enum odp_event_type_t {
+	ODP_EVENT_BUFFER       = 1,
+	ODP_EVENT_PACKET       = 2,
+	ODP_EVENT_TIMEOUT      = 3,
+	ODP_EVENT_CRYPTO_COMPL = 4
+} odp_event_type_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/odp/arch/mips64-linux/odp/api/abi/event.h b/include/odp/arch/mips64-linux/odp/api/abi/event.h
new file mode 100644
index 0000000..5d2ac75
--- /dev/null
+++ b/include/odp/arch/mips64-linux/odp/api/abi/event.h
@@ -0,0 +1,7 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/arch/default/api/abi/event.h>
diff --git a/include/odp/arch/power64-linux/odp/api/abi/event.h b/include/odp/arch/power64-linux/odp/api/abi/event.h
new file mode 100644
index 0000000..5d2ac75
--- /dev/null
+++ b/include/odp/arch/power64-linux/odp/api/abi/event.h
@@ -0,0 +1,7 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/arch/default/api/abi/event.h>
diff --git a/include/odp/arch/x86_32-linux/odp/api/abi/event.h b/include/odp/arch/x86_32-linux/odp/api/abi/event.h
new file mode 100644
index 0000000..5d2ac75
--- /dev/null
+++ b/include/odp/arch/x86_32-linux/odp/api/abi/event.h
@@ -0,0 +1,7 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/arch/default/api/abi/event.h>
diff --git a/include/odp/arch/x86_64-linux/odp/api/abi/event.h b/include/odp/arch/x86_64-linux/odp/api/abi/event.h
new file mode 100644
index 0000000..5d2ac75
--- /dev/null
+++ b/include/odp/arch/x86_64-linux/odp/api/abi/event.h
@@ -0,0 +1,7 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/arch/default/api/abi/event.h>
diff --git a/platform/Makefile.inc b/platform/Makefile.inc
index 2722946..a24accb 100644
--- a/platform/Makefile.inc
+++ b/platform/Makefile.inc
@@ -60,6 +60,14 @@  odpapispecinclude_HEADERS = \
 		  $(top_builddir)/include/odp/api/spec/version.h \
 		  $(top_srcdir)/include/odp/api/spec/traffic_mngr.h
 
+odpapiabidefaultincludedir= $(includedir)/odp/arch/default/api/abi
+odpapiabidefaultinclude_HEADERS = \
+	$(top_srcdir)/include/odp/arch/default/api/abi/event.h
+
+odpapiabiarchincludedir= $(includedir)/odp/arch/@ARCH_ABI@/odp/api/abi
+odpapiabiarchinclude_HEADERS = \
+	$(top_srcdir)/include/odp/arch/@ARCH_ABI@/odp/api/abi/event.h
+
 EXTRA_DIST = \
 	     arch/arm/odp/api/cpu_arch.h \
 	     arch/arm/odp_cpu_arch.c \
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index 0bc9842..576fedf 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -6,6 +6,7 @@  include $(top_srcdir)/platform/@with_platform@/Makefile.inc
 
 AM_CFLAGS +=  -I$(srcdir)/include
 AM_CFLAGS +=  -I$(top_srcdir)/include
+AM_CFLAGS +=  -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@
 AM_CFLAGS +=  -I$(top_builddir)/include
 AM_CFLAGS +=  -Iinclude
 
diff --git a/platform/linux-generic/include/odp/api/plat/event_types.h b/platform/linux-generic/include/odp/api/plat/event_types.h
index 9ca0fb8..a1aa0e4 100644
--- a/platform/linux-generic/include/odp/api/plat/event_types.h
+++ b/platform/linux-generic/include/odp/api/plat/event_types.h
@@ -18,11 +18,15 @@ 
 extern "C" {
 #endif
 
+#include <odp/api/plat/static_inline.h>
+#if ODP_ABI_COMPAT == 1
+#include <odp/api/abi/event.h>
+#else
+
 #include <odp/api/std_types.h>
 #include <odp/api/plat/strong_types.h>
 
-/** @defgroup odp_event ODP EVENT
- *  Operations on an event.
+/** @ingroup odp_event
  *  @{
  */
 
@@ -30,9 +34,6 @@  typedef ODP_HANDLE_T(odp_event_t);
 
 #define ODP_EVENT_INVALID _odp_cast_scalar(odp_event_t, 0xffffffff)
 
-/**
- * Event types
- */
 typedef enum odp_event_type_t {
 	ODP_EVENT_BUFFER       = 1,
 	ODP_EVENT_PACKET       = 2,
@@ -40,16 +41,12 @@  typedef enum odp_event_type_t {
 	ODP_EVENT_CRYPTO_COMPL = 4,
 } odp_event_type_t;
 
-/** Get printable format of odp_event_t */
-static inline uint64_t odp_event_to_u64(odp_event_t hdl)
-{
-	return _odp_pri(hdl);
-}
-
 /**
  * @}
  */
 
+#endif
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/odp_event.c b/platform/linux-generic/odp_event.c
index cc3fb0a..d71f446 100644
--- a/platform/linux-generic/odp_event.c
+++ b/platform/linux-generic/odp_event.c
@@ -38,3 +38,8 @@  void odp_event_free(odp_event_t event)
 		ODP_ABORT("Invalid event type: %d\n", odp_event_type(event));
 	}
 }
+
+uint64_t odp_event_to_u64(odp_event_t hdl)
+{
+	return _odp_pri(hdl);
+}
diff --git a/test/Makefile.inc b/test/Makefile.inc
index 243a616..898249d 100644
--- a/test/Makefile.inc
+++ b/test/Makefile.inc
@@ -10,6 +10,7 @@  INCFLAGS = \
 	-I$(top_builddir)/platform/@with_platform@/include \
 	-I$(top_srcdir)/helper/include \
 	-I$(top_srcdir)/include \
+	-I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ \
 	-I$(top_srcdir)/platform/@with_platform@/include \
 	-I$(top_srcdir)/test \
 	-I$(top_builddir)/include
diff --git a/test/linux-generic/Makefile.inc b/test/linux-generic/Makefile.inc
index 2a49076..373157b 100644
--- a/test/linux-generic/Makefile.inc
+++ b/test/linux-generic/Makefile.inc
@@ -14,6 +14,7 @@  INCODP =  \
 	 -I$(top_builddir)/platform/@with_platform@/include \
 	 -I$(top_srcdir)/helper/include \
 	 -I$(top_srcdir)/include \
+	 -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ \
 	 -I$(top_srcdir)/platform/@with_platform@/arch/$(ARCH_DIR) \
 	 -I$(top_srcdir)/platform/@with_platform@/include \
 	 -I$(top_srcdir)/test