Struct hpet::Hpet

source ·
#[repr(C)]
pub struct Hpet { pub general_capabilities_and_id: ReadOnly<u64>, pub general_configuration: Volatile<u64>, pub general_interrupt_status: Volatile<u64>, pub main_counter_value: Volatile<u64>, pub timers: [HpetTimer; 32], /* private fields */ }
Expand description

A structure that offers access to HPET through its I/O registers, specified by the format here: https://wiki.osdev.org/HPET#HPET_registers.

Fields§

§general_capabilities_and_id: ReadOnly<u64>

The General Capabilities and ID Register, at offset 0x0.

§general_configuration: Volatile<u64>

The General Configuration Register, at offset 0x10.

§general_interrupt_status: Volatile<u64>

The General Interrupt Status Register, at offset 0x20.

§main_counter_value: Volatile<u64>

The Main Counter Value Register, at offset 0xF0.

§timers: [HpetTimer; 32]

The timers (comparators) available for separate. There is a minimum of 3 timers and a maximum of 32 in an HPET-enabled system. Call num_timers to get the actual number of HPET timers.

Implementations§

source§

impl Hpet

source

pub fn get_counter(&self) -> u64

Returns the HPET’s main counter value

source

pub fn enable_counter(&mut self, enable: bool)

Turns on or off the main counter

source

pub fn counter_period_femtoseconds(&self) -> u32

Returns the period of the HPET counter in femtoseconds, i.e., the length of time that one HPET tick takes.

Can be used to calculate the frequency of the HPET clock.

Must not be zero, must be less or equal to 0x05F5E100 (100 nanoseconds)

source

pub fn vendor_id(&self) -> u16

source

pub fn num_timers(&self) -> u8

Trait Implementations§

source§

impl ClockSource for Hpet

§

type ClockType = Monotonic

The type of clock (either [Monotonic] or [WallTime]).
source§

fn now() -> Instant

The current time according to the clock. Read more
source§

impl FromBytes for Hpet

Auto Trait Implementations§

§

impl RefUnwindSafe for Hpet

§

impl Send for Hpet

§

impl Sync for Hpet

§

impl Unpin for Hpet

§

impl UnwindSafe for Hpet

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

type Error = Infallible

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

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

Performs the conversion.
source§

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

§

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.