On 01/20 16:11:56, Petri Savolainen wrote: > Used event API as the first example of an ABI spec file. Used > the same default architecture file initially for all > architectures. Default ABI files avoid multiple copies > of the same definition.
Please consider an alternative approach to achieving API and ABI found in the patch that I just posted to the ML. It does this by removing a lot of code instead of adding a lot of code like this patchseries will. > Signed-off-by: Petri Savolainen <petri.savolai...@nokia.com> > --- > configure.ac | 22 ++++++++++++ > example/Makefile.inc | 1 + > helper/Makefile.am | 1 + > include/odp/arch/arm32-linux/odp/api/abi/event.h | 7 ++++ > include/odp/arch/arm64-linux/odp/api/abi/event.h | 7 ++++ > include/odp/arch/default/api/abi/event.h | 42 > ++++++++++++++++++++++ > include/odp/arch/mips64-linux/odp/api/abi/event.h | 7 ++++ > include/odp/arch/power64-linux/odp/api/abi/event.h | 7 ++++ > include/odp/arch/x86_32-linux/odp/api/abi/event.h | 7 ++++ > include/odp/arch/x86_64-linux/odp/api/abi/event.h | 7 ++++ > platform/Makefile.inc | 8 +++++ > platform/linux-generic/Makefile.am | 1 + > .../include/odp/api/plat/event_types.h | 19 +++++----- > platform/linux-generic/odp_event.c | 5 +++ > test/Makefile.inc | 1 + > test/linux-generic/Makefile.inc | 1 + > 16 files changed, 132 insertions(+), 11 deletions(-) > create mode 100644 include/odp/arch/arm32-linux/odp/api/abi/event.h > create mode 100644 include/odp/arch/arm64-linux/odp/api/abi/event.h > create mode 100644 include/odp/arch/default/api/abi/event.h > create mode 100644 include/odp/arch/mips64-linux/odp/api/abi/event.h > create mode 100644 include/odp/arch/power64-linux/odp/api/abi/event.h > create mode 100644 include/odp/arch/x86_32-linux/odp/api/abi/event.h > create mode 100644 include/odp/arch/x86_64-linux/odp/api/abi/event.h > > diff --git a/configure.ac b/configure.ac > index 67d60d2..b3f016c 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -119,6 +119,26 @@ then > fi > > ########################################################################## > +# Architecture for ABI support > +########################################################################## > +AS_CASE([$host], > + [x86*], [ARCH_ABI=x86_64-linux], > + [i686*], [ARCH_ABI=x86_32-linux], > + [mips64*], [ARCH_ABI=mips64-linux], > + [powerpc*], [ARCH_ABI=power64-linux], > + [aarch64*], [ARCH_ABI=arm64-linux], > + [arm*], [ARCH_ABI=arm32-linux], > + [ARCH_ABI=undefined] > +) > +AC_SUBST([ARCH_ABI]) > + > +if test "${ARCH_ABI}" == "undefined"; > +then > + echo "ARCH_ABI is undefined, please add your ARCH_ABI based on > host=${host}" > + exit 1 > +fi > + > +########################################################################## > # Set correct pkgconfig version > ########################################################################## > PKGCONFIG_VERSION=$(echo $VERSION | awk -F '.git' '{print $1}') > @@ -322,7 +342,9 @@ AC_MSG_RESULT([ > Helper Library version: ${ODPHELPER_LIBSO_VERSION} > > implementation_name: ${IMPLEMENTATION_NAME} > + host: ${host} > ARCH_DIR ${ARCH_DIR} > + ARCH_ABI ${ARCH_ABI} > with_platform: ${with_platform} > prefix: ${prefix} > sysconfdir: ${sysconfdir} > diff --git a/example/Makefile.inc b/example/Makefile.inc > index 19d3994..a52e40c 100644 > --- a/example/Makefile.inc > +++ b/example/Makefile.inc > @@ -6,6 +6,7 @@ AM_CFLAGS += \ > -I$(top_srcdir)/example \ > -I$(top_srcdir)/platform/@with_platform@/include \ > -I$(top_srcdir)/include/ \ > + -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ \ > -I$(top_srcdir)/helper/include \ > -I$(top_builddir)/platform/@with_platform@/include \ > -I$(top_builddir)/include > diff --git a/helper/Makefile.am b/helper/Makefile.am > index 9d0036d..badbbf8 100644 > --- a/helper/Makefile.am > +++ b/helper/Makefile.am > @@ -7,6 +7,7 @@ LIB = $(top_builddir)/lib > AM_CFLAGS = -I$(srcdir)/include > AM_CFLAGS += -I$(top_srcdir)/platform/@with_platform@/include > AM_CFLAGS += -I$(top_srcdir)/include > +AM_CFLAGS += -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ > AM_CFLAGS += -I$(top_builddir)/platform/@with_platform@/include > AM_CFLAGS += -I$(top_builddir)/include > > diff --git a/include/odp/arch/arm32-linux/odp/api/abi/event.h > b/include/odp/arch/arm32-linux/odp/api/abi/event.h > new file mode 100644 > index 0000000..5d2ac75 > --- /dev/null > +++ b/include/odp/arch/arm32-linux/odp/api/abi/event.h > @@ -0,0 +1,7 @@ > +/* Copyright (c) 2017, Linaro Limited > + * All rights reserved. > + * > + * SPDX-License-Identifier: BSD-3-Clause > + */ > + > +#include <odp/arch/default/api/abi/event.h> > diff --git a/include/odp/arch/arm64-linux/odp/api/abi/event.h > b/include/odp/arch/arm64-linux/odp/api/abi/event.h > new file mode 100644 > index 0000000..5d2ac75 > --- /dev/null > +++ b/include/odp/arch/arm64-linux/odp/api/abi/event.h > @@ -0,0 +1,7 @@ > +/* Copyright (c) 2017, Linaro Limited > + * All rights reserved. > + * > + * SPDX-License-Identifier: BSD-3-Clause > + */ > + > +#include <odp/arch/default/api/abi/event.h> > diff --git a/include/odp/arch/default/api/abi/event.h > b/include/odp/arch/default/api/abi/event.h > new file mode 100644 > index 0000000..4f6596b > --- /dev/null > +++ b/include/odp/arch/default/api/abi/event.h > @@ -0,0 +1,42 @@ > +/* Copyright (c) 2017, Linaro Limited > + * All rights reserved. > + * > + * SPDX-License-Identifier: BSD-3-Clause > + */ > + > +#ifndef ODP_ABI_EVENT_H_ > +#define ODP_ABI_EVENT_H_ > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +#include <stdint.h> > + > +/** @internal Dummy type for strong typing */ > +typedef struct { char dummy; /**< @internal Dummy */ } _odp_abi_event_t; > + > +/** @ingroup odp_event > + * @{ > + */ > + > +typedef _odp_abi_event_t *odp_event_t; > + > +#define ODP_EVENT_INVALID ((odp_event_t)0xffffffff) > + > +typedef enum odp_event_type_t { > + ODP_EVENT_BUFFER = 1, > + ODP_EVENT_PACKET = 2, > + ODP_EVENT_TIMEOUT = 3, > + ODP_EVENT_CRYPTO_COMPL = 4 > +} odp_event_type_t; > + > +/** > + * @} > + */ > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif > diff --git a/include/odp/arch/mips64-linux/odp/api/abi/event.h > b/include/odp/arch/mips64-linux/odp/api/abi/event.h > new file mode 100644 > index 0000000..5d2ac75 > --- /dev/null > +++ b/include/odp/arch/mips64-linux/odp/api/abi/event.h > @@ -0,0 +1,7 @@ > +/* Copyright (c) 2017, Linaro Limited > + * All rights reserved. > + * > + * SPDX-License-Identifier: BSD-3-Clause > + */ > + > +#include <odp/arch/default/api/abi/event.h> > diff --git a/include/odp/arch/power64-linux/odp/api/abi/event.h > b/include/odp/arch/power64-linux/odp/api/abi/event.h > new file mode 100644 > index 0000000..5d2ac75 > --- /dev/null > +++ b/include/odp/arch/power64-linux/odp/api/abi/event.h > @@ -0,0 +1,7 @@ > +/* Copyright (c) 2017, Linaro Limited > + * All rights reserved. > + * > + * SPDX-License-Identifier: BSD-3-Clause > + */ > + > +#include <odp/arch/default/api/abi/event.h> > diff --git a/include/odp/arch/x86_32-linux/odp/api/abi/event.h > b/include/odp/arch/x86_32-linux/odp/api/abi/event.h > new file mode 100644 > index 0000000..5d2ac75 > --- /dev/null > +++ b/include/odp/arch/x86_32-linux/odp/api/abi/event.h > @@ -0,0 +1,7 @@ > +/* Copyright (c) 2017, Linaro Limited > + * All rights reserved. > + * > + * SPDX-License-Identifier: BSD-3-Clause > + */ > + > +#include <odp/arch/default/api/abi/event.h> > diff --git a/include/odp/arch/x86_64-linux/odp/api/abi/event.h > b/include/odp/arch/x86_64-linux/odp/api/abi/event.h > new file mode 100644 > index 0000000..5d2ac75 > --- /dev/null > +++ b/include/odp/arch/x86_64-linux/odp/api/abi/event.h > @@ -0,0 +1,7 @@ > +/* Copyright (c) 2017, Linaro Limited > + * All rights reserved. > + * > + * SPDX-License-Identifier: BSD-3-Clause > + */ > + > +#include <odp/arch/default/api/abi/event.h> > diff --git a/platform/Makefile.inc b/platform/Makefile.inc > index 2722946..a24accb 100644 > --- a/platform/Makefile.inc > +++ b/platform/Makefile.inc > @@ -60,6 +60,14 @@ odpapispecinclude_HEADERS = \ > $(top_builddir)/include/odp/api/spec/version.h \ > $(top_srcdir)/include/odp/api/spec/traffic_mngr.h > > +odpapiabidefaultincludedir= $(includedir)/odp/arch/default/api/abi > +odpapiabidefaultinclude_HEADERS = \ > + $(top_srcdir)/include/odp/arch/default/api/abi/event.h > + > +odpapiabiarchincludedir= $(includedir)/odp/arch/@ARCH_ABI@/odp/api/abi > +odpapiabiarchinclude_HEADERS = \ > + $(top_srcdir)/include/odp/arch/@ARCH_ABI@/odp/api/abi/event.h > + > EXTRA_DIST = \ > arch/arm/odp/api/cpu_arch.h \ > arch/arm/odp_cpu_arch.c \ > diff --git a/platform/linux-generic/Makefile.am > b/platform/linux-generic/Makefile.am > index 0bc9842..576fedf 100644 > --- a/platform/linux-generic/Makefile.am > +++ b/platform/linux-generic/Makefile.am > @@ -6,6 +6,7 @@ include $(top_srcdir)/platform/@with_platform@/Makefile.inc > > AM_CFLAGS += -I$(srcdir)/include > AM_CFLAGS += -I$(top_srcdir)/include > +AM_CFLAGS += -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ > AM_CFLAGS += -I$(top_builddir)/include > AM_CFLAGS += -Iinclude > > diff --git a/platform/linux-generic/include/odp/api/plat/event_types.h > b/platform/linux-generic/include/odp/api/plat/event_types.h > index 9ca0fb8..a1aa0e4 100644 > --- a/platform/linux-generic/include/odp/api/plat/event_types.h > +++ b/platform/linux-generic/include/odp/api/plat/event_types.h > @@ -18,11 +18,15 @@ > extern "C" { > #endif > > +#include <odp/api/plat/static_inline.h> > +#if ODP_ABI_COMPAT == 1 > +#include <odp/api/abi/event.h> > +#else > + > #include <odp/api/std_types.h> > #include <odp/api/plat/strong_types.h> > > -/** @defgroup odp_event ODP EVENT > - * Operations on an event. > +/** @ingroup odp_event > * @{ > */ > > @@ -30,9 +34,6 @@ typedef ODP_HANDLE_T(odp_event_t); > > #define ODP_EVENT_INVALID _odp_cast_scalar(odp_event_t, 0xffffffff) > > -/** > - * Event types > - */ > typedef enum odp_event_type_t { > ODP_EVENT_BUFFER = 1, > ODP_EVENT_PACKET = 2, > @@ -40,16 +41,12 @@ typedef enum odp_event_type_t { > ODP_EVENT_CRYPTO_COMPL = 4, > } odp_event_type_t; > > -/** Get printable format of odp_event_t */ > -static inline uint64_t odp_event_to_u64(odp_event_t hdl) > -{ > - return _odp_pri(hdl); > -} > - > /** > * @} > */ > > +#endif > + > #ifdef __cplusplus > } > #endif > diff --git a/platform/linux-generic/odp_event.c > b/platform/linux-generic/odp_event.c > index cc3fb0a..d71f446 100644 > --- a/platform/linux-generic/odp_event.c > +++ b/platform/linux-generic/odp_event.c > @@ -38,3 +38,8 @@ void odp_event_free(odp_event_t event) > ODP_ABORT("Invalid event type: %d\n", odp_event_type(event)); > } > } > + > +uint64_t odp_event_to_u64(odp_event_t hdl) > +{ > + return _odp_pri(hdl); > +} > diff --git a/test/Makefile.inc b/test/Makefile.inc > index 1ebc047..f01f3de 100644 > --- a/test/Makefile.inc > +++ b/test/Makefile.inc > @@ -10,6 +10,7 @@ INCFLAGS = \ > -I$(top_builddir)/platform/@with_platform@/include \ > -I$(top_srcdir)/helper/include \ > -I$(top_srcdir)/include \ > + -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ \ > -I$(top_srcdir)/platform/@with_platform@/include \ > -I$(top_srcdir)/test \ > -I$(top_builddir)/include > diff --git a/test/linux-generic/Makefile.inc b/test/linux-generic/Makefile.inc > index 36745fe..e2de5c8 100644 > --- a/test/linux-generic/Makefile.inc > +++ b/test/linux-generic/Makefile.inc > @@ -14,6 +14,7 @@ INCODP = \ > -I$(top_builddir)/platform/@with_platform@/include \ > -I$(top_srcdir)/helper/include \ > -I$(top_srcdir)/include \ > + -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ \ > -I$(top_srcdir)/platform/@with_platform@/arch/$(ARCH_DIR) \ > -I$(top_srcdir)/platform/@with_platform@/include \ > -I$(top_srcdir)/test > -- > 2.8.1 >