You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/11/01 03:17:48 UTC

[GitHub] [incubator-nuttx] zyfeier opened a new pull request, #7494: arch_timer: adjust timer/arch_timer to support tick

zyfeier opened a new pull request, #7494:
URL: https://github.com/apache/incubator-nuttx/pull/7494

   ## Summary
   
   Enable CONFIG_SCHED_TICKLESS_TICK_ARGUMENT in tickless mode to improve the performance.
   
   ## Impact
   
   NA
   
   ## Testing
   
   bl602
   


-- 
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-unsubscribe@nuttx.apache.org

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


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #7494: arch_timer: adjust timer/arch_timer to support tick

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #7494:
URL: https://github.com/apache/incubator-nuttx/pull/7494#discussion_r1010048575


##########
include/nuttx/timers/timer.h:
##########
@@ -200,6 +247,98 @@ extern "C"
 #define EXTERN extern
 #endif
 
+static inline
+int timer_getstatus(FAR struct timer_lowerhalf_s *lower,
+                     FAR struct timer_status_s *status)
+{
+  struct timer_status_s tick_status;
+  int ret;
+
+  DEBUGASSERT(lower->ops->tick_getstatus);
+
+  ret = lower->ops->tick_getstatus(lower, &tick_status);

Review Comment:
   let's use status directly



##########
include/nuttx/timers/timer.h:
##########
@@ -200,6 +247,98 @@ extern "C"
 #define EXTERN extern
 #endif
 
+static inline
+int timer_getstatus(FAR struct timer_lowerhalf_s *lower,
+                     FAR struct timer_status_s *status)
+{
+  struct timer_status_s tick_status;
+  int ret;
+
+  DEBUGASSERT(lower->ops->tick_getstatus);
+
+  ret = lower->ops->tick_getstatus(lower, &tick_status);
+  if (ret >= 0)
+    {
+      status->flags = tick_status.flags;
+      status->timeout = TICK2USEC(tick_status.timeout);
+      status->timeleft = TICK2USEC(tick_status.timeleft);
+    }
+
+  return ret;
+}
+
+static inline
+int timer_settimeout(FAR struct timer_lowerhalf_s *lower,
+                     uint32_t timeout)
+{
+  DEBUGASSERT(lower->ops->tick_setttimeout);
+  return lower->ops->tick_setttimeout(lower, USEC2TICK(timeout));
+}
+
+static inline
+int timer_maxtimeout(FAR struct timer_lowerhalf_s *lower,
+                     FAR uint32_t *maxtimeout)
+{
+  uint32_t maxtimeout_tick;
+  int ret;
+
+  DEBUGASSERT(lower->ops->tick_maxtimeout);
+
+  ret = lower->ops->tick_maxtimeout(lower, &maxtimeout_tick);
+  if (ret >= 0)
+    {
+      *maxtimeout = TICK2USEC(maxtimeout_tick);
+    }
+
+  return ret;
+}
+
+static inline
+int timer_tick_getstatus(FAR struct timer_lowerhalf_s *lower,
+                          FAR struct timer_status_s *status)
+{
+  struct timer_status_s us_status;
+  int ret;
+
+  DEBUGASSERT(lower->ops->getstatus);
+
+  ret = lower->ops->getstatus(lower, &us_status);
+  if (ret >= 0)
+    {
+      status->flags = us_status.flags;
+      status->timeout = USEC2TICK(us_status.timeout);
+      status->timeleft = USEC2TICK(us_status.timeleft);
+    }
+
+  return ret;
+}
+
+static inline
+int timer_tick_settimeout(FAR struct timer_lowerhalf_s *lower,
+                          uint32_t timeout)
+{
+  DEBUGASSERT(lower->ops->settimeout);
+  return lower->ops->settimeout(lower, TICK2USEC(timeout));
+}
+
+static inline
+int timer_tick_maxtimeout(FAR struct timer_lowerhalf_s *lower,
+                          FAR uint32_t *maxtimeout)
+{
+  uint32_t maxtimeout_us;
+  int ret;
+
+  DEBUGASSERT(lower->ops->maxtimeout);
+
+  ret = lower->ops->maxtimeout(lower, &maxtimeout_us);

Review Comment:
   let's use maxtimeout directly



##########
include/nuttx/timers/timer.h:
##########
@@ -200,6 +247,98 @@ extern "C"
 #define EXTERN extern
 #endif
 
+static inline
+int timer_getstatus(FAR struct timer_lowerhalf_s *lower,
+                     FAR struct timer_status_s *status)
+{
+  struct timer_status_s tick_status;
+  int ret;
+
+  DEBUGASSERT(lower->ops->tick_getstatus);
+
+  ret = lower->ops->tick_getstatus(lower, &tick_status);
+  if (ret >= 0)
+    {
+      status->flags = tick_status.flags;
+      status->timeout = TICK2USEC(tick_status.timeout);
+      status->timeleft = TICK2USEC(tick_status.timeleft);
+    }
+
+  return ret;
+}
+
+static inline
+int timer_settimeout(FAR struct timer_lowerhalf_s *lower,
+                     uint32_t timeout)
+{
+  DEBUGASSERT(lower->ops->tick_setttimeout);
+  return lower->ops->tick_setttimeout(lower, USEC2TICK(timeout));
+}
+
+static inline
+int timer_maxtimeout(FAR struct timer_lowerhalf_s *lower,
+                     FAR uint32_t *maxtimeout)
+{
+  uint32_t maxtimeout_tick;
+  int ret;
+
+  DEBUGASSERT(lower->ops->tick_maxtimeout);
+
+  ret = lower->ops->tick_maxtimeout(lower, &maxtimeout_tick);
+  if (ret >= 0)
+    {
+      *maxtimeout = TICK2USEC(maxtimeout_tick);
+    }
+
+  return ret;
+}
+
+static inline
+int timer_tick_getstatus(FAR struct timer_lowerhalf_s *lower,
+                          FAR struct timer_status_s *status)
+{
+  struct timer_status_s us_status;
+  int ret;
+
+  DEBUGASSERT(lower->ops->getstatus);
+
+  ret = lower->ops->getstatus(lower, &us_status);

Review Comment:
   let's use status directly



##########
include/nuttx/timers/timer.h:
##########
@@ -200,6 +247,98 @@ extern "C"
 #define EXTERN extern
 #endif
 
+static inline
+int timer_getstatus(FAR struct timer_lowerhalf_s *lower,
+                     FAR struct timer_status_s *status)
+{
+  struct timer_status_s tick_status;
+  int ret;
+
+  DEBUGASSERT(lower->ops->tick_getstatus);
+
+  ret = lower->ops->tick_getstatus(lower, &tick_status);
+  if (ret >= 0)
+    {
+      status->flags = tick_status.flags;
+      status->timeout = TICK2USEC(tick_status.timeout);
+      status->timeleft = TICK2USEC(tick_status.timeleft);
+    }
+
+  return ret;
+}
+
+static inline
+int timer_settimeout(FAR struct timer_lowerhalf_s *lower,
+                     uint32_t timeout)
+{
+  DEBUGASSERT(lower->ops->tick_setttimeout);
+  return lower->ops->tick_setttimeout(lower, USEC2TICK(timeout));
+}
+
+static inline
+int timer_maxtimeout(FAR struct timer_lowerhalf_s *lower,
+                     FAR uint32_t *maxtimeout)
+{
+  uint32_t maxtimeout_tick;
+  int ret;
+
+  DEBUGASSERT(lower->ops->tick_maxtimeout);
+
+  ret = lower->ops->tick_maxtimeout(lower, &maxtimeout_tick);

Review Comment:
   let's use maxtimeout directly



-- 
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-unsubscribe@nuttx.apache.org

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


[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #7494: arch_timer: adjust timer/arch_timer to support tick

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #7494:
URL: https://github.com/apache/incubator-nuttx/pull/7494


-- 
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-unsubscribe@nuttx.apache.org

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