From 2aa6d1298fb572b1f4a6cfd6b1af25671627661e Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Sun, 4 Oct 2020 19:07:34 +0800 Subject: [PATCH] shell: timer: add timer function We're now a preemptive kernel, yay! Signed-off-by: Sean Cross --- examples/shell/src/timer.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/shell/src/timer.rs b/examples/shell/src/timer.rs index 3e3ec9786..1b750b126 100644 --- a/examples/shell/src/timer.rs +++ b/examples/shell/src/timer.rs @@ -1,6 +1,6 @@ #[cfg(baremetal)] -const SYSTEM_CLOCK_FREQUENCY: u32 = 12_000_000; +const SYSTEM_CLOCK_FREQUENCY: u32 = 100_000_000; #[cfg(baremetal)] const TIMER_BASE: usize = 0xF000_3000; @@ -21,7 +21,7 @@ pub fn init() { use xous::{MemoryAddress, MemorySize}; println!("Allocating timer..."); xous::rsyscall(xous::SysCall::MapMemory( - MemoryAddress::new(TIMER_BASE), + MemoryAddress::new(utra::HW_TIMER0_BASE), MemoryAddress::new(TIMER_BASE), MemorySize::new(4096).unwrap(), xous::MemoryFlags::R | xous::MemoryFlags::W, @@ -35,7 +35,7 @@ pub fn init() { )) .expect("timer: couldn't claim interrupt"); - let ms = 10; // tick every 10 ms + let ms = 100; // tick every 100 ms en(false); load(SYSTEM_CLOCK_FREQUENCY / 1_000 * ms); reload(SYSTEM_CLOCK_FREQUENCY / 1_000 * ms);