printf("Starting wdt_driver (timeout: %d, sleep: %d, test: %s)\n",
fd = open("/dev/watchdog", O_WRONLY);
if (fd == ‐1) {
}
printf("Trying to set timeout value=%d seconds\n", timeout);
ioctl(fd, WDIOC_SETTIMEOUT, &timeout);
printf("The actual timeout was set to %d seconds\n", timeout);
ioctl(fd, WDIOC_GETTIMEOUT, &timeout);
printf("Now reading back ‐‐ The timeout is %d seconds\n", timeout);
while (1) {
}
return 0;
}
void help_info(void)
{
printf("Usage: wdt_driver_test <timeout> <sleep> <trigger>\n");
printf(" timeout: value in seconds to cause wdt timeout/reset\n");
printf(" sleep: value in seconds to display wdt timeout\n");
printf(" trigger: value in seconds to ping the wdt\n");
}
If you would like to change the WDT time, please modify:
ioctl(fd, WDIOC_SETTIMEOUT, &timeout).
3.8.3
GPIO Setting
Please see GPIO initial code listed below. Below code is to assign the starting value
to GPIO variable.
/* Enable GPIO */
gpio_request(SABRESD_GPIO8, "gpio‐8");
gpio_request(SABRESD_GPIO9, "gpio‐9");
ROM-3420 User Manual
timeout, sleep_sec, (test == 0) ? "ioctl" : "write");
perror("watchdog");
exit(1);
printf("WDT Time out counter:%d\n",count);
if ((test !=0) && (test ==count)) {
printf("Ping Watchdog (reset wdt)\n");
ioctl(fd, WDIOC_KEEPALIVE, 0);
test=0;
count=0;
}
sleep(sleep_sec);
count+=sleep_sec;
32