qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Andre Beckus <mikemail98-qemu@yahoo.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, Andre Beckus <mikemail98-qemu@yahoo.com>
Subject: [Qemu-devel] [PATCH 2/2] hw/armv7m_nvic: Add global variable for SysTick external reference clock
Date: Tue,  9 Oct 2012 18:29:16 -0400	[thread overview]
Message-ID: <1349821756-23125-2-git-send-email-mikemail98-qemu@yahoo.com> (raw)
In-Reply-To: <1349821756-23125-1-git-send-email-mikemail98-qemu@yahoo.com>

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 <mikemail98-qemu@yahoo.com>
---
 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)
-- 
1.7.9.5

  reply	other threads:[~2012-10-09 22:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-09 22:29 [Qemu-devel] [PATCH 1/2] hw/armv7m_nvic: Implement byte read/write for NVIC SCB_SHPRx registers Andre Beckus
2012-10-09 22:29 ` Andre Beckus [this message]
2012-10-10 12:03   ` [Qemu-devel] [PATCH 2/2] hw/armv7m_nvic: Add global variable for SysTick external reference clock Peter Maydell
2012-10-12  6:53     ` Andre Beckus
2012-10-12  8:36       ` Peter Maydell
2012-10-10 11:32 ` [Qemu-devel] [PATCH 1/2] hw/armv7m_nvic: Implement byte read/write for NVIC SCB_SHPRx registers Peter Maydell
2012-10-12  5:43   ` Andre Beckus
2012-10-12  8:31     ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349821756-23125-2-git-send-email-mikemail98-qemu@yahoo.com \
    --to=mikemail98-qemu@yahoo.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).