aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs44
-rw-r--r--src/ostimer.rs5
-rw-r--r--src/rtc.rs4
3 files changed, 27 insertions, 26 deletions
diff --git a/src/lib.rs b/src/lib.rs
index ec2cb31e7..1bf54a98b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -59,29 +59,29 @@ pub fn init(cfg: crate::config::Config) -> Peripherals {
59 peripherals 59 peripherals
60} 60}
61 61
62/// Optional hook called by cortex-m-rt before RAM init. 62// /// Optional hook called by cortex-m-rt before RAM init.
63/// We proactively mask and clear all NVIC IRQs to avoid wedges from stale state 63// /// We proactively mask and clear all NVIC IRQs to avoid wedges from stale state
64/// left by soft resets/debug sessions. 64// /// left by soft resets/debug sessions.
65/// 65// ///
66/// NOTE: Manual VTOR setup is required for RAM execution. The cortex-m-rt 'set-vtor' 66// /// NOTE: Manual VTOR setup is required for RAM execution. The cortex-m-rt 'set-vtor'
67/// feature is incompatible with our setup because it expects __vector_table to be 67// /// feature is incompatible with our setup because it expects __vector_table to be
68/// defined differently than how our RAM-based linker script arranges it. 68// /// defined differently than how our RAM-based linker script arranges it.
69#[no_mangle] 69// #[no_mangle]
70pub unsafe extern "C" fn __pre_init() { 70// pub unsafe extern "C" fn __pre_init() {
71 // Set the VTOR to point to the interrupt vector table in RAM 71// // Set the VTOR to point to the interrupt vector table in RAM
72 // This is required since code runs from RAM on this MCU 72// // This is required since code runs from RAM on this MCU
73 crate::interrupt::vtor_set_ram_vector_base(0x2000_0000 as *const u32); 73// crate::interrupt::vtor_set_ram_vector_base(0x2000_0000 as *const u32);
74 74
75 // Mask and clear pending for all NVIC lines (0..127) to avoid stale state across runs. 75// // Mask and clear pending for all NVIC lines (0..127) to avoid stale state across runs.
76 let nvic = &*cortex_m::peripheral::NVIC::PTR; 76// let nvic = &*cortex_m::peripheral::NVIC::PTR;
77 for i in 0..4 { 77// for i in 0..4 {
78 // 4 words x 32 = 128 IRQs 78// // 4 words x 32 = 128 IRQs
79 nvic.icer[i].write(0xFFFF_FFFF); 79// nvic.icer[i].write(0xFFFF_FFFF);
80 nvic.icpr[i].write(0xFFFF_FFFF); 80// nvic.icpr[i].write(0xFFFF_FFFF);
81 } 81// }
82 // Do NOT touch peripheral registers here: clocks may be off and accesses can fault. 82// // Do NOT touch peripheral registers here: clocks may be off and accesses can fault.
83 crate::interrupt::clear_default_handler_snapshot(); 83// crate::interrupt::clear_default_handler_snapshot();
84} 84// }
85 85
86/// Internal helper to dispatch a type-level interrupt handler. 86/// Internal helper to dispatch a type-level interrupt handler.
87#[inline(always)] 87#[inline(always)]
diff --git a/src/ostimer.rs b/src/ostimer.rs
index ebdf7d45d..cd5451b53 100644
--- a/src/ostimer.rs
+++ b/src/ostimer.rs
@@ -534,7 +534,10 @@ pub mod time_driver {
534 bin_to_gray, now_ticks_read, Regs, ALARM_ACTIVE, ALARM_CALLBACK, ALARM_FLAG, ALARM_TARGET_TIME, 534 bin_to_gray, now_ticks_read, Regs, ALARM_ACTIVE, ALARM_CALLBACK, ALARM_FLAG, ALARM_TARGET_TIME,
535 EVTIMER_HI_MASK, EVTIMER_HI_SHIFT, LOW_32_BIT_MASK, 535 EVTIMER_HI_MASK, EVTIMER_HI_SHIFT, LOW_32_BIT_MASK,
536 }; 536 };
537 use crate::{clocks::{enable_and_reset, periph_helpers::{OsTimerConfig, OstimerClockSel}, PoweredClock}, pac, peripherals::OSTIMER0}; 537 use crate::clocks::periph_helpers::{OsTimerConfig, OstimerClockSel};
538 use crate::clocks::{enable_and_reset, PoweredClock};
539 use crate::pac;
540 use crate::peripherals::OSTIMER0;
538 pub struct Driver; 541 pub struct Driver;
539 static TIMER_WAKER: AtomicWaker = AtomicWaker::new(); 542 static TIMER_WAKER: AtomicWaker = AtomicWaker::new();
540 543
diff --git a/src/rtc.rs b/src/rtc.rs
index f526e82ac..b750a97ea 100644
--- a/src/rtc.rs
+++ b/src/rtc.rs
@@ -163,9 +163,7 @@ impl<'a, I: Instance> Rtc<'a, I> {
163 163
164 // The RTC is NOT gated by the MRCC, but we DO need to make sure the 16k clock 164 // The RTC is NOT gated by the MRCC, but we DO need to make sure the 16k clock
165 // on the vsys domain is active 165 // on the vsys domain is active
166 let clocks = with_clocks(|c| { 166 let clocks = with_clocks(|c| c.clk_16k_vsys.clone());
167 c.clk_16k_vsys.clone()
168 });
169 match clocks { 167 match clocks {
170 None => panic!("Clocks have not been initialized"), 168 None => panic!("Clocks have not been initialized"),
171 Some(None) => panic!("Clocks initialized, but clk_16k_vsys not active"), 169 Some(None) => panic!("Clocks initialized, but clk_16k_vsys not active"),