diff options
| author | Emil Fresk <emil.fresk@gmail.com> | 2021-07-08 23:18:44 +0200 |
|---|---|---|
| committer | Emil Fresk <emil.fresk@gmail.com> | 2021-07-08 23:18:44 +0200 |
| commit | 8f3704378295fe8007290dbddbc1f4946ac599f9 (patch) | |
| tree | 3969e6f6bccfd16e187d7d5ccd56d269d3d9bb9e /examples/t-resource.rs | |
| parent | 98d2af9d73da56910c8bb6cb662fbc4d609a704a (diff) | |
Cleanup from review (needs releases to compile)
Diffstat (limited to 'examples/t-resource.rs')
| -rw-r--r-- | examples/t-resource.rs | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/examples/t-resource.rs b/examples/t-resource.rs deleted file mode 100644 index 2732491..0000000 --- a/examples/t-resource.rs +++ /dev/null @@ -1,85 +0,0 @@ -//! [compile-pass] Check code generation of shared resources - -#![deny(unsafe_code)] -#![deny(warnings)] -#![no_main] -#![no_std] - -use panic_semihosting as _; - -#[rtic::app(device = lm3s6965)] -mod app { - #[shared] - struct Shared { - o2: u32, // idle - o3: u32, // EXTI0 - o4: u32, // idle - o5: u32, // EXTI1 - s1: u32, // idle & uart0 - s2: u32, // uart0 & uart1 - s3: u32, // idle & uart0 - } - - #[local] - struct Local {} - - #[init] - fn init(_: init::Context) -> (Shared, Local, init::Monotonics) { - ( - Shared { - o2: 0, - o3: 0, - o4: 0, - o5: 0, - s1: 0, - s2: 0, - s3: 0, - }, - Local {}, - init::Monotonics(), - ) - } - - #[idle(shared = [o2, &o4, s1, &s3])] - fn idle(mut c: idle::Context) -> ! { - // owned by `idle` == `&'static mut` - let _: shared_resources::o2 = c.shared.o2; - - // owned by `idle` == `&'static` if read-only - let _: &u32 = c.shared.o4; - - // shared with `idle` == `Mutex` - c.shared.s1.lock(|_| {}); - - // `&` if read-only - let _: &u32 = c.shared.s3; - - loop { - cortex_m::asm::nop(); - } - } - - #[task(binds = UART0, shared = [o3, s1, s2, &s3])] - fn uart0(c: uart0::Context) { - // owned by interrupt == `&mut` - let _: shared_resources::o3 = c.shared.o3; - - // no `Mutex` proxy when access from highest priority task - let _: shared_resources::s1 = c.shared.s1; - - // no `Mutex` proxy when co-owned by cooperative (same priority) tasks - let _: shared_resources::s2 = c.shared.s2; - - // `&` if read-only - let _: &u32 = c.shared.s3; - } - - #[task(binds = UART1, shared = [s2, &o5])] - fn uart1(c: uart1::Context) { - // owned by interrupt == `&` if read-only - let _: &u32 = c.shared.o5; - - // no `Mutex` proxy when co-owned by cooperative (same priority) tasks - let _: shared_resources::s2 = c.shared.s2; - } -} |
