public class WatchdogTimer extends Object
Modifier and Type | Method and Description |
---|---|
static void |
checkpoint(int checkpointId)
Validates the checkpoint identified by the given
checkpointId and
refreshes the watchdog if all checkpoints are passed. |
static int |
getWatchdogTimeoutMs()
Gets the configured watchdog timeout period (in milliseconds).
|
static void |
init()
Initializes the watchdog timer and the checkpoints registration system.
|
static boolean |
isResetCause()
Checks whether the last reset was caused by the watchdog or not.
|
static int |
registerCheckpoint()
Registers a watchdog checkpoint and returns its corresponding Id.
|
static void |
start()
Starts the watchdog timer.
|
static void |
stop()
Stops the watchdog timer and unregisters all existing checkpoints.
|
static void |
unregisterCheckpoint(int checkpointId)
Unregisters the checkpoint with the given
checkpointId . |
public static void checkpoint(int checkpointId) throws WatchdogTimerException, IllegalArgumentException
checkpointId
and
refreshes the watchdog if all checkpoints are passed.
Be sure that all the checkpoints are validated before the watchdog timeout
expires otherwise a hardware reset will be performed.checkpointId
- the Id of the checkpoint to validate.WatchdogTimerException
- if the watchdog is not initializedIllegalArgumentException
- if checkpointId is out of the range.public static int getWatchdogTimeoutMs() throws WatchdogTimerException
WatchdogTimerException
- if an error occurs.public static void init() throws WatchdogTimerException
WatchdogTimerException
- if an error occurs.public static boolean isResetCause() throws WatchdogTimerException
WatchdogTimerException
- if an error occurs.public static int registerCheckpoint() throws WatchdogTimerException
WatchdogTimerException
- if we exceed the maximum number of registrations or
if watchdog was not initialized.public static void start() throws WatchdogTimerException
WatchdogTimerException
- if the watchdog is not initialized or an error
occurs.public static void stop() throws WatchdogTimerException
WatchdogTimerException
- if an error occurs.public static void unregisterCheckpoint(int checkpointId) throws WatchdogTimerException, IllegalArgumentException
checkpointId
.checkpointId
- the checkpoint Id to unregister.WatchdogTimerException
- if watchdog is not initialized or the
checkpointId is not registered.IllegalArgumentException
- if checkpointId is out of the range.