Moxa W321-LX [66/80] Wdt watch dog timer

Moxa W321-LX [66/80] Wdt watch dog timer
W321/341 Linux Programmer's Guide
6-3
Function: KDMKTONE
ioctl(fd, KDMKTONE, unsigned int arg);
Description: The buzzer’s behavior is determined by the argument arg. The “high word” part of arg gives
the length of time the buzzer will sound, and the “low word” part gives the frequency.
The buzzer’s on / off behavior is controlled by software. If you call the “ioctl” function, you MUST set the
frequency at 100 Hz. If you use a different frequency, the system could crash.
WDT (Watch Dog Timer)
1. Introduction
The WDT works like a watch dog function. You can enable it or disable it. When the user enables WDT but
the application does not acknowledge it, the system will reboot. You can set the ack time from a minimum
of 50 msec to a maximum of 60 seconds.
2. How the WDT works
The WatchDog is disabled when the system boots up. The user application can also enable ack. When the
user does not ack, it will let the system reboot.
Kernel boot
.....
....
User application running and enable user ack
....
....
3. The user API
1. Pinging the watchdog using an ioctl:
All drivers that have an ioctl interface support at least one ioctl,
KEEPALIVE. This ioctl does exactly the same thing as a write to the
watchdog device, so the main loop in the above program could be
replaced with:
while (1) {
ioctl(fd, WDIOC_KEEPALIVE, 0);
sleep(10);
}
the argument to the ioctl is ignored.
2. For some drivers it is possible to modify the watchdog timeout on the fly with the SETTIMEOUT ioctl,
those drivers have the WDIOF_SETTIMEOUT flag set in their option field. The argument is an
integerrepresenting the timeout in seconds. The driver returns the real timeout used in the same
variable, and this timeout might differ from the requested one due to limitation of the hardware.
int timeout = 45;
ioctl(fd, WDIOC_SETTIMEOUT, &timeout);
printf("The timeout was set to %d seconds\n", timeout);

Содержание

Похожие устройства

Скачать
Случайные обсуждения