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
impl Timer
Sourcepub unsafe fn current(kind: TimerKind) -> Self
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.
Sourcepub fn compare(&self) -> u64
pub fn compare(&self) -> u64
Reads the absolute comparator value, in the selected counter’s ticks.
Sourcepub fn set_compare(&mut self, ticks: u64)
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.
Sourcepub fn control(&self) -> TimerControl
pub fn control(&self) -> TimerControl
Reads ENABLE, IMASK and the read-only comparator condition.
Sourcepub fn set_control(&mut self, control: TimerControl)
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.