Lift the definition of odp_cpu_cycles() out of the arch specific directory into the common odp_cpu.c which then calls the internal arch specific definition.
Signed-off-by: Brian Brooks <brian.bro...@linaro.org> --- platform/linux-generic/Makefile.am | 1 + platform/linux-generic/arch/default/odp_cpu_arch.c | 3 ++- platform/linux-generic/arch/mips64/odp_cpu_arch.c | 3 ++- platform/linux-generic/arch/powerpc/odp_cpu_arch.c | 3 ++- platform/linux-generic/arch/x86/odp_cpu_arch.c | 3 ++- platform/linux-generic/include/odp_cpu_internal.h | 22 ++++++++++++++++++++++ platform/linux-generic/odp_cpu.c | 6 ++++++ 7 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 platform/linux-generic/include/odp_cpu_internal.h diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 8dc2764..7c364ec 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -97,6 +97,7 @@ noinst_HEADERS = \ ${srcdir}/include/odp_classification_inlines.h \ ${srcdir}/include/odp_classification_internal.h \ ${srcdir}/include/odp_config_internal.h \ + ${srcdir}/include/odp_cpu_internal.h \ ${srcdir}/include/odp_crypto_internal.h \ ${srcdir}/include/odp_debug_internal.h \ ${srcdir}/include/odp_forward_typedefs_internal.h \ diff --git a/platform/linux-generic/arch/default/odp_cpu_arch.c b/platform/linux-generic/arch/default/odp_cpu_arch.c index 109dd93..e7899fd 100644 --- a/platform/linux-generic/arch/default/odp_cpu_arch.c +++ b/platform/linux-generic/arch/default/odp_cpu_arch.c @@ -12,11 +12,12 @@ #include <odp/api/cpu.h> #include <odp/api/hints.h> #include <odp/api/system_info.h> +#include <odp_cpu_internal.h> #include <odp_debug_internal.h> #define GIGA 1000000000 -uint64_t odp_cpu_cycles(void) +uint64_t _odp_cpu_cycles(void) { struct timespec time; uint64_t sec, ns, hz, cycles; diff --git a/platform/linux-generic/arch/mips64/odp_cpu_arch.c b/platform/linux-generic/arch/mips64/odp_cpu_arch.c index 6dc8f86..1b282e4 100644 --- a/platform/linux-generic/arch/mips64/odp_cpu_arch.c +++ b/platform/linux-generic/arch/mips64/odp_cpu_arch.c @@ -7,8 +7,9 @@ #include <odp/api/cpu.h> #include <odp/api/hints.h> #include <odp/api/system_info.h> +#include <odp_cpu_internal.h> -uint64_t odp_cpu_cycles(void) +uint64_t _odp_cpu_cycles(void) { #define CVMX_TMP_STR(x) CVMX_TMP_STR2(x) #define CVMX_TMP_STR2(x) #x diff --git a/platform/linux-generic/arch/powerpc/odp_cpu_arch.c b/platform/linux-generic/arch/powerpc/odp_cpu_arch.c index 109dd93..e7899fd 100644 --- a/platform/linux-generic/arch/powerpc/odp_cpu_arch.c +++ b/platform/linux-generic/arch/powerpc/odp_cpu_arch.c @@ -12,11 +12,12 @@ #include <odp/api/cpu.h> #include <odp/api/hints.h> #include <odp/api/system_info.h> +#include <odp_cpu_internal.h> #include <odp_debug_internal.h> #define GIGA 1000000000 -uint64_t odp_cpu_cycles(void) +uint64_t _odp_cpu_cycles(void) { struct timespec time; uint64_t sec, ns, hz, cycles; diff --git a/platform/linux-generic/arch/x86/odp_cpu_arch.c b/platform/linux-generic/arch/x86/odp_cpu_arch.c index c3be356..c596775 100644 --- a/platform/linux-generic/arch/x86/odp_cpu_arch.c +++ b/platform/linux-generic/arch/x86/odp_cpu_arch.c @@ -4,8 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ #include <odp/api/cpu.h> +#include <odp_cpu_internal.h> -uint64_t odp_cpu_cycles(void) +uint64_t _odp_cpu_cycles(void) { union { uint64_t tsc_64; diff --git a/platform/linux-generic/include/odp_cpu_internal.h b/platform/linux-generic/include/odp_cpu_internal.h new file mode 100644 index 0000000..351d430 --- /dev/null +++ b/platform/linux-generic/include/odp_cpu_internal.h @@ -0,0 +1,22 @@ +/* Copyright (c) 2016, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef ODP_CPU_INTERNAL_H_ +#define ODP_CPU_INTERNAL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <odp/api/cpu.h> + +uint64_t _odp_cpu_cycles(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/odp_cpu.c b/platform/linux-generic/odp_cpu.c index 282defd..da4f2bc 100644 --- a/platform/linux-generic/odp_cpu.c +++ b/platform/linux-generic/odp_cpu.c @@ -6,6 +6,12 @@ #include <odp/api/cpu.h> #include <odp/api/hints.h> +#include <odp_cpu_internal.h> + +uint64_t odp_cpu_cycles(void) +{ + return _odp_cpu_cycles(); +} uint64_t odp_cpu_cycles_diff(uint64_t c2, uint64_t c1) { -- 2.9.2