From 93a34b199242caa8e5ccaea9cf0f796e19e0589d Mon Sep 17 00:00:00 2001 From: chao an Date: Wed, 4 Dec 2024 10:31:48 +0800 Subject: [PATCH] drivers/timers: export arch timer api to support higher resolution Before: [ 384.149000] [CPU0] [ 5] Hello World! After: [ 384.149947] [CPU0] [ 5] Hello World! Signed-off-by: chao an --- drivers/timers/arch_alarm.c | 6 +----- drivers/timers/arch_timer.c | 4 ---- include/nuttx/arch.h | 8 -------- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/drivers/timers/arch_alarm.c b/drivers/timers/arch_alarm.c index 64c7a7a7d3..bb1db50a64 100644 --- a/drivers/timers/arch_alarm.c +++ b/drivers/timers/arch_alarm.c @@ -187,14 +187,13 @@ void up_alarm_set_lowerhalf(FAR struct oneshot_lowerhalf_s *lower) * ****************************************************************************/ -#ifdef CONFIG_CLOCK_TIMEKEEPING void weak_function up_timer_getmask(FAR clock_t *mask) { *mask = 0; if (g_oneshot_lower != NULL) { - clock_t maxticks; + clock_t maxticks = 0; ONESHOT_TICK_MAX_DELAY(g_oneshot_lower, &maxticks); @@ -210,9 +209,7 @@ void weak_function up_timer_getmask(FAR clock_t *mask) } } } -#endif -#if defined(CONFIG_SCHED_TICKLESS) || defined(CONFIG_CLOCK_TIMEKEEPING) int weak_function up_timer_gettick(FAR clock_t *ticks) { int ret = -EAGAIN; @@ -236,7 +233,6 @@ int weak_function up_timer_gettime(struct timespec *ts) return ret; } -#endif /**************************************************************************** * Name: up_alarm_cancel diff --git a/drivers/timers/arch_timer.c b/drivers/timers/arch_timer.c index a0725d00cf..8622e6b705 100644 --- a/drivers/timers/arch_timer.c +++ b/drivers/timers/arch_timer.c @@ -243,7 +243,6 @@ void up_timer_set_lowerhalf(FAR struct timer_lowerhalf_s *lower) * ****************************************************************************/ -#ifdef CONFIG_CLOCK_TIMEKEEPING void weak_function up_timer_getmask(FAR clock_t *mask) { uint32_t maxticks; @@ -262,9 +261,7 @@ void weak_function up_timer_getmask(FAR clock_t *mask) *mask = next; } } -#endif -#if defined(CONFIG_SCHED_TICKLESS) || defined(CONFIG_CLOCK_TIMEKEEPING) int weak_function up_timer_gettick(FAR clock_t *ticks) { int ret = -EAGAIN; @@ -291,7 +288,6 @@ int weak_function up_timer_gettime(struct timespec *ts) return ret; } -#endif /**************************************************************************** * Name: up_timer_cancel diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index 33b359441e..a9a5820b7f 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -1928,17 +1928,9 @@ void up_timer_initialize(void); * ****************************************************************************/ -#if defined(CONFIG_SCHED_TICKLESS) && !defined(CONFIG_SCHED_TICKLESS_TICK_ARGUMENT) int up_timer_gettime(FAR struct timespec *ts); -#endif - -#if defined(CONFIG_SCHED_TICKLESS_TICK_ARGUMENT) || defined(CONFIG_CLOCK_TIMEKEEPING) int up_timer_gettick(FAR clock_t *ticks); -#endif - -#ifdef CONFIG_CLOCK_TIMEKEEPING void up_timer_getmask(FAR clock_t *mask); -#endif /**************************************************************************** * Name: up_alarm_cancel