diff mbox series

[v4,8/8] abi: shm: added initial definitions

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

Commit Message

Petri Savolainen Jan. 31, 2017, 8:07 a.m. UTC
Initially, use the same default ABI file for all architectures.
Default values match those defined in odp-linux implementation
to minimize changes in this phase.

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

---
 .../arch/arm32-linux/odp/api/abi/shared_memory.h   |  7 +++++
 .../arch/arm64-linux/odp/api/abi/shared_memory.h   |  7 +++++
 include/odp/arch/default/api/abi/shared_memory.h   | 35 ++++++++++++++++++++++
 .../arch/mips64-linux/odp/api/abi/shared_memory.h  |  7 +++++
 .../arch/power64-linux/odp/api/abi/shared_memory.h |  7 +++++
 .../arch/x86_32-linux/odp/api/abi/shared_memory.h  |  7 +++++
 .../arch/x86_64-linux/odp/api/abi/shared_memory.h  |  7 +++++
 platform/Makefile.inc                              |  6 ++--
 .../include/odp/api/plat/shared_memory_types.h     | 16 +++++-----
 platform/linux-generic/include/odp_pool_internal.h |  1 +
 platform/linux-generic/odp_shared_memory.c         |  6 ++++
 11 files changed, 96 insertions(+), 10 deletions(-)
 create mode 100644 include/odp/arch/arm32-linux/odp/api/abi/shared_memory.h
 create mode 100644 include/odp/arch/arm64-linux/odp/api/abi/shared_memory.h
 create mode 100644 include/odp/arch/default/api/abi/shared_memory.h
 create mode 100644 include/odp/arch/mips64-linux/odp/api/abi/shared_memory.h
 create mode 100644 include/odp/arch/power64-linux/odp/api/abi/shared_memory.h
 create mode 100644 include/odp/arch/x86_32-linux/odp/api/abi/shared_memory.h
 create mode 100644 include/odp/arch/x86_64-linux/odp/api/abi/shared_memory.h

-- 
2.8.1
diff mbox series

Patch

diff --git a/include/odp/arch/arm32-linux/odp/api/abi/shared_memory.h b/include/odp/arch/arm32-linux/odp/api/abi/shared_memory.h
new file mode 100644
index 0000000..d203678
--- /dev/null
+++ b/include/odp/arch/arm32-linux/odp/api/abi/shared_memory.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/shared_memory.h>
diff --git a/include/odp/arch/arm64-linux/odp/api/abi/shared_memory.h b/include/odp/arch/arm64-linux/odp/api/abi/shared_memory.h
new file mode 100644
index 0000000..d203678
--- /dev/null
+++ b/include/odp/arch/arm64-linux/odp/api/abi/shared_memory.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/shared_memory.h>
diff --git a/include/odp/arch/default/api/abi/shared_memory.h b/include/odp/arch/default/api/abi/shared_memory.h
new file mode 100644
index 0000000..5805f95
--- /dev/null
+++ b/include/odp/arch/default/api/abi/shared_memory.h
@@ -0,0 +1,35 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#ifndef ODP_ABI_SHM_H_
+#define ODP_ABI_SHM_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @internal Dummy type for strong typing */
+typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_shm_t;
+
+/** @ingroup odp_shared_memory
+ *  @{
+ */
+
+typedef _odp_abi_shm_t *odp_shm_t;
+
+#define ODP_SHM_INVALID   ((odp_shm_t)0)
+#define ODP_SHM_NULL      ODP_SHM_INVALID
+#define ODP_SHM_NAME_LEN  32
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/odp/arch/mips64-linux/odp/api/abi/shared_memory.h b/include/odp/arch/mips64-linux/odp/api/abi/shared_memory.h
new file mode 100644
index 0000000..d203678
--- /dev/null
+++ b/include/odp/arch/mips64-linux/odp/api/abi/shared_memory.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/shared_memory.h>
diff --git a/include/odp/arch/power64-linux/odp/api/abi/shared_memory.h b/include/odp/arch/power64-linux/odp/api/abi/shared_memory.h
new file mode 100644
index 0000000..d203678
--- /dev/null
+++ b/include/odp/arch/power64-linux/odp/api/abi/shared_memory.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/shared_memory.h>
diff --git a/include/odp/arch/x86_32-linux/odp/api/abi/shared_memory.h b/include/odp/arch/x86_32-linux/odp/api/abi/shared_memory.h
new file mode 100644
index 0000000..d203678
--- /dev/null
+++ b/include/odp/arch/x86_32-linux/odp/api/abi/shared_memory.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/shared_memory.h>
diff --git a/include/odp/arch/x86_64-linux/odp/api/abi/shared_memory.h b/include/odp/arch/x86_64-linux/odp/api/abi/shared_memory.h
new file mode 100644
index 0000000..d203678
--- /dev/null
+++ b/include/odp/arch/x86_64-linux/odp/api/abi/shared_memory.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/shared_memory.h>
diff --git a/platform/Makefile.inc b/platform/Makefile.inc
index 3201d33..7059d91 100644
--- a/platform/Makefile.inc
+++ b/platform/Makefile.inc
@@ -68,7 +68,8 @@  odpapiabidefaultinclude_HEADERS = \
 	$(top_srcdir)/include/odp/arch/default/api/abi/event.h \
 	$(top_srcdir)/include/odp/arch/default/api/abi/packet.h \
 	$(top_srcdir)/include/odp/arch/default/api/abi/pool.h \
