1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#[inline]
pub fn read() -> u8 {
match () {
#[cfg(all(cortex_m, feature = "inline-asm"))]
() => {
let r: u32;
unsafe {
asm!("mrs $0, BASEPRI" : "=r"(r) ::: "volatile");
}
r as u8
}
#[cfg(all(cortex_m, not(feature = "inline-asm")))]
() => unsafe {
extern "C" {
fn __basepri_r() -> u8;
}
__basepri_r()
},
#[cfg(not(cortex_m))]
() => unimplemented!(),
}
}
#[inline]
pub unsafe fn write(_basepri: u8) {
match () {
#[cfg(all(cortex_m, feature = "inline-asm"))]
() => match () {
#[cfg(not(feature = "cm7-r0p1"))]
() => asm!("msr BASEPRI, $0" :: "r"(_basepri) : "memory" : "volatile"),
#[cfg(feature = "cm7-r0p1")]
() => ::interrupt::free(
|_| asm!("msr BASEPRI, $0" :: "r"(_basepri) : "memory" : "volatile"),
),
},
#[cfg(all(cortex_m, not(feature = "inline-asm")))]
() => match () {
#[cfg(not(feature = "cm7-r0p1"))]
() => {
extern "C" {
fn __basepri_w(_: u8);
}
__basepri_w(_basepri);
}
#[cfg(feature = "cm7-r0p1")]
() => {
extern "C" {
fn __basepri_w_cm7_r0p1(_: u8);
}
__basepri_w_cm7_r0p1(_basepri);
}
},
#[cfg(not(cortex_m))]
() => unimplemented!(),
}
}