From: Tilman Sauerbeck Date: Sat, 28 Dec 2019 18:49:02 +0000 (+0100) Subject: common: Implement clock::enable_osc0(). X-Git-Url: http://git.code-monkey.de/?p=gps-watch.git;a=commitdiff_plain;h=6f9bc3b6061ea102f917f911a05edb9498fbebdf common: Implement clock::enable_osc0(). --- diff --git a/src/common/clock.rs b/src/common/clock.rs index 659e572..1189fdd 100644 --- a/src/common/clock.rs +++ b/src/common/clock.rs @@ -75,6 +75,10 @@ const MCG_S_CLKST_MASK: u8 = 3 << MCG_S_CLKST_SHIFT; const MCG_S_IREFST: u8 = 1 << 4; const MCG_S_LOCK0: u8 = 1 << 6; +const OSC0_CR: u32 = 0x40065000; + +const OSC_CR_ERCLKEN: u8 = 1 << 7; + fn configure_clkdiv() { let mut clkdiv1 = Reg32::new(SIM_CLKDIV1); @@ -169,6 +173,10 @@ pub unsafe fn reset() { switch_to_fbe(); } +pub unsafe fn enable_osc0() { + Reg8::new(OSC0_CR).write(OSC_CR_ERCLKEN); +} + pub unsafe fn configure_usb() { let mut scgc4 = Reg32::new(SIM_SCGC4); scgc4.modify(|v| v & !SIM_SCGC4_USBOTG);