aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include/odp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/linux-generic/include/odp')
-rw-r--r--platform/linux-generic/include/odp/atomic.h2
-rw-r--r--platform/linux-generic/include/odp/barrier.h8
-rw-r--r--platform/linux-generic/include/odp/hash.h34
-rw-r--r--platform/linux-generic/include/odp/plat/atomic_types.h8
-rw-r--r--platform/linux-generic/include/odp/plat/barrier_types.h8
-rw-r--r--platform/linux-generic/include/odp/plat/rwlock_recursive_types.h38
-rw-r--r--platform/linux-generic/include/odp/plat/rwlock_types.h13
-rw-r--r--platform/linux-generic/include/odp/plat/spinlock_recursive_types.h36
-rw-r--r--platform/linux-generic/include/odp/plat/spinlock_types.h14
-rw-r--r--platform/linux-generic/include/odp/plat/thread_types.h34
-rw-r--r--platform/linux-generic/include/odp/plat/ticketlock_types.h13
-rw-r--r--platform/linux-generic/include/odp/plat/time_types.h11
-rw-r--r--platform/linux-generic/include/odp/rwlock.h8
-rw-r--r--platform/linux-generic/include/odp/rwlock_recursive.h28
-rw-r--r--platform/linux-generic/include/odp/spinlock.h8
-rw-r--r--platform/linux-generic/include/odp/spinlock_recursive.h28
-rw-r--r--platform/linux-generic/include/odp/std_clib.h30
-rw-r--r--platform/linux-generic/include/odp/sync.h17
-rw-r--r--platform/linux-generic/include/odp/thread.h8
-rw-r--r--platform/linux-generic/include/odp/ticketlock.h9
20 files changed, 258 insertions, 97 deletions
diff --git a/platform/linux-generic/include/odp/atomic.h b/platform/linux-generic/include/odp/atomic.h
index e47a280bf..deb4039b3 100644
--- a/platform/linux-generic/include/odp/atomic.h
+++ b/platform/linux-generic/include/odp/atomic.h
@@ -21,7 +21,7 @@ extern "C" {
#include <odp/align.h>
#include <odp/plat/atomic_types.h>
-/** @ingroup odp_synchronizers
+/** @ingroup odp_atomic
* @{
*/
diff --git a/platform/linux-generic/include/odp/barrier.h b/platform/linux-generic/include/odp/barrier.h
index 7ea5a6b99..42df8595a 100644
--- a/platform/linux-generic/include/odp/barrier.h
+++ b/platform/linux-generic/include/odp/barrier.h
@@ -21,14 +21,6 @@ extern "C" {
#include <odp/plat/shared_memory_types.h>
#include <odp/plat/barrier_types.h>
-/** @ingroup odp_synchronizers
- * @{
- */
-
-/**
- * @}
- */
-
#include <odp/api/barrier.h>
#ifdef __cplusplus
diff --git a/platform/linux-generic/include/odp/hash.h b/platform/linux-generic/include/odp/hash.h
new file mode 100644
index 000000000..df8add002
--- /dev/null
+++ b/platform/linux-generic/include/odp/hash.h
@@ -0,0 +1,34 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP Hash function
+ */
+
+#ifndef ODP_PLAT_HASH_H_
+#define ODP_PLAT_HASH_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @ingroup odp_hash
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+#include <odp/api/hash.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/plat/atomic_types.h b/platform/linux-generic/include/odp/plat/atomic_types.h
index 3cdcab8bd..0f6c353a1 100644
--- a/platform/linux-generic/include/odp/plat/atomic_types.h
+++ b/platform/linux-generic/include/odp/plat/atomic_types.h
@@ -62,18 +62,10 @@ struct odp_atomic_u32_s {
})
#endif
-/** @addtogroup odp_synchronizers
- * @{
- */
-
typedef struct odp_atomic_u64_s odp_atomic_u64_t;
typedef struct odp_atomic_u32_s odp_atomic_u32_t;
-/**
- * @}
- */
-
#ifdef __cplusplus
}
#endif
diff --git a/platform/linux-generic/include/odp/plat/barrier_types.h b/platform/linux-generic/include/odp/plat/barrier_types.h
index c8c978dca..b8e1d97bb 100644
--- a/platform/linux-generic/include/odp/plat/barrier_types.h
+++ b/platform/linux-generic/include/odp/plat/barrier_types.h
@@ -30,16 +30,8 @@ struct odp_barrier_s {
odp_atomic_u32_t bar; /**< Barrier counter */
};
-/** @addtogroup odp_synchronizers
- * @{
- */
-
typedef struct odp_barrier_s odp_barrier_t;
-/**
- * @}
- */
-
#ifdef __cplusplus
}
#endif
diff --git a/platform/linux-generic/include/odp/plat/rwlock_recursive_types.h b/platform/linux-generic/include/odp/plat/rwlock_recursive_types.h
new file mode 100644
index 000000000..474751cf0
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/rwlock_recursive_types.h
@@ -0,0 +1,38 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP recursive read/write lock
+ */
+
+#ifndef ODP_RWLOCK_RECURSIVE_TYPES_H_
+#define ODP_RWLOCK_RECURSIVE_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/rwlock.h>
+#include <odp/std_types.h>
+#include <odp/thread.h>
+
+/** @internal */
+struct odp_rwlock_recursive_s {
+ odp_rwlock_t lock; /**< the lock */
+ int wr_owner; /**< write owner thread */
+ uint32_t wr_cnt; /**< write recursion count */
+ uint8_t rd_cnt[ODP_THREAD_COUNT_MAX]; /**< read recursion count */
+};
+
+typedef struct odp_rwlock_recursive_s odp_rwlock_recursive_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/plat/rwlock_types.h b/platform/linux-generic/include/odp/plat/rwlock_types.h
index bd46e5722..35d65decb 100644
--- a/platform/linux-generic/include/odp/plat/rwlock_types.h
+++ b/platform/linux-generic/include/odp/plat/rwlock_types.h
@@ -20,10 +20,7 @@ extern "C" {
#include <odp/atomic.h>
-/**
- * @internal
- * ODP rwlock
- */
+/** @internal */
struct odp_rwlock_s {
odp_atomic_u32_t cnt; /**< lock count
0 lock not taken
@@ -31,16 +28,8 @@ struct odp_rwlock_s {
>0 read lock(s) taken */
};
-/** @addtogroup odp_synchronizers
- * @{
- */
-
typedef struct odp_rwlock_s odp_rwlock_t;
-/**
- * @}
- */
-
#ifdef __cplusplus
}
#endif
diff --git a/platform/linux-generic/include/odp/plat/spinlock_recursive_types.h b/platform/linux-generic/include/odp/plat/spinlock_recursive_types.h
new file mode 100644
index 000000000..2809277bd
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/spinlock_recursive_types.h
@@ -0,0 +1,36 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP recursive spinlock
+ */
+
+#ifndef ODP_SPINLOCK_RECURSIVE_TYPES_H_
+#define ODP_SPINLOCK_RECURSIVE_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/spinlock.h>
+#include <odp/std_types.h>
+
+/** @internal */
+struct odp_spinlock_recursive_s {
+ odp_spinlock_t lock; /**< the lock */
+ int owner; /**< thread owning the lock */
+ uint32_t cnt; /**< recursion count */
+};
+
+typedef struct odp_spinlock_recursive_s odp_spinlock_recursive_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/plat/spinlock_types.h b/platform/linux-generic/include/odp/plat/spinlock_types.h
index 83d306b5b..3e0231d1d 100644
--- a/platform/linux-generic/include/odp/plat/spinlock_types.h
+++ b/platform/linux-generic/include/odp/plat/spinlock_types.h
@@ -20,25 +20,13 @@ extern "C" {
#include <odp/std_types.h>
-/**
- * @internal
- * ODP spinlock
- */
+/** @internal */
struct odp_spinlock_s {
char lock; /**< lock flag, should match odp_atomic_flag_t */
};
-
-/** @addtogroup odp_synchronizers
- * @{
- */
-
typedef struct odp_spinlock_s odp_spinlock_t;
-/**
- * @}
- */
-
#ifdef __cplusplus
}
#endif
diff --git a/platform/linux-generic/include/odp/plat/thread_types.h b/platform/linux-generic/include/odp/plat/thread_types.h
new file mode 100644
index 000000000..33af45983
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/thread_types.h
@@ -0,0 +1,34 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP thread
+ */
+
+#ifndef ODP_THREAD_TYPES_H_
+#define ODP_THREAD_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @addtogroup odp_thread
+ * @{
+ */
+
+#define ODP_THREAD_COUNT_MAX 128
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/plat/ticketlock_types.h b/platform/linux-generic/include/odp/plat/ticketlock_types.h
index be9308556..73f970542 100644
--- a/platform/linux-generic/include/odp/plat/ticketlock_types.h
+++ b/platform/linux-generic/include/odp/plat/ticketlock_types.h
@@ -20,25 +20,14 @@ extern "C" {
#include <odp/atomic.h>
-/**
- * @internal
- * ODP ticketlock
- */
+/** @internal */
struct odp_ticketlock_s {
odp_atomic_u32_t next_ticket; /**< Next ticket */
odp_atomic_u32_t cur_ticket; /**< Current ticket */
};
-/** @addtogroup odp_synchronizers
- * @{
- */
-
typedef struct odp_ticketlock_s odp_ticketlock_t;
-/**
- * @}
- */
-
#ifdef __cplusplus
}
#endif
diff --git a/platform/linux-generic/include/odp/plat/time_types.h b/platform/linux-generic/include/odp/plat/time_types.h
index 9ba1508c7..14c35f0bf 100644
--- a/platform/linux-generic/include/odp/plat/time_types.h
+++ b/platform/linux-generic/include/odp/plat/time_types.h
@@ -21,9 +21,16 @@ extern "C" {
* @{
**/
-typedef uint64_t odp_time_t;
+/**
+ * @internal Time structure used to isolate linux-generic implementation from
+ * the linux timespec structure, which is dependent on _POSIX_C_SOURCE level.
+ */
+typedef struct odp_time_t {
+ int64_t tv_sec; /**< @internal Seconds */
+ int64_t tv_nsec; /**< @internal Nanoseconds */
+} odp_time_t;
-#define ODP_TIME_NULL ((odp_time_t)0)
+#define ODP_TIME_NULL ((odp_time_t){0, 0})
/**
* @}
diff --git a/platform/linux-generic/include/odp/rwlock.h b/platform/linux-generic/include/odp/rwlock.h
index ca88ff7db..f9d8f5fd4 100644
--- a/platform/linux-generic/include/odp/rwlock.h
+++ b/platform/linux-generic/include/odp/rwlock.h
@@ -19,14 +19,6 @@ extern "C" {
#include <odp/plat/rwlock_types.h>
-/** @ingroup odp_synchronizers
- * @{
- */
-
-/**
- * @}
- */
-
#include <odp/api/rwlock.h>
#ifdef __cplusplus
diff --git a/platform/linux-generic/include/odp/rwlock_recursive.h b/platform/linux-generic/include/odp/rwlock_recursive.h
new file mode 100644
index 000000000..e9dadc878
--- /dev/null
+++ b/platform/linux-generic/include/odp/rwlock_recursive.h
@@ -0,0 +1,28 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP resursive read/write lock
+ */
+
+#ifndef ODP_PLAT_RWLOCK_RECURSIVE_H_
+#define ODP_PLAT_RWLOCK_RECURSIVE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/plat/rwlock_recursive_types.h>
+
+#include <odp/api/rwlock_recursive.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/spinlock.h b/platform/linux-generic/include/odp/spinlock.h
index 7dbb1c4bf..046fcfada 100644
--- a/platform/linux-generic/include/odp/spinlock.h
+++ b/platform/linux-generic/include/odp/spinlock.h
@@ -19,14 +19,6 @@ extern "C" {
#include <odp/plat/spinlock_types.h>
-/** @ingroup odp_synchronizers
- * @{
- */
-
-/**
- * @}
- */
-
#include <odp/api/spinlock.h>
#ifdef __cplusplus
diff --git a/platform/linux-generic/include/odp/spinlock_recursive.h b/platform/linux-generic/include/odp/spinlock_recursive.h
new file mode 100644
index 000000000..e8a996837
--- /dev/null
+++ b/platform/linux-generic/include/odp/spinlock_recursive.h
@@ -0,0 +1,28 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP resursive spinlock
+ */
+
+#ifndef ODP_PLAT_SPINLOCK_RECURSIVE_H_
+#define ODP_PLAT_SPINLOCK_RECURSIVE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/plat/spinlock_recursive_types.h>
+
+#include <odp/api/spinlock_recursive.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/std_clib.h b/platform/linux-generic/include/odp/std_clib.h
new file mode 100644
index 000000000..c939c48e9
--- /dev/null
+++ b/platform/linux-generic/include/odp/std_clib.h
@@ -0,0 +1,30 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_PLAT_STD_CLIB_H_
+#define ODP_PLAT_STD_CLIB_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/api/std_types.h>
+
+static inline void *odp_memcpy(void *dst, const void *src, size_t num)
+{
+ return memcpy(dst, src, num);
+}
+
+static inline void *odp_memset(void *ptr, int value, size_t num)
+{
+ return memset(ptr, value, num);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/sync.h b/platform/linux-generic/include/odp/sync.h
index 8cdab21ef..b2995e19c 100644
--- a/platform/linux-generic/include/odp/sync.h
+++ b/platform/linux-generic/include/odp/sync.h
@@ -17,10 +17,25 @@
extern "C" {
#endif
-/** @ingroup odp_synchronizers
+/** @ingroup odp_barrier
* @{
*/
+static inline void odp_mb_release(void)
+{
+ __atomic_thread_fence(__ATOMIC_RELEASE);
+}
+
+static inline void odp_mb_acquire(void)
+{
+ __atomic_thread_fence(__ATOMIC_ACQUIRE);
+}
+
+static inline void odp_mb_full(void)
+{
+ __atomic_thread_fence(__ATOMIC_SEQ_CST);
+}
+
/**
* @}
*/
diff --git a/platform/linux-generic/include/odp/thread.h b/platform/linux-generic/include/odp/thread.h
index e5215852a..522ca2599 100644
--- a/platform/linux-generic/include/odp/thread.h
+++ b/platform/linux-generic/include/odp/thread.h
@@ -17,13 +17,7 @@
extern "C" {
#endif
-/** @ingroup odp_thread ODP THREAD
- * @{
- */
-
-/**
- * @}
- */
+#include <odp/plat/thread_types.h>
#include <odp/api/thread.h>
diff --git a/platform/linux-generic/include/odp/ticketlock.h b/platform/linux-generic/include/odp/ticketlock.h
index 658e27fe4..d3491519a 100644
--- a/platform/linux-generic/include/odp/ticketlock.h
+++ b/platform/linux-generic/include/odp/ticketlock.h
@@ -19,15 +19,6 @@ extern "C" {
#include <odp/plat/ticketlock_types.h>
-/** @ingroup odp_synchronizers
- * Operations on ticket locks.
- * @{
- */
-
-/**
- * @}
- */
-
#include <odp/api/ticketlock.h>
#ifdef __cplusplus