From 35a8c5b47c7f8b64f41aede493dad4eeb120d8b2 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Thu, 21 May 2020 00:26:05 +1000 Subject: [PATCH] Timers: Don't hang when counter+target = 0 for timer1 This needs proper research into how it behaves with IRQs. --- src/core/timers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/timers.cpp b/src/core/timers.cpp index 0078ededc..85e1b820a 100644 --- a/src/core/timers.cpp +++ b/src/core/timers.cpp @@ -96,7 +96,7 @@ TickCount Timers::GetTicksUntilIRQ(u32 timer) const return std::numeric_limits::max(); TickCount ticks_until_irq = std::numeric_limits::max(); - if (cs.mode.irq_at_target) + if (cs.mode.irq_at_target && cs.counter < cs.target) ticks_until_irq = static_cast(cs.target - cs.counter); if (cs.mode.irq_on_overflow) ticks_until_irq = std::min(ticks_until_irq, static_cast(0xFFFFu - cs.counter));