From 6f9bc3b6061ea102f917f911a05edb9498fbebdf Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Sat, 28 Dec 2019 19:49:02 +0100 Subject: [PATCH] common: Implement clock::enable_osc0(). --- src/common/clock.rs | 8 ++++++++ 1 file changed, 8 insertions(+) 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); -- 2.30.2