demos_source/code_TestWatchdog.c File Reference

#include "femtoos_code.h"

Include dependency graph for code_TestWatchdog.c:

Go to the source code of this file.


#define delay07   1600U
 This file is solely for demonstration purposes.
#define delay06   800U
#define delay05   400U
#define delay04   200U
#define delay03   1600U
#define delay02   800U
#define delay01   400U
#define delay00   200U
#define setLed(lednr, state)   if (state) { devLedPORT |= (1 << lednr); } else { devLedPORT &= ~(1 << lednr); }


void appBoot (void)
 Prototype for the general initialization.


static Tbool bSync = false

Define Documentation

#define delay00   200U

Definition at line 58 of file code_TestWatchdog.c.

#define delay01   400U

Definition at line 57 of file code_TestWatchdog.c.

#define delay02   800U

Definition at line 56 of file code_TestWatchdog.c.

#define delay03   1600U

Definition at line 55 of file code_TestWatchdog.c.

#define delay04   200U

Definition at line 54 of file code_TestWatchdog.c.

#define delay05   400U

Definition at line 53 of file code_TestWatchdog.c.

#define delay06   800U

Definition at line 52 of file code_TestWatchdog.c.

#define delay07   1600U

This file is solely for demonstration purposes.

The Femto OS contains a facility that checks on the status of all tasks, which is called the watchdog. This is not to be confused with the watchdog of the device, to which it has no relation, it is a pure OS feature. If a task is not running anymore the watchdog calls your special code inside a 'bark' routine after which the task is restarted. This is particularly useful for code that may get stuck on a lot of places, and you don't want to implement timeouts everywhere. Here we have eight led blinkers running in different priorities. The rightmost led gets stuck after a while (endless loop). As soon as the watchdog kicks in the priority of the task is lowered by one, and the task is restarted. This continues until the priority is zero and the task is suspended. By using the switch the task can be restarted in the old priority. Furthermore the two slowest leds, who have identical blinking frequencies, get out of sync because they run in different priorities. They may be re-synced by pushing a button.

Definition at line 51 of file code_TestWatchdog.c.

#define setLed ( lednr,
state   )     if (state) { devLedPORT |= (1 << lednr); } else { devLedPORT &= ~(1 << lednr); }

Definition at line 71 of file code_TestWatchdog.c.

Function Documentation

void appBoot ( void   ) 

Prototype for the general initialization.

The Remember demonstration fills the file system with random numbers and calculates a (xor) hash on before hand. Then three worker tasks are started which read the files with concurrently and calculate hash's for each files. When all workers are done the main task combines the result and checks if it is equal to the value before. If so, a new round is started. Note that this demo wears out the EEPROM rapidly.

Definition at line 64 of file code_TestWatchdog.c.

Variable Documentation

Tbool bSync = false [static]

Definition at line 60 of file code_TestWatchdog.c.

Generated on Fri Oct 16 00:05:27 2009 for FemtoOS by  doxygen 1.5.2