diff mbox

[1/4] api: cpu: Added cpu.h

Message ID 1422617966-27160-1-git-send-email-petri.savolainen@linaro.org
State New
Headers show

Commit Message

Petri Savolainen Jan. 30, 2015, 11:39 a.m. UTC
This file contains cpu related API calls. The calls are
renames from odp_thread_cpu() and odp_sys_cpu_count().

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
---
 include/odp.h                            |  1 +
 include/odp/api/cpu.h                    | 54 ++++++++++++++++++++++++++++++++
 platform/linux-generic/Makefile.am       |  2 ++
 platform/linux-generic/include/odp/cpu.h | 26 +++++++++++++++
 4 files changed, 83 insertions(+)
 create mode 100644 include/odp/api/cpu.h
 create mode 100644 platform/linux-generic/include/odp/cpu.h
diff mbox

Patch

diff --git a/include/odp.h b/include/odp.h
index 30bed8e..99e01eb 100644
--- a/include/odp.h
+++ b/include/odp.h
@@ -27,6 +27,7 @@  extern "C" {
 #include <odp/hints.h>
 #include <odp/debug.h>
 #include <odp/byteorder.h>
+#include <odp/cpu.h>
 #include <odp/cpumask.h>
 #include <odp/barrier.h>
 #include <odp/spinlock.h>
diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
new file mode 100644
index 0000000..16461a3
--- /dev/null
+++ b/include/odp/api/cpu.h
@@ -0,0 +1,54 @@ 
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP CPU API
+ */
+
+#ifndef ODP_CPU_H_
+#define ODP_CPU_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup odp_cpu ODP CPU
+ *  @{
+ */
+
+
+/**
+ * CPU number
+ *
+ * CPU number where the thread is currently running. CPU numbering is system
+ * specific.
+ *
+ * @return CPU number
+ */
+int odp_cpu(void);
+
+/**
+ * CPU count
+ *
+ * Report the number of CPU's available to this ODP program.
+ * This may be smaller than the number of (online) CPU's in the system.
+ *
+ * @return Number of available CPU's
+ */
+int odp_cpu_count(void);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index addb5ec..0e62650 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -18,6 +18,7 @@  odpinclude_HEADERS = \
 		  $(top_srcdir)/platform/linux-generic/include/odp/classification.h \
 		  $(top_srcdir)/platform/linux-generic/include/odp/compiler.h \
 		  $(top_srcdir)/platform/linux-generic/include/odp/config.h \
+		  $(top_srcdir)/platform/linux-generic/include/odp/cpu.h \
 		  $(top_srcdir)/platform/linux-generic/include/odp/cpumask.h \
 		  $(top_srcdir)/platform/linux-generic/include/odp/crypto.h \
 		  $(top_srcdir)/platform/linux-generic/include/odp/debug.h \
@@ -69,6 +70,7 @@  odpapiinclude_HEADERS = \
 		  $(top_srcdir)/include/odp/api/classification.h \
 		  $(top_srcdir)/include/odp/api/compiler.h \
 		  $(top_srcdir)/include/odp/api/config.h \
+		  $(top_srcdir)/include/odp/api/cpu.h \
 		  $(top_srcdir)/include/odp/api/cpumask.h \
 		  $(top_srcdir)/include/odp/api/crypto.h \
 		  $(top_srcdir)/include/odp/api/debug.h \
diff --git a/platform/linux-generic/include/odp/cpu.h b/platform/linux-generic/include/odp/cpu.h
new file mode 100644
index 0000000..b5b5320
--- /dev/null
+++ b/platform/linux-generic/include/odp/cpu.h
@@ -0,0 +1,26 @@ 
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * ODP CPU
+ */
+
+#ifndef ODP_PLAT_CPU_H_
+#define ODP_PLAT_CPU_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp/api/cpu.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif