diff mbox series

[API-NEXT,PATCHv11,2/5] linux-gen: adding enum, devio and driver registration interface (stub)

Message ID 1485280086-3958-3-git-send-email-christophe.milard@linaro.org
State New
Headers show
Series driver initialisation framework | expand

Commit Message

Christophe Milard Jan. 24, 2017, 5:48 p.m. UTC
The linux implementation for the enumerator class registration function,
enumerator instance registration function,
devio and driver registration functions (stub)

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

---
 include/odp_drv.h                                  |  1 +
 platform/linux-generic/Makefile.am                 |  3 +
 platform/linux-generic/drv_driver.c                | 64 ++++++++++++++++++++++
 platform/linux-generic/include/odp/drv/driver.h    | 37 +++++++++++++
 .../include/odp/drv/plat/driver_types.h            | 52 ++++++++++++++++++
 5 files changed, 157 insertions(+)
 create mode 100644 platform/linux-generic/drv_driver.c
 create mode 100644 platform/linux-generic/include/odp/drv/driver.h
 create mode 100644 platform/linux-generic/include/odp/drv/plat/driver_types.h

-- 
2.7.4
diff mbox series

Patch

diff --git a/include/odp_drv.h b/include/odp_drv.h
index 0959879..96d81ba 100644
--- a/include/odp_drv.h
+++ b/include/odp_drv.h
@@ -23,6 +23,7 @@  extern C {
 #include <odp/drv/barrier.h>
 #include <odp/drv/byteorder.h>
 #include <odp/drv/compiler.h>
+#include <odp/drv/driver.h>
 #include <odp/drv/shm.h>
 #include <odp/drv/spinlock.h>
 #include <odp/drv/std_types.h>
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index 74e606d..2d97414 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -109,6 +109,7 @@  odpdrvinclude_HEADERS = \
 		  $(srcdir)/include/odp/drv/barrier.h \
 		  $(srcdir)/include/odp/drv/byteorder.h \
 		  $(srcdir)/include/odp/drv/compiler.h \
+		  $(srcdir)/include/odp/drv/driver.h \
 		  $(srcdir)/include/odp/drv/shm.h \
 		  $(srcdir)/include/odp/drv/spinlock.h \
 		  $(srcdir)/include/odp/drv/std_types.h \
@@ -119,6 +120,7 @@  odpdrvplatinclude_HEADERS = \
 		  $(srcdir)/include/odp/drv/plat/atomic_types.h \
 		  $(srcdir)/include/odp/drv/plat/barrier_types.h \
 		  $(srcdir)/include/odp/drv/plat/byteorder_types.h \
+		  $(srcdir)/include/odp/drv/plat/driver_types.h \
 		  $(srcdir)/include/odp/drv/plat/shm_types.h \
 		  $(srcdir)/include/odp/drv/plat/spinlock_types.h \
 		  $(srcdir)/include/odp/drv/plat/strong_types.h
@@ -233,6 +235,7 @@  __LIB__libodp_linux_la_SOURCES = \
 			   odp_weak.c \
 			   drv_atomic.c \
 			   drv_barrier.c \
+			   drv_driver.c \
 			   drv_shm.c \
 			   drv_spinlock.c \
 			   arch/@ARCH_DIR@/odp_cpu_arch.c \
diff --git a/platform/linux-generic/drv_driver.c b/platform/linux-generic/drv_driver.c
new file mode 100644
index 0000000..529da48
--- /dev/null
+++ b/platform/linux-generic/drv_driver.c
@@ -0,0 +1,64 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp_config_internal.h>
+
+#include <odp/api/std_types.h>
+#include <odp/api/debug.h>
+#include <odp/drv/driver.h>
+#include <odp_debug_internal.h>
+
+odpdrv_enumr_class_t odpdrv_enumr_class_register(odpdrv_enumr_class_param_t
+						 *param)
+{
+	ODP_ERR("NOT Supported yet! Enumerator Class %s Registration!\n.",
+		param->name);
+
+	return ODPDRV_ENUMR_CLASS_INVALID;
+}
+
+odpdrv_enumr_t odpdrv_enumr_register(odpdrv_enumr_param_t *param)
+{
+	ODP_ERR("NOT Supported yet! Enumerator API %s Registration!\n.",
+		param->api_name);
+
+	return ODPDRV_ENUMR_INVALID;
+}
+
+odpdrv_device_t odpdrv_device_create(odpdrv_device_param_t *param)
+{
+	ODP_ERR("odpdrv_device_create not Supported yet! devaddress: %s\n.",
+		param->address);
+	return ODPDRV_DEVICE_INVALID;
+}
+
+void odpdrv_device_destroy(odpdrv_device_t dev)
+{
+	if (dev == ODPDRV_DEVICE_INVALID)
+		ODP_ERR("Invalid device\n");
+}
+
+odpdrv_devio_t odpdrv_devio_register(odpdrv_devio_param_t *param)
+{
+	ODP_ERR("NOT Supported yet! Driver %s Registration!\n.",
+		param->api_name);
+
+	return ODPDRV_DEVIO_INVALID;
+}
+
+odpdrv_driver_t odpdrv_driver_register(odpdrv_driver_param_t *param)
+{
+	ODP_ERR("NOT Supported yet! Driver %s Registration!\n.",
+		param->name);
+
+	return ODPDRV_DRIVER_INVALID;
+}
+
+int odpdrv_print_all(void)
+{
+	ODP_ERR("odpdrv_print_all not Supported yet!\n.");
+	return 0;
+}
diff --git a/platform/linux-generic/include/odp/drv/driver.h b/platform/linux-generic/include/odp/drv/driver.h
new file mode 100644
index 0000000..b12c83d
--- /dev/null
+++ b/platform/linux-generic/include/odp/drv/driver.h
@@ -0,0 +1,37 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODPDRV drivers
+ */
+
+#ifndef ODPDRV_PLAT_DRIVER_H_
+#define ODPDRV_PLAT_DRIVER_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/drv/plat/driver_types.h>
+
+/** @ingroup odpdrv_driver
+ *  @{
+ */
+
+/**
+ * @}
+ */
+
+#include <odp/drv/std_types.h>
+#include <odp/drv/spec/driver.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/drv/plat/driver_types.h b/platform/linux-generic/include/odp/drv/plat/driver_types.h
new file mode 100644
index 0000000..6c611bd
--- /dev/null
+++ b/platform/linux-generic/include/odp/drv/plat/driver_types.h
@@ -0,0 +1,52 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP shared memory
+ */
+
+#ifndef ODPDRV_DRIVER_TYPES_H_
+#define ODPDRV_DRIVER_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/drv/std_types.h>
+#include <odp/drv/plat/strong_types.h>
+
+/** @addtogroup odpdrv_driver ODPDRV DRIVER
+ *  Operations on driver related items (enumerator class, enumerators,
+ *  devios and drivers).
+ *  @{
+ */
+
+typedef ODPDRV_HANDLE_T(odpdrv_enumr_class_t);
+#define ODPDRV_ENUMR_CLASS_INVALID _odpdrv_cast_scalar(odpdrv_enumr_class_t, 0)
+
+typedef ODPDRV_HANDLE_T(odpdrv_enumr_t);
+#define ODPDRV_ENUMR_INVALID _odpdrv_cast_scalar(odpdrv_enumr_t, 0)
+
+typedef ODPDRV_HANDLE_T(odpdrv_device_t);
+#define ODPDRV_DEVICE_INVALID _odpdrv_cast_scalar(odpdrv_device_t, 0)
+
+typedef ODPDRV_HANDLE_T(odpdrv_devio_t);
+#define ODPDRV_DEVIO_INVALID _odpdrv_cast_scalar(odpdrv_devio_t, 0)
+
+typedef ODPDRV_HANDLE_T(odpdrv_driver_t);
+#define ODPDRV_DRIVER_INVALID _odpdrv_cast_scalar(odpdrv_driver_t, 0)
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif