wangchdo commented on code in PR #17065:
URL: https://github.com/apache/nuttx/pull/17065#discussion_r2374683915


##########
arch/tricore/src/common/tricore_systimer.c:
##########
@@ -332,17 +332,83 @@ tricore_systimer_tick_start(struct oneshot_lowerhalf_s 
*lower,
 
 static int tricore_systimer_interrupt(int irq, void *context, void *arg)
 {
+#ifdef CONFIG_HRTIMER
+  (void)irq;
+  (void)context;
+  (void)arg;
+
+  hrtimer_queue_process(&g_hrtimer_oneshot_queue);
+#else
   struct tricore_systimer_lowerhalf_s *priv = arg;
 
   tricore_systimer_set_timecmp(priv, UINT64_MAX);
   if (priv->callback != NULL)
     {
       priv->callback(&priv->lower, priv->arg);
     }
+#endif
 
   return 0;
 }
 
+#ifdef CONFIG_HRTIMER
+static int
+tricore_hrtimer_set_expire(FAR const struct hrtimer_driver_s *driver,
+                           hrtimer_time_t expiration_time)
+{
+  (void)driver;
+
+  struct tricore_systimer_lowerhalf_s *priv = &g_systimer_lower;
+
+  IfxStm_updateCompare(priv->tbase, IfxStm_Comparator_0, expiration_time);
+
+  return OK;
+}
+
+static hrtimer_time_t
+tricore_hrtimer_current(FAR const struct hrtimer_driver_s *driver)
+{
+  (void)driver;
+
+  struct tricore_systimer_lowerhalf_s *priv = &g_systimer_lower;
+
+  return IfxStm_get(priv->tbase);
+}
+
+static int tricore_hrtimer_start(FAR const struct hrtimer_driver_s *driver)
+{
+  (void)driver;
+
+  up_enable_irq(192);
+
+  return OK;
+}
+
+static int tricore_hrtimer_trigger(FAR const struct hrtimer_driver_s *driver)
+{
+  (void)driver;
+
+  up_trigger_irq(192, 0);
+
+  return OK;
+}
+
+static const struct hrtimer_driver_ops_s g_hrtimer_driver_ops =
+{
+  .set_expire  = tricore_hrtimer_set_expire,
+  .current = tricore_hrtimer_current,
+  .start = tricore_hrtimer_start,
+  .trigger = tricore_hrtimer_trigger,
+};
+
+static struct hrtimer_driver_s g_hrtimer_driver =

Review Comment:
   I updated, please check @xiaoxiang781216 



-- 
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