⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

PlatformTimer

Trait PlatformTimer 

Source
pub trait PlatformTimer {
    // Required methods
    fn current_ticks() -> u64;
    fn ticks_per_second() -> u64;
    fn set_timer(ticks: u64);
}
Expand description

Platform timer abstraction trait.

Each architecture provides a zero-sized struct implementing this trait, exposing a common interface for tick counting, frequency queries, and hardware timer programming.

Required Methods§

Source

fn current_ticks() -> u64

Read the current hardware tick/cycle counter.

This is a monotonically increasing counter whose frequency is given by ticks_per_second.

Source

fn ticks_per_second() -> u64

Return the frequency of the tick counter in Hz.

For x86_64 this is an approximate TSC frequency; for AArch64 the architectural CNTFRQ_EL0; for RISC-V the timebase frequency.

Source

fn set_timer(ticks: u64)

Program the next timer interrupt to fire after ticks ticks from now.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl PlatformTimer for X86_64Timer

Available on x86-64 only.