EasyManua.ls Logo

Sun Microsystems Netra T2000 - Example Watchdog Program

Sun Microsystems Netra T2000
122 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Appendix A Watchdog Timer Application Mode 91
Example Watchdog Program
Following is a sample program for the watchdog timer.
CODE EXAMPLE A-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 A-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);
}

Table of Contents

Other manuals for Sun Microsystems Netra T2000

Related product manuals