byteorder.h is created for the driver interface, using the common part (common to both ODP application interface and ODP driver interface).
Signed-off-by: Christophe Milard <christophe.mil...@linaro.org> --- include/odp_drv.h | 1 + platform/linux-generic/Makefile.am | 5 ++ platform/linux-generic/include/odp/drv/byteorder.h | 99 ++++++++++++++++++++++ .../include/odp/drv/plat/byteorder_types.h | 62 ++++++++++++++ 4 files changed, 167 insertions(+) create mode 100644 platform/linux-generic/include/odp/drv/byteorder.h create mode 100644 platform/linux-generic/include/odp/drv/plat/byteorder_types.h diff --git a/include/odp_drv.h b/include/odp_drv.h index a6d3a44..1956e8c 100644 --- a/include/odp_drv.h +++ b/include/odp_drv.h @@ -18,6 +18,7 @@ extern C { #endif +#include <odp/drv/byteorder.h> #include <odp/drv/compiler.h> #include <odp/drv/std_types.h> diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index df3f0b9..8702b51 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -90,8 +90,13 @@ odpapiplatinclude_HEADERS = \ odpdrvincludedir= $(includedir)/odp/drv odpdrvinclude_HEADERS = \ + $(srcdir)/include/odp/drv/byteorder.h \ $(srcdir)/include/odp/drv/compiler.h +odpdrvplatincludedir= $(includedir)/odp/drv/plat +odpdrvplatinclude_HEADERS = \ + $(srcdir)/include/odp/drv/plat/byteorder_types.h + odpcomincludedir= $(includedir)/odp/com odpcominclude_HEADERS = \ $(srcdir)/include/odp/api/byteorder.h diff --git a/platform/linux-generic/include/odp/drv/byteorder.h b/platform/linux-generic/include/odp/drv/byteorder.h new file mode 100644 index 0000000..3b27117 --- /dev/null +++ b/platform/linux-generic/include/odp/drv/byteorder.h @@ -0,0 +1,99 @@ +/* Copyright (c) 2016, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODPDRV byteorder for ODP driver interface + */ + +#ifndef ODPDRV_PLAT_BYTEORDER_H_ +#define ODPDRV_PLAT_BYTEORDER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <odp/drv/plat/byteorder_types.h> +#include <odp/drv/std_types.h> +#include <odp/drv/compiler.h> +#include <odp/com/byteorder.h> + +/** @addtogroup odpdrv_compiler_optim ODPDRV COMPILER / OPTIMIZATION + * @{ + */ + +static inline uint16_t odpdrv_be_to_cpu_16(odpdrv_u16be_t be16) +{ + return _odp_be_to_cpu_16((_odp_u16be_t)be16); +} + +static inline uint32_t odpdrv_be_to_cpu_32(odpdrv_u32be_t be32) +{ + return _odp_be_to_cpu_32((_odp_u32be_t)be32); +} + +static inline uint64_t odpdrv_be_to_cpu_64(odpdrv_u64be_t be64) +{ + return _odp_be_to_cpu_64((_odp_u64be_t)be64); +} + +static inline odpdrv_u16be_t odpdrv_cpu_to_be_16(uint16_t cpu16) +{ + return (odpdrv_u16be_t)_odp_cpu_to_be_16(cpu16); +} + +static inline odpdrv_u32be_t odpdrv_cpu_to_be_32(uint32_t cpu32) +{ + return (odpdrv_u32be_t)_odp_cpu_to_be_32(cpu32); +} + +static inline odpdrv_u64be_t odpdrv_cpu_to_be_64(uint64_t cpu64) +{ + return (odpdrv_u64be_t)_odp_cpu_to_be_64(cpu64); +} + +static inline uint16_t odpdrv_le_to_cpu_16(odpdrv_u16le_t le16) +{ + return _odp_le_to_cpu_16((_odp_u16le_t)le16); +} + +static inline uint32_t odpdrv_le_to_cpu_32(odpdrv_u32le_t le32) +{ + return _odp_le_to_cpu_32((_odp_u32le_t)le32); +} + +static inline uint64_t odpdrv_le_to_cpu_64(odpdrv_u64le_t le64) +{ + return _odp_le_to_cpu_64((_odp_u64le_t)le64); +} + +static inline odpdrv_u16le_t odpdrv_cpu_to_le_16(uint16_t cpu16) +{ + return (odpdrv_u16le_t)_odp_cpu_to_le_16(cpu16); +} + +static inline odpdrv_u32le_t odpdrv_cpu_to_le_32(uint32_t cpu32) +{ + return (odpdrv_u32le_t)_odp_cpu_to_le_32(cpu32); +} + +static inline odpdrv_u64le_t odpdrv_cpu_to_le_64(uint64_t cpu64) +{ + return (odpdrv_u64le_t)_odp_cpu_to_le_64(cpu64); +} + +/** + * @} + */ + +#include <odp/drv/spec/byteorder.h> + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/odp/drv/plat/byteorder_types.h b/platform/linux-generic/include/odp/drv/plat/byteorder_types.h new file mode 100644 index 0000000..2c736a2 --- /dev/null +++ b/platform/linux-generic/include/odp/drv/plat/byteorder_types.h @@ -0,0 +1,62 @@ +/* Copyright (c) 2016, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODPDRV byteorder for ODP driver interface + */ + +#ifndef ODPDRV_BYTEORDER_TYPES_H_ +#define ODPDRV_BYTEORDER_TYPES_H_ + +#include "odp/com/plat/byteorder_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup odpdrv_compiler_optim ODPDRV COMPILER / OPTIMIZATION + * @{ + */ + +#define ODPDRV_BIG_ENDIAN _ODP_BIG_ENDIAN + +#define ODPDRV_LITTLE_ENDIAN _ODP_LITTLE_ENDIAN + +#ifdef __BIG_ENDIAN_BITFIELD +#define ODPDRV_BIG_ENDIAN_BITFIELD +#endif + +#ifdef __LITTLE_ENDIAN_BITFIELD +#define ODPDRV_LITTLE_ENDIAN_BITFIELD +#endif + +#ifdef _ODP_BYTE_ORDER +#define ODPDRV_BYTE_ORDER _ODP_BYTE_ORDER +#endif + +typedef _odp_u16le_t odpdrv_u16le_t; +typedef _odp_u16be_t odpdrv_u16be_t; + +typedef _odp_u32le_t odpdrv_u32le_t; +typedef _odp_u32be_t odpdrv_u32be_t; + +typedef _odp_u64le_t odpdrv_u64le_t; +typedef _odp_u64be_t odpdrv_u64be_t; + +typedef _odp_u16sum_t odpdrv_u16sum_t; +typedef _odp_u32sum_t odpdrv_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