-	$(top_srcdir)/include/odp/arch/default/api/abi/queue.h
+	$(top_srcdir)/include/odp/arch/default/api/abi/queue.h \
+	$(top_srcdir)/include/odp/arch/default/api/abi/shared_memory.h
 
 odpapiabiarchincludedir= $(includedir)/odp/arch/@ARCH_ABI@/odp/api/abi
 odpapiabiarchinclude_HEADERS = \
@@ -78,7 +79,8 @@  odpapiabiarchinclude_HEADERS = \
 	$(top_srcdir)/include/odp/arch/@ARCH_ABI@/odp/api/abi/event.h \
 	$(top_srcdir)/include/odp/arch/@ARCH_ABI@/odp/api/abi/packet.h \
 	$(top_srcdir)/include/odp/arch/@ARCH_ABI@/odp/api/abi/pool.h \
-	$(top_srcdir)/include/odp/arch/@ARCH_ABI@/odp/api/abi/queue.h
+	$(top_srcdir)/include/odp/arch/@ARCH_ABI@/odp/api/abi/queue.h \
+	$(top_srcdir)/include/odp/arch/@ARCH_ABI@/odp/api/abi/shared_memory.h
 
 EXTRA_DIST = \
 	     arch/arm/odp/api/cpu_arch.h \
diff --git a/platform/linux-generic/include/odp/api/plat/shared_memory_types.h b/platform/linux-generic/include/odp/api/plat/shared_memory_types.h
index afa0bf9..2c5b4ed 100644
--- a/platform/linux-generic/include/odp/api/plat/shared_memory_types.h
+++ b/platform/linux-generic/include/odp/api/plat/shared_memory_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/shared_memory.h>
+#else
+
 #include <odp/api/std_types.h>
 #include <odp/api/plat/strong_types.h>
 
-/** @addtogroup odp_shared_memory ODP SHARED MEMORY
- *  Operations on shared memory.
+/** @ingroup odp_shared_memory
  *  @{
  */
 
@@ -33,16 +37,12 @@  typedef ODP_HANDLE_T(odp_shm_t);
 
 #define ODP_SHM_NAME_LEN 32
 
-/** Get printable format of odp_shm_t */
-static inline uint64_t odp_shm_to_u64(odp_shm_t hdl)
-{
-	return _odp_pri(hdl);
-}
-
 /**
  * @}
  */
 
+#endif
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/platform/linux-generic/include/odp_pool_internal.h b/platform/linux-generic/include/odp_pool_internal.h
index b0805ac..ebb779d 100644
--- a/platform/linux-generic/include/odp_pool_internal.h
+++ b/platform/linux-generic/include/odp_pool_internal.h
@@ -24,6 +24,7 @@  extern "C" {
 #include <odp_buffer_internal.h>
 #include <odp_config_internal.h>
 #include <odp_ring_internal.h>
+#include <odp/api/plat/strong_types.h>
 
 typedef struct pool_cache_t {
 	uint32_t num;
diff --git a/platform/linux-generic/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c
index ba32dee..a6faff6 100644
--- a/platform/linux-generic/odp_shared_memory.c
+++ b/platform/linux-generic/odp_shared_memory.c
@@ -8,6 +8,7 @@ 
 #include <odp/api/debug.h>
 #include <odp/api/std_types.h>
 #include <odp/api/shared_memory.h>
+#include <odp/api/plat/strong_types.h>
 #include <_ishm_internal.h>
 #include <string.h>
 
@@ -112,3 +113,8 @@  void odp_shm_print_all(void)
 {
 	_odp_ishm_status("Memory allocation status:");
 }
+
+uint64_t odp_shm_to_u64(odp_shm_t hdl)
+{
+	return _odp_pri(hdl);
+}