Dmitry K. wrote:
Hi all.
User's Guide gave next code for atomic 32-bit operation
(slau049d.pdf page 75):
dint
nop
mov counthi,r5
mov countlo,r6
eint
Note: Disable Interrupt
If any code sequence needs to be protected from interruption, the DINT
should be executed at least one instruction before the beginning of the
uninterruptible sequence, or should be followed by a NOP instruction.
it's no misprint, it's an important feature.
interrupts are delayed by one instruction for a good reason, see note on
page 28 (2-10)
And of quote.
Question 1.
Interrupt is possible after `dint'. It is clear.
Is it possible interrupt between `nop' and first `mov'? Description
yes, that's the reason you have to use that extra instruction
of `eint' on next page says about interrupt absence after `eint' only,
and it do not say about what happens after second instruction.
Is anybody check this?
both eint and dint have a delay of one instruction until they take effect
Question 2.
Why is `eint' placed after second `mov' instruction?
It is possible to place it between two `mov's to decrease interrupt
desable time.
i'd say so, but it's not obvious for someone else that reads the code
(or yourself after two weeks ;-) . i'd make some comments in the code
when using such tricks.
chris