From patchwork Thu Jul 21 12:06:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 72553 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp382633qga; Thu, 21 Jul 2016 04:17:59 -0700 (PDT) X-Received: by 10.55.16.27 with SMTP id a27mr70114678qkh.34.1469099879143; Thu, 21 Jul 2016 04:17:59 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 77si4645563qkt.119.2016.07.21.04.17.58; Thu, 21 Jul 2016 04:17:59 -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 C0F1B61A2B; Thu, 21 Jul 2016 11:17:58 +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 8289868966; Thu, 21 Jul 2016 11:08:41 +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 67AAC68982; Thu, 21 Jul 2016 11:08:34 +0000 (UTC) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com [209.85.215.54]) by lists.linaro.org (Postfix) with ESMTPS id 4807F61095 for ; Thu, 21 Jul 2016 11:07:29 +0000 (UTC) Received: by mail-lf0-f54.google.com with SMTP id b199so58734910lfe.0 for ; Thu, 21 Jul 2016 04:07:29 -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=A7WrukPtT6+ChfPzS5K/X6Hav6fu7ZFbjyeFd4DyWu8=; b=F1XB7nh0OvGGlz91I1mKu3Fr1VTVzoHY3ANp7uUHftAfy7iCqTvrPddPqpG02E3Jow WQ7HY5kLo273G2wIpIEAZ9/nCLkqY1mKDVCQ32YPZ6IHQQcTRVl4ShyxVvyuVlyrsbP0 rievdZ47q2x4cWWL4IQGNeaySxpsf5HswvkDy+97HPKWeqk9e3iBeX58mJ5o+FgYIMdp FjbzyVr1LyCcrijQX03suqwbMFLLaYjuRa0g72IAzFvpqI9DznvgPHpJPGtC9r2wHf6V dyiW+2kago2WI6CQ47ZQhP3VR7fvQygKm5DBQ6LxpWHLlf/5GIlSlnv9QiQ+XWcAquyI /Byw== X-Gm-Message-State: ALyK8tKAE5YvTsPl5C9CZYmirdCRya1xR1dgGXNYuPws7jADiw6Pefm7ACq2BnixwgBZa6B6xZY= X-Received: by 10.25.219.198 with SMTP id t67mr6590539lfi.177.1469099248034; Thu, 21 Jul 2016 04:07:28 -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 i80sm1577861lfg.6.2016.07.21.04.07.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Jul 2016 04:07:27 -0700 (PDT) From: Christophe Milard To: mike.holmes@linaro.org, lng-odp@lists.linaro.org, balakrishna.garapati@linaro.org Date: Thu, 21 Jul 2016 14:06:20 +0200 Message-Id: <1469102786-65530-13-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1469102786-65530-1-git-send-email-christophe.milard@linaro.org> References: <1469102786-65530-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv3 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" Based on API interface file. 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..eded2e3 --- /dev/null +++ b/platform/linux-generic/include/odp/drv/align.h @@ -0,0 +1,60 @@ +/* Copyright (c) 2016, 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