From patchwork Thu Apr 28 06:39:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Elo, Matias \(Nokia - FI/Espoo\)" X-Patchwork-Id: 66854 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp41426qge; Wed, 27 Apr 2016 23:39:19 -0700 (PDT) X-Received: by 10.50.92.34 with SMTP id cj2mr30554716igb.7.1461825559257; Wed, 27 Apr 2016 23:39:19 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j100si7384192ioo.150.2016.04.27.23.39.18; Wed, 27 Apr 2016 23:39:19 -0700 (PDT) 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=fail (p=NONE dis=NONE) header.from=nokia.com Received: by lists.linaro.org (Postfix, from userid 109) id 5512C6158E; Thu, 28 Apr 2016 06:39:18 +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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED 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 6C6A861570; Thu, 28 Apr 2016 06:39:11 +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 D34936157A; Thu, 28 Apr 2016 06:39:08 +0000 (UTC) Received: from demumfd002.nsn-inter.net (demumfd002.nsn-inter.net [93.183.12.31]) by lists.linaro.org (Postfix) with ESMTPS id 773646156E for ; Thu, 28 Apr 2016 06:39:07 +0000 (UTC) Received: from demuprx017.emea.nsn-intra.net ([10.150.129.56]) by demumfd002.nsn-inter.net (8.15.2/8.15.2) with ESMTPS id u3S6d5xk007885 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 28 Apr 2016 06:39:06 GMT Received: from 10.144.19.15 ([10.144.104.109]) by demuprx017.emea.nsn-intra.net (8.12.11.20060308/8.12.11) with ESMTP id u3S6d4uI012081 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Thu, 28 Apr 2016 08:39:05 +0200 From: Matias Elo To: lng-odp@lists.linaro.org Date: Thu, 28 Apr 2016 09:39:04 +0300 Message-Id: <1461825544-5360-2-git-send-email-matias.elo@nokia.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461825544-5360-1-git-send-email-matias.elo@nokia.com> References: <1461825544-5360-1-git-send-email-matias.elo@nokia.com> X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-size: 2729 X-purgate-ID: 151667::1461825546-00002418-C4B4D3B3/0/0 X-Topics: timers patch Subject: [lng-odp] [API-NEXT PATCH v2 2/2] linux-generic: timer: add missing odp_time*_to_u64() functions 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: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Add missing odp_timer_pool_to_u64(), odp_timer_to_u64(), and odp_timeout_to_u64() functions. Use the functions in timer validation tests. Signed-off-by: Matias Elo --- Reviewed-by: Bill Fischofer platform/linux-generic/odp_timer.c | 15 +++++++++++++++ test/validation/timer/timer.c | 3 +++ 2 files changed, 18 insertions(+) diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index f4fb1f6..793cf0b 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -829,6 +829,11 @@ int odp_timer_pool_info(odp_timer_pool_t tpid, return 0; } +uint64_t odp_timer_pool_to_u64(odp_timer_pool_t tpid) +{ + return (uint64_t)tpid; +} + odp_timer_t odp_timer_alloc(odp_timer_pool_t tpid, odp_queue_t queue, void *user_ptr) @@ -902,6 +907,11 @@ int odp_timer_cancel(odp_timer_t hdl, odp_event_t *tmo_ev) } } +uint64_t odp_timer_to_u64(odp_timer_t hdl) +{ + return (uint64_t)hdl; +} + odp_timeout_t odp_timeout_from_event(odp_event_t ev) { /* This check not mandated by the API specification */ @@ -915,6 +925,11 @@ odp_event_t odp_timeout_to_event(odp_timeout_t tmo) return (odp_event_t)tmo; } +uint64_t odp_timeout_to_u64(odp_timeout_t tmo) +{ + return (uint64_t)tmo; +} + int odp_timeout_fresh(odp_timeout_t tmo) { const odp_timeout_hdr_t *hdr = timeout_hdr(tmo); diff --git a/test/validation/timer/timer.c b/test/validation/timer/timer.c index aad11aa..c8ef785 100644 --- a/test/validation/timer/timer.c +++ b/test/validation/timer/timer.c @@ -168,6 +168,7 @@ void timer_test_odp_timer_cancel(void) tim = odp_timer_alloc(tp, queue, USER_PTR); if (tim == ODP_TIMER_INVALID) CU_FAIL_FATAL("Failed to allocate timer"); + LOG_DBG("Timer handle: %" PRIu64 "\n", odp_timer_to_u64(tim)); ev = odp_timeout_to_event(odp_timeout_alloc(pool)); if (ev == ODP_EVENT_INVALID) @@ -189,6 +190,7 @@ void timer_test_odp_timer_cancel(void) tmo = odp_timeout_from_event(ev); if (tmo == ODP_TIMEOUT_INVALID) CU_FAIL_FATAL("Cancel did not return timeout"); + LOG_DBG("Timeout handle: %" PRIu64 "\n", odp_timeout_to_u64(tmo)); if (odp_timeout_timer(tmo) != tim) CU_FAIL("Cancel invalid tmo.timer"); @@ -501,6 +503,7 @@ void timer_test_odp_timer_all(void) CU_ASSERT(tpinfo.param.max_tmo == MAX); CU_ASSERT(strcmp(tpinfo.name, NAME) == 0); + 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, odp_timer_ns_to_tick(tp, 1000000ULL * RANGE_MS));