33 lines
510 B
C
33 lines
510 B
C
|
|
||
|
/*
|
||
|
* Watchdog Driver Test Program
|
||
|
*/
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
#include <unistd.h>
|
||
|
#include <fcntl.h>
|
||
|
#include <sys/ioctl.h>
|
||
|
#include <linux/types.h>
|
||
|
#include <linux/watchdog.h>
|
||
|
|
||
|
int main(void)
|
||
|
{
|
||
|
|
||
|
int fd,flags;
|
||
|
fd = open("/dev/watchdog", O_WRONLY);
|
||
|
|
||
|
if (fd == -1) {
|
||
|
fprintf(stderr, "Watchdog device not enabled.\n");
|
||
|
fflush(stderr);
|
||
|
exit(-1);
|
||
|
}
|
||
|
flags = 10;
|
||
|
ioctl(fd,WDIOC_SETTIMEOUT,&flags);
|
||
|
printf("Restart after 10 seconds\n");
|
||
|
|
||
|
while(1) {
|
||
|
}
|
||
|
}
|