52 using CallbackFn = std::function<void(
int channelId,
void* userData)>;
77 void* userData =
nullptr,
94 virtual int feed(
int channelId) = 0;
125 return static_cast<IWatchdog::Option>(
static_cast<uint8_t
>(lhs) |
static_cast<uint8_t
>(rhs));
132 return static_cast<IWatchdog::Option>(
static_cast<uint8_t
>(lhs) &
static_cast<uint8_t
>(rhs));
Interface for a hardware watchdog peripheral (not the software watchdog, this does not need to be moc...
Definition IWatchdog.hpp:26
const char * getName() const
Get the name of this watchdog instance.
Definition IWatchdog.hpp:108
Option
Watchdog configuration options.
Definition IWatchdog.hpp:31
@ PauseInSleep
Pause timer during CPU sleep.
@ PauseHaltedByDebug
Pause timer when debugger halts CPU.
virtual int installTimeout(uint32_t timeoutMs, CallbackFn callback=nullptr, void *userData=nullptr, ResetFlag flags=ResetFlag::ResetSoc)=0
Install a watchdog timeout configuration.
virtual const struct device * getRawDevice() const =0
Get the raw watchdog device pointer. Only valid on real implementations, mock implementations will re...
virtual ~IWatchdog()=default
Virtual destructor.
const char * m_name
Name of this watchdog instance.
Definition IWatchdog.hpp:118
virtual int setup(Option options=Option::None)=0
Setup the watchdog with global configuration.
std::function< void(int channelId, void *userData)> CallbackFn
Watchdog callback function type.
Definition IWatchdog.hpp:52
ResetFlag
Watchdog reset behavior flags.
Definition IWatchdog.hpp:40
@ ResetCpuCore
Reset CPU core on timeout.
@ ResetSoc
Reset entire SoC on timeout.
virtual int feed(int channelId)=0
Feed (service) a watchdog channel to prevent timeout.
virtual int disable()=0
Disable the watchdog instance.
constexpr IWatchdog::Option operator|(IWatchdog::Option lhs, IWatchdog::Option rhs)
Bitwise OR operator for watchdog options.
Definition IWatchdog.hpp:124
constexpr IWatchdog::Option operator&(IWatchdog::Option lhs, IWatchdog::Option rhs)
Bitwise AND operator for watchdog options.
Definition IWatchdog.hpp:131