include: zephyr: sys: time_units: Type cast SYS_CLOCK_HW_CYCLES_PER_SEC
Type case CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC to uint32_t while defining sys_clock_hw_cycles_per_sec_runtime_get() to extend the range of frequency to 0xffffffff. Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
This commit is contained in:
parent
38caff2886
commit
98dba7da7c
4 changed files with 7 additions and 7 deletions
|
@ -79,7 +79,7 @@ static inline int z_impl_sys_clock_hw_cycles_per_sec_runtime_get(void)
|
|||
#if defined(CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME)
|
||||
#define sys_clock_hw_cycles_per_sec() sys_clock_hw_cycles_per_sec_runtime_get()
|
||||
#else
|
||||
#define sys_clock_hw_cycles_per_sec() CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC
|
||||
#define sys_clock_hw_cycles_per_sec() (uint32_t)CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC
|
||||
#endif
|
||||
|
||||
/** @internal
|
||||
|
|
|
@ -44,7 +44,7 @@ void timer(void)
|
|||
printk("TIMER: unknown");
|
||||
#endif
|
||||
|
||||
printk(", configured frequency = %dHz\n",
|
||||
printk(", configured frequency = %uHz\n",
|
||||
sys_clock_hw_cycles_per_sec());
|
||||
|
||||
#if defined(CONFIG_COUNTER_CMOS)
|
||||
|
|
|
@ -240,7 +240,7 @@ static void do_test_using(void (*sample_collection_fn)(void), const char *mechan
|
|||
/* If max stddev is lower than a single clock cycle then round it up. */
|
||||
uint32_t max_stddev = MAX(k_cyc_to_us_ceil32(1), CONFIG_TIMER_TEST_MAX_STDDEV);
|
||||
|
||||
TC_PRINT("timer clock rate %d, kernel tick rate %d\n",
|
||||
TC_PRINT("timer clock rate %u, kernel tick rate %d\n",
|
||||
sys_clock_hw_cycles_per_sec(), CONFIG_SYS_CLOCK_TICKS_PER_SEC);
|
||||
if ((USEC_PER_SEC / CONFIG_TIMER_TEST_PERIOD) > CONFIG_SYS_CLOCK_TICKS_PER_SEC) {
|
||||
TC_PRINT("test timer period (%u us) is smaller than "
|
||||
|
@ -282,8 +282,8 @@ static void do_test_using(void (*sample_collection_fn)(void), const char *mechan
|
|||
", \"total_drift_us\":%.6f"
|
||||
", \"expected_period_cycles\":%.0f"
|
||||
", \"expected_period_drift_us\":%.6f"
|
||||
", \"sys_clock_hw_cycles_per_sec\":%d"
|
||||
", \"CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC\":%d"
|
||||
", \"sys_clock_hw_cycles_per_sec\":%u"
|
||||
", \"CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC\":%u"
|
||||
", \"CONFIG_SYS_CLOCK_TICKS_PER_SEC\":%d"
|
||||
", \"CONFIG_TIMER_TEST_PERIOD\":%d"
|
||||
", \"CONFIG_TIMER_TEST_SAMPLES\":%d"
|
||||
|
@ -304,7 +304,7 @@ static void do_test_using(void (*sample_collection_fn)(void), const char *mechan
|
|||
expected_period,
|
||||
expected_period_drift,
|
||||
sys_clock_hw_cycles_per_sec(),
|
||||
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC,
|
||||
(uint32_t)CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC,
|
||||
CONFIG_SYS_CLOCK_TICKS_PER_SEC,
|
||||
CONFIG_TIMER_TEST_PERIOD,
|
||||
CONFIG_TIMER_TEST_SAMPLES,
|
||||
|
|
|
@ -58,7 +58,7 @@ ZTEST(timer_fn, test_timer)
|
|||
|
||||
TC_PRINT("k_ticks_to_cyc_floor32(1) = %d\n",
|
||||
k_ticks_to_cyc_floor32(1));
|
||||
TC_PRINT("sys_clock_hw_cycles_per_sec() = %d\n",
|
||||
TC_PRINT("sys_clock_hw_cycles_per_sec() = %u\n",
|
||||
sys_clock_hw_cycles_per_sec());
|
||||
|
||||
t_last = k_cycle_get_32();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue