From: Tam Do Date: Wed, 18 Jul 2018 00:27:44 +0000 (-0500) Subject: allow polling interrupt flag within ISR X-Git-Tag: v1.7~39^2~1 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=a3c405ddb416bbf6848c31aff73803bf45aa0cee;p=sx%2Fsimavr.git allow polling interrupt flag within ISR --- 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));