aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerin Jacob <jerin.jacob@caviumnetworks.com>2015-03-18 19:41:34 +0530
committerMaxim Uvarov <maxim.uvarov@linaro.org>2015-03-24 13:01:22 +0300
commit7ec392ceeeb0617998beebaeeb7f01236b013055 (patch)
treed6f6b7118191b61b2083dd7647955d2e6e53fb24
parent432f182cab9cd9fa927d9ba146b55bb06eadadde (diff)
rwlock: allow platform to override odp_rwlock_t
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Reviewed-by: Bala Manoharan<bala.manoharan@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r--include/odp/api/rwlock.h11
-rw-r--r--platform/linux-generic/Makefile.am1
-rw-r--r--platform/linux-generic/include/odp/plat/rwlock_types.h48
-rw-r--r--platform/linux-generic/include/odp/rwlock.h2
4 files changed, 53 insertions, 9 deletions
diff --git a/include/odp/api/rwlock.h b/include/odp/api/rwlock.h
index 950b83a03..d730a7014 100644
--- a/include/odp/api/rwlock.h
+++ b/include/odp/api/rwlock.h
@@ -13,8 +13,6 @@
* ODP RW Locks
*/
-#include <odp/atomic.h>
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -29,14 +27,9 @@ extern "C" {
*/
/**
- * The odp_rwlock_t type.
+ * @typedef odp_rwlock_t
+ * ODP rwlock
*/
-typedef struct {
- odp_atomic_u32_t cnt; /**< @private lock count
- 0 lock not taken
- -1 write lock taken
- >0 read lock(s) taken */
-} odp_rwlock_t;
/**
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index 9749df6bc..200523c66 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -58,6 +58,7 @@ odpplatinclude_HEADERS = \
$(top_srcdir)/platform/linux-generic/include/odp/plat/packet_io_types.h \
$(top_srcdir)/platform/linux-generic/include/odp/plat/pool_types.h \
$(top_srcdir)/platform/linux-generic/include/odp/plat/queue_types.h \
+ $(top_srcdir)/platform/linux-generic/include/odp/plat/rwlock_types.h \
$(top_srcdir)/platform/linux-generic/include/odp/plat/schedule_types.h \
$(top_srcdir)/platform/linux-generic/include/odp/plat/shared_memory_types.h \
$(top_srcdir)/platform/linux-generic/include/odp/plat/spinlock_types.h \
diff --git a/platform/linux-generic/include/odp/plat/rwlock_types.h b/platform/linux-generic/include/odp/plat/rwlock_types.h
new file mode 100644
index 000000000..bd46e5722
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/rwlock_types.h
@@ -0,0 +1,48 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP rwlock
+ */
+
+#ifndef ODP_RWLOCK_TYPES_H_
+#define ODP_RWLOCK_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/atomic.h>
+
+/**
+ * @internal
+ * ODP rwlock
+ */
+struct odp_rwlock_s {
+ odp_atomic_u32_t cnt; /**< lock count
+ 0 lock not taken
+ -1 write lock taken
+ >0 read lock(s) taken */
+};
+
+/** @addtogroup odp_synchronizers
+ * @{
+ */
+
+typedef struct odp_rwlock_s odp_rwlock_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/rwlock.h b/platform/linux-generic/include/odp/rwlock.h
index 06320f659..ca88ff7db 100644
--- a/platform/linux-generic/include/odp/rwlock.h
+++ b/platform/linux-generic/include/odp/rwlock.h
@@ -17,6 +17,8 @@
extern "C" {
#endif
+#include <odp/plat/rwlock_types.h>
+
/** @ingroup odp_synchronizers
* @{
*/