This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 7e7828b3f67ca5bfe7b6caf023cf6baa8cecfe91
Author: ouyangxiangzhen <[email protected]>
AuthorDate: Tue Jul 29 17:11:32 2025 +0800

    timers/oneshot: Remove oneshot tick API.
    
    This commit removed all oneshot tick API for new clkdev API.
    
    Signed-off-by: ouyangxiangzhen <[email protected]>
---
 arch/tricore/src/common/tricore_systimer.c      |  47 --------
 arch/x86_64/src/intel64/intel64_oneshot_lower.c | 150 +-----------------------
 include/nuttx/timers/oneshot.h                  | 106 ++---------------
 3 files changed, 14 insertions(+), 289 deletions(-)

diff --git a/arch/tricore/src/common/tricore_systimer.c 
b/arch/tricore/src/common/tricore_systimer.c
index 7ac11436dee..c3d574dc92e 100644
--- a/arch/tricore/src/common/tricore_systimer.c
+++ b/arch/tricore/src/common/tricore_systimer.c
@@ -64,10 +64,6 @@ static int tricore_systimer_cancel(struct 
oneshot_lowerhalf_s *lower,
                                    struct timespec *ts);
 static int tricore_systimer_current(struct oneshot_lowerhalf_s *lower,
                                     struct timespec *ts);
