projects
/
gps-watch.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8b09b78
)
common: Implement clock::enable_osc0().
author
Tilman Sauerbeck
<tilman@code-monkey.de>
Sat, 28 Dec 2019 18:49:02 +0000
(19:49 +0100)
committer
Tilman Sauerbeck
<tilman@code-monkey.de>
Sun, 5 Jan 2020 19:38:11 +0000
(20:38 +0100)
src/common/clock.rs
patch
|
blob
|
history
diff --git
a/src/common/clock.rs
b/src/common/clock.rs
index 659e572d3fe26d7baaa3547e5c7ac9b00a2e1719..1189fdd58a45ac49f9de05d39f5ae9c8fc11b4ec 100644
(file)
--- 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);