mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-27 14:04:56 +01:00
remove system ceiling from lock_mut
closure
now it's impossible to do a `borrow` within that critical section as a borrow of the task priority is required (and that's already mutably borrowed by the `lock_mut` closure)
This commit is contained in:
parent
2fb00c7d85
commit
fdc060c273
1 changed files with 3 additions and 12 deletions
15
src/lib.rs
15
src/lib.rs
|
@ -8,8 +8,6 @@ extern crate typenum;
|
||||||
|
|
||||||
use core::cell::UnsafeCell;
|
use core::cell::UnsafeCell;
|
||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
#[cfg(not(thumbv6m))]
|
|
||||||
use core::ops::Sub;
|
|
||||||
|
|
||||||
use cortex_m::ctxt::Context;
|
use cortex_m::ctxt::Context;
|
||||||
use cortex_m::interrupt::Nr;
|
use cortex_m::interrupt::Nr;
|
||||||
|
@ -17,7 +15,7 @@ use cortex_m::interrupt::Nr;
|
||||||
use cortex_m::register::{basepri, basepri_max};
|
use cortex_m::register::{basepri, basepri_max};
|
||||||
use typenum::{Cmp, Equal, Unsigned};
|
use typenum::{Cmp, Equal, Unsigned};
|
||||||
#[cfg(not(thumbv6m))]
|
#[cfg(not(thumbv6m))]
|
||||||
use typenum::{B1, Greater, Less, Sub1};
|
use typenum::{Greater, Less};
|
||||||
|
|
||||||
pub use cortex_m::ctxt::Local;
|
pub use cortex_m::ctxt::Local;
|
||||||
pub use cortex_m::asm::wfi;
|
pub use cortex_m::asm::wfi;
|
||||||
|
@ -156,9 +154,8 @@ where
|
||||||
f: F,
|
f: F,
|
||||||
) -> R
|
) -> R
|
||||||
where
|
where
|
||||||
F: FnOnce(&mut T, C<Sub1<CEILING>>) -> R,
|
F: FnOnce(&mut T) -> R,
|
||||||
C<CEILING>: Ceiling,
|
C<CEILING>: Ceiling,
|
||||||
CEILING: Sub<B1>,
|
|
||||||
CEILING: Cmp<PRIORITY, Output = Greater> + Cmp<UMAX, Output = Less>
|
CEILING: Cmp<PRIORITY, Output = Greater> + Cmp<UMAX, Output = Less>
|
||||||
+ Level,
|
+ Level,
|
||||||
P<PRIORITY>: Priority,
|
P<PRIORITY>: Priority,
|
||||||
|
@ -167,13 +164,7 @@ where
|
||||||
let old_basepri = basepri::read();
|
let old_basepri = basepri::read();
|
||||||
basepri_max::write(<CEILING>::hw());
|
basepri_max::write(<CEILING>::hw());
|
||||||
barrier!();
|
barrier!();
|
||||||
let ret = f(
|
let ret = f(&mut *self.data.get());
|
||||||
&mut *self.data.get(),
|
|
||||||
C {
|
|
||||||
_0: (),
|
|
||||||
_marker: PhantomData,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
barrier!();
|
barrier!();
|
||||||
basepri::write(old_basepri);
|
basepri::write(old_basepri);
|
||||||
ret
|
ret
|
||||||
|
|
Loading…
Reference in a new issue