simulavr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Simulavr-devel] [PATCH] FIX: Remove delayed ISR calls when clearing


From: Petr Hluzín
Subject: Re: [Simulavr-devel] [PATCH] FIX: Remove delayed ISR calls when clearing the interrupt's flag.
Date: Fri, 13 Jan 2012 01:39:38 +0100

On 12 January 2012 11:39, Stan Behrens
<address@hidden> wrote:
> If interrupts are globally disabled and a condition occurs where an ISR
> would be executed, they will be delayed until interrupts are enabled
> again (SEI or RETI).
> On a real MCU the interrupt's condition is saved in hardware through the
> wiring of the MCU. In the simulator we have a sorted list for delayed
> interrupts (irqPartnerList) which has to be kept in sync with the
> simulated hardware state.
> This patch fixes a situation where the already scheduled execution
> of an ISR is not removed from the list while the hardware state changed
> through clearing the interrupt's flag.

(I guess this happens at least on ATmega8 on its Timer 2, I will be
using its datasheet.)

If I understand correctly then the line "TCCR2 = 0;" is not necessary
in the demonstration program (check-remove-delayed-isr-calls.c) - the
"TIFR = (1<<OCF2);" line should be enough to prevent firing of the
Timer 2 Output Compare interrupt.

Yes, the current code seems to work as you describe and your patch
seems to fix it. (I am not familiar with timer code.)

I will try to turn your example into a regression test and commit the
fix and test during weekend.

-- 
Petr Hluzin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]