From 8f36db5a48c12b86681d4a0177114e7d43c99565 Mon Sep 17 00:00:00 2001 From: Jyri Sarha Date: Thu, 7 Nov 2024 21:41:25 +0200 Subject: [PATCH] drivers: timer: Export sys_clock_cycle_get_64() implementations Export sys_clock_cycle_get_64() implementations to enable k_cycle_get_64() calls from llext libraries. Signed-off-by: Jyri Sarha --- drivers/timer/apic_timer.c | 1 + drivers/timer/apic_tsc.c | 1 + drivers/timer/arm_arch_timer.c | 1 + drivers/timer/cc13xx_cc26xx_rtc_timer.c | 1 + drivers/timer/cortex_m_systick.c | 1 + drivers/timer/esp32_sys_timer.c | 1 + drivers/timer/hpet.c | 1 + drivers/timer/intel_adsp_timer.c | 1 + drivers/timer/litex_timer.c | 1 + drivers/timer/mcux_os_timer.c | 1 + drivers/timer/mtk_adsp_timer.c | 1 + drivers/timer/native_posix_timer.c | 1 + drivers/timer/npcx_itim_timer.c | 1 + drivers/timer/nrf_grtc_timer.c | 1 + drivers/timer/riscv_machine_timer.c | 1 + 15 files changed, 15 insertions(+) diff --git a/drivers/timer/apic_timer.c b/drivers/timer/apic_timer.c index 2c16ba749000bdf..de2dec0c27d80f1 100644 --- a/drivers/timer/apic_timer.c +++ b/drivers/timer/apic_timer.c @@ -80,6 +80,7 @@ uint64_t sys_clock_cycle_get_64(void) return cycles + (CYCLES_PER_TICK - ccr_2nd); } +EXPORT_SYMBOL(sys_clock_cycle_get_64); uint32_t sys_clock_cycle_get_32(void) { diff --git a/drivers/timer/apic_tsc.c b/drivers/timer/apic_tsc.c index 0c617a01ca789e9..93086daae2e8d7d 100644 --- a/drivers/timer/apic_tsc.c +++ b/drivers/timer/apic_tsc.c @@ -209,6 +209,7 @@ uint64_t sys_clock_cycle_get_64(void) { return rdtsc(); } +EXPORT_SYMBOL(sys_clock_cycle_get_64); static inline uint32_t timer_irq(void) { diff --git a/drivers/timer/arm_arch_timer.c b/drivers/timer/arm_arch_timer.c index 885eb3a369b1c2d..5d05a5c11a58f6b 100644 --- a/drivers/timer/arm_arch_timer.c +++ b/drivers/timer/arm_arch_timer.c @@ -190,6 +190,7 @@ uint64_t sys_clock_cycle_get_64(void) { return arm_arch_timer_count(); } +EXPORT_SYMBOL(sys_clock_cycle_get_64); #ifdef CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT void arch_busy_wait(uint32_t usec_to_wait) diff --git a/drivers/timer/cc13xx_cc26xx_rtc_timer.c b/drivers/timer/cc13xx_cc26xx_rtc_timer.c index 3d45fb7d7daa7f2..20f443d8358513f 100644 --- a/drivers/timer/cc13xx_cc26xx_rtc_timer.c +++ b/drivers/timer/cc13xx_cc26xx_rtc_timer.c @@ -233,6 +233,7 @@ uint64_t sys_clock_cycle_get_64(void) { return AONRTCCurrent64BitValueGet() / RTC_COUNTS_PER_CYCLE; } +EXPORT_SYMBOL(sys_clock_cycle_get_64); static int sys_clock_driver_init(void) { diff --git a/drivers/timer/cortex_m_systick.c b/drivers/timer/cortex_m_systick.c index 1a3183af5e7048c..4a072e8335dd769 100644 --- a/drivers/timer/cortex_m_systick.c +++ b/drivers/timer/cortex_m_systick.c @@ -365,6 +365,7 @@ uint64_t sys_clock_cycle_get_64(void) k_spin_unlock(&lock, key); return ret; } +EXPORT_SYMBOL(sys_clock_cycle_get_64); #endif void sys_clock_idle_exit(void) diff --git a/drivers/timer/esp32_sys_timer.c b/drivers/timer/esp32_sys_timer.c index bb36445d1131cf4..008b7088dccc010 100644 --- a/drivers/timer/esp32_sys_timer.c +++ b/drivers/timer/esp32_sys_timer.c @@ -133,6 +133,7 @@ uint64_t sys_clock_cycle_get_64(void) { return get_systimer_alarm(); } +EXPORT_SYMBOL(sys_clock_cycle_get_64); void sys_clock_disable(void) { diff --git a/drivers/timer/hpet.c b/drivers/timer/hpet.c index 8a7134a762efa18..d138b30827ab1b1 100644 --- a/drivers/timer/hpet.c +++ b/drivers/timer/hpet.c @@ -401,6 +401,7 @@ uint64_t sys_clock_cycle_get_64(void) { return hpet_counter_get(); } +EXPORT_SYMBOL(sys_clock_cycle_get_64); __pinned_func void sys_clock_idle_exit(void) diff --git a/drivers/timer/intel_adsp_timer.c b/drivers/timer/intel_adsp_timer.c index 2636e506bfe0a49..a9c6d1d6a517016 100644 --- a/drivers/timer/intel_adsp_timer.c +++ b/drivers/timer/intel_adsp_timer.c @@ -184,6 +184,7 @@ uint64_t sys_clock_cycle_get_64(void) { return count(); } +EXPORT_SYMBOL(sys_clock_cycle_get_64); /* Interrupt setup is partially-cpu-local state, so needs to be * repeated for each core when it starts. Note that this conforms to diff --git a/drivers/timer/litex_timer.c b/drivers/timer/litex_timer.c index c12630eba34f0fe..39d32d390aeab97 100644 --- a/drivers/timer/litex_timer.c +++ b/drivers/timer/litex_timer.c @@ -72,6 +72,7 @@ uint64_t sys_clock_cycle_get_64(void) return uptime_cycles; } +EXPORT_SYMBOL(sys_clock_cycle_get_64); /* tickless kernel is not supported */ uint32_t sys_clock_elapsed(void) diff --git a/drivers/timer/mcux_os_timer.c b/drivers/timer/mcux_os_timer.c index c6eb776e43abf5f..6941482e0f3930a 100644 --- a/drivers/timer/mcux_os_timer.c +++ b/drivers/timer/mcux_os_timer.c @@ -244,6 +244,7 @@ uint64_t sys_clock_cycle_get_64(void) { return mcux_lpc_ostick_get_compensated_timer_value(); } +EXPORT_SYMBOL(sys_clock_cycle_get_64); void sys_clock_idle_exit(void) { diff --git a/drivers/timer/mtk_adsp_timer.c b/drivers/timer/mtk_adsp_timer.c index 7a6c06d9e61ac1d..b41e7e3dbb14de2 100644 --- a/drivers/timer/mtk_adsp_timer.c +++ b/drivers/timer/mtk_adsp_timer.c @@ -88,6 +88,7 @@ uint64_t sys_clock_cycle_get_64(void) return (((uint64_t)h0) << 32) | l; } +EXPORT_SYMBOL(sys_clock_cycle_get_64); void sys_clock_set_timeout(int32_t ticks, bool idle) { diff --git a/drivers/timer/native_posix_timer.c b/drivers/timer/native_posix_timer.c index db2706a230675d4..7aa60e97520fe84 100644 --- a/drivers/timer/native_posix_timer.c +++ b/drivers/timer/native_posix_timer.c @@ -36,6 +36,7 @@ uint64_t sys_clock_cycle_get_64(void) { return hwm_get_time(); } +EXPORT_SYMBOL(sys_clock_cycle_get_64); /** * Interrupt handler for the timer interrupt diff --git a/drivers/timer/npcx_itim_timer.c b/drivers/timer/npcx_itim_timer.c index eb0436c8a6e8fa9..f0eaec4fbc92f45 100644 --- a/drivers/timer/npcx_itim_timer.c +++ b/drivers/timer/npcx_itim_timer.c @@ -303,6 +303,7 @@ uint64_t sys_clock_cycle_get_64(void) /* Return how many cycles since system kernel timer start counting */ return current; } +EXPORT_SYMBOL(sys_clock_cycle_get_64); /* Platform specific system timer functions */ #if defined(CONFIG_PM) diff --git a/drivers/timer/nrf_grtc_timer.c b/drivers/timer/nrf_grtc_timer.c index fb9c859caeb89db..67ab5f9664a23f5 100644 --- a/drivers/timer/nrf_grtc_timer.c +++ b/drivers/timer/nrf_grtc_timer.c @@ -451,6 +451,7 @@ uint64_t sys_clock_cycle_get_64(void) k_spin_unlock(&lock, key); return ret; } +EXPORT_SYMBOL(sys_clock_cycle_get_64); uint32_t sys_clock_elapsed(void) { diff --git a/drivers/timer/riscv_machine_timer.c b/drivers/timer/riscv_machine_timer.c index 36e29c6aadb3189..f3ef1adca8adaef 100644 --- a/drivers/timer/riscv_machine_timer.c +++ b/drivers/timer/riscv_machine_timer.c @@ -237,6 +237,7 @@ uint64_t sys_clock_cycle_get_64(void) { return mtime() << CONFIG_RISCV_MACHINE_TIMER_SYSTEM_CLOCK_DIVIDER; } +EXPORT_SYMBOL(sys_clock_cycle_get_64); static int sys_clock_driver_init(void) {