PCI WATCHDOG TIME CARD

Sco Unix Device Driver

SCO UNIX DEVICE DRIVER and TEST SPFTWARE

How to install Watchdog Driver

>>> Install Decision Watch Dog Driver to UNIX <<<
1. Login as a root user.

2. install all relative files
# cd /
# doscp a:whdg.tz ./whdg.tar.Z ["dosget" in Interactive Unix]
# zcat whdg.tar | tar xvfp -

3. # cd /usr/sys/whdg

4. Install the Watch Dog driver to the kernel.
# ./install


>>> Remove Decision Watch Dog Driver from UNIX <<<

1. Login as a root user


2. # cd /usr/sys/whdg

3. Remove the Watch Dog Driver from the kernel
# ./remove

>>> Default Configuration of Decision Watch Dog Card <<<
Refresh time : 4 sec

>>> Default Device Names to the Watch Dog Driver <<<
/dev/whdg

>>> Enclosed Uilities for the Watch Dog Driver <<<
1. To turn on the watch dog
# /etc/whdg_on



2. To turn off the watch dog
# /et/whdg_off


>>> Programming Examples to turn on/off the watch dog
1. You may reference the file "whdg.c" for
- how to turn on the watchdog functionality for monitoring the whole system
- how to turn on the watchdog fucntionality for monitoring both the whole system and specific user-level processes
- how to turn off the watchdog funcationality
- how applications regularly notify the wathdog driver that they are alive
- how to power on/off the watchdog box

1. To turn on the watchdog for monitoring the whole system
...........
if ((whdg_h = open("/dev/whdg", O_WRONLY)) == -1) {
printf("There is no Watch Dog device %s\n", WATCH_DOG_DEV);
return FALSE;
}

...........




2. To turn on the watchdog for monitoring the whole system and specific user-level processes.
...........
if ((whdg_h = open("/dev/whdg", O_RDWR)) == -1) {
printf("There is no Watch Dog device %s\n", WATCH_DOG_DEV);
return FALSE;
}

...........


3. To turn off the watch dog
if (close(whdg_h) == -1) {
printf("It is failed to stop Watch Dog\n");
return FALSE;
}




4. how processes to regularly notify the wathdog driver that they are alive
void
whdg_app_standby()
{
/*
* if nsecs > the interval of the watchdog driver that you can
* specify while installing the watchdog driver can tolerate,
* it means that this process can not notify the driver that
* the process is alive so the system will be resetted.
* You can adjust the value to verify the driver can work or not.
*/
int nsecs = 6;
char c;

do {
/*
* notify the watch dog driver that I am alive
*/
read(whdg_h, &c, 1);

/*
* doing major routines
*/

/*
* sleep for a while
*/
printf("whdg_app_standby(): sleep %d sec...\n", nsecs);
sleep(nsecs);
} while (whdg_signo != SIGTERM);
} /* whdg_app_standby() */




5. how to power on/off the watchdog box
/*
* commands to whdgioctl()
*/
#ifndef MIOC
#define MIOC ('M' << 8)
#endif /* MIOC */

#define MCPOWERON (MIOC | 0xF8)
#define MCPOWEROFF (MIOC | 0xF9)

boolean_t
whdg_poweron()
{
if (ioctl(whdg_h, MCPOWERON, NULL) == -1) {
printf("It is failed to ioctl the Watch Dog\n");

return FALSE;
}

return TRUE;
} /* whdg_poweron() */

boolean_t
whdg_poweroff()
{
if (ioctl(whdg_h, MCPOWEROFF, NULL) == -1) {
printf("It is failed to ioctl the Watch Dog\n");

return FALSE;
}

return TRUE;
} /* whdg_poweroff() */

SCO UNIX DEVICE DRIVER
FILE
DEVICE DRIVER USING UNIX
HOME