-static int
-tricore_systimer_tick_start(struct oneshot_lowerhalf_s *lower,
-                            oneshot_callback_t callback, void *arg,
-                            clock_t ticks);
 
 /****************************************************************************
  * Private Data
@@ -79,7 +75,6 @@ static const struct oneshot_operations_s 
g_tricore_systimer_ops =
   .start     = tricore_systimer_start,
   .cancel    = tricore_systimer_cancel,
   .current   = tricore_systimer_current,
-  .tick_start = tricore_systimer_tick_start,
 };
 
 static struct tricore_systimer_lowerhalf_s g_systimer_lower =
@@ -270,48 +265,6 @@ static int tricore_systimer_current(struct 
oneshot_lowerhalf_s *lower,
   return 0;
 }
 
-/****************************************************************************
- * Name: tricore_systimer_tick_start
- *
- * Description:
- *   Start the oneshot timer
- *
- * Input Parameters:
- *   lower    An instance of the lower-half oneshot state structure.  This
- *            structure must have been previously initialized via a call to
- *            oneshot_initialize();
- *   handler  The function to call when when the oneshot timer expires.
- *   arg      An opaque argument that will accompany the callback.
- *   ticks    Provides the duration of the one shot timer.
- *
- * Returned Value:
- *   Zero (OK) is returned on success; a negated errno value is returned
- *   on failure.
- *
- ****************************************************************************/
-
-static int
-tricore_systimer_tick_start(struct oneshot_lowerhalf_s *lower,
-                            oneshot_callback_t callback, void *arg,
-                            clock_t ticks)
-{
-  struct tricore_systimer_lowerhalf_s *priv =
-    (struct tricore_systimer_lowerhalf_s *)lower;
-  uint64_t mtime = tricore_systimer_get_time(priv);
-
-  priv->alarm = mtime + priv->freq * ticks / TICK_PER_SEC;
-  if (priv->alarm < mtime)
-    {
-      priv->alarm = UINT64_MAX;
-    }
-
-  priv->callback = callback;
-  priv->arg      = arg;
-
-  tricore_systimer_set_timecmp(priv, priv->alarm);
-  return 0;
-}
-
 /****************************************************************************
  * Name: tricore_systimer_interrupt
  *
diff --git a/arch/x86_64/src/intel64/intel64_oneshot_lower.c 
b/arch/x86_64/src/intel64/intel64_oneshot_lower.c
index d8c6dd92345..bb8e55d2305 100644
--- a/arch/x86_64/src/intel64/intel64_oneshot_lower.c
+++ b/arch/x86_64/src/intel64/intel64_oneshot_lower.c
@@ -65,14 +65,6 @@ static int intel64_cancel(struct oneshot_lowerhalf_s *lower,
                           struct timespec *ts);
 static int intel64_current(struct oneshot_lowerhalf_s *lower,
                            struct timespec *ts);
-static int intel64_tick_max_delay(struct oneshot_lowerhalf_s *lower,
-                                  clock_t *ticks);
-static int intel64_tick_start(struct oneshot_lowerhalf_s *lower,
-                              clock_t ticks);
-static int intel64_tick_cancel(struct oneshot_lowerhalf_s *lower,
-                               clock_t *ticks);
-static int intel64_tick_current(struct oneshot_lowerhalf_s *lower,
-                                clock_t *ticks);
 
 /****************************************************************************
  * Private Data
@@ -85,11 +77,7 @@ static const struct oneshot_operations_s g_oneshot_ops =
   .max_delay      = intel64_max_delay,
   .start          = intel64_start,
   .cancel         = intel64_cancel,
-  .current        = intel64_current,
-  .tick_max_delay = intel64_tick_max_delay,
-  .tick_start     = intel64_tick_start,
-  .tick_cancel    = intel64_tick_cancel,
-  .tick_current   = intel64_tick_current,
+  .current        = intel64_current
 };
 
 static spinlock_t g_oneshotlow_spin;
@@ -295,142 +283,6 @@ static int intel64_current(struct oneshot_lowerhalf_s 
*lower,
   return OK;
 }
 
-/****************************************************************************
- * Name: intel64_tick_max_delay
- *
- * Description:
- *   Determine the maximum delay of the one-shot timer (in microseconds)
- *
- * Input Parameters:
- *   lower   An instance of the lower-half oneshot state structure.  This
- *           structure must have been previously initialized via a call to
- *           oneshot_initialize();
- *   ticks   The location in which to return the maximum delay.
- *
- * Returned Value:
- *   Zero (OK) is returned on success; a negated errno value is returned
- *   on failure.
- *
- ****************************************************************************/
-
-static int intel64_tick_max_delay(struct oneshot_lowerhalf_s *lower,
-                                  clock_t *ticks)
-{
-  struct timespec ts;
-  int             ret;
-
-  ret = intel64_max_delay(lower, &ts);
-
-  /* Convert time to ticks */
-
-  *ticks = clock_time2ticks(&ts);
-
-  return ret;
-}
-
-/****************************************************************************
- * Name: intel64_tick_start
- *
- * Description:
- *   Start the oneshot timer
- *
- * Input Parameters:
- *   lower    An instance of the lower-half oneshot state structure.  This
- *            structure must have been previously initialized via a call to
- *            oneshot_initialize();
- *   handler  The function to call when when the oneshot timer expires.
- *   arg      An opaque argument that will accompany the callback.
- *   ticks    Provides the duration of the one shot timer.
- *
- * Returned Value:
- *   Zero (OK) is returned on success; a negated errno value is returned
- *   on failure.
- *
- ****************************************************************************/
-
-static int intel64_tick_start(struct oneshot_lowerhalf_s *lower,
-                              clock_t ticks)
-{
-  struct timespec ts;
-
-  /* Convert ticks to time */
-
-  clock_ticks2time(&ts, ticks);
-
-  return intel64_start(lower, &ts);
-}
-
-/****************************************************************************
- * Name: intel64_tick_cancel
- *
- * Description:
- *   Cancel the oneshot timer and return the time remaining on the timer.
- *
- *   NOTE: This function may execute at a high rate with no timer running (as
- *   when pre-emption is enabled and disabled).
- *
- * Input Parameters:
- *   lower   Caller allocated instance of the oneshot state structure.  This
- *           structure must have been previously initialized via a call to
- *           oneshot_initialize();
- *   ticks   The location in which to return the time remaining on the
- *           oneshot timer.
- *
- * Returned Value:
- *   Zero (OK) is returned on success.  A call to up_timer_cancel() when
- *   the timer is not active should also return success; a negated errno
- *   value is returned on any failure.
- *
- ****************************************************************************/
-
-static int intel64_tick_cancel(struct oneshot_lowerhalf_s *lower,
-                               clock_t *ticks)
-{
-  struct timespec ts;
-  int             ret;
-
-  ret = intel64_cancel(lower, &ts);
-
-  /* Convert time to ticks */
-
-  *ticks = clock_time2ticks(&ts);
-
-  return ret;
-}
-
-/****************************************************************************
- * Name: intel64_tick_current
- *
- * Description:
- *  Get the current time.
- *
- * Input Parameters:
- *   lower   Caller allocated instance of the oneshot state structure.  This
- *           structure must have been previously initialized via a call to
- *           oneshot_initialize();
- *   ticks   The location in which to return the current time.
- *
- * Returned Value:
- *   Zero (OK) is returned on success, a negated errno value is returned on
- *   any failure.
- *
- ****************************************************************************/
-
-static int intel64_tick_current(struct oneshot_lowerhalf_s *lower,
-                                clock_t *ticks)
-{
-  struct timespec ts;
-  int             ret;
-
-  ret = intel64_current(lower, &ts);
-
-  /* Convert time to ticks */
-
-  *ticks = clock_time2ticks(&ts);
-
-  return ret;
-}
-
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
diff --git a/include/nuttx/timers/oneshot.h b/include/nuttx/timers/oneshot.h
index 747d494ab73..642bd138f20 100644
--- a/include/nuttx/timers/oneshot.h
+++ b/include/nuttx/timers/oneshot.h
@@ -95,10 +95,8 @@
  *
  ****************************************************************************/
 
-#define ONESHOT_MAX_DELAY(l,t) \
-  ((l)->ops->max_delay ? (l)->ops->max_delay(l,t) : oneshot_max_delay(l,t))
-#define ONESHOT_TICK_MAX_DELAY(l,t) \
-  ((l)->ops->tick_max_delay ? (l)->ops->tick_max_delay(l,t) : 
oneshot_tick_max_delay(l,t))
+#define ONESHOT_MAX_DELAY(l,t) (l)->ops->max_delay(l,t)
+#define ONESHOT_TICK_MAX_DELAY(l,t) oneshot_tick_max_delay(l,t)
 
 /****************************************************************************
  * Name: ONESHOT_START
@@ -120,10 +118,8 @@
  *
  ****************************************************************************/
 
