Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions boards/acrn/acrn/acrn_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ CONFIG_X2APIC=y
CONFIG_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=1900000000
CONFIG_BUILD_OUTPUT_BIN=y
CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN=n
CONFIG_KERNEL_VM_SIZE=0x1000000
Expand Down
1 change: 1 addition & 0 deletions boards/acrn/acrn/acrn_ehl_crb_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ CONFIG_PCIE=y
CONFIG_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=1900000000
CONFIG_BUILD_OUTPUT_BIN=y
CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN=n
CONFIG_KERNEL_VM_SIZE=0x1000000
Expand Down
2 changes: 1 addition & 1 deletion include/zephyr/sys_clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ BUILD_ASSERT(CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC != 0,
* @{
*/

#if defined(CONFIG_SYS_CLOCK_EXISTS) && !defined(CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME)
#if defined(CONFIG_SYS_CLOCK_EXISTS)

#if defined(CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME) || \
(MSEC_PER_SEC % CONFIG_SYS_CLOCK_TICKS_PER_SEC) || \
Expand Down
1 change: 0 additions & 1 deletion kernel/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,6 @@ config SYS_CLOCK_TICKS_PER_SEC

config SYS_CLOCK_HW_CYCLES_PER_SEC
int "System clock's h/w timer frequency"
depends on !TIMER_READS_ITS_FREQUENCY_AT_RUNTIME
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is sort of an abuse. The idea behind the dependency is to prevent apps from accidentally using the "static" clock rate on devices where it might be wrong because the actual rate is selected by the hardware.

help
This option specifies the frequency of the hardware timer used for the
system clock (in Hz). This option is set by the SOC's or board's Kconfig file
Expand Down
2 changes: 1 addition & 1 deletion kernel/timeout.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static struct k_spinlock timeout_lock;
static int announce_remaining;

#if defined(CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME)
int z_clock_hw_cycles_per_sec;
int z_clock_hw_cycles_per_sec = CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC;

#ifdef CONFIG_USERSPACE
static inline int z_vrfy_sys_clock_hw_cycles_per_sec_runtime_get(void)
Expand Down