Skip to content

Commit

Permalink
The initialize_sys_tick function takes Hz not MHz
Browse files Browse the repository at this point in the history
  • Loading branch information
KoviRobi authored and cbiffle committed Mar 2, 2024
1 parent 29bfcf0 commit c98c6b5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions os/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ static TICK: AtomicU32 = AtomicU32::new(0);
static EPOCH: AtomicU32 = AtomicU32::new(0);

/// Sets up the tick counter for 1kHz operation, assuming a CPU core clock of
/// `clock_mhz`.
/// `clock_hz`.
///
/// If you use this module in your application, call this before
/// [`run_tasks`][crate::exec::run_tasks] (or a fancier version of `run_tasks`)
/// to set up the timer for monotonic operation.
pub fn initialize_sys_tick(syst: &mut SYST, clock_mhz: u32) {
let cycles_per_millisecond = clock_mhz / 1000;
pub fn initialize_sys_tick(syst: &mut SYST, clock_hz: u32) {
let cycles_per_millisecond = clock_hz / 1000;
syst.set_reload(cycles_per_millisecond - 1);
syst.clear_current();
syst.set_clock_source(SystClkSource::Core);
Expand Down

0 comments on commit c98c6b5

Please sign in to comment.