synth/arm/lock.h
Paul Mathieu f274749050 arm: add host uart driver tests
All host tests currently pass
Some async refactors may not work well on device, will try later
2023-06-02 23:33:01 -07:00

23 lines
439 B
C++

#pragma once
#ifndef __x86_64__
#include "aum1_cm1.h"
struct InterruptLock {
uint32_t old_primask;
InterruptLock() : old_primask(__get_PRIMASK()) { __disable_irq(); }
~InterruptLock() {
__set_PRIMASK(old_primask);
}
};
#else // __x86_64__
#include <mutex>
struct InterruptLock {
static std::recursive_mutex m;
InterruptLock() { m.lock(); }
~InterruptLock() { m.unlock(); }
};
#endif // __x86_64__