On 12/05/2011 08:40 PM, Peter Maydell wrote:
-/* Return conversion factor from mpcore timer ticks to qemu timer ticks. */
-static inline uint32_t mpcore_timer_scale(mpcore_timer_state *s)
-{
- return (((s->control>> 8)& 0xff) + 1) * 10;
-}
Dear Peter, could you please explain why such a conversion used to gain
qemu ticks from mpcore timer ticks, actually why to multiply by 10?
AFAIK by default to get timer ticks QEMU uses host's time. Also cortex
documentation says that mpcore timer tick interval should be calculated
in this way: ((prescaler + 1) * (load + 1))/freq
Later mpcore_timer_reload uses this code to update QEMU ticks:
- s->tick += (int64_t)s->count * mpcore_timer_scale(s);
I see that equation has transformed to: (prescaler * load) * 10
As I understand, this means that arm core internal timer is working at
frequency 10 times less (in ideal) then host.
--
Kind regards,
Evgeny Voevodin,
Leading Software Engineer,
ASWG, Moscow R&D center, Samsung Electronics
e-mail: e.voevo...@samsung.com