Skip to content

Commit

Permalink
drivers: timer: Export sys_clock_cycle_get_64() implementations
Browse files Browse the repository at this point in the history
Export sys_clock_cycle_get_64() implementations to enable k_cycle_get_64()
calls from llext libraries.

Signed-off-by: Jyri Sarha <[email protected]>
  • Loading branch information
Jyri Sarha committed Nov 12, 2024
1 parent 91a59e7 commit 8f36db5
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/timer/apic_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions drivers/timer/apic_tsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions drivers/timer/arm_arch_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions drivers/timer/cc13xx_cc26xx_rtc_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions drivers/timer/cortex_m_systick.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions drivers/timer/esp32_sys_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions drivers/timer/hpet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions drivers/timer/intel_adsp_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions drivers/timer/litex_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions drivers/timer/mcux_os_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions drivers/timer/mtk_adsp_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions drivers/timer/native_posix_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions drivers/timer/npcx_itim_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions drivers/timer/nrf_grtc_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions drivers/timer/riscv_machine_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 8f36db5

Please sign in to comment.