Skip to main content

TimerInterface

Trait TimerInterface 

Source
pub trait TimerInterface {
    // Required methods
    fn enable(&mut self);
    fn frequency(&self) -> u32;
    fn timer_value(&self) -> i32;
    fn compare_value(&self) -> u64;
    fn set_timer_value(&mut self, timer_value: i32);
    fn set_compare_value(&mut self, compare_value: u64);
    fn enable_interrupt(&mut self, enabled: bool);
}
Expand description

Interface for accessing common timer registers.

Required Methods§

Source

fn enable(&mut self)

Enables timer

Source

fn frequency(&self) -> u32

Returns the frequency in Hz.

Source

fn timer_value(&self) -> i32

Returns the down-counter value.

Source

fn compare_value(&self) -> u64

Returns the compare value.

Source

fn set_timer_value(&mut self, timer_value: i32)

Sets timer value. This programs the compare value relative to the physical counter, which affects the value returned by TimerInterface::compare_value(). Setting a negative value will trigger an interrupt, if enabled.

Source

fn set_compare_value(&mut self, compare_value: u64)

Sets the compare value. This also affects the down-counter value queried using TimerInterface::timer_value().

Source

fn enable_interrupt(&mut self, enabled: bool)

Unmasks / masks interrupts for the counter.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl TimerInterface for El2VirtualTimer

Available on crate feature el2 and (AArch64 or crate feature fakes) only.
Source§

impl TimerInterface for HypervisorPhysicalTimer

Available on crate feature el2 and (AArch64 or crate feature fakes) only.
Source§

impl TimerInterface for PhysicalSecureTimer

Available on crate feature el1 and (AArch64 or crate feature fakes) only.
Source§

impl TimerInterface for PhysicalTimer

Available on AArch64 or crate feature fakes only.
Source§

impl TimerInterface for SecureEl2PhysicalTimer

Available on crate feature el2 and (AArch64 or crate feature fakes) only.
Source§

impl TimerInterface for SecureEl2VirtualTimer

Available on crate feature el2 and (AArch64 or crate feature fakes) only.
Source§

impl TimerInterface for VirtualTimer

Available on AArch64 or crate feature fakes only.
Source§

impl<'a> TimerInterface for MmioTimer<'a>