From patchwork Fri Jan 30 04:27:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 44009 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6C3E524128 for ; Fri, 30 Jan 2015 04:28:16 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id u10sf26580986lbd.3 for ; Thu, 29 Jan 2015 20:28:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=nSKw94AFb6zQHWs9rdBRD0LERF1QNOM51yKZDnid7FI=; b=c0u2OpX583KBjINTTU0AGKvBLdDp1owoj+Q6qbK7EzFBZbJRD2wJvwbh8h7K+MVJql hTiczXymi5LiA3R15G3z5489Gng6J+c1BSTu/fcLIqpXgNr3J/X0blhg408hcD/su25D bs3065zbucO09OkoFsqdNp/uJKdwJbjDs5JzpC1vMMV5rxK+8nosml3fxFKh9P8X/3Oe y8lnJNsRRNyskKR7cIuQfIUFGotsdnCk9/WbljwliT1NtrnUc3w0XIvGspXkoDeHEjRd K6i+j90wgZxT/Do3ZpCKnDaMPfU5PfHspfbDBqzKnZ904W5wE0YahYdm3oCCD1CgSgBV 1oew== X-Gm-Message-State: ALoCoQkQo5t59AcpyzHI1JLfzaTQVUfbDIq44xxPkpAwKe562+bt6uB/6Fpwp2QcuCQHoQqW/vGo X-Received: by 10.112.143.167 with SMTP id sf7mr522070lbb.0.1422592094854; Thu, 29 Jan 2015 20:28:14 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.1.195 with SMTP id 3ls241678lao.47.gmail; Thu, 29 Jan 2015 20:28:14 -0800 (PST) X-Received: by 10.153.7.100 with SMTP id db4mr4490134lad.79.1422592094704; Thu, 29 Jan 2015 20:28:14 -0800 (PST) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id ls9si7953190lac.1.2015.01.29.20.28.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 Jan 2015 20:28:14 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by mail-la0-f49.google.com with SMTP id gf13so21609314lab.8 for ; Thu, 29 Jan 2015 20:28:14 -0800 (PST) X-Received: by 10.152.7.229 with SMTP id m5mr4640499laa.80.1422592094359; Thu, 29 Jan 2015 20:28:14 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp159139lbj; Thu, 29 Jan 2015 20:28:13 -0800 (PST) X-Received: by 10.229.197.129 with SMTP id ek1mr8843427qcb.8.1422592093062; Thu, 29 Jan 2015 20:28:13 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id j1si13021319qai.10.2015.01.29.20.28.11 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 29 Jan 2015 20:28:13 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YH3Bh-0007Nd-Py; Fri, 30 Jan 2015 04:28:09 +0000 Received: from mail-oi0-f53.google.com ([209.85.218.53]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YH3BZ-0007Li-AQ for lng-odp@lists.linaro.org; Fri, 30 Jan 2015 04:28:01 +0000 Received: by mail-oi0-f53.google.com with SMTP id i138so33038804oig.12 for ; Thu, 29 Jan 2015 20:27:56 -0800 (PST) X-Received: by 10.202.213.131 with SMTP id m125mr2404470oig.87.1422592076098; Thu, 29 Jan 2015 20:27:56 -0800 (PST) Received: from localhost.localdomain (cpe-24-28-70-239.austin.res.rr.com. [24.28.70.239]) by mx.google.com with ESMTPSA id x21sm4737369oix.24.2015.01.29.20.27.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jan 2015 20:27:55 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Thu, 29 Jan 2015 22:27:37 -0600 Message-Id: <1422592065-15875-2-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1422592065-15875-1-git-send-email-bill.fischofer@linaro.org> References: <1422592065-15875-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [patch 1/9] api: add base macros for strong typing support X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: bill.fischofer@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Bill Fischofer --- platform/linux-generic/Makefile.am | 1 + .../linux-generic/include/odp/plat/strong_types.h | 37 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 platform/linux-generic/include/odp/plat/strong_types.h diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index addb5ec..81245b1 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -57,6 +57,7 @@ odpplatinclude_HEADERS = \ $(top_srcdir)/platform/linux-generic/include/odp/plat/queue_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/schedule_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/shared_memory_types.h \ + $(top_srcdir)/platform/linux-generic/include/odp/plat/strong_types.h \ $(top_srcdir)/platform/linux-generic/include/odp/plat/version_types.h odpapiincludedir= $(includedir)/odp/api diff --git a/platform/linux-generic/include/odp/plat/strong_types.h b/platform/linux-generic/include/odp/plat/strong_types.h new file mode 100644 index 0000000..9d73229 --- /dev/null +++ b/platform/linux-generic/include/odp/plat/strong_types.h @@ -0,0 +1,37 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + + +/** + * @file + * + * ODP Strong Types. Common macros for implementing strong typing + * for ODP abstract data types + */ + +#ifndef STRONG_TYPES_H_ +#define STRONG_TYPES_H_ + +/** Use strong typing for ODP types */ +#define odp_handle_t struct {} * + +/** Internal typedefs for ODP strong type manipulation */ +typedef odp_handle_t _odp_handle_t; + +typedef union { + _odp_handle_t hdl; + uint32_t val; +} _odp_handle_u; + +/** Internal macro to get value of an ODP handle */ +#define _odp_typeval(handle) (((_odp_handle_u)(_odp_handle_t)handle).val) + +/** Internal macro to get printable value of an ODP handle */ +#define _odp_pri(handle) ((uint64_t)_odp_typeval(handle)) + +#define _odp_cast_scalar(type, val) ((type)(size_t)(val)) + +#endif