blob: b3a4b9c7e276328b35062cb5bee06ee8c0048238 (
plain) (
blame)
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
|
#![no_main]
#[rtic_macros::mock_app(device = mock)]
mod app {
#[shared]
struct Shared {
// An exclusive, early resource
#[lock_free]
e1: u32,
// An exclusive, late resource
#[lock_free]
e2: u32,
}
#[local]
struct Local {}
#[init]
fn init(_: init::Context) -> (Shared, Local) {}
// e2 ok
#[idle(shared = [e2])]
fn idle(cx: idle::Context) -> ! {
debug::exit(debug::EXIT_SUCCESS);
loop {}
}
// e1 rejected (not lock_free)
#[task(binds = UART0, priority = 1, shared = [e1])]
fn uart0(cx: uart0::Context) {
*cx.resources.e1 += 10;
}
// e1 rejected (not lock_free)
#[task(binds = UART1, priority = 2, shared = [e1])]
fn uart1(cx: uart1::Context) {}
}
|