Skip to main content

El1VirtualTimer

Struct El1VirtualTimer 

Source
pub struct El1VirtualTimer(/* private fields */);
Expand description

Represents our Virtual Timer when we are running at EL1.

Implementations§

Source§

impl El1VirtualTimer

Source

pub unsafe fn new() -> El1VirtualTimer

Create an EL1 Generic Timer handle

§Safety

Only create one of these at any given time, as they access shared mutable state within the processor and do read-modify-writes on that state.

Source

pub fn el0_access_virtual_counter(&mut self, access: bool)

Control whether user code at EL0 can access the virtual counter.

Source

pub fn el0_access_virtual_timer(&mut self, access: bool)

Control whether user code at EL0 can access the virtual timer.

Source

pub fn virtual_event_stream_configure( &mut self, event_config: Option<&EventConfig>, )

Configure an event stream from the virtual counter.

The event stream is tied to one of the bottom 16 bits of the virtual counter. If you select the bottom (0th) bit, the event fires every counter tick. If you select the 3rd bit, the event fires every 2^3 = 8 counter ticks.

This is useful if you want to ensure that a WFE instruction can never wait forever; effectively it allows you to put a timeout on a WFE.

Pass None to disable.

Trait Implementations§

Source§

impl GenericTimer for El1VirtualTimer

Source§

fn frequency_hz(&self) -> u32

Get the timer frequency
Source§

fn counter(&self) -> u64

Get the current counter value. Read more
Source§

fn counter_compare(&self) -> u64

Get the counter compare value.
Source§

fn counter_compare_set(&mut self, value: u64)

Set the counter compare value. Read more
Source§

fn countdown(&self) -> u32

Get the current value of the countdown timer.
Source§

fn countdown_set(&mut self, duration_ticks: u32)

Set the value of the count-down timer. Read more
Source§

fn enabled(&self) -> bool

This is timer enabled?
Source§

fn enable(&self, enabled: bool)

Enable/disable this timer
Source§

fn interrupt_masked(&self) -> bool

Is this timer’s interrupt masked?
Source§

fn interrupt_mask(&mut self, mask: bool)

Mask (or unmask) this timer’s interrupt.
Source§

fn interrupt_status(&self) -> bool

Has this timer’s interrupt fired?
Source§

fn delay_ticks(&mut self, ticks: u32)

Wait for some number of clock ticks
Source§

fn delay_ms(&mut self, ms: u32)

Delay for some number of milliseconds
Source§

fn delay_us(&mut self, us: u32)

Delay for some number of microseconds

Auto Trait Implementations§

§

impl Freeze for El1VirtualTimer

§

impl RefUnwindSafe for El1VirtualTimer

§

impl Send for El1VirtualTimer

§

impl Sync for El1VirtualTimer

§

impl Unpin for El1VirtualTimer

§

impl UnsafeUnpin for El1VirtualTimer

§

impl UnwindSafe for El1VirtualTimer

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.