Appendix B
Watchdog Timer Application Mode
109
Example Watchdog Program
Following is a sample program for the watchdog timer.
CODE EXAMPLE B-2
Watchdog and Reset Control Data Structure
typedef struct {
int reset_enable; /* reset enabled if non-zero */
int dog_enable; /* watchdog enabled if non-zero */
} lom_dogctl_t;
CODE EXAMPLE B-3
Example Watchdog Program
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <lom_io.h>
int main() {
uint_t timeout = 30; /* 30 seconds */
lom_dogctl_t dogctl;
int fd;
dogctl.reset_enable = 1;
dogctl.dog_enable = 1;
fd = open("/dev/ntwdt", O_EXCL);
/* Set timeout */
ioctl(fd, LOMIOCDOGTIME, (void *)&timeout);
/* Enable watchdog */
ioctl(fd, LOMIOCDOGCTL, (void *)&dogctl);
/* Keep patting */
while (1) {
ioctl(fd, LOMIOCDOGPAT, NULL);
sleep (5);
}
return (0);
}
Summary of Contents for Netra 1290
Page 12: ...xii Netra 1290 Server System Administration Guide May 2006...
Page 32: ...14 Netra 1290 Server System Administration Guide May 2006...
Page 48: ...30 Netra 1290 Server System Administration Guide May 2006...
Page 80: ...62 Netra 1290 Server System Administration Guide May 2006...
Page 104: ...86 Netra 1290 Server System Administration Guide May 2006...
Page 112: ...94 Netra 1290 Server System Administration Guide May 2006...
Page 142: ...124 Netra 1290 Server System Administration Guide May 2006...