Skip to main content

Timer

Struct Timer 

Source
pub struct Timer { /* private fields */ }
Expand description

Exclusive, non-migrating access to one CPU timer comparator. Dropping this view does not change timer or interrupt state.

Implementations§

Source§

impl Timer

Source

pub unsafe fn current(kind: TimerKind) -> Self

Borrows a comparator without changing its registers.

§Safety

The selected bank must be accessible at the current exception level. The caller must keep this CPU pinned and exclude conflicting accesses, including timer IRQ and guest entry/exit, for the returned view’s life.

Source

pub fn counter(&self) -> u64

Reads the counter used by this comparator.

Source

pub fn compare(&self) -> u64

Reads the absolute comparator value, in the selected counter’s ticks.

Source

pub fn set_compare(&mut self, ticks: u64)

Writes an absolute comparator value without changing ENABLE or IMASK. This does not clamp expired deadlines or choose scheduling policy.

Source

pub fn control(&self) -> TimerControl

Reads ENABLE, IMASK and the read-only comparator condition.

Source

pub fn set_control(&mut self, control: TimerControl)

Replaces ENABLE and IMASK, ignoring the read-only PENDING flag. The update is synchronized before returning; the IRQ controller remains owned by the platform and is neither acknowledged nor reconfigured.

Trait Implementations§

Source§

impl Debug for Timer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Send for Timer

§

impl !Sync for Timer

§

impl Freeze for Timer

§

impl RefUnwindSafe for Timer

§

impl Unpin for Timer

§

impl UnsafeUnpin for Timer

§

impl UnwindSafe for Timer

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.