all
This commit is contained in:
22
RTOS_Labs_common/CriticalSection.s
Normal file
22
RTOS_Labs_common/CriticalSection.s
Normal file
@@ -0,0 +1,22 @@
|
||||
.text
|
||||
.thumb
|
||||
.align 2
|
||||
.global StartCritical
|
||||
.global EndCritical
|
||||
|
||||
// *********** StartCritical ************************
|
||||
//make a copy of previous I bit, disable interrupts
|
||||
// inputs : none
|
||||
// outputs : R0=previous I bit
|
||||
StartCritical:
|
||||
MRS R0, PRIMASK // save old status
|
||||
CPSID I // mask all (except faults)
|
||||
BX LR
|
||||
|
||||
// *********** EndCritical ************************
|
||||
// using the copy of previous I bit, restore I bit to previous value
|
||||
// inputs : R0=previous I bit
|
||||
// outputs : none
|
||||
EndCritical:
|
||||
MSR PRIMASK, R0
|
||||
BX LR
|
||||
Reference in New Issue
Block a user