Nut/OS  4.10.3
API Reference
Watchdogs

Watchdog Support. More...

Collaboration diagram for Watchdogs:

Functions

uint32_t NutWatchDogStart (uint32_t ms, uint32_t xmode)
 Start the watch dog timer.
void NutWatchDogRestart (void)
 Restart the watch dog timer.
void NutWatchDogDisable (void)
 Disables the watch dog timer.
void NutWatchDogEnable (void)
 Enables the watch dog timer.

Detailed Description

Watchdog Support.

Platform independent watchdog support is available for the AVR platform and the AT91R40008 MCU.


Function Documentation

uint32_t NutWatchDogStart ( uint32_t  ms,
uint32_t  xmode 
)

Start the watch dog timer.

This function can be used by applications to prevent hang-ups.

Parameters:
msWatch dog time out in milliseconds.
xmodeHardware specific mode. If 0, the default mode is used. In this mode, the watch dog will reset the CPU if not restarted within the specified time out period.
Returns:
The actual time out value, which may differ from the specified value due to hardware limitations. The watch dog timer will be automatically enabled on return.

The following code fragment starts the watch timer with a time out of 550 milliseconds and restarts it every 500 milliseconds.

 #include <dev/watchdog.h>
 #include <sys/timer.h>

 NutWatchDogStart(550, 0);
 for(;;) {
     NutWatchDogRestart();
     NutSleep(500);
 }
Todo:
AVR implementation.
Note:
The AT91 implementation does not calculate the actual time out value, but simply returns the specified number of milliseconds.

Definition at line 50 of file watchdog.c.

References At91WatchDogStart(), Avr32WatchDogStart(), and AvrWatchDogStart().

Referenced by Avr32Reset().

Here is the call graph for this function:

void NutWatchDogRestart ( void  )

Restart the watch dog timer.

Definition at line 66 of file watchdog.c.

References At91WatchDogRestart(), Avr32WatchDogRestart(), and AvrWatchDogRestart().

Here is the call graph for this function:

void NutWatchDogDisable ( void  )

Disables the watch dog timer.

Applications should call this function to temporarily disable the watch dog timer. To re-enable it, call NutWatchDogEnable().

 #include <dev/watchdog.h>

 NutWatchDogStart(100, 0);

 //Some code here.

 NutWatchDogRestart();

 //Some code here.

 NutWatchDogDisable();

 //Some lengthy code here, like writing to flash memory.

 NutWatchDogEnable();

Definition at line 80 of file watchdog.c.

References At91WatchDogDisable(), Avr32WatchDogDisable(), and AvrWatchDogDisable().

Here is the call graph for this function:

void NutWatchDogEnable ( void  )

Enables the watch dog timer.

The function can be safely used within nested subroutines. The watch dog will be enabled only, if this function is called the same number of times as NutWatchDogDisable(). If enabled, the watch dog timer will also have been re-started and the full time out value is available before another NutWatchDogRestart() is required.

If the watch has not been started by NutWatchDogStart(), then this function does nothing.

Definition at line 94 of file watchdog.c.

References At91WatchDogEnable(), Avr32WatchDogEnable(), and AvrWatchDogEnable().

Here is the call graph for this function: