pkarashchenko commented on code in PR #7126:
URL: https://github.com/apache/incubator-nuttx/pull/7126#discussion_r975221624


##########
drivers/timers/watchdog.c:
##########
@@ -186,26 +223,49 @@ static void watchdog_automonitor_idle(FAR struct 
pm_callback_s *cb,
 #endif
 
 #ifdef CONFIG_WATCHDOG_AUTOMONITOR
-static void watchdog_automonitor_start(FAR struct watchdog_upperhalf_s
-                                       *upper)
+#  if defined(CONFIG_WATCHDOG_AUTOMONITOR_BY_ONESHOT)
+static void
+watchdog_automonitor_start(FAR struct watchdog_upperhalf_s *upper,
+                           FAR struct oneshot_lowerhalf_s *oneshot)
+#  elif defined(CONFIG_WATCHDOG_AUTOMONITOR_BY_TIMER)
+static void
+watchdog_automonitor_start(FAR struct watchdog_upperhalf_s *upper,
+                           FAR struct timer_lowerhalf_s *timer)
+#  else
+static void
+watchdog_automonitor_start(FAR struct watchdog_upperhalf_s *upper)
+#  endif
 {
   FAR struct watchdog_lowerhalf_s *lower = upper->lower;
 
   if (!upper->monitor)
     {
-      upper->monitor = true;
-#if defined(CONFIG_WATCHDOG_AUTOMONITOR_BY_CAPTURE)
+#  if defined(CONFIG_WATCHDOG_AUTOMONITOR_BY_CAPTURE)
       lower->ops->capture(lower, watchdog_automonitor_capture);
+#  elif defined(CONFIG_WATCHDOG_AUTOMONITOR_BY_ONESHOT)
+      struct timespec ts =
+      {
+        WATCHDOG_AUTOMONITOR_PING_INTERVAL, 0
+      };

Review Comment:
   ```suggestion
           {
             WATCHDOG_AUTOMONITOR_PING_INTERVAL, 0
           };
   ```



##########
drivers/timers/watchdog.c:
##########
@@ -144,17 +148,50 @@ static int watchdog_automonitor_capture(int irq, FAR void 
*context,
 
   return 0;
 }
+#elif defined(CONFIG_WATCHDOG_AUTOMONITOR_BY_ONESHOT)
+static void
+watchdog_automonitor_oneshot(FAR struct oneshot_lowerhalf_s *oneshot,
+                             FAR void *arg)
+{
+  FAR struct watchdog_upperhalf_s *upper = arg;
+  FAR struct watchdog_lowerhalf_s *lower = upper->lower;
+
+  if (upper->monitor)
+    {
+      struct timespec ts =
+      {
+        WATCHDOG_AUTOMONITOR_PING_INTERVAL, 0
+      };

Review Comment:
   ```suggestion
           {
             WATCHDOG_AUTOMONITOR_PING_INTERVAL, 0
           };
   ```
   I see that style accept both, so not sure which one is better



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to