qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/2] hw/armv7m_nvic: Add global variable for Sys


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 2/2] hw/armv7m_nvic: Add global variable for SysTick external reference clock
Date: Wed, 10 Oct 2012 13:03:15 +0100

On 9 October 2012 23:29, Andre Beckus <address@hidden> wrote:
> 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 <address@hidden>

Hi. Do you have a use planned for this (new board maybe, or some
change to the stellaris board)? I generally prefer to put this kind
of patch in at the same time as the patches which make use of the
new feature, rather than putting them into the codebase without
any immediate users.

In this particular case, the system_clock_scale variable is a nasty
hack which I would like to get rid of. I think the right way to
implement the systick scaling/calibration is that instead of a
random global int, the NVIC exposes a GPIO input which corresponds
to the hardware's STCALIB input lines (which set the TENMS field
in SYST_CALIB), and the stellaris hardware sets that line via
qemu_set_irq().

I think that if the board provides an external reference clock,
then the scale should (as well as being used in the calculations,
as your patch does) appear in the return value form SYST_CALIB
(currently we return a hardcoded 10000 value.)

We should check what the stellaris code is doing when it sets
system_clock_scale -- I guess that's the actual system clock,
not the reference clock (if the stellaris even provides one).
The hardware doesn't have an explicit signal input to provide
that but we should probably fake one up to avoid the global.

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]