Atomic Read/Write of SR

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Atomic Read/Write of SR

1,125 Views
BTaylor
Contributor III
What is the best way to perform the following operations in an atomic manner: ?

- Read current value for SR[I] and retain it so that it can be restored later
- Set SR[I] to some specified value

Note that I do not wish to change any of the SR bits other than those associated with SR[I].

I am hoping that there is an easier way to do this than to:
- Call STRLDSR with a value of 0x2700 (thus disabling interrupts)
- Pop the SR that STRLDSR pushed on to the stack
- Modify bits 8-10 of the popped value to match the desired SR[I]
- Set SR to the modified value

Thanks.
Labels (1)
0 Kudos
Reply
1 Reply

382 Views
stzari
Contributor III
Hi,

depending on the processor you use, did you have a look at the STLDSR instruction ?
This instruction is only available on ISA_A+ and ISA_C instruction sets. For further information you can look into the Coldfire Programmer's Ref. Manual.

HTH
 stzari
0 Kudos
Reply