Permalink
Browse files

hw/armv7m_nvic: Add global variable for SysTick external reference clock

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.
  • Loading branch information...
beckus committed Oct 8, 2012
1 parent c20b1e8 commit 3ff4c22bb0d5f73e7bdbb825a38027d12420fe4e
Showing with 6 additions and 1 deletion.
  1. +4 −0 hw/arm-misc.h
  2. +2 −1 hw/armv7m_nvic.c
View
@@ -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 */
View
@@ -65,14 +65,15 @@ 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)
{
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)

0 comments on commit 3ff4c22

Please sign in to comment.