Hi Bill, The cover letter states: "This patch should be applied on top of [API-NEXT PATCHv2 1/2] drv: adding compiler.h" "
did you do that? Many thanks for going through this anyway!! :-) Christophe. On 18 February 2016 at 02:14, Bill Fischofer <bill.fischo...@linaro.org> wrote: > This patch fails to apply for me to a fresh clone of api-next: > > bill@Ubuntu15:~/linaro/chrisdoc$ git am --reject > ~/Mail/Incoming/Christophe/6 > Applying: linux-generic: byte-order: split common part > Checking patch platform/linux-generic/Makefile.am... > error: while searching for: > odpdrvinclude_HEADERS = \ > $(srcdir)/include/odp/drv/compiler.h > > noinst_HEADERS = \ > ${srcdir}/include/odp_align_internal.h \ > ${srcdir}/include/odp_atomic_internal.h \ > > error: patch failed: platform/linux-generic/Makefile.am:92 > Checking patch platform/linux-generic/include/odp/api/byteorder.h... > Checking patch > platform/linux-generic/include/odp/api/plat/byteorder_types.h... > Checking patch platform/linux-generic/include/odp/com/byteorder.h... > Checking patch > platform/linux-generic/include/odp/com/plat/byteorder_types.h... > Applying patch platform/linux-generic/Makefile.am with 1 reject... > Rejected hunk #1. > Applied patch platform/linux-generic/include/odp/api/byteorder.h cleanly. > Applied patch > platform/linux-generic/include/odp/api/plat/byteorder_types.h cleanly. > Applied patch platform/linux-generic/include/odp/com/byteorder.h cleanly. > Applied patch > platform/linux-generic/include/odp/com/plat/byteorder_types.h cleanly. > Patch failed at 0001 linux-generic: byte-order: split common part > The copy of the patch that failed is found in: > /home/bill/linaro/chrisdoc/.git/rebase-apply/patch > When you have resolved this problem, run "git am --continue". > If you prefer to skip this patch, run "git am --skip" instead. > To restore the original branch and stop patching, run "git am --abort". > > > On Wed, Feb 17, 2016 at 8:36 AM, Christophe Milard < > christophe.mil...@linaro.org> wrote: > >> The files defining byte order and related functions are split so that >> a common part can be re-used for other odp interfaces. >> >> Signed-off-by: Christophe Milard <christophe.mil...@linaro.org> >> --- >> platform/linux-generic/Makefile.am | 8 ++ >> platform/linux-generic/include/odp/api/byteorder.h | 76 ++---------- >> .../include/odp/api/plat/byteorder_types.h | 55 +++------ >> platform/linux-generic/include/odp/com/byteorder.h | 132 >> +++++++++++++++++++++ >> .../include/odp/com/plat/byteorder_types.h | 71 +++++++++++ >> 5 files changed, 238 insertions(+), 104 deletions(-) >> create mode 100644 platform/linux-generic/include/odp/com/byteorder.h >> create mode 100644 >> platform/linux-generic/include/odp/com/plat/byteorder_types.h >> >> diff --git a/platform/linux-generic/Makefile.am >> b/platform/linux-generic/Makefile.am >> index 734e2a4..df3f0b9 100644 >> --- a/platform/linux-generic/Makefile.am >> +++ b/platform/linux-generic/Makefile.am >> @@ -92,6 +92,14 @@ odpdrvincludedir= $(includedir)/odp/drv >> odpdrvinclude_HEADERS = \ >> $(srcdir)/include/odp/drv/compiler.h >> >> +odpcomincludedir= $(includedir)/odp/com >> +odpcominclude_HEADERS = \ >> + $(srcdir)/include/odp/api/byteorder.h >> + >> +odpcomplatincludedir= $(includedir)/odp/com/plat >> +odpcomplatinclude_HEADERS = \ >> + $(srcdir)/include/odp/com/plat/byteorder_types.h >> + >> noinst_HEADERS = \ >> ${srcdir}/include/odp_align_internal.h \ >> ${srcdir}/include/odp_atomic_internal.h \ >> diff --git a/platform/linux-generic/include/odp/api/byteorder.h >> b/platform/linux-generic/include/odp/api/byteorder.h >> index c347be0..8cdc5df 100644 >> --- a/platform/linux-generic/include/odp/api/byteorder.h >> +++ b/platform/linux-generic/include/odp/api/byteorder.h >> @@ -20,6 +20,7 @@ extern "C" { >> #include <odp/api/plat/byteorder_types.h> >> #include <odp/api/std_types.h> >> #include <odp/api/compiler.h> >> +#include <odp/com/byteorder.h> >> >> /** @ingroup odp_compiler_optim >> * @{ >> @@ -27,113 +28,62 @@ extern "C" { >> >> static inline uint16_t odp_be_to_cpu_16(odp_u16be_t be16) >> { >> -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> - return __odp_builtin_bswap16((__odp_force uint16_t)be16); >> -#else >> - return (__odp_force uint16_t)be16; >> -#endif >> + return _odp_be_to_cpu_16((_odp_u16be_t)be16); >> } >> >> static inline uint32_t odp_be_to_cpu_32(odp_u32be_t be32) >> { >> -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> - return __builtin_bswap32((__odp_force uint32_t)be32); >> -#else >> - return (__odp_force uint32_t)be32; >> -#endif >> + return _odp_be_to_cpu_32((_odp_u32be_t)be32); >> } >> >> static inline uint64_t odp_be_to_cpu_64(odp_u64be_t be64) >> { >> -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> - return __builtin_bswap64((__odp_force uint64_t)be64); >> -#else >> - return (__odp_force uint64_t)be64; >> -#endif >> + return _odp_be_to_cpu_64((_odp_u64be_t)be64); >> } >> >> - >> static inline odp_u16be_t odp_cpu_to_be_16(uint16_t cpu16) >> { >> -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> - return (__odp_force odp_u16be_t)__odp_builtin_bswap16(cpu16); >> -#else >> - return (__odp_force odp_u16be_t)cpu16; >> -#endif >> + return (odp_u16be_t)_odp_cpu_to_be_16(cpu16); >> } >> >> static inline odp_u32be_t odp_cpu_to_be_32(uint32_t cpu32) >> { >> -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> - return (__odp_force odp_u32be_t)__builtin_bswap32(cpu32); >> -#else >> - return (__odp_force odp_u32be_t)cpu32; >> -#endif >> + return (odp_u32be_t)_odp_cpu_to_be_32(cpu32); >> } >> >> static inline odp_u64be_t odp_cpu_to_be_64(uint64_t cpu64) >> { >> -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> - return (__odp_force odp_u64be_t)__builtin_bswap64(cpu64); >> -#else >> - return (__odp_force odp_u64be_t)cpu64; >> -#endif >> + return (odp_u64be_t)_odp_cpu_to_be_64(cpu64); >> } >> >> - >> static inline uint16_t odp_le_to_cpu_16(odp_u16le_t le16) >> { >> -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> - return (__odp_force uint16_t)le16; >> -#else >> - return __odp_builtin_bswap16((__odp_force uint16_t)le16); >> -#endif >> + return _odp_le_to_cpu_16((_odp_u16le_t)le16); >> } >> >> static inline uint32_t odp_le_to_cpu_32(odp_u32le_t le32) >> { >> -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> - return (__odp_force uint32_t)le32; >> -#else >> - return __builtin_bswap32((__odp_force uint32_t)le32); >> -#endif >> + return _odp_le_to_cpu_32((_odp_u32le_t)le32); >> } >> >> static inline uint64_t odp_le_to_cpu_64(odp_u64le_t le64) >> { >> -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> - return (__odp_force uint64_t)le64; >> -#else >> - return __builtin_bswap64((__odp_force uint64_t)le64); >> -#endif >> + return _odp_le_to_cpu_64((_odp_u64le_t)le64); >> } >> >> - >> static inline odp_u16le_t odp_cpu_to_le_16(uint16_t cpu16) >> { >> -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> - return (__odp_force odp_u16le_t)cpu16; >> -#else >> - return (__odp_force odp_u16le_t)__odp_builtin_bswap16(cpu16); >> -#endif >> + return (odp_u16le_t)_odp_cpu_to_le_16(cpu16); >> } >> >> static inline odp_u32le_t odp_cpu_to_le_32(uint32_t cpu32) >> { >> -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> - return (__odp_force odp_u32le_t)cpu32; >> -#else >> - return (__odp_force odp_u32le_t)__builtin_bswap32(cpu32); >> -#endif >> + return (odp_u32le_t)_odp_cpu_to_le_32(cpu32); >> } >> >> static inline odp_u64le_t odp_cpu_to_le_64(uint64_t cpu64) >> { >> -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> - return (__odp_force odp_u64le_t)cpu64; >> -#else >> - return (__odp_force odp_u64le_t)__builtin_bswap64(cpu64); >> -#endif >> + return (odp_u64le_t)_odp_cpu_to_le_64(cpu64); >> } >> >> /** >> diff --git >> a/platform/linux-generic/include/odp/api/plat/byteorder_types.h >> b/platform/linux-generic/include/odp/api/plat/byteorder_types.h >> index 0a8e409..d5dead7 100644 >> --- a/platform/linux-generic/include/odp/api/plat/byteorder_types.h >> +++ b/platform/linux-generic/include/odp/api/plat/byteorder_types.h >> @@ -14,44 +14,19 @@ >> #ifndef ODP_BYTEORDER_TYPES_H_ >> #define ODP_BYTEORDER_TYPES_H_ >> >> +#include "odp/com/plat/byteorder_types.h" >> + >> #ifdef __cplusplus >> extern "C" { >> #endif >> >> -#ifndef __BYTE_ORDER >> -#error __BYTE_ORDER not defined! >> -#endif >> - >> -#ifndef __BIG_ENDIAN >> -#error __BIG_ENDIAN not defined! >> -#endif >> - >> -#ifndef __LITTLE_ENDIAN >> -#error __LITTLE_ENDIAN not defined! >> -#endif >> - >> - >> -/* for use with type checkers such as sparse */ >> -#ifdef __CHECKER__ >> -/** @internal bitwise attribute */ >> -#define __odp_bitwise __attribute__((bitwise)) >> -/** @internal force attribute */ >> -#define __odp_force __attribute__((force)) >> -#else >> -/** @internal bitwise attribute */ >> -#define __odp_bitwise >> -/** @internal force attribute */ >> -#define __odp_force >> -#endif >> - >> - >> /** @addtogroup odp_compiler_optim >> * @{ >> */ >> >> -#define ODP_BIG_ENDIAN __BIG_ENDIAN >> +#define ODP_BIG_ENDIAN _ODP_BIG_ENDIAN >> >> -#define ODP_LITTLE_ENDIAN __LITTLE_ENDIAN >> +#define ODP_LITTLE_ENDIAN _ODP_LITTLE_ENDIAN >> >> #ifdef __BIG_ENDIAN_BITFIELD >> #define ODP_BIG_ENDIAN_BITFIELD >> @@ -61,23 +36,21 @@ extern "C" { >> #define ODP_LITTLE_ENDIAN_BITFIELD >> #endif >> >> -#if __BYTE_ORDER == __LITTLE_ENDIAN >> -#define ODP_BYTE_ORDER ODP_LITTLE_ENDIAN >> -#elif __BYTE_ORDER == __BIG_ENDIAN >> -#define ODP_BYTE_ORDER ODP_BIG_ENDIAN >> +#ifdef _ODP_BYTE_ORDER >> +#define ODP_BYTE_ORDER _ODP_BYTE_ORDER >> #endif >> >> -typedef uint16_t __odp_bitwise odp_u16le_t; >> -typedef uint16_t __odp_bitwise odp_u16be_t; >> +typedef _odp_u16le_t odp_u16le_t; >> +typedef _odp_u16be_t odp_u16be_t; >> >> -typedef uint32_t __odp_bitwise odp_u32le_t; >> -typedef uint32_t __odp_bitwise odp_u32be_t; >> +typedef _odp_u32le_t odp_u32le_t; >> +typedef _odp_u32be_t odp_u32be_t; >> >> -typedef uint64_t __odp_bitwise odp_u64le_t; >> -typedef uint64_t __odp_bitwise odp_u64be_t; >> +typedef _odp_u64le_t odp_u64le_t; >> +typedef _odp_u64be_t odp_u64be_t; >> >> -typedef uint16_t __odp_bitwise odp_u16sum_t; >> -typedef uint32_t __odp_bitwise odp_u32sum_t; >> +typedef _odp_u16sum_t odp_u16sum_t; >> +typedef _odp_u32sum_t odp_u32sum_t; >> >> /** >> * @} >> diff --git a/platform/linux-generic/include/odp/com/byteorder.h >> b/platform/linux-generic/include/odp/com/byteorder.h >> new file mode 100644 >> index 0000000..7bd838f >> --- /dev/null >> +++ b/platform/linux-generic/include/odp/com/byteorder.h >> @@ -0,0 +1,132 @@ >> +/* Copyright (c) 2016, Linaro Limited >> + * All rights reserved. >> + * >> + * SPDX-License-Identifier: BSD-3-Clause >> + */ >> + >> +/** >> + * @file >> + * >> + * ODP byteorder, things common to API and DRV interfaces >> + */ >> + >> +#ifndef ODPCOM_PLAT_BYTEORDER_H_ >> +#define ODPCOM_PLAT_BYTEORDER_H_ >> + >> +#ifdef __cplusplus >> +extern "C" { >> +#endif >> + >> +static inline uint16_t _odp_be_to_cpu_16(_odp_u16be_t be16) >> +{ >> +#if _ODP_BYTE_ORDER == _ODP_LITTLE_ENDIAN >> + return __odp_builtin_bswap16((__odp_force uint16_t)be16); >> +#else >> + return (__odp_force uint16_t)be16; >> +#endif >> +} >> + >> +static inline uint32_t _odp_be_to_cpu_32(_odp_u32be_t be32) >> +{ >> +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> + return __builtin_bswap32((__odp_force uint32_t)be32); >> +#else >> + return (__odp_force uint32_t)be32; >> +#endif >> +} >> + >> +static inline uint64_t _odp_be_to_cpu_64(_odp_u64be_t be64) >> +{ >> +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> + return __builtin_bswap64((__odp_force uint64_t)be64); >> +#else >> + return (__odp_force uint64_t)be64; >> +#endif >> +} >> + >> +static inline _odp_u16be_t _odp_cpu_to_be_16(uint16_t cpu16) >> +{ >> +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> + return (__odp_force _odp_u16be_t)__odp_builtin_bswap16(cpu16); >> +#else >> + return (__odp_force _odp_u16be_t)cpu16; >> +#endif >> +} >> + >> +static inline _odp_u32be_t _odp_cpu_to_be_32(uint32_t cpu32) >> +{ >> +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> + return (__odp_force _odp_u32be_t)__builtin_bswap32(cpu32); >> +#else >> + return (__odp_force _odp_u32be_t)cpu32; >> +#endif >> +} >> + >> +static inline odp_u64be_t _odp_cpu_to_be_64(uint64_t cpu64) >> +{ >> +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> + return (__odp_force _odp_u64be_t)__builtin_bswap64(cpu64); >> +#else >> + return (__odp_force _odp_u64be_t)cpu64; >> +#endif >> +} >> + >> +static inline uint16_t _odp_le_to_cpu_16(_odp_u16le_t le16) >> +{ >> +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> + return (__odp_force uint16_t)le16; >> +#else >> + return __odp_builtin_bswap16((__odp_force uint16_t)le16); >> +#endif >> +} >> + >> +static inline uint32_t _odp_le_to_cpu_32(_odp_u32le_t le32) >> +{ >> +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> + return (__odp_force uint32_t)le32; >> +#else >> + return __builtin_bswap32((__odp_force uint32_t)le32); >> +#endif >> +} >> + >> +static inline uint64_t _odp_le_to_cpu_64(_odp_u64le_t le64) >> +{ >> +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> + return (__odp_force uint64_t)le64; >> +#else >> + return __builtin_bswap64((__odp_force uint64_t)le64); >> +#endif >> +} >> + >> +static inline _odp_u16le_t _odp_cpu_to_le_16(uint16_t cpu16) >> +{ >> +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> + return (__odp_force odp_u16le_t)cpu16; >> +#else >> + return (__odp_force odp_u16le_t)__odp_builtin_bswap16(cpu16); >> +#endif >> +} >> + >> +static inline _odp_u32le_t _odp_cpu_to_le_32(uint32_t cpu32) >> +{ >> +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> + return (__odp_force odp_u32le_t)cpu32; >> +#else >> + return (__odp_force odp_u32le_t)__builtin_bswap32(cpu32); >> +#endif >> +} >> + >> +static inline _odp_u64le_t _odp_cpu_to_le_64(uint64_t cpu64) >> +{ >> +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN >> + return (__odp_force odp_u64le_t)cpu64; >> +#else >> + return (__odp_force odp_u64le_t)__builtin_bswap64(cpu64); >> +#endif >> +} >> + >> +#ifdef __cplusplus >> +} >> +#endif >> + >> +#endif >> diff --git >> a/platform/linux-generic/include/odp/com/plat/byteorder_types.h >> b/platform/linux-generic/include/odp/com/plat/byteorder_types.h >> new file mode 100644 >> index 0000000..6828d28 >> --- /dev/null >> +++ b/platform/linux-generic/include/odp/com/plat/byteorder_types.h >> @@ -0,0 +1,71 @@ >> +/* Copyright (c) 2016, Linaro Limited >> + * All rights reserved. >> + * >> + * SPDX-License-Identifier: BSD-3-Clause >> + */ >> + >> +/** >> + * @file >> + * >> + * ODP byteorder, things common to API and DRV interfaces >> + */ >> + >> +#ifndef ODPCOM_BYTEORDER_TYPES_H_ >> +#define ODPCOM_BYTEORDER_TYPES_H_ >> + >> +#ifdef __cplusplus >> +extern "C" { >> +#endif >> + >> +#ifndef __BYTE_ORDER >> +#error __BYTE_ORDER not defined! >> +#endif >> + >> +#ifndef __BIG_ENDIAN >> +#error __BIG_ENDIAN not defined! >> +#endif >> + >> +#ifndef __LITTLE_ENDIAN >> +#error __LITTLE_ENDIAN not defined! >> +#endif >> + >> +/* for use with type checkers such as sparse */ >> +#ifdef __CHECKER__ >> +/** @internal bitwise attribute */ >> +#define __odp_bitwise __attribute__((bitwise)) >> +/** @internal force attribute */ >> +#define __odp_force __attribute__((force)) >> +#else >> +/** @internal bitwise attribute */ >> +#define __odp_bitwise >> +/** @internal force attribute */ >> +#define __odp_force >> +#endif >> + >> +#define _ODP_BIG_ENDIAN __BIG_ENDIAN >> + >> +#define _ODP_LITTLE_ENDIAN __LITTLE_ENDIAN >> + >> +#if __BYTE_ORDER == __LITTLE_ENDIAN >> +#define _ODP_BYTE_ORDER _ODP_LITTLE_ENDIAN >> +#elif __BYTE_ORDER == __BIG_ENDIAN >> +#define _ODP_BYTE_ORDER _ODP_BIG_ENDIAN >> +#endif >> + >> +typedef uint16_t __odp_bitwise _odp_u16le_t; >> +typedef uint16_t __odp_bitwise _odp_u16be_t; >> + >> +typedef uint32_t __odp_bitwise _odp_u32le_t; >> +typedef uint32_t __odp_bitwise _odp_u32be_t; >> + >> +typedef uint64_t __odp_bitwise _odp_u64le_t; >> +typedef uint64_t __odp_bitwise _odp_u64be_t; >> + >> +typedef uint16_t __odp_bitwise _odp_u16sum_t; >> +typedef uint32_t __odp_bitwise _odp_u32sum_t; >> + >> +#ifdef __cplusplus >> +} >> +#endif >> + >> +#endif >> -- >> 2.1.4 >> >> >
_______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp