dnx RTOS 2.2.0 "Eagle"
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
WDG Driver

Detailed Description

Description

Driver handles watchdog peripheral.

Supported architectures

Details

Meaning of major and minor numbers

Both major and minor numbers should be set to 0.

Numeration restrictions

Both major and minor numbers should be set to 0.

Driver initialization

To initialize driver the following code can be used:

driver_init("WDG", 0, 0, "/dev/wdg");
Note
Watchdog peripheral starts counting reset time from driver initialization. Make sure that system initialization is not too long or watchdog driver is initialized at the end of system startup to protect against unexpected reset.

Driver release

There is not possibility to release WDG driver.

Driver configuration

Watchdog can be configured only at project configuration by using Configtool. There is no possibility to reconfigure watchdog peripheral at runtime.

Data write

Operation not supported.

Data read

Operation not supported.

Watchdog reset

Watchdog should be reseted by using ioctl() function. Example:

#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
//...
FILE *wdg = fopen("/dev/wdg", "r+");
if (!wdg) {
abort();
}
//...
if (ioctl(fileno(wdg), IOCTL_WDG__RESET) != 0) {
// no permission or IO error
}
//...

Macros

#define IOCTL_WDG__RESET   _IO(WDG, 0x00)
 Reset watchdog counter. More...
 

Macro Definition Documentation

#define IOCTL_WDG__RESET   _IO(WDG, 0x00)

If this request won't send on time the watchdog resets the system.

Returns
On success 0 is returned, otherwise -1.