summaryrefslogtreecommitdiffstats
path: root/asm.h
blob: f638d584527fbf0fb00b67c8890bc482f29b46e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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 */