From patchwork Sun Feb 1 00:16:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 44104 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 045D02359E for ; Sun, 1 Feb 2015 00:17:14 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id r20sf9110414wiv.2 for ; Sat, 31 Jan 2015 16:17:13 -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=Abq0FVruHgKXUpvrN4Ga74FA6QA8b/DRgD6tThB1Yow=; b=ECpu6ASCjiw6BQGawJAgIXzultnLV4psEtgmxWtF5MuhovX0VbPuT5qcqI0tNwDBB3 PwI1IHNf4IZ3lPk+7K78R0+WsyfvPI9KP6srmDHyI8DHk0b2O2u2vdqndAfmXZhoiQD7 vaHESRW/o96BsyKcebG4Wtffj2Qys7QlcYJLhwihW/gpQPN6EZEx/M4IjOIESFLi6Uck WAo9zraJsNF6K+xgqzD44wCLannjSrhORcyEBvWEEpwpCQeBSEEFBk8dol/trpzRbvi5 hgtIVsY2KoAcjL8KtlkLJqqav73LB2CBdSwCbxzVm8vaR+MU9AFTvUIAnLUFjrX8ATM0 awfQ== X-Gm-Message-State: ALoCoQl5CBcdGoezMBIR+QBCPbrjFoaoTwPvDChcydyQBGcqidjwqR0lJayMFuViNzd70W5t+zIq X-Received: by 10.180.108.197 with SMTP id hm5mr431385wib.4.1422749833309; Sat, 31 Jan 2015 16:17:13 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.13 with SMTP id n13ls558761laa.80.gmail; Sat, 31 Jan 2015 16:17:13 -0800 (PST) X-Received: by 10.152.37.165 with SMTP id z5mr4272269laj.88.1422749833146; Sat, 31 Jan 2015 16:17:13 -0800 (PST) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id pn5si13428892lbb.26.2015.01.31.16.17.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 31 Jan 2015 16:17:12 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by mail-la0-f48.google.com with SMTP id pv20so31106119lab.7 for ; Sat, 31 Jan 2015 16:17:12 -0800 (PST) X-Received: by 10.152.3.70 with SMTP id a6mr12861338laa.71.1422749832325; Sat, 31 Jan 2015 16:17:12 -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 h5csp507616lbj; Sat, 31 Jan 2015 16:17:11 -0800 (PST) X-Received: by 10.140.93.21 with SMTP id c21mr26189628qge.0.1422749831012; Sat, 31 Jan 2015 16:17:11 -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 i92si7101671qgf.41.2015.01.31.16.17.09 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 31 Jan 2015 16:17:11 -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 1YHiDs-0002J1-4q; Sun, 01 Feb 2015 00:17:08 +0000 Received: from mail-ob0-f171.google.com ([209.85.214.171]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YHiDj-0002IB-Mf for lng-odp@lists.linaro.org; Sun, 01 Feb 2015 00:16:59 +0000 Received: by mail-ob0-f171.google.com with SMTP id gq1so3057026obb.2 for ; Sat, 31 Jan 2015 16:16:54 -0800 (PST) X-Received: by 10.202.204.142 with SMTP id c136mr7372477oig.81.1422749814393; Sat, 31 Jan 2015 16:16:54 -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 xr17sm5945905oeb.12.2015.01.31.16.16.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 31 Jan 2015 16:16:53 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Sat, 31 Jan 2015 18:16:32 -0600 Message-Id: <1422749807-20228-2-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1422749807-20228-1-git-send-email-bill.fischofer@linaro.org> References: <1422749807-20228-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv4 01/10] 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.48 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 | 38 ++++++++++++++++++++++ 2 files changed, 39 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..a5449ac --- /dev/null +++ b/platform/linux-generic/include/odp/plat/strong_types.h @@ -0,0 +1,38 @@ +/* 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)) + +/** Internal macro to convert a scalar to a typed handle */ +#define _odp_cast_scalar(type, val) ((type)(size_t)(val)) + +#endif