| Electronic Components Datasheet Search |
|
UM0851 Datasheet(PDF) 214 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
UM0851 Datasheet(HTML) 214 Page - STMicroelectronics |
|
214 / 245 page ![]() Miscellaneous device drivers UM0851 214/245 Doc ID 16604 Rev 2 fd = open(wdt_dev, O_RDWR); if (fd < 0) { printf("Error in opening device\n"); } Configuring WDT IOCTL calls can be used to program and configure watchdog timer. The following code snippet demonstrates the use of these ioctls. int ret = 0; int timeleft=0; struct watchdog_info ident; int timeout = 45; /* in seconds */ /* to find out supported options in watchdog */ ret = ioctl(fd, WDIOC_GETSUPPORT, &ident); /* to set time out */ ioctl(fd, WDIOC_SETTIMEOUT, &timeout); /* to find out how much time is left before reset */ ret = ioctl(fd, WDIOC_GETTIMEOUT, &timeleft); /* Refresh watchdog timer at every 10 secs to prevent reset */ while (1) { ioctl(fd, WDIOC,KEEPALIVE, 0); sleep(10); } The following table lists the standard ioctl calls supported by the SPEAr watchdog driver. Watchdog deamon The watchdog is a daemon. It opens /dev/watchdog, and keeps writing to it often enough to keep the kernel from resetting, at least once per minute. Each write delays the reboot time another minute. After a minute the watchdog hardware generates a reset. The watchdog can be stopped without causing a reboot if the device /dev/watchdog is closed correctly, unless your kernel is compiled with the CONFIG_WATCHDOG_NOWAYOUT option enabled. Table 56. Watchdog IOCTLs IOCTLs Purpose WDIOC_GETSUPPORT The fields returned in the ident structure are: identity: A string identifying the watchdog driver firmware_version: the firmware version of the card if available. options: A flags describing what the device supports. WDIOC_KEEPALIVE This ioctl does exactly the same thing as a write to the watchdog device and hence refreshes the timer WDIOC_SETTIMEOUT Set time out in seconds, after which reset would be generated (if wdt is not refreshed) WDIOC_GETTIMEOUT Query the current timeout |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |