58
Programmer’s Guide | Korenix
1. Function: RTC_RD_TIME
int ioctl(fd, RTC_RD_TIME, struct rtc_time *time);
Description: read time information from RTC. It will return the value on argument 3.
2. Function: RTC_SET_TIME
int ioctl(fd, RTC_SET_TIME, struct rtc_time *time);
Description: set RTC time. Argument 3 will be passed to RTC.
6-4
Watch Dog Timer
A Watchdog Timer (WDT) is a hardware circuit that can reset the computer system in case of a
software fault. You probably knew that already.
The Watchdog Driver has one basic role: to talk to the card and send signals to it so it doesn't
reset your computer ... at least during normal operation.
The ioctl API:
Pinging the watchdog using an ioctl:
WDIOC_KEEPALIVE:,
This ioctl does exactly the same thing as a write to the watchdog device, so the main loop in
the program could be:
while (1) {
ioctl(fd, WDIOC_KEEPALIVE, 0);
sleep(10);
}
The argument to the ioctl is ignored.
Setting and getting the timeout:
To modify the watchdog timeout on the fly with the SETTIMEOUT ioctl, driver has the
WDIOF_SETTIMEOUT flag set in their option field. The argument is an integer representing
the timeout in seconds. The driver returns the real timeout used in the same variable, and
this timeout might differ from the requested one due to limitation of the hardware.
int timeout = 45;
ioctl(fd, WDIOC_SETTIMEOUT, &timeout);
printf("The timeout was set to %d seconds\n", timeout);
Содержание JetBox5400 series
Страница 1: ...JetOS95 User Manual www korenix com...
Страница 5: ...Korenix Overview 5...
Страница 68: ...68 Appendix Korenix http www busybox net downloads BusyBox html...