1 Watchdog Timer Interfaces For The Linux Operating System 2 3 Alan Cox <alan@lxorguk.ukuu.org.uk> 4 5 Custom Linux Driver And Program Development 6 7 8The following watchdog drivers are currently implemented: 9 10 ICS WDT501-P 11 ICS WDT501-P (no fan tachometer) 12 ICS WDT500-P 13 Software Only 14 Berkshire Products PC Watchdog Revision A & C (by Ken Hollis) 15 16 17All five interfaces provide /dev/watchdog, which when open must be written 18to within a timeout or the machine will reboot. Each write delays the reboot 19time another timeout. In the case of the software watchdog the ability to 20reboot will depend on the state of the machines and interrupts. The hardware 21boards physically pull the machine down off their own onboard timers and 22will reboot from almost anything. 23 24A second temperature monitoring interface is available on the WDT501P cards 25and some Berkshire cards. This provides /dev/temperature. This is the machine 26internal temperature in degrees Fahrenheit. Each read returns a single byte 27giving the temperature. 28 29The third interface logs kernel messages on additional alert events. 30 31Both software and hardware watchdog drivers are available in the standard 32kernel. If you are using the software watchdog, you probably also want 33to use "panic=60" as a boot argument as well. 34 35The wdt card cannot be safely probed for. Instead you need to pass 36wdt=ioaddr,irq as a boot parameter - eg "wdt=0x240,11". 37 38Features 39-------- 40 WDT501P WDT500P Software Berkshire 41Reboot Timer X X X X 42External Reboot X X o o 43I/O Port Monitor o o o X 44Temperature X o o X 45Fan Speed X o o o 46Power Under X o o o 47Power Over X o o o 48Overheat X o o o 49 50The external event interfaces on the WDT boards are not currently supported. 51Minor numbers are however allocated for it. 52 53 54Example Watchdog Driver 55----------------------- 56 57#include <stdio.h> 58#include <unistd.h> 59#include <fcntl.h> 60 61int main(int argc, const char *argv[]) 62{ 63 int fd=open("/dev/watchdog",O_WRONLY); 64 if(fd==-1) 65 { 66 perror("watchdog"); 67 exit(1); 68 } 69 while(1) 70 { 71 write(fd,"\0",1); 72 sleep(10); 73 } 74} 75 76 77Contact Information 78 79People keep asking about the WDT watchdog timer hardware: The phone contacts 80for Industrial Computer Source are: 81 82US: 619 677 0877 (sales) 0895 (fax) 83UK: 01243 533900 84France (1) 69.18.74.30 85 86Industrial Computer Source 879950 Barnes Canyon Road 88San Diego, CA 89 90http://www.industry.net/indcompsrc 91 92and please mention Linux when enquiring. 93 94For full information about the PCWD cards see the pcwd-watchdog.txt document. 95

