From a3c405ddb416bbf6848c31aff73803bf45aa0cee Mon Sep 17 00:00:00 2001 From: Tam Do Date: Tue, 17 Jul 2018 19:27:44 -0500 Subject: [PATCH] allow polling interrupt flag within ISR --- simavr/sim/sim_interrupts.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/simavr/sim/sim_interrupts.c b/simavr/sim/sim_interrupts.c index b689a94..68c3bff 100644 --- a/simavr/sim/sim_interrupts.c +++ b/simavr/sim/sim_interrupts.c @@ -114,13 +114,15 @@ avr_raise_interrupt( { if (!vector || !vector->vector) return 0; + if (vector->pending) { if (vector->trace) printf("IRQ%d:I=%d already raised (enabled %d) (cycle %lld pc 0x%x)\n", vector->vector, !!avr->sreg[S_I], avr_regbit_get(avr, vector->enable), (long long int)avr->cycle, avr->pc); - return 0; + // no return - polling ISR within interrupt allowed } + if (vector->trace) printf("IRQ%d raising (enabled %d)\n", vector->vector, avr_regbit_get(avr, vector->enable)); -- 2.39.5