arm: interrupt lock fix
This commit is contained in:
parent
61b92f5faa
commit
ec024adfff
@ -3,13 +3,11 @@
|
|||||||
#include "aum1_cm1.h"
|
#include "aum1_cm1.h"
|
||||||
|
|
||||||
struct InterruptLock {
|
struct InterruptLock {
|
||||||
bool was_locked;
|
uint32_t old_primask;
|
||||||
|
|
||||||
InterruptLock() : was_locked(__get_PRIMASK() != 0) { __disable_irq(); }
|
InterruptLock() : old_primask(__get_PRIMASK()) { __disable_irq(); }
|
||||||
|
|
||||||
~InterruptLock() {
|
~InterruptLock() {
|
||||||
if (!was_locked) {
|
__set_PRIMASK(old_primask);
|
||||||
__enable_irq();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user