mirror of
https://github.com/qemu/qemu.git
synced 2026-11-10 22:04:44 +00:00
RM0090 timers count from 0 to ARR inclusive, with a period of ARR + 1, including ARR == 0. Wrap CNT while running, arm an absolute expiry, and delete the QEMU timer when CEN is cleared. Freeze CNT in stopped_cnt while CEN is clear so TIM_CNT writes while stopped are preserved and resume on enable. Return a stopped CNT verbatim even when it is greater than ARR. Reset also deletes any pending event. Migration compatibility is not required for these machine types, so use version 2 as both the current and minimum VMState version and serialize stopped_cnt directly. Add qtests covering the timer period, prescaler, stopped CNT, ARR == 0, update generation, and system reset. Signed-off-by: Manuele Conti <manuele.conti@archimede-energia.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>