From patchwork Tue Oct 9 22:29:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Beckus X-Patchwork-Id: 190589 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8EC4F2C0088 for ; Wed, 10 Oct 2012 20:57:34 +1100 (EST) Received: from localhost ([::1]:34476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLt2i-0002qk-Nv for incoming@patchwork.ozlabs.org; Wed, 10 Oct 2012 05:57:32 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46113) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLiQR-0003jr-OZ for qemu-devel@nongnu.org; Tue, 09 Oct 2012 18:37:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TLiIy-0003Tc-HP for qemu-devel@nongnu.org; Tue, 09 Oct 2012 18:29:49 -0400 Received: from nm28-vm2.bullet.mail.ne1.yahoo.com ([98.138.91.128]:48680) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLiIy-0003Sj-6G for qemu-devel@nongnu.org; Tue, 09 Oct 2012 18:29:36 -0400 Received: from [98.138.226.180] by nm28.bullet.mail.ne1.yahoo.com with NNFMP; 09 Oct 2012 22:29:35 -0000 Received: from [98.138.84.46] by tm15.bullet.mail.ne1.yahoo.com with NNFMP; 09 Oct 2012 22:29:35 -0000 Received: from [127.0.0.1] by smtp114.mail.ne1.yahoo.com with NNFMP; 09 Oct 2012 22:29:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1349821775; bh=GiFd0c2ZNmoD4++G82Yd/zSSCyvqvU9tCuS65ssJ9K0=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References; b=bNmCdg/bNqDXLtYnt3/7fbr5Z8ZbU2AHS6p67qhrwbC+wuZFPTfA4Sqzbf5Lh967yU2rOfVJuiYXEf8NxlmXe+DZhgETHVzovLm5zBExplMfVgJFBUnR5ZVI2kmWkv1mo+SdbPi4hiaGx1at20nzx87EsmaJzntS5pPQ8pGo25s= X-Yahoo-Newman-Id: 461062.33623.bm@smtp114.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: MBe71koVM1k9US8fkdy9VIsDInD0TGRso3mJvdRSbZkWr0a _tjr4hd0zcXwu48noxGecWii.ilwI1qFcpxDSWt6xDZ6b.C1Vb8f1xikMZ6n ivSN6LCFQrYUHBgHs8Oj.wfEXEMVrDndNJ_dg.CVrN6ClwK9fxGTMONfVCJo .nzE5pq8hZqjmQ.uOTvumxQTdFa03FLa6MjGOcijpXk6ykMUSSbnYBnsCUbT OjCezSNoJnWYZoceJ2w9tRF5gaN_YqJ6HeyKFLHQGjA6Vq3qHa9dxXN7M0bk wJmpcOYSqZQLO4_.70dD0f9dtG49oZsHHWP6ztTJ_o.k7pVkSdd9RWvBXysK pbZSVRu4lg7VZPOyuxEpZoy9knkxG2_P3FiSL.UJd4Slpvy9ljxBpzR50Jdy nuUP0O..HS0rz3.01ybaXvJl_cXwll9jyBIJofCcWhGpo5J9OursL_3XISiw o4gon0f8PNvjhNw-- X-Yahoo-SMTP: 4TFaAByswBAZKf9qTZGa7_gxA._yvAE- Received: from localhost.localdomain (mikemail98-qemu@207.203.67.250 with login) by smtp114.mail.ne1.yahoo.com with SMTP; 09 Oct 2012 15:29:35 -0700 PDT From: Andre Beckus To: qemu-devel@nongnu.org Date: Tue, 9 Oct 2012 18:29:16 -0400 Message-Id: <1349821756-23125-2-git-send-email-mikemail98-qemu@yahoo.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1349821756-23125-1-git-send-email-mikemail98-qemu@yahoo.com> References: <1349821756-23125-1-git-send-email-mikemail98-qemu@yahoo.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 98.138.91.128 X-Mailman-Approved-At: Wed, 10 Oct 2012 05:57:13 -0400 Cc: peter.maydell@linaro.org, Andre Beckus Subject: [Qemu-devel] [PATCH 2/2] hw/armv7m_nvic: Add global variable for SysTick external reference clock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org Adds a new external reference clock scale variable to complement the existing system_clock_scale variable. Previously, the value was hardcoded to 1000 when calculating the SysTick scale. The new variable defaults to 1000 to maintain backward compatibility. Signed-off-by: Andre Beckus --- hw/arm-misc.h | 4 ++++ hw/armv7m_nvic.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/arm-misc.h b/hw/arm-misc.h index bdd8fec..32b19df 100644 --- a/hw/arm-misc.h +++ b/hw/arm-misc.h @@ -65,4 +65,8 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info); ticks. */ extern int system_clock_scale; +/* Multiplication factor to convert from external reference clock ticks to + * qemu timer ticks. */ +extern int external_ref_clock_scale; + #endif /* !ARM_MISC_H */ diff --git a/hw/armv7m_nvic.c b/hw/armv7m_nvic.c index 10b5954..4eaa113 100644 --- a/hw/armv7m_nvic.c +++ b/hw/armv7m_nvic.c @@ -65,6 +65,7 @@ static const uint8_t nvic_id[] = { #define SYSTICK_COUNTFLAG (1 << 16) int system_clock_scale; +int external_ref_clock_scale = 1000; /* Conversion factor from qemu timer to SysTick frequencies. */ static inline int64_t systick_scale(nvic_state *s) @@ -72,7 +73,7 @@ static inline int64_t systick_scale(nvic_state *s) if (s->systick.control & SYSTICK_CLKSOURCE) return system_clock_scale; else - return 1000; + return external_ref_clock_scale; } static void systick_reload(nvic_state *s, int reset)