From patchwork Tue Feb 3 04:44:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 44193 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 76C142034D for ; Tue, 3 Feb 2015 04:46:07 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id r20sf23627007wiv.2 for ; Mon, 02 Feb 2015 20:46:06 -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=CzDf+w4aSNTPcVyaOrJC3rkaltve670cRR0Nmo2xG5LvFONdbtEyXYuCB05piKR41O 2WB3nxQhabQl7ubCGVbl4DbWYy0QP6Pk4+bzd8wclIgs67BRGvRyffyvtU2kjW8uYINM vt56Evkz0z37nHqXMUtA+LiRM7C0tUgMoIGoZ+8jmxgrvtcN5iZYKs71/EV9SlbHssFr nmQDKWHMMKnpHV+DIwb9mxCvTQEHY/P0meyZilx8k0Wq/KeRedzENQGvRwto/bNkX23T IpcTW8g14kWa0FtR4QKab2oX8W1AFnDgWWMSS8V394MuQieHQAlkxUlm4oiL49qvU45w hGVg== X-Gm-Message-State: ALoCoQnquObSltmnMWlSBczPsJn7REnk++Lp8EZWhdZVA8WZjhGKg1Wgm/bZHpnWMX/U63Z7pm0N X-Received: by 10.112.99.37 with SMTP id en5mr2752474lbb.17.1422938766646; Mon, 02 Feb 2015 20:46:06 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.232 with SMTP id h8ls147250lam.30.gmail; Mon, 02 Feb 2015 20:46:06 -0800 (PST) X-Received: by 10.112.162.167 with SMTP id yb7mr23217015lbb.76.1422938766364; Mon, 02 Feb 2015 20:46:06 -0800 (PST) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id v6si18399875laj.52.2015.02.02.20.46.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Feb 2015 20:46:06 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id ge10so48035327lab.10 for ; Mon, 02 Feb 2015 20:46:06 -0800 (PST) X-Received: by 10.152.245.44 with SMTP id xl12mr22525487lac.81.1422938766262; Mon, 02 Feb 2015 20:46:06 -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 h5csp1712424lbj; Mon, 2 Feb 2015 20:46:05 -0800 (PST) X-Received: by 10.224.40.195 with SMTP id l3mr49361811qae.61.1422938764932; Mon, 02 Feb 2015 20:46:04 -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 s3si25457547qak.46.2015.02.02.20.46.03 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 02 Feb 2015 20:46:04 -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 1YIVNB-00066g-So; Tue, 03 Feb 2015 04:46:01 +0000 Received: from mail-oi0-f44.google.com ([209.85.218.44]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YIVMg-00060D-UY for lng-odp@lists.linaro.org; Tue, 03 Feb 2015 04:45:30 +0000 Received: by mail-oi0-f44.google.com with SMTP id a3so47348153oib.3 for ; Mon, 02 Feb 2015 20:45:25 -0800 (PST) X-Received: by 10.182.142.229 with SMTP id rz5mr14227528obb.87.1422938725629; Mon, 02 Feb 2015 20:45:25 -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 vs5sm10277537oeb.14.2015.02.02.20.45.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Feb 2015 20:45:25 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Mon, 2 Feb 2015 22:44:50 -0600 Message-Id: <1422938699-12877-11-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1422938699-12877-1-git-send-email-bill.fischofer@linaro.org> References: <1422938699-12877-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv5 10/19] linux-generic: 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.51 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