From patchwork Mon Jul 18 17:49:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 72231 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp212692qga; Mon, 18 Jul 2016 10:00:33 -0700 (PDT) X-Received: by 10.55.82.2 with SMTP id g2mr5178711qkb.168.1468861233628; Mon, 18 Jul 2016 10:00:33 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f51si16846442qtc.97.2016.07.18.10.00.33; Mon, 18 Jul 2016 10:00:33 -0700 (PDT) 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; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 2AEC06182B; Mon, 18 Jul 2016 17:00:33 +0000 (UTC) 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.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 9751468835; Mon, 18 Jul 2016 16:51:43 +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 F3E5A68833; Mon, 18 Jul 2016 16:51:37 +0000 (UTC) Received: from mail-lf0-f48.google.com (mail-lf0-f48.google.com [209.85.215.48]) by lists.linaro.org (Postfix) with ESMTPS id 199E86808D for ; Mon, 18 Jul 2016 16:50:51 +0000 (UTC) Received: by mail-lf0-f48.google.com with SMTP id l69so79251388lfg.1 for ; Mon, 18 Jul 2016 09:50:51 -0700 (PDT) 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=8I6ywPm11l9h4U1ifbRkV0EBEPKt4tf+1skbXSCsNzI=; b=FniKuyelGRrA3fsJf9D63QrUUWobfErMOb5pPRnSvccnvDVvCDa7HJTLfHMawk9UlB zPqor1FwA708ejCG6c4ZlS0rnjRM2y1jsNcwn2XNttymU2kbMLqF1tm1fcDIyiNr7be3 xIVClLeXyM2TXW/Lyf5SmTLZYjrFjQdVW+/Xg/otiKBlQjTwD1zZjMQ38f7T5tV0Rlay RrB6qBjjNFwpj937TxFzhmhW3r2YVww69SPYM8e8QjOSEchfbXQOCNpzEDTdtPPnvBAd y4+6vMrBV7/2J2auhzTGKHPtfuboU7ZmWmUH4endp9ne7dqy80WTy/X8hE3VrwxRZGFF ltAg== X-Gm-Message-State: ALyK8tJh75S/B4l9ghJsZhHJ0s1WLB5X7k9e3EhXyV8PhfmKGX/JrRO6yVi8BzGdEXe+u9kvkzQ= X-Received: by 10.25.159.130 with SMTP id i124mr16174282lfe.74.1468860649873; Mon, 18 Jul 2016 09:50:49 -0700 (PDT) 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 y200sm2226229lfd.12.2016.07.18.09.50.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jul 2016 09:50:49 -0700 (PDT) From: Christophe Milard To: mike.holmes@linaro.org, yi.he@linaro.org, balakrishna.garapati@linaro.org, lng-odp@lists.linaro.org Date: Mon, 18 Jul 2016 19:49:32 +0200 Message-Id: <1468864178-43721-13-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1468864178-43721-1-git-send-email-christophe.milard@linaro.org> References: <1468864178-43721-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 12/18] linux-generic: drv: adding align.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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" duplicated from the API side (hash: 77a27212b563299959fb2a609b86bb9117a8f918.) Signed-off-by: Christophe Milard --- include/odp_drv.h | 1 + platform/linux-generic/Makefile.am | 1 + platform/linux-generic/include/odp/drv/align.h | 60 ++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 platform/linux-generic/include/odp/drv/align.h -- 2.7.4 diff --git a/include/odp_drv.h b/include/odp_drv.h index e2c3bda..6d2f7ff 100644 --- a/include/odp_drv.h +++ b/include/odp_drv.h @@ -18,6 +18,7 @@ extern C { #endif +#include #include #include #include diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 68db647..20b4b29 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -93,6 +93,7 @@ odpapiplatinclude_HEADERS = \ odpdrvincludedir = $(includedir)/odp/drv odpdrvinclude_HEADERS = \ + $(srcdir)/include/odp/drv/align.h \ $(srcdir)/include/odp/drv/byteorder.h \ $(srcdir)/include/odp/drv/compiler.h \ $(srcdir)/include/odp/drv/std_types.h \ diff --git a/platform/linux-generic/include/odp/drv/align.h b/platform/linux-generic/include/odp/drv/align.h new file mode 100644 index 0000000..9ae3e19 --- /dev/null +++ b/platform/linux-generic/include/odp/drv/align.h @@ -0,0 +1,60 @@ +/* Copyright (c) 2013, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODPDRV alignments + */ + +#ifndef ODPDRV_PLAT_ALIGN_H_ +#define ODPDRV_PLAT_ALIGN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @ingroup odpdrv_compiler_optim + * @{ + */ + +#ifdef __GNUC__ + +#define ODPDRV_ALIGNED(x) __attribute__((__aligned__(x))) + +#define ODPDRV_PACKED __attribute__((__packed__)) + +#define ODPDRV_OFFSETOF(type, member) __builtin_offsetof(type, member) + +#define ODPDRV_FIELD_SIZEOF(type, member) sizeof(((type *)0)->member) + +#if defined __arm__ || defined __aarch64__ + +#define ODPDRV_CACHE_LINE_SIZE 64 + +#endif + +#else +#error Non-gcc compatible compiler +#endif + +#define ODPDRV_PAGE_SIZE 4096 + +#define ODPDRV_ALIGNED_CACHE ODPDRV_ALIGNED(ODPDRV_CACHE_LINE_SIZE) + +#define ODPDRV_ALIGNED_PAGE ODPDRV_ALIGNED(ODPDRV_PAGE_SIZE) + +/** + * @} + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif