Message ID | 170152443229.18048.53824064267512246-4@git.sr.ht |
---|---|
State | New |
Headers | show |
Series | Fix malfunctioning of T2-T5 timers on the STM32 platform | expand |
diff --git a/hw/timer/stm32f2xx_timer.c b/hw/timer/stm32f2xx_timer.c index 0c5586cb8b..9261090b84 100644 --- a/hw/timer/stm32f2xx_timer.c +++ b/hw/timer/stm32f2xx_timer.c @@ -59,6 +59,16 @@ static uint32_t stm32f2xx_timer_get_count(STM32F2XXTimerState *s) } +static void stm32f2xx_timer_set_count(STM32F2XXTimerState *s, uint32_t cnt) +{ + if (s->count_mode == TIMER_UP_COUNT) { + ptimer_set_count(s->timer, s->tim_arr - (cnt & 0xffff)); + } else { + ptimer_set_count(s->timer, cnt & 0xffff); + } +} + + static void stm32f2xx_timer_reset(DeviceState *dev) { STM32F2XXTimerState *s = STM32F2XXTIMER(dev);