xref: /OK3568_Linux_fs/app/forlinx/forlinx_cmd/fltest_watchdogrestart/watchdogrestart.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 
2 /*
3  * Watchdog Driver Test Program
4  */
5 
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <unistd.h>
10 #include <fcntl.h>
11 #include <sys/ioctl.h>
12 #include <linux/types.h>
13 #include <linux/watchdog.h>
14 
main(void)15 int main(void)
16 {
17 
18 	int fd,flags;
19     fd = open("/dev/watchdog", O_WRONLY);
20 
21     if (fd == -1) {
22 	fprintf(stderr, "Watchdog device not enabled.\n");
23 	fflush(stderr);
24 	exit(-1);
25     }
26 	flags = 10;
27 	ioctl(fd,WDIOC_SETTIMEOUT,&flags);
28 	printf("Restart after 10 seconds\n");
29 
30     while(1) {
31     }
32 }
33