This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 4a51c21afc sched/clock: call up_timer_gettime() to get higher
resolution
4a51c21afc is described below
commit 4a51c21afce7f84ed28792038854d3d37b71083e
Author: ligd <[email protected]>
AuthorDate: Wed Dec 11 18:02:08 2024 +0800
sched/clock: call up_timer_gettime() to get higher resolution
Signed-off-by: ligd <[email protected]>
---
include/nuttx/clock.h | 6 ------
sched/clock/clock.h | 2 +-
sched/clock/clock_systime_ticks.c | 12 +++---------
sched/clock/clock_systime_timespec.c | 9 +++------
4 files changed, 7 insertions(+), 22 deletions(-)
diff --git a/include/nuttx/clock.h b/include/nuttx/clock.h
index 5afc8ed605..b750e5347d 100644
--- a/include/nuttx/clock.h
+++ b/include/nuttx/clock.h
@@ -334,10 +334,6 @@ extern "C"
#ifdef __HAVE_KERNEL_GLOBALS
EXTERN volatile clock_t g_system_ticks;
-
-# ifndef CONFIG_SYSTEM_TIME64
-# define clock_systime_ticks() g_system_ticks
-# endif
#endif
/****************************************************************************
@@ -695,9 +691,7 @@ void clock_resynchronize(FAR struct timespec *rtc_diff);
*
****************************************************************************/
-#if !defined(__HAVE_KERNEL_GLOBALS) || defined(CONFIG_SYSTEM_TIME64)
clock_t clock_systime_ticks(void);
-#endif
/****************************************************************************
* Name: clock_systime_timespec
diff --git a/sched/clock/clock.h b/sched/clock/clock.h
index 9e49af0e94..507adac347 100644
--- a/sched/clock/clock.h
+++ b/sched/clock/clock.h
@@ -56,7 +56,7 @@
* Public Data
****************************************************************************/
-#if !defined(CONFIG_SCHED_TICKLESS) && !defined(__HAVE_KERNEL_GLOBALS)
+#if !defined(__HAVE_KERNEL_GLOBALS)
/* The system clock exists (CONFIG_SCHED_TICKLESS), but it not prototyped
* globally in include/nuttx/clock.h.
*/
diff --git a/sched/clock/clock_systime_ticks.c
b/sched/clock/clock_systime_ticks.c
index a638719f94..a99d8e1040 100644
--- a/sched/clock/clock_systime_ticks.c
+++ b/sched/clock/clock_systime_ticks.c
@@ -85,19 +85,13 @@ clock_t clock_systime_ticks(void)
clock_systime_timespec(&ts);
return clock_time2ticks(&ts);
-#elif defined(CONFIG_SCHED_TICKLESS_TICK_ARGUMENT)
+#elif defined(CONFIG_ALARM_ARCH) || \
+ defined(CONFIG_TIMER_ARCH) || \
+ defined(CONFIG_SCHED_TICKLESS)
clock_t ticks = 0;
up_timer_gettick(&ticks);
return ticks;
-#elif defined(CONFIG_SCHED_TICKLESS)
- struct timespec ts =
- {
- 0
- };
-
- up_timer_gettime(&ts);
- return clock_time2ticks(&ts);
#elif defined(CONFIG_SYSTEM_TIME64)
clock_t sample;
clock_t verify;
diff --git a/sched/clock/clock_systime_timespec.c
b/sched/clock/clock_systime_timespec.c
index b27c548631..2e60b59a5b 100644
--- a/sched/clock/clock_systime_timespec.c
+++ b/sched/clock/clock_systime_timespec.c
@@ -77,12 +77,9 @@ int clock_systime_timespec(FAR struct timespec *ts)
ts->tv_sec = 0;
ts->tv_nsec = 0;
}
-#elif defined(CONFIG_SCHED_TICKLESS_TICK_ARGUMENT)
- clock_t ticks = 0;
-
- up_timer_gettick(&ticks);
- clock_ticks2time(ts, ticks);
-#elif defined(CONFIG_SCHED_TICKLESS)
+#elif defined(CONFIG_ALARM_ARCH) || \
+ defined(CONFIG_TIMER_ARCH) || \
+ defined(CONFIG_SCHED_TICKLESS)
up_timer_gettime(ts);
#else
clock_ticks2time(ts, g_system_ticks);