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


##########
sched/hrtimer/hrtimer_set.c:
##########
@@ -0,0 +1,90 @@
+/****************************************************************************
+ * sched/hrtimer/hrtimer_set.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/arch.h>
+
+#include "sched/sched.h"
+#include "hrtimer/hrtimer.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: hrtimer_set
+ *
+ * Description:
+ *   Set or update the callback function and argument for a high-resolution
+ *   timer.
+ *
+ *   This function only updates the callback context associated with the
+ *   timer.  It does not arm, disarm, or otherwise modify the timer's
+ *   expiration state.
+ *
+ *   If the timer callback is currently executing, the updated callback
+ *   function will not affect the running invocation, but will be observed
+ *   by any subsequent expiration.
+ *
+ * Input Parameters:
+ *   hrtimer - Pointer to the high-resolution timer instance.
+ *   func    - Callback function to be invoked on timer expiration.
+ *   arg     - Argument passed to the callback function.
+ *
+ * Returned Value:
+ *   None.
+ *
+ * Assumptions/Notes:
+ *   - The global hrtimer spinlock protects access to the timer state.
+ *   - The caller must ensure that the timer structure remains valid while
+ *     the callback may still be executing.
+ *   - This function is safe to call regardless of whether the timer is
+ *     currently armed or inactive.
+ *
+ ****************************************************************************/
+
+int hrtimer_set(FAR hrtimer_t *hrtimer,

Review Comment:
   I was challenged by fix-point that users may need to update func of hrtimer 
and may do this concurrently on other cores, when the current core is executing 
the hrtimer, so I think I need to provide this API....
   
   **I agree with you and removed this API.**



##########
drivers/timers/arch_alarm.c:
##########
@@ -380,7 +380,7 @@ int weak_function up_alarm_tick_cancel(FAR clock_t *ticks)
  *
  ****************************************************************************/
 
-#ifdef CONFIG_SCHED_TICKLESS
+#if defined(CONFIG_HRTIMER) || defined(CONFIG_SCHED_TICKLESS)

Review Comment:
   Done



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to