Watchdog

From Sharpfin
Jump to navigation Jump to search

Overview

The Libreciva dog function provides control of the processor's watchdog timer.

In order to use the library function, you must include the header file:

<syntaxhighlight>

  1. include "dog.h"

</syntaxhighlight>

int dog_init() and void dog_exit()

These functions are used to initialise and shut down the watchdog system. dog_init() returns true on success, or false if there was an error accessing the hardware.

Note that dog_exit() simply leaves the watchdog in whatever state it has been set - if you want the dog disabled, you must call dog_disable() before calling dog_exit().

int dog_enable() and int dog_disable()

These functions are used to enable and disable the watchdog. the functions return 0 on success, or -1 if there is an error accessing the hardware.

int dog_isenabled()

This function reports the current enable (true) or disable (false) state of the watchdog. Note that this function simply reports which dog_enable() / dog_disable() function was last called from this application. It is not possible to read the enabled status back from the hardware.

int dog_kick()

This function is used to kick the dog. It returns 0 on success, or -1 if there has been a problem accessing the hardware.