projects
/
gps-watch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
common: Implement the "ls" shell command.
[gps-watch.git]
/
src
/
common
/
clock.rs
diff --git
a/src/common/clock.rs
b/src/common/clock.rs
index 86aa3efb884175e399aa4fe9e9269237f6f3c341..1189fdd58a45ac49f9de05d39f5ae9c8fc11b4ec 100644
(file)
--- a/
src/common/clock.rs
+++ b/
src/common/clock.rs
@@
-75,11
+75,15
@@
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 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);
fn configure_clkdiv() {
let mut clkdiv1 = Reg32::new(SIM_CLKDIV1);
- clkdiv1.write(
1 << SIM_CLKDIV1_OUTDIV4_SHIFT);
-
clkdiv1.modify(|v| v
| (1 << SIM_CLKDIV1_OUTDIV1_SHIFT));
+ clkdiv1.write(
(1 << SIM_CLKDIV1_OUTDIV4_SHIFT)
+
| (1 << SIM_CLKDIV1_OUTDIV1_SHIFT));
}
fn switch_to_fbe() {
}
fn switch_to_fbe() {
@@
-164,6
+168,15
@@
pub unsafe fn configure() {
});
}
});
}
+pub unsafe fn reset() {
+ switch_to_pbe();
+ 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);
pub unsafe fn configure_usb() {
let mut scgc4 = Reg32::new(SIM_SCGC4);
scgc4.modify(|v| v & !SIM_SCGC4_USBOTG);