arm: interrupt lock fix

This commit is contained in:
Paul Mathieu 2022-06-19 09:46:30 +02:00
parent 61b92f5faa
commit ec024adfff

View File

@ -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();
}
} }
}; };