1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-27 01:48:17 +00:00
trezor-firmware/core/embed/trezorhal/supervise.h
2019-12-15 08:43:00 +00:00

23 lines
715 B
C

// supervisor call functions
#define SVC_ENABLE_IRQ 0
#define SVC_DISABLE_IRQ 1
#define SVC_SET_PRIORITY 2
inline void svc_enableIRQ(uint32_t IRQn) {
register uint32_t r0 __asm__("r0") = IRQn;
__asm__ __volatile__("svc %0" ::"i"(SVC_ENABLE_IRQ), "r"(r0) : "memory");
}
inline void svc_disableIRQ(uint32_t IRQn) {
register uint32_t r0 __asm__("r0") = IRQn;
__asm__ __volatile__("svc %0" ::"i"(SVC_DISABLE_IRQ), "r"(r0) : "memory");
}
inline void svc_setpriority(uint32_t IRQn, uint32_t priority) {
register uint32_t r0 __asm__("r0") = IRQn;
register uint32_t r1 __asm__("r1") = priority;
__asm__ __volatile__("svc %0" ::"i"(SVC_SET_PRIORITY), "r"(r0), "r"(r1)
: "memory");
}