mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-25 21:19:35 +01:00
unlock the DWT, if locked, when using the timer queue
This commit is contained in:
parent
4df6292e1e
commit
f5de8307b2
1 changed files with 9 additions and 0 deletions
|
@ -2024,6 +2024,15 @@ fn pre_init(ctxt: &Context, app: &App, analysis: &Analysis) -> proc_macro2::Toke
|
||||||
|
|
||||||
// Set the cycle count to 0 and disable it while `init` executes
|
// Set the cycle count to 0 and disable it while `init` executes
|
||||||
if cfg!(feature = "timer-queue") {
|
if cfg!(feature = "timer-queue") {
|
||||||
|
exprs.push(quote!(
|
||||||
|
// unlock the DWT, if software locked
|
||||||
|
// See ARM CoreSight Architecture Specification v3.0, section B2.3.10
|
||||||
|
// 1 << 0 = Software lock mechanism is implemented.
|
||||||
|
// 1 << 1 = Writing to the other registers in the component is blocked
|
||||||
|
if p.DWT.lsr.read() & 0b11 == 0b11 {
|
||||||
|
p.DWT.lar.write(0xC5ACCE55);
|
||||||
|
}
|
||||||
|
));
|
||||||
exprs.push(quote!(p.DWT.ctrl.modify(|r| r & !1);));
|
exprs.push(quote!(p.DWT.ctrl.modify(|r| r & !1);));
|
||||||
exprs.push(quote!(p.DWT.cyccnt.write(0);));
|
exprs.push(quote!(p.DWT.cyccnt.write(0);));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue