diff mbox

[API-NEXT,PATCHv3,2/3] linux-generic: dev: implement odp_dev_id() api

Message ID 1477344567-2561-2-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer Oct. 24, 2016, 9:29 p.m. UTC
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

---
Changes for v2:
- incorporate changes suggested by Petri

 platform/linux-generic/Makefile.am                 |  3 ++
 platform/linux-generic/include/odp/api/dev.h       | 37 ++++++++++++++++
 .../linux-generic/include/odp/api/plat/dev_types.h | 49 ++++++++++++++++++++++
 platform/linux-generic/odp_dev.c                   | 13 ++++++
 4 files changed, 102 insertions(+)
 create mode 100644 platform/linux-generic/include/odp/api/dev.h
 create mode 100644 platform/linux-generic/include/odp/api/plat/dev_types.h
 create mode 100644 platform/linux-generic/odp_dev.c

-- 
2.7.4
diff mbox

Patch

diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index dc2486c..0cc9c3d 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -31,6 +31,7 @@  odpapiinclude_HEADERS = \
 		  $(srcdir)/include/odp/api/cpumask.h \
 		  $(srcdir)/include/odp/api/crypto.h \
 		  $(srcdir)/include/odp/api/debug.h \
+		  $(srcdir)/include/odp/api/dev.h \
 		  $(srcdir)/include/odp/api/errno.h \
 		  $(srcdir)/include/odp/api/event.h \
 		  $(srcdir)/include/odp/api/hash.h \
@@ -75,6 +76,7 @@  odpapiplatinclude_HEADERS = \
 		  $(srcdir)/include/odp/api/plat/classification_types.h \
 		  $(srcdir)/include/odp/api/plat/cpumask_types.h \
 		  $(srcdir)/include/odp/api/plat/crypto_types.h \
+		  $(srcdir)/include/odp/api/plat/dev_types.h \
 		  $(srcdir)/include/odp/api/plat/event_types.h \
 		  $(srcdir)/include/odp/api/plat/init_types.h \
 		  $(srcdir)/include/odp/api/plat/packet_types.h \
@@ -178,6 +180,7 @@  __LIB__libodp_linux_la_SOURCES = \
 			   odp_cpumask.c \
 			   odp_cpumask_task.c \
 			   odp_crypto.c \
+			   odp_dev.c \
 			   odp_errno.c \
 			   odp_event.c \
 			   odp_hash.c \
diff --git a/platform/linux-generic/include/odp/api/dev.h b/platform/linux-generic/include/odp/api/dev.h
new file mode 100644
index 0000000..f8faddd
--- /dev/null
+++ b/platform/linux-generic/include/odp/api/dev.h
@@ -0,0 +1,37 @@ 
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP Device
+ */
+
+#ifndef ODP_PLAT_DEV_H_
+#define ODP_PLAT_DEV_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/api/std_types.h>
+#include <odp/api/plat/dev_types.h>
+
+/** @ingroup odp_dev
+ *  @{
+ */
+
+/**
+ * @}
+ */
+
+#include <odp/api/spec/dev.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/api/plat/dev_types.h b/platform/linux-generic/include/odp/api/plat/dev_types.h
new file mode 100644
index 0000000..c596c10
--- /dev/null
+++ b/platform/linux-generic/include/odp/api/plat/dev_types.h
@@ -0,0 +1,49 @@ 
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP device
+ */
+
+#ifndef ODP_DEV_TYPES_H_
+#define ODP_DEV_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/api/std_types.h>
+#include <odp/api/plat/strong_types.h>
+
+/** @addtogroup odp_dev ODP DEVICE
+ *  Macros and operation on a device.
+ *  @{
+ */
+
+typedef ODP_HANDLE_T(odp_dev_t);
+
+#define ODP_DEV_DEFAULT _odp_cast_scalar(odp_dev_t, 0)
+#define ODP_DEV_INVALID _odp_cast_scalar(odp_dev_t, 0xffffffff)
+
+#define ODP_DEV_NAME_LEN 32
+
+/** Get printable format of odp_dev_t */
+static inline uint64_t odp_dev_id_to_u64(odp_dev_t dev)
+{
+	return _odp_pri(dev);
+}
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/odp_dev.c b/platform/linux-generic/odp_dev.c
new file mode 100644
index 0000000..cb400ec
--- /dev/null
+++ b/platform/linux-generic/odp_dev.c
@@ -0,0 +1,13 @@ 
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp/api/dev.h>
+#include <odp/api/hints.h>
+
+odp_dev_t odp_dev_id(const char *name ODP_UNUSED)
+{
+	return ODP_DEV_DEFAULT;
+}