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 */
|
||||
|
||||
#if defined(CONFIG_SYS_CLOCK_EXISTS) && \
|
||||
(CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC == 0)
|
||||
#error "SYS_CLOCK_HW_CYCLES_PER_SEC must be non-zero!"
|
||||
#if defined(CONFIG_SYS_CLOCK_EXISTS) && !defined(CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME)
|
||||
BUILD_ASSERT(CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC != 0,
|
||||
"SYS_CLOCK_HW_CYCLES_PER_SEC must be non-zero!");
|
||||
#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) || \
|
||||
(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
|
||||
int "System clock's h/w timer frequency"
|
||||
depends on !TIMER_READS_ITS_FREQUENCY_AT_RUNTIME
|
||||
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
|
||||
|
|
|
@ -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 = CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC;
|
||||
int z_clock_hw_cycles_per_sec;
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
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