[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH qemu.git 08/11] hw/timer/imx_epit: simplify CR.ENMOD handling
From: |
~axelheider |
Subject: |
[PATCH qemu.git 08/11] hw/timer/imx_epit: simplify CR.ENMOD handling |
Date: |
Sat, 29 Oct 2022 18:41:08 +0200 |
From: Axel Heider <axel.heider@hensoldt.net>
Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
---
hw/timer/imx_epit.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c
index bba9c87cd4..5915d4b3d4 100644
--- a/hw/timer/imx_epit.c
+++ b/hw/timer/imx_epit.c
@@ -198,13 +198,10 @@ static void imx_epit_write_cr(IMXEPITState *s, uint32_t
value)
if (freq && (s->cr & CR_EN) && !(oldcr & CR_EN)) {
if (s->cr & CR_ENMOD) {
- if (s->cr & CR_RLD) {
- ptimer_set_limit(s->timer_reload, s->lr, 1);
- ptimer_set_limit(s->timer_cmp, s->lr, 1);
- } else {
- ptimer_set_limit(s->timer_reload, EPIT_TIMER_MAX, 1);
- ptimer_set_limit(s->timer_cmp, EPIT_TIMER_MAX, 1);
- }
+ uint64_t limit = (s->cr & CR_RLD) ? s->lr : EPIT_TIMER_MAX;
+ /* set new limit and also set timer to this value right now */
+ ptimer_set_limit(s->timer_reload, limit, 1);
+ ptimer_set_limit(s->timer_cmp, limit, 1);
}
imx_epit_reload_compare_timer(s);
--
2.34.5
- Re: [PATCH qemu.git 02/11] hw/timer/imx_epit: improve comments, (continued)
- [PATCH qemu.git 04/11] hw/timer/imx_epit: remove explicit fields cnt and freq, ~axelheider, 2022/10/30
- [PATCH qemu.git 03/11] hw/timer/imx_epit: factor out register write handlers, ~axelheider, 2022/10/30
- [PATCH qemu.git 06/11] hw/timer/imx_epit: software reset clears the interrupt, ~axelheider, 2022/10/30
- [PATCH qemu.git 09/11] hw/timer/imx_epit: cleanup CR defines, ~axelheider, 2022/10/30
- [PATCH qemu.git 01/11] hw/timer/imx_epit: fix typo in comment, ~axelheider, 2022/10/30
- [PATCH qemu.git 05/11] hw/timer/imx_epit: simplify interrupt logic, ~axelheider, 2022/10/30
- [PATCH qemu.git 08/11] hw/timer/imx_epit: simplify CR.ENMOD handling,
~axelheider <=
- [PATCH qemu.git 07/11] hw/timer/imx_epit: do not persist CR.SWR bit, ~axelheider, 2022/10/30
- [PATCH qemu.git 10/11] hw/timer/imx_epit: fix compare timer update, ~axelheider, 2022/10/30
- [PATCH qemu.git 11/11] hw/timer/imx_epit: rework CR write handling, ~axelheider, 2022/10/30