diff mbox

[API-NEXT,08/18] linux-generic: drv: adding sync.h

Message ID 1468864178-43721-9-git-send-email-christophe.milard@linaro.org
State Superseded
Headers show

Commit Message

Christophe Milard July 18, 2016, 5:49 p.m. UTC
duplicated from the API side
(hash: 77a27212b563299959fb2a609b86bb9117a8f918)

Signed-off-by: Christophe Milard <christophe.milard@linaro.org>

---
 include/odp_drv.h                             |  1 +
 platform/linux-generic/Makefile.am            |  3 +-
 platform/linux-generic/include/odp/drv/sync.h | 49 +++++++++++++++++++++++++++
 3 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 platform/linux-generic/include/odp/drv/sync.h

-- 
2.7.4
diff mbox

Patch

diff --git a/include/odp_drv.h b/include/odp_drv.h
index 1956e8c..e2c3bda 100644
--- a/include/odp_drv.h
+++ b/include/odp_drv.h
@@ -21,6 +21,7 @@  extern C {
 #include <odp/drv/byteorder.h>
 #include <odp/drv/compiler.h>
 #include <odp/drv/std_types.h>
+#include <odp/drv/sync.h>
 
 #ifdef __cplusplus
 }
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index 5b70fb4..4ef8ac1 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -94,7 +94,8 @@  odpapiplatinclude_HEADERS = \
 odpdrvincludedir = $(includedir)/odp/drv
 odpdrvinclude_HEADERS = \
 		  $(srcdir)/include/odp/drv/byteorder.h \
-		  $(srcdir)/include/odp/drv/compiler.h
+		  $(srcdir)/include/odp/drv/compiler.h \
+		  $(srcdir)/include/odp/drv/sync.h
 
 odpdrvplatincludedir = $(includedir)/odp/drv/plat
 odpdrvplatinclude_HEADERS = \
diff --git a/platform/linux-generic/include/odp/drv/sync.h b/platform/linux-generic/include/odp/drv/sync.h
new file mode 100644
index 0000000..5852138
--- /dev/null
+++ b/platform/linux-generic/include/odp/drv/sync.h
@@ -0,0 +1,49 @@ 
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODPDRV synchronisation
+ */
+
+#ifndef ODPDRV_PLAT_SYNC_H_
+#define ODPDRV_PLAT_SYNC_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @ingroup odpdrv_barrier
+ *  @{
+ */
+
+static inline void odpdrv_mb_release(void)
+{
+	__atomic_thread_fence(__ATOMIC_RELEASE);
+}
+
+static inline void odpdrv_mb_acquire(void)
+{
+	__atomic_thread_fence(__ATOMIC_ACQUIRE);
+}
+
+static inline void odpdrv_mb_full(void)
+{
+	__atomic_thread_fence(__ATOMIC_SEQ_CST);
+}
+
+/**
+ * @}
+ */
+
+#include <odp/drv/spec/sync.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif