From patchwork Sat Jan 31 16:14:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 44082 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 913E82359E for ; Sat, 31 Jan 2015 16:14:56 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id fb4sf7769831wid.3 for ; Sat, 31 Jan 2015 08:14:55 -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=V/RDZNkAMBRGzvmPsmJcUWgYkfVs9JnsdJ2vyyOUv8gLZkExrZjwd7mEUCWPndWRBh ve4SN6nPGZV7DMkQpKOsfrIwgLQfO7lgKZjUgI9T0wGkI9oDPNGGCHFitBpw+QplIYHp 6wps2Dc7GzLrrMl5ToXCYzE6a0SreDo8VszQxVTuGsSsNHV6SchjNe4yENrxJaF6q6B1 nUZtEUslzRG0y4fhyHhTs4JjctAxmCfHgXXpja5My1vlQaU6WjBY2QRLOxUYhz+CoL4g TVfIQjshZD/28e11x/ZZg+785i2lmBgZ7VLAsyDzRAKXCjmcm2txhIVYFcDTYHnr44tk /lBg== X-Gm-Message-State: ALoCoQkN37qoCvLJs9Fh/83wN8nX1YkNjjzg99cZlAMRPhXGHKYJio68ZP7nOg4CTZ/daZTzSZT1 X-Received: by 10.180.93.165 with SMTP id cv5mr268044wib.6.1422720895921; Sat, 31 Jan 2015 08:14:55 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.49 with SMTP id o17ls542250laa.24.gmail; Sat, 31 Jan 2015 08:14:55 -0800 (PST) X-Received: by 10.152.185.72 with SMTP id fa8mr11389432lac.73.1422720895527; Sat, 31 Jan 2015 08:14:55 -0800 (PST) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id qr3si2198705lbb.127.2015.01.31.08.14.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 31 Jan 2015 08:14:54 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by mail-la0-f52.google.com with SMTP id ge10so29608216lab.11 for ; Sat, 31 Jan 2015 08:14:54 -0800 (PST) X-Received: by 10.152.6.132 with SMTP id b4mr11618447laa.59.1422720894559; Sat, 31 Jan 2015 08:14:54 -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 h5csp351833lbj; Sat, 31 Jan 2015 08:14:53 -0800 (PST) X-Received: by 10.140.84.20 with SMTP id k20mr22361456qgd.45.1422720891334; Sat, 31 Jan 2015 08:14:51 -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 m8si18401209qao.3.2015.01.31.08.14.50 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 31 Jan 2015 08:14:51 -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 1YHah6-00056G-1w; Sat, 31 Jan 2015 16:14:48 +0000 Received: from mail-ob0-f182.google.com ([209.85.214.182]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YHagx-00055Z-5j for lng-odp@lists.linaro.org; Sat, 31 Jan 2015 16:14:39 +0000 Received: by mail-ob0-f182.google.com with SMTP id nt9so7303695obb.13 for ; Sat, 31 Jan 2015 08:14:33 -0800 (PST) X-Received: by 10.182.28.100 with SMTP id a4mr7065260obh.69.1422720873869; Sat, 31 Jan 2015 08:14:33 -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 ur1sm6921411obc.3.2015.01.31.08.14.32 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 31 Jan 2015 08:14:32 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Sat, 31 Jan 2015 10:14:18 -0600 Message-Id: <1422720866-22194-2-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1422720866-22194-1-git-send-email-bill.fischofer@linaro.org> References: <1422720866-22194-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv2 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.52 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