summaryrefslogtreecommitdiffstats
path: root/apps/examples
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-04-16 22:15:33 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-04-16 22:15:33 +0000
commit461a0ea6cc9fb889343058124489a916fd79d5ee (patch)
treed06b5b451b2353f7812b1a6759250237a35f472e /apps/examples
parentd8d410ba2ecc1a838b07aa8a94e9c221a77eebf2 (diff)
Fix a couple of bugs in the STM32 IWDG driver
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4620 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'apps/examples')
-rw-r--r--apps/examples/watchdog/watchdog_main.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/apps/examples/watchdog/watchdog_main.c b/apps/examples/watchdog/watchdog_main.c
index 819f2636fd..c1341e0fb9 100644
--- a/apps/examples/watchdog/watchdog_main.c
+++ b/apps/examples/watchdog/watchdog_main.c
@@ -223,6 +223,9 @@ static void parse_args(FAR struct wdog_example_s *wdog, int argc, FAR char **arg
int wdog_main(int argc, char *argv[])
{
struct wdog_example_s wdog;
+#ifdef CONFIG_DEBUG_WATCHDOG
+ struct watchdog_status_s status;
+#endif
long elapsed;
int fd;
int ret;
@@ -278,6 +281,21 @@ int wdog_main(int argc, char *argv[])
usleep(wdog.pingdelay * 1000);
+ /* Show watchdog status. Only if debug is enabled because this
+ * could interfere with the timer.
+ */
+
+#ifdef CONFIG_DEBUG_WATCHDOG
+ ret = ioctl(fd, WDIOC_GETSTATUS, (unsigned long)&status);
+ if (ret < 0)
+ {
+ message("wdog_main: ioctl(WDIOC_GETSTATUS) failed: %d\n", errno);
+ goto errout_with_dev;
+ }
+ message("wdog_main: flags=%08x timeout=%d timeleft=%d\n",
+ status.flags, status.timeout, status.timeleft);
+#endif
+
/* Then ping */
ret = ioctl(fd, WDIOC_KEEPALIVE, 0);
@@ -299,6 +317,21 @@ int wdog_main(int argc, char *argv[])
usleep(wdog.pingdelay * 1000);
+ /* Show watchdog status. Only if debug is enabled because this
+ * could interfere with the timer.
+ */
+
+#ifdef CONFIG_DEBUG_WATCHDOG
+ ret = ioctl(fd, WDIOC_GETSTATUS, (unsigned long)&status);
+ if (ret < 0)
+ {
+ message("wdog_main: ioctl(WDIOC_GETSTATUS) failed: %d\n", errno);
+ goto errout_with_dev;
+ }
+ message("wdog_main: flags=%08x timeout=%d timeleft=%d\n",
+ status.flags, status.timeout, status.timeleft);
+#endif
+
message(" NO ping elapsed=%ld\n", elapsed);
msgflush();
}