pub struct Rtc { /* private fields */ }Expand description
The System Real Time Clock structure for aarch64 based on PL031.
Implementations§
Source§impl Rtc
impl Rtc
Source§impl Rtc
impl Rtc
Sourcepub unsafe fn new(base_address: *mut u32) -> Self
pub unsafe fn new(base_address: *mut u32) -> Self
Constructs a new instance of the RTC driver for a PL031 device at the given base address.
The base address may be obtained from the device tree.
§Safety
The given base address must point to the MMIO control registers of a PL031 device, which must be mapped into the address space of the process as device memory and not have any other aliases. It must be aligned to a 4 byte boundary.
Sourcepub fn get_unix_timestamp(&self) -> u32
pub fn get_unix_timestamp(&self) -> u32
Returns the current time in seconds since UNIX epoch.
Sourcepub fn set_unix_timestamp(&mut self, unix_time: u32)
pub fn set_unix_timestamp(&mut self, unix_time: u32)
Sets the current time in seconds since UNIX epoch.
Sourcepub fn set_match_timestamp(&mut self, match_timestamp: u32)
pub fn set_match_timestamp(&mut self, match_timestamp: u32)
Writes a match value. When the RTC value matches this then an interrupt will be generated (if it is enabled).
Sourcepub fn matched(&self) -> bool
pub fn matched(&self) -> bool
Returns whether the match register matches the RTC value, whether or not the interrupt is enabled.
Sourcepub fn interrupt_pending(&self) -> bool
pub fn interrupt_pending(&self) -> bool
Returns whether there is currently an interrupt pending.
This should be true if and only if matched returns true and the
interrupt is masked.
Sourcepub fn enable_interrupt(&mut self, mask: bool)
pub fn enable_interrupt(&mut self, mask: bool)
Sets or clears the interrupt mask.
When the mask is true the interrupt is enabled; when it is false the interrupt is disabled.
Sourcepub fn clear_interrupt(&mut self)
pub fn clear_interrupt(&mut self)
Clears a pending interrupt, if any.