Philip Sambles wrote:
Chris Liechti wrote:
also a note about dint(): dint/eint, on purpose, lock/enable the
interrupts one instruction later (thats used for eint; reti, without
filling the stack with reocouring ints, see slau049, NMI/WDT int)
I see why this is the case (you don't want the next interrupt to occur before
the stack is
cleaned) but I'm not sure where this is needed as the first thing a reti does
is pop the
status register which restores the state of GIE.
not all interrupts are switched off with clearing GIE, the Non Maskable
Interrupt is indeed not maskable (but it can be disabled). therefore you
need the feature of the delayed interrupt enabling, bit it looks like
its a general property of enabling/disabling interrupts, that they have
one instruction delay (not just eint and dint).
It seems to me that eint; reti; doesn't do what you would expect, or am I
missing something
here?
my bad, that was a pretty bad example. as you correctly said, reti does
pop SR from the stack and restores the interrupt state anyway.
i had the exaples from the NMI/WDT interrupt in mind. there you have to
enable the interrupt source just before reti.
chris