From patchwork Thu Dec 1 23:03:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Brooks X-Patchwork-Id: 86167 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp928315qgi; Thu, 1 Dec 2016 15:04:34 -0800 (PST) X-Received: by 10.55.21.81 with SMTP id f78mr38933393qkh.210.1480633474557; Thu, 01 Dec 2016 15:04:34 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id v200si1377226qkb.187.2016.12.01.15.04.33; Thu, 01 Dec 2016 15:04:34 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id A8C41608ED; Thu, 1 Dec 2016 23:04:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 97CC360802; Thu, 1 Dec 2016 23:04:28 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id EAEB4607E2; Thu, 1 Dec 2016 23:04:25 +0000 (UTC) Received: from mail-oi0-f42.google.com (mail-oi0-f42.google.com [209.85.218.42]) by lists.linaro.org (Postfix) with ESMTPS id B66CD6065A for ; Thu, 1 Dec 2016 23:04:24 +0000 (UTC) Received: by mail-oi0-f42.google.com with SMTP id y198so247990506oia.1 for ; Thu, 01 Dec 2016 15:04:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=809bwgjyQP7xU8Truvi2aBVnkWSlW2ai73OalYeNyR4=; b=Ci/CmPF/Us+BpGMf80fqYOTepnhGPuQtezq+75Wt0Hyt8866A+zEYhz73kQFDSjIjV 1gDLGJ63Ia5tfDq5xslTai4lM+kh/11FjK/0oQGYOQTpsR4/XgFD1oiIQtnvgCXnmDkw W8FVu5Etq5pEnsJ7P6Wt7zX+37c6tJADAg+WHU2TxdIDxtubYq44CJRxFrhMtztALEO8 yUVRL3BGAwU1GxQr0oABQDOu9vb1eOyc8b3857TT4X9plqui6Ax7hqW5NW2XpulaVI7n MTwl6qVxKHFlxu62KcAVZC91ivTVpjE3F9F9fL1od+agla5+BCBpmuwYZMxkiPhMmR5y RWOA== X-Gm-Message-State: AKaTC01ZrDZet0ztoNYUpWOt0dffhVHb/YKlh/OJDj1lWrtalrt9RATQpfoo2aN8MtFRWfLo2l4= X-Received: by 10.157.57.229 with SMTP id y92mr24794371otb.41.1480633464194; Thu, 01 Dec 2016 15:04:24 -0800 (PST) Received: from localhost.localdomain (68-248-140-212.lightspeed.austtx.sbcglobal.net. [68.248.140.212]) by smtp.gmail.com with ESMTPSA id w129sm759106oie.1.2016.12.01.15.04.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Dec 2016 15:04:23 -0800 (PST) From: Brian Brooks To: lng-odp@lists.linaro.org Date: Thu, 1 Dec 2016 17:03:26 -0600 Message-Id: <1480633409-24532-1-git-send-email-brian.brooks@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [lng-odp] [RFC API-NEXT PATCHv2 1/4] api: timer: add odp_timer_pool_resolution() X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Signed-off-by: Brian Brooks --- include/odp/api/spec/timer.h | 9 +++++++++ platform/linux-generic/odp_timer.c | 5 +++++ test/common_plat/validation/api/timer/timer.c | 2 ++ 3 files changed, 16 insertions(+) -- 2.7.4 diff --git a/include/odp/api/spec/timer.h b/include/odp/api/spec/timer.h index 3f8fdd4..2e59ace 100644 --- a/include/odp/api/spec/timer.h +++ b/include/odp/api/spec/timer.h @@ -191,6 +191,15 @@ int odp_timer_pool_info(odp_timer_pool_t tpid, odp_timer_pool_info_t *info); /** + * Get resolution from timer pool + * + * @param tpid Timer pool identifier + * + * @return Timeout resolution in nanoseconds + */ +uint64_t odp_timer_pool_resolution(odp_timer_pool_t tpid); + +/** * Allocate a timer * * Create a timer (allocating all necessary resources e.g. timeout event) from diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index ee4c4c0..2c14c93 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -837,6 +837,11 @@ int odp_timer_pool_info(odp_timer_pool_t tpid, return 0; } +uint64_t odp_timer_pool_resolution(odp_timer_pool_t tpid) +{ + return tpid->param.res_ns; +} + uint64_t odp_timer_pool_to_u64(odp_timer_pool_t tpid) { return _odp_pri(tpid); diff --git a/test/common_plat/validation/api/timer/timer.c b/test/common_plat/validation/api/timer/timer.c index 0007639..0d0514a 100644 --- a/test/common_plat/validation/api/timer/timer.c +++ b/test/common_plat/validation/api/timer/timer.c @@ -529,6 +529,8 @@ void timer_test_odp_timer_all(void) CU_ASSERT(tpinfo.param.max_tmo == MAX); CU_ASSERT(strcmp(tpinfo.name, NAME) == 0); + CU_ASSERT(odp_timer_pool_resolution(tp) == RES); + LOG_DBG("Timer pool handle: %" PRIu64 "\n", odp_timer_pool_to_u64(tp)); LOG_DBG("#timers..: %u\n", NTIMERS); LOG_DBG("Tmo range: %u ms (%" PRIu64 " ticks)\n", RANGE_MS,