summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asm.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/asm.h b/asm.h
index f6489e6..f638d58 100644
--- a/asm.h
+++ b/asm.h
@@ -1,7 +1,24 @@
#ifndef ASM_H
#define ASM_H
+#include <stdint.h>
+
#define CLI() __asm__ volatile ("cpsid i")
#define STI() __asm__ volatile ("cpsie i")
+#define WFI() __asm__ volatile ("wfi")
+
+static inline uint32_t get_BASEPRI(void)
+{
+ uint32_t ret;
+
+ __asm__ volatile ("mrs %0, basepri" :"=r"(ret));
+
+ return ret;
+}
+
+static inline void set_BASEPRI(uint32_t p)
+{
+ __asm__ volatile ("msr basepri, %0" ::"r"(p));
+}
#endif /* ASM_H */