kernel: retrieve system timer clock frequency at runtime or static
update kernel timeout logic based on retrieve system timer clock frequency at runtime or static way based on Kconfig TIMER_READS_ITS_FREQUENCY_AT_RUNTIME Signed-off-by: Najumon B.A <najumon.ba@intel.com>
This commit is contained in:
parent
d82f4a9258
commit
7c03e5de7f
3 changed files with 6 additions and 5 deletions
|
@ -146,9 +146,9 @@ typedef struct {
|
||||||
|
|
||||||
/** @endcond */
|
/** @endcond */
|
||||||
|
|
||||||
#if defined(CONFIG_SYS_CLOCK_EXISTS) && \
|
#if defined(CONFIG_SYS_CLOCK_EXISTS) && !defined(CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME)
|
||||||
(CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC == 0)
|
BUILD_ASSERT(CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC != 0,
|
||||||
#error "SYS_CLOCK_HW_CYCLES_PER_SEC must be non-zero!"
|
"SYS_CLOCK_HW_CYCLES_PER_SEC must be non-zero!");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ typedef struct {
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_SYS_CLOCK_EXISTS
|
#if defined(CONFIG_SYS_CLOCK_EXISTS) && !defined(CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME)
|
||||||
|
|
||||||
#if defined(CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME) || \
|
#if defined(CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME) || \
|
||||||
(MSEC_PER_SEC % CONFIG_SYS_CLOCK_TICKS_PER_SEC) || \
|
(MSEC_PER_SEC % CONFIG_SYS_CLOCK_TICKS_PER_SEC) || \
|
||||||
|
|
|
@ -799,6 +799,7 @@ config SYS_CLOCK_TICKS_PER_SEC
|
||||||
|
|
||||||
config SYS_CLOCK_HW_CYCLES_PER_SEC
|
config SYS_CLOCK_HW_CYCLES_PER_SEC
|
||||||
int "System clock's h/w timer frequency"
|
int "System clock's h/w timer frequency"
|
||||||
|
depends on !TIMER_READS_ITS_FREQUENCY_AT_RUNTIME
|
||||||
help
|
help
|
||||||
This option specifies the frequency of the hardware timer used for the
|
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
|
system clock (in Hz). This option is set by the SOC's or board's Kconfig file
|
||||||
|
|
|
@ -25,7 +25,7 @@ static struct k_spinlock timeout_lock;
|
||||||
static int announce_remaining;
|
static int announce_remaining;
|
||||||
|
|
||||||
#if defined(CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME)
|
#if defined(CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME)
|
||||||
int z_clock_hw_cycles_per_sec = CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC;
|
int z_clock_hw_cycles_per_sec;
|
||||||
|
|
||||||
#ifdef CONFIG_USERSPACE
|
#ifdef CONFIG_USERSPACE
|
||||||
static inline int z_vrfy_sys_clock_hw_cycles_per_sec_runtime_get(void)
|
static inline int z_vrfy_sys_clock_hw_cycles_per_sec_runtime_get(void)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue