Skip to content

Commit 8d3b35e

Browse files
committed
Finish implementing the timer update interrupt
Most of the logic was already there, but the update interrupt flag needed to be connected to the NVIC. Note that the trigger interrupt flag is still not connected to the NVIC, so trigger interrupts will not work.
1 parent cfe9232 commit 8d3b35e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

hw/timer/stm32_timer.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,19 @@ static void stm32_timer_update(Stm32Timer *s)
194194
}
195195
}
196196

197+
static void stm32_timer_update_UIF(Stm32Timer *s, uint8_t value) {
198+
s->sr &= ~0x1; /* update interrupt flag in status reg */
199+
s->sr |= 0x1;
200+
201+
qemu_set_irq(s->irq, value);
202+
}
203+
197204
static void stm32_timer_tick(void *opaque)
198205
{
199206
Stm32Timer *s = (Stm32Timer *)opaque;
200207
DPRINTF("%s Alarm raised\n", stm32_periph_name(s->periph));
201208
s->itr = 1;
202-
s->sr |= 0x1; /* update interrupt flag in status reg */
209+
stm32_timer_update_UIF(s, 1);
203210

204211
if (s->countMode == TIMER_UP_COUNT)
205212
{
@@ -332,6 +339,7 @@ static void stm32_timer_write(void * opaque, hwaddr offset,
332339
case TIMER_SR_OFFSET:
333340
s->sr ^= (value ^ 0xFFFF);
334341
s->sr &= 0x1eFF;
342+
stm32_timer_update_UIF(s, s->sr & 0x1);
335343
DPRINTF("%s sr = %x\n", stm32_periph_name(s->periph), s->sr);
336344
break;
337345
case TIMER_EGR_OFFSET:

0 commit comments

Comments
 (0)