From patchwork Fri Sep 5 13:51:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 36846 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 959EF202E4 for ; Fri, 5 Sep 2014 13:52:07 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id eu11sf101398815pac.3 for ; Fri, 05 Sep 2014 06:52:06 -0700 (PDT) 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:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=nNxBp6KSpDWsI1fdr7NN95v+/6JJgNsrH8PZqSCwMkM=; b=CurxwIh2+s0ldqxiRE9gZXrKSFcY7rmfv1NKVxCW5AwGvs9/4rVZquvwkfH+l+zudz hyI3YHibwbKmYI8nPn56S5to7i6PR9Ek0ohyfFdVtawz8AU2Gzw6QA74XDTSNeeuekz1 pOTgRmBHWO5+Dfxf/VYAScLGkb21FkHwAqDoqS/1i074nMxFhHekF9nliSAQtmtY9kJh dAcTS6DgmkcY4lggJ+AeuPXdgnWrrtE33rIUdBaGv4E0PbLfMfDwG8gHlSdSjioPlWRd 07eCMeqJxp1ZBje3p/NwaixotjiBXueMGL1YDlYpEladPxCQmKOgHNsff8VypMYn9vaf 5ijA== X-Gm-Message-State: ALoCoQn6uNu6yeAdwMQCasju98TZfzEIYri652DzIQfczYhBnULGO3ZB6Z40cpdIqq4q/piLLi6y X-Received: by 10.66.168.197 with SMTP id zy5mr6869535pab.7.1409925124968; Fri, 05 Sep 2014 06:52:04 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.39.231 with SMTP id v94ls771711qgv.16.gmail; Fri, 05 Sep 2014 06:52:04 -0700 (PDT) X-Received: by 10.220.105.201 with SMTP id u9mr10523463vco.11.1409925124840; Fri, 05 Sep 2014 06:52:04 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id x11si1186297vdg.56.2014.09.05.06.52.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 06:52:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.175 as permitted sender) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id lf12so12173676vcb.6 for ; Fri, 05 Sep 2014 06:52:04 -0700 (PDT) X-Received: by 10.52.3.40 with SMTP id 8mr8870607vdz.24.1409925124706; Fri, 05 Sep 2014 06:52:04 -0700 (PDT) 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.221.45.67 with SMTP id uj3csp85702vcb; Fri, 5 Sep 2014 06:52:04 -0700 (PDT) X-Received: by 10.224.136.130 with SMTP id r2mr18594235qat.66.1409925124010; Fri, 05 Sep 2014 06:52:04 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id v5si1740694qck.7.2014.09.05.06.52.03 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 05 Sep 2014 06:52:04 -0700 (PDT) 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-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XPtvm-0003ng-1M; Fri, 05 Sep 2014 13:52:02 +0000 Received: from mail-la0-f54.google.com ([209.85.215.54]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XPtvg-0003nb-FD for lng-odp@lists.linaro.org; Fri, 05 Sep 2014 13:51:56 +0000 Received: by mail-la0-f54.google.com with SMTP id b17so13963381lan.13 for ; Fri, 05 Sep 2014 06:51:50 -0700 (PDT) X-Received: by 10.112.119.142 with SMTP id ku14mr11272281lbb.34.1409925110135; Fri, 05 Sep 2014 06:51:50 -0700 (PDT) Received: from uglx0153363.synapse.com ([195.238.92.128]) by mx.google.com with ESMTPSA id ld9sm719808lac.24.2014.09.05.06.51.49 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 06:51:49 -0700 (PDT) From: Taras Kondratiuk To: lng-odp@lists.linaro.org Date: Fri, 5 Sep 2014 16:51:43 +0300 Message-Id: <1409925103-32346-1-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: X-Topics: patch Cc: petri.savolainen@nsn.com, Taras Kondratiuk Subject: [lng-odp] [PATCH] linux-generic: version: Add macros to compare ODP versions 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: taras.kondratiuk@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.220.175 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 API and header names will evolve and change continuously. Some changes may be not backward compatible. Application need some mechanism to support at least a few recent revisions of ODP API. Hence add a few macros to be able to compare ODP API versions. Macros can be used in a following way: #include #if ODP_VERSION_API >= ODP_VERSION(2,0,0) /* Call ODP v2.0 API */ #elif ODP_VERSION_API >= ODP_VERSION(1,0,0) /* Call ODP v1.0 API */ #else /* Call pre v1.0 API */ #endif Signed-off-by: Taras Kondratiuk Signed-off-by: Taras Kondratiuk --- platform/linux-generic/include/api/odp_version.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/platform/linux-generic/include/api/odp_version.h b/platform/linux-generic/include/api/odp_version.h index c823e2d..97f8e26 100644 --- a/platform/linux-generic/include/api/odp_version.h +++ b/platform/linux-generic/include/api/odp_version.h @@ -44,6 +44,22 @@ extern "C" { */ #define ODP_VERSION_API_BUG 1 +/** + * Macro to merge three parts of ODP API version into one word + * + * Merge ODP version into one word: + * byte 0 - bug correction version + * byte 1 - sub version + * byte 2 - main version + */ +#define ODP_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) + +/** + * Current version of ODP API in one word form + */ +#define ODP_VERSION_API ODP_VERSION((ODP_VERSION_API_MAIN), \ + (ODP_VERSION_API_SUB), \ + (ODP_VERSION_API_BUG)) /** @internal Version string expand */ #define ODP_VERSION_STR_EXPAND(x) #x