pub struct LiteXTimer<'a, R: LiteXSoCRegisterConfiguration, F: Frequency> { /* private fields */ }
Expand description
LiteX hardware timer core
Defined in
litex/soc/cores/timer.py
.
This peripheral supports counting down a certain interval, either as a oneshot timer or in a repeated fashion.
§Uptime extension
LiteX timers can optionally be extended to feature an uptime register integrated into the timer peripheral, monotonically counting the clock ticks and wrapping at the maximum value.
The uptime register may have a different width as the Timer
peripheral itself, hence it must be implemented using a separate
type. The type must contain a reference to this Timer
instance, since the register is located on this register bank.
Since this extension is not always configured, the Timer features
an unsafe function to read the uptime. It must only be called by
LiteXTimerUptime
struct and only if the uptime has been
configured.
Implementations§
Source§impl<R: LiteXSoCRegisterConfiguration, F: Frequency> LiteXTimer<'_, R, F>
impl<R: LiteXSoCRegisterConfiguration, F: Frequency> LiteXTimer<'_, R, F>
pub fn new(base: StaticRef<LiteXTimerRegisters<R>>) -> Self
pub fn service_interrupt(&self)
Trait Implementations§
Source§impl<R: LiteXSoCRegisterConfiguration, F: Frequency> Time for LiteXTimer<'_, R, F>
impl<R: LiteXSoCRegisterConfiguration, F: Frequency> Time for LiteXTimer<'_, R, F>
Source§impl<'a, R: LiteXSoCRegisterConfiguration, F: Frequency> Timer<'a> for LiteXTimer<'a, R, F>
impl<'a, R: LiteXSoCRegisterConfiguration, F: Frequency> Timer<'a> for LiteXTimer<'a, R, F>
Source§fn set_timer_client(&self, client: &'a dyn TimerClient)
fn set_timer_client(&self, client: &'a dyn TimerClient)
Source§fn oneshot(&self, interval: Self::Ticks) -> Self::Ticks
fn oneshot(&self, interval: Self::Ticks) -> Self::Ticks
interval
ticks in the future. If there is a timer currently pending,
calling this cancels that previous timer. After a callback is invoked
for a one shot timer, the timer MUST NOT invoke the callback again
unless a new timer is started (either with repeating or one shot).
Returns the actual interval for the timer that was registered.
This MUST NOT be smaller than interval
but MAY be larger.Source§fn repeating(&self, interval: Self::Ticks) -> Self::Ticks
fn repeating(&self, interval: Self::Ticks) -> Self::Ticks
interval
ticks in the future. If there is a timer currently
pending, calling this cancels that previous timer.
Returns the actual interval for the timer that was registered.
This MUST NOT be smaller than interval
but MAY be larger.Source§fn is_repeating(&self) -> bool
fn is_repeating(&self) -> bool
Source§fn is_oneshot(&self) -> bool
fn is_oneshot(&self) -> bool
Source§fn time_remaining(&self) -> Option<Self::Ticks>
fn time_remaining(&self) -> Option<Self::Ticks>
Source§fn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
is_enabled
returns false then
the implementation MUST NOT invoke a callback until a call to oneshot
or repeating
restarts the timer.