diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2022-09-10 17:10:09 +0200 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2022-09-10 17:10:09 +0200 |
commit | 2d75a9be32e2510ff32d331c33178c4625a53054 (patch) | |
tree | 52375aa3a1be6468184733ab4ea50d232001d9c7 /cortex_m | |
parent | 59b94427c591e7ec4603b2d9dd6753b1b0927175 (diff) |
riscv: Add critical section.
Diffstat (limited to 'cortex_m')
-rw-r--r-- | cortex_m/critical_section.h | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/cortex_m/critical_section.h b/cortex_m/critical_section.h deleted file mode 100644 index 6b611a8..0000000 --- a/cortex_m/critical_section.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include <cstdint> - -struct critical_section { - uint32_t primask; - - critical_section() { - asm volatile("mrs %0, primask" : "=r" (primask)); - - asm volatile("cpsid i"); - - asm volatile("dmb"); - } - - ~critical_section() { - asm volatile("dmb"); - - asm volatile("msr primask, %0" :: "r" (primask)); - } -}; |