From patchwork Wed Feb 17 14:36:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 62111 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp3347lbl; Wed, 17 Feb 2016 05:38:48 -0800 (PST) X-Received: by 10.140.133.133 with SMTP id 127mr2016423qhf.42.1455716328738; Wed, 17 Feb 2016 05:38:48 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id u11si1309386qku.14.2016.02.17.05.38.48; Wed, 17 Feb 2016 05:38:48 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 505186177D; Wed, 17 Feb 2016 13:38:48 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=d+XGNEyd; dkim-adsp=none (unprotected policy); dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,T_DKIM_INVALID,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 1A679617B3; Wed, 17 Feb 2016 13:37:46 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id B559561775; Wed, 17 Feb 2016 13:37:36 +0000 (UTC) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com [209.85.217.175]) by lists.linaro.org (Postfix) with ESMTPS id D3E68615CA for ; Wed, 17 Feb 2016 13:37:33 +0000 (UTC) Received: by mail-lb0-f175.google.com with SMTP id of3so9534748lbc.1 for ; Wed, 17 Feb 2016 05:37:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gv+RWva9A/0LxstI7aviC+GBPqP0/ZYa0dCea4FxjoM=; b=d+XGNEydl9QXxr81skfN/H2+TpowS1Xkat/7ji95m35BFRwHIUME4fTuth8Cc4MuaX Yk0GIe+p7ObYD3/dFfAWRmoMGNEp7b4f3SruzWp1tVQrCdfXgCv1Q+ao1W/H6xBwiApq 2TAhP4dD1g5JhPW6O32bEY/C9RbTOLHMlkX60= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gv+RWva9A/0LxstI7aviC+GBPqP0/ZYa0dCea4FxjoM=; b=CC6kgTUJC1vRAlCJgOpljVicprSWbasFY9DWISirrWj6UO9vxipeb3bkb3wsG0/CxV xj4CFWxewlazOWxELrwLCe7HPZRKK3uc9rs+6TexlFEYWqwcMZedmVYuLYn6fYTrgt8L iz/cXvpUnfTKLbcADO3ApCNhdXSrYcIM8Kgy112uol06SU2pMpiy7WTaOZZW0DVZnV9Q SWs4I2TaPs2FvoiQZChTHQ/OxSxM+aSBSXQkbpZESTGe/kiLvyTsZVfhsdp9jMitTWhJ c1lerQyTzj3Bv6elLMk7nQ7qEgbP1h83VrI6xvAdKGhxz86tmfQexuFuSdMGycd4oCuC 1BJg== X-Gm-Message-State: AG10YOTDfMeN+sW+rPz7X1b0fBbP57QNHpbA0v+cud19VbVMoual0fvI3w95582yirZdwK8YonU= X-Received: by 10.112.125.9 with SMTP id mm9mr654640lbb.113.1455716252856; Wed, 17 Feb 2016 05:37:32 -0800 (PST) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by smtp.gmail.com with ESMTPSA id wj2sm215102lbb.5.2016.02.17.05.37.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Feb 2016 05:37:32 -0800 (PST) From: Christophe Milard To: anders.roxell@linaro.org, mike.holmes@linaro.org, bill.fischofer@linaro.org, petri.savolainen@linaro.org Date: Wed, 17 Feb 2016 15:36:17 +0100 Message-Id: <1455719777-15879-4-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1455719777-15879-1-git-send-email-christophe.milard@linaro.org> References: <1455719777-15879-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [API-NEXT PATCH 3/3] linux-generic: drv: adding byteorder.h X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" 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 --- 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 #include #include 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 +#include +#include +#include + +/** @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 + +#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