1 Berkshire Products PC Watchdog Card
2 Support for ISA Cards Revision A and C
3 Documentation and Driver by Ken Hollis <khollis@nurk.org>
5 The PC Watchdog is a card that offers the same type of functionality that
6 the WDT card does, only it doesn't require an IRQ to run. Furthermore,
7 the Revision C card allows you to monitor any IO Port to automatically
8 trigger the card into being reset. This way you can make the card
9 monitor hard drive status, or anything else you need.
11 The Watchdog Driver has one basic role: to talk to the card and send
12 signals to it so it doesn't reset your computer ... at least during
15 The Watchdog Driver will automatically find your watchdog card, and will
16 attach a running driver for use with that card. After the watchdog
17 drivers have initialized, you can then talk to the card using the PC
18 Watchdog program, available from ftp.bitgate.com:/pub/bitgate/pcwd.
20 I suggest putting a "watchdog -d" before the beginning of an fsck, and
21 a "watchdog -e -t 1" immediately after the end of an fsck. (Remember
22 to run the program with an "&" to run it in the background!)
24 If you want to write a program to be compatible with the PC Watchdog
25 driver, simply do the following:
29 * Watchdog Driver Test Program
37 #include <sys/ioctl.h>
38 #include <linux/pcwd.h>
43 * This function simply sends an IOCTL to the driver, which in turn ticks
44 * the PC Watchdog card to reset its internal timer so it doesn't trigger
51 ioctl(fd, WDIOC_KEEPALIVE, &dummy);
55 * The main program. Run the program with "-d" to disable the card,
56 * or "-e" to enable the card.
58 int main(int argc, char *argv[])
60 fd = open("/dev/watchdog", O_WRONLY);
63 fprintf(stderr, "Watchdog device not enabled.\n");
69 if (!strncasecmp(argv[1], "-d", 2)) {
70 ioctl(fd, WDIOC_SETOPTIONS, WDIOS_DISABLECARD);
71 fprintf(stderr, "Watchdog card disabled.\n");
74 } else if (!strncasecmp(argv[1], "-e", 2)) {
75 ioctl(fd, WDIOC_SETOPTIONS, WDIOS_ENABLECARD);
76 fprintf(stderr, "Watchdog card enabled.\n");
80 fprintf(stderr, "-d to disable, -e to enable.\n");
81 fprintf(stderr, "run by itself to tick the card.\n");
86 fprintf(stderr, "Watchdog Ticking Away!\n");
97 Other IOCTL functions include:
100 This returns the support of the card itself. This
101 returns in structure "PCWDS" which returns:
102 options = WDIOS_TEMPPANIC
103 (This card supports temperature)
104 firmware_version = xxxx
105 (Firmware version of the card)
108 This returns the status of the card, with the bits of
109 WDIOF_* bitwise-anded into the value. (The comments
113 This returns the status of the card that was reported
117 This returns the temperature of the card. (You can also
118 read /dev/watchdog, which gives a temperature update
122 This lets you set the options of the card. You can either
123 enable or disable the card this way.
126 This pings the card to tell it not to reset your computer.
128 And that's all she wrote!