From patchwork Mon Jun 6 14:47:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 630963 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rNdkR46J0z9t6F for ; Tue, 7 Jun 2016 01:23:11 +1000 (AEST) Received: from localhost ([::1]:43113 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9wMv-00060k-GG for incoming@patchwork.ozlabs.org; Mon, 06 Jun 2016 11:23:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9vos-00005O-Cn for qemu-devel@nongnu.org; Mon, 06 Jun 2016 10:48:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9voq-0000SR-3B for qemu-devel@nongnu.org; Mon, 06 Jun 2016 10:47:57 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:57505) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9vop-0000Rh-Sa for qemu-devel@nongnu.org; Mon, 06 Jun 2016 10:47:56 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1b9vop-0008FU-FN for qemu-devel@nongnu.org; Mon, 06 Jun 2016 15:47:55 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 6 Jun 2016 15:47:37 +0100 Message-Id: <1465224465-21998-21-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465224465-21998-1-git-send-email-peter.maydell@linaro.org> References: <1465224465-21998-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 20/28] hw/ptimer: Introduce ptimer_get_limit X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Dmitry Osipenko Currently ptimer users are used to store copy of the limit value, because ptimer doesn't provide facility to retrieve the limit. Let's provide it. Signed-off-by: Dmitry Osipenko Reviewed-by: Peter Crosthwaite Message-id: 8f1fa9f90d8dbf8086fb02f3b4835eaeb4089cf6.1464367869.git.digetx@gmail.com Signed-off-by: Peter Maydell --- hw/core/ptimer.c | 5 +++++ include/hw/ptimer.h | 1 + 2 files changed, 6 insertions(+) diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index d0b2f38..05b0c27 100644 --- a/hw/core/ptimer.c +++ b/hw/core/ptimer.c @@ -225,6 +225,11 @@ void ptimer_set_limit(ptimer_state *s, uint64_t limit, int reload) } } +uint64_t ptimer_get_limit(ptimer_state *s) +{ + return s->limit; +} + const VMStateDescription vmstate_ptimer = { .name = "ptimer", .version_id = 1, diff --git a/include/hw/ptimer.h b/include/hw/ptimer.h index 8ebacbb..e397db5 100644 --- a/include/hw/ptimer.h +++ b/include/hw/ptimer.h @@ -19,6 +19,7 @@ typedef void (*ptimer_cb)(void *opaque); ptimer_state *ptimer_init(QEMUBH *bh); void ptimer_set_period(ptimer_state *s, int64_t period); void ptimer_set_freq(ptimer_state *s, uint32_t freq); +uint64_t ptimer_get_limit(ptimer_state *s); void ptimer_set_limit(ptimer_state *s, uint64_t limit, int reload); uint64_t ptimer_get_count(ptimer_state *s); void ptimer_set_count(ptimer_state *s, uint64_t count);