Message ID | 1436176775-29545-3-git-send-email-peter.maydell@linaro.org |
---|---|
State | Accepted |
Commit | a7ffaf5c96e26820edffa94eeac766fe60bfdd31 |
Headers | show |
diff --git a/hw/timer/cadence_ttc.c b/hw/timer/cadence_ttc.c index d46db3c..35bc880 100644 --- a/hw/timer/cadence_ttc.c +++ b/hw/timer/cadence_ttc.c @@ -208,15 +208,14 @@ static void cadence_timer_sync(CadenceTimerState *s) s->reg_intr |= (2 << i); } } + if ((x < 0) || (x >= interval)) { + s->reg_intr |= (s->reg_count & COUNTER_CTRL_INT) ? + COUNTER_INTR_IV : COUNTER_INTR_OV; + } while (x < 0) { x += interval; } s->reg_value = (uint32_t)(x % interval); - - if (s->reg_value != x) { - s->reg_intr |= (s->reg_count & COUNTER_CTRL_INT) ? - COUNTER_INTR_IV : COUNTER_INTR_OV; - } cadence_timer_update(s); }