-#define ONESHOT_START(l,t) \
-  ((l)->ops->start ? (l)->ops->start(l,t) : oneshot_start(l,t))
-#define ONESHOT_TICK_START(l,t) \
-  ((l)->ops->tick_start ? (l)->ops->tick_start(l,t) : oneshot_tick_start(l,t))
+#define ONESHOT_START(l,t) (l)->ops->start(l,t)
+#define ONESHOT_TICK_START(l,t) oneshot_tick_start(l,t)
 
 /****************************************************************************
  * Name: ONESHOT_CANCEL
@@ -149,10 +145,8 @@
  *
  ****************************************************************************/
 
-#define ONESHOT_CANCEL(l,t) \
-  ((l)->ops->cancel ? (l)->ops->cancel(l,t) : oneshot_cancel(l,t))
-#define ONESHOT_TICK_CANCEL(l,t) \
-  ((l)->ops->tick_cancel ? (l)->ops->tick_cancel(l,t) : 
oneshot_tick_cancel(l,t))
+#define ONESHOT_CANCEL(l,t) (l)->ops->cancel(l,t)
+#define ONESHOT_TICK_CANCEL(l,t) oneshot_tick_cancel(l,t)
 
 /****************************************************************************
  * Name: ONESHOT_CURRENT
@@ -173,10 +167,8 @@
  *
  ****************************************************************************/
 
-#define ONESHOT_CURRENT(l,t) \
-  ((l)->ops->current ? (l)->ops->current(l,t) : oneshot_current(l,t))
-#define ONESHOT_TICK_CURRENT(l,t) \
-  ((l)->ops->tick_current ? (l)->ops->tick_current(l,t) : 
oneshot_tick_current(l,t))
+#define ONESHOT_CURRENT(l,t) (l)->ops->current(l,t)
+#define ONESHOT_TICK_CURRENT(l,t) oneshot_tick_current(l,t)
 
 /****************************************************************************
  * Public Types
@@ -207,14 +199,6 @@ struct oneshot_operations_s
                      FAR struct timespec *ts);
   CODE int (*current)(FAR struct oneshot_lowerhalf_s *lower,
                       FAR struct timespec *ts);
-  CODE int (*tick_max_delay)(FAR struct oneshot_lowerhalf_s *lower,
-                             FAR clock_t *ticks);
-  CODE int (*tick_start)(FAR struct oneshot_lowerhalf_s *lower,
-                         clock_t ticks);
-  CODE int (*tick_cancel)(FAR struct oneshot_lowerhalf_s *lower,
-                          FAR clock_t *ticks);
-  CODE int (*tick_current)(FAR struct oneshot_lowerhalf_s *lower,
-                           FAR clock_t *ticks);
 };
 
 /* This structure describes the state of the oneshot timer lower-half
@@ -260,77 +244,9 @@ extern "C"
 #endif
 
 /****************************************************************************
- * Public Function Prototypes
+ * Inline Functions
  ****************************************************************************/
 
-static inline
-int oneshot_max_delay(FAR struct oneshot_lowerhalf_s *lower,
-                      FAR struct timespec *ts)
-{
-  clock_t tick;
-  int ret;
-
-  if (lower->ops->tick_max_delay == NULL)
-    {
-      return -ENOTSUP;
-    }
-
-  ret = lower->ops->tick_max_delay(lower, &tick);
-  clock_ticks2time(ts, tick);
-  return ret;
-}
-
-static inline
-int oneshot_start(FAR struct oneshot_lowerhalf_s *lower,
-                  FAR const struct timespec *ts)
-{
-  clock_t tick;
-
-  if (lower->ops->tick_start == NULL)
-    {
-      return -ENOTSUP;
-    }
-
-  tick = clock_time2ticks(ts);
-  return lower->ops->tick_start(lower, tick);
-}
-
-static inline
-int oneshot_cancel(FAR struct oneshot_lowerhalf_s *lower,
-                   FAR struct timespec *ts)
-{
-  clock_t tick;
-  int ret;
-
-  if (lower->ops->tick_cancel == NULL)
-    {
-      return -ENOTSUP;
-    }
-
-  ret = lower->ops->tick_cancel(lower, &tick);
-  clock_ticks2time(ts, tick);
-
-  return ret;
-}
-
-static inline
-int oneshot_current(FAR struct oneshot_lowerhalf_s *lower,
-                    FAR struct timespec *ts)
-{
-  clock_t tick;
-  int ret;
-
-  if (lower->ops->tick_current == NULL)
-    {
-      return -ENOTSUP;
-    }
-
-  ret = lower->ops->tick_current(lower, &tick);
-  clock_ticks2time(ts, tick);
-
-  return ret;
-}
-
 static inline
 int oneshot_tick_max_delay(FAR struct oneshot_lowerhalf_s *lower,
                            FAR clock_t *ticks)
@@ -408,6 +324,10 @@ void oneshot_process_callback(FAR struct 
oneshot_lowerhalf_s *lower)
     }
 }
 
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
 /****************************************************************************
  * Name: oneshot_initialize
  *

Reply via email to