My Assembly language code for turning interrupts off is typically like
the following snippet:
.
.
.
move SR,y0 bfset #$0200,SR move a0,x:(R2)+ move a1,x:(R2) move y0,SR
.
.
.
Where R2, a0, and a1 are setup before the move sr,y0
instruction.
Jerry
Hi, I need a mutual exclusion
mechanism that allows access to two global variables as an atomic
unit. To prevent code within an ISR from accessing one of the
variables during this short period, I would like to mask IPL 0 interrupts
while I access the pair and then unmask IPL 0 interrupts again when
done. I would also like to put this code into a function that
automatically determines if masking is already in affect (SR bit $0200 is
set) so that the IPL 0 mask in the SR can be restored to its original
state. This would allow the function to be called from inside or
outside ISRs without the user keeping track of IPL 0 masking. Is it possible to use a BFSET instruction to set the IPL 0
mask bit in the SR and then test whether this bit was actually
changed? This would then allow me to restore the mask after my
"critical section" of code. So far I have not been suscessful in my
attempts to do this, so I am wondering if anyone has a mechanism like this
working. I am using an up to date version of
Metrowerks with the 56F807 DSP.
Thanks,
Aaron
_____________________________________ Note: If you do a simple "reply" with your email client, only the author of
this message will receive your answer. You need to do a "reply all" if you
want your answer to be distributed to the entire group.
_____________________________________ About this discussion group:
To Join: m...@yahoogroups.com
To Post:
m...@yahoogroups.com
To Leave: m...@yahoogroups.com
Archives: http://www.yahoogroups.com/group/motoroladsp
More Groups:
http://www.dsprelated.com/groups.php3
">Yahoo! Terms
of Service.
|