From patchwork Wed Apr 9 17:05:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 28112 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BA20F2145A for ; Wed, 9 Apr 2014 17:05:45 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id f10sf8453252yha.11 for ; Wed, 09 Apr 2014 10:05:45 -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: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=OmWB8NZ56JBrOauDZ6f3FMVaMRShg3YVBJ/YuvDoXPs=; b=YrFqDB1Yp6FAY+xbuocwvSwa3eenPLsQk6XlKakHdz3r2wh0auk/bQ+bcHDzNGIHuj IaA8ScJe2wwVaujaFOBTNK9itp5uD/Ks1Cb7K5srHBtqt5/khqiGy31IBwRbIcOiuo1+ aBPozEqwkze6AWzy54BM7dyFJHZki7UnjlOzEcsTZ5IjeZxcc8ZykJsUiQofVJuI9Mx5 fjzcRoBsCRhHyVZHUkS+ZYftm68/NXpIqHXVqLuyVQ4QaYKpOkrJRn/LXVPBIznk3nc6 m3hqrJTmD/NZRU5tA//xWkZ22ss6pICansGIB16v06ij8A9cqeiE8fLl/iHPoeXLvhdY r0DQ== X-Gm-Message-State: ALoCoQl0RBEQ6efva4dSGIn+g77h6OKnA36ILIOA1p/ULa/JIwF9KtaAixpN9ysCuWjCK+hYHw/N X-Received: by 10.58.127.66 with SMTP id ne2mr4912412veb.27.1397063145441; Wed, 09 Apr 2014 10:05:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.51.11 with SMTP id t11ls693546qga.96.gmail; Wed, 09 Apr 2014 10:05:45 -0700 (PDT) X-Received: by 10.58.187.9 with SMTP id fo9mr9554763vec.4.1397063145216; Wed, 09 Apr 2014 10:05:45 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id xv15si237416veb.98.2014.04.09.10.05.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 09 Apr 2014 10:05:45 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id oy12so2296864veb.26 for ; Wed, 09 Apr 2014 10:05:45 -0700 (PDT) X-Received: by 10.58.90.99 with SMTP id bv3mr1454135veb.34.1397063145046; Wed, 09 Apr 2014 10:05:45 -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.220.12.8 with SMTP id v8csp346407vcv; Wed, 9 Apr 2014 10:05:44 -0700 (PDT) X-Received: by 10.140.47.86 with SMTP id l80mr13573939qga.9.1397063144554; Wed, 09 Apr 2014 10:05:44 -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 gq5si702352qab.72.2014.04.09.10.05.43 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 09 Apr 2014 10:05:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) 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 1WXvwU-0008RF-Rp; Wed, 09 Apr 2014 17:05:42 +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 1WXvwO-0008RA-F0 for lng-odp@lists.linaro.org; Wed, 09 Apr 2014 17:05:36 +0000 Received: by mail-la0-f54.google.com with SMTP id mc6so1362247lab.41 for ; Wed, 09 Apr 2014 10:05:30 -0700 (PDT) X-Received: by 10.152.21.137 with SMTP id v9mr2152672lae.44.1397063130793; Wed, 09 Apr 2014 10:05:30 -0700 (PDT) Received: from maxim-lap.localhost.onion ([92.39.133.154]) by mx.google.com with ESMTPSA id sx1sm1554069lac.1.2014.04.09.10.05.29 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 09 Apr 2014 10:05:29 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Wed, 9 Apr 2014 21:05:30 +0400 Message-Id: <1397063130-10525-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 Subject: [lng-odp] [ODP/PATCH] implement odp_timer_disarm_all() 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: maxim.uvarov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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 Implement function to disarm all timers. Needed in case of normal exit from application. Signed-off-by: Maxim Uvarov --- platform/linux-generic/include/odp_internal.h | 1 + platform/linux-generic/source/odp_timer.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index fb3be79..9b0769e 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -38,6 +38,7 @@ int odp_schedule_init_global(void); int odp_schedule_init_local(void); int odp_timer_init_global(void); +int odp_timer_disarm_all(void); #ifdef __cplusplus } diff --git a/platform/linux-generic/source/odp_timer.c b/platform/linux-generic/source/odp_timer.c index 6fb5025..98ffde3 100644 --- a/platform/linux-generic/source/odp_timer.c +++ b/platform/linux-generic/source/odp_timer.c @@ -217,6 +217,30 @@ int odp_timer_init_global(void) return 0; } +int odp_timer_disarm_all(void) +{ + int timers; + struct itimerspec ispec; + + timers = odp_atomic_load_int(&odp_timer.num_timers); + + ispec.it_interval.tv_sec = 0; + ispec.it_interval.tv_nsec = 0; + ispec.it_value.tv_sec = 0; + ispec.it_value.tv_nsec = 0; + + for (; timers >= 0; timers--) { + if (timer_settime(odp_timer.timer[timers].timerid, + 0, &ispec, NULL)) { + ODP_DBG("Timer reset failed\n"); + return -1; + } + odp_atomic_fetch_sub_int(&odp_timer.num_timers, 1); + } + + return 0; +} + odp_timer_t odp_timer_create(const char *name, odp_buffer_pool_t pool, uint64_t resolution, uint64_t min_tmo, uint64_t max_tmo)