From: Lucjan Bryndza <lbryndza....@icloud.com> The current implementation of timers does not work properly even in basic functionality. A counter configured to report an interrupt every 10ms reports the first interrupts after a few seconds. There are also no properly implemented count up an count down modes. This commit fixes bugs with interrupt reporting and implements the basic modes of the counter's time-base block.
Update timer realize Signed-off-by: Lucjan Bryndza <lbryndza....@icloud.com> --- hw/timer/stm32f2xx_timer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/timer/stm32f2xx_timer.c b/hw/timer/stm32f2xx_timer.c index c237b3053c..9a992231fa 100644 --- a/hw/timer/stm32f2xx_timer.c +++ b/hw/timer/stm32f2xx_timer.c @@ -394,7 +394,11 @@ static void stm32f2xx_timer_init(Object *obj) static void stm32f2xx_timer_realize(DeviceState *dev, Error **errp) { STM32F2XXTimerState *s = STM32F2XXTIMER(dev); - s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, stm32f2xx_timer_interrupt, s); + if (s->freq_hz == 0) { + error_setg(errp, "stm32f2xx_timer: Timer clock not defined"); + return; + } + s->timer = ptimer_init(stm32f2xx_timer_tick, s, PTIMER_POLICY_LEGACY); } static void stm32f2xx_timer_class_init(ObjectClass *klass, void *data) -- 2.38.5