10 #include <satcat5/cfgbus_interrupt.h>
30 :
Timer(cfg, devaddr, hw_ticks_per_sec(cfg, devaddr)) {}
37 ,
Interrupt(cfg, devaddr, REGADDR_TIMER_IRQ)
38 , m_ctrl(cfg->get_register(devaddr))
41 m_ctrl[REGADDR_WDOG] = WDOG_PAUSE;
79 static constexpr u32 WDOG_PAUSE = (u32)(-1);
82 static constexpr
unsigned REGADDR_WDOG = 0;
83 static constexpr
unsigned REGADDR_CPU_HZ = 1;
84 static constexpr
unsigned REGADDR_PERF_CTR = 2;
85 static constexpr
unsigned REGADDR_LAST_EVT = 3;
86 static constexpr
unsigned REGADDR_TIMER_LEN = 4;
87 static constexpr
unsigned REGADDR_TIMER_IRQ = 5;
92 return reg[REGADDR_CPU_HZ];
satcat5::cfg::Register get_register(unsigned dev, unsigned reg=0)
Create register-map object for the given device address.
Event-handler for individual ConfigBus interrupts.
satcat5::util::TimeVal last_event()
Read timestamp of the last external event signal.
void timer_interval(unsigned usec)
Change the timer-interrupt interval.
void wdog_disable()
Disable the hardware watchdog function.
void timer_callback(satcat5::poll::OnDemand *callback)
Set the callback for timer-interrupt notifications.
Timer(satcat5::cfg::ConfigBus *cfg, unsigned devaddr)
Auto-configuration constructor.
void irq_event() override
Interrupt service routine.
u32 raw() override
Read the current time.
void wdog_update(u32 usec)
Resume or reset the watchdog countdown.
Timer(satcat5::cfg::ConfigBus *cfg, unsigned devaddr, u32 refclk_hz)
Manual-configuration constructor.
Pointer-like wrapper for one or more ConfigBus registers.
An "OnDemand" object is polled only on request.
The TimeRef API provides access to a monotonic time-counter.
constexpr TimeRef(u64 ticks_per_sec)
Constructor accepts a scale-factor for conversion to real-time.
Timestamp for measuring elapsed time.
TimeRef and TimeVal define the API for monotonic timers.