diff --git a/boards/arm/qemu_cortex_m0/nrf_timer_timer.c b/boards/arm/qemu_cortex_m0/nrf_timer_timer.c index d5647a788ab..2af9f45ba35 100644 --- a/boards/arm/qemu_cortex_m0/nrf_timer_timer.c +++ b/boards/arm/qemu_cortex_m0/nrf_timer_timer.c @@ -247,7 +247,7 @@ uint32_t sys_clock_elapsed(void) return ret; } -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { k_spinlock_key_t key = k_spin_lock(&lock); uint32_t ret = counter_sub(counter(), last_count) + last_count; diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig index 405656b42f5..6eb9b29a6f7 100644 --- a/drivers/timer/Kconfig +++ b/drivers/timer/Kconfig @@ -30,12 +30,12 @@ config APIC_TIMER_IRQ_PRIORITY This option specifies the IRQ priority used by the local APIC timer. config APIC_TIMER_TSC - bool "Use invariant TSC for z_timer_cycle_get_32()" + bool "Use invariant TSC for sys_clock_cycle_get_32()" help If your CPU supports invariant TSC, and you know the ratio of the TSC frequency to CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC (the local APIC timer frequency), then enable this for a much faster and more - accurate z_timer_cycle_get_32(). + accurate sys_clock_cycle_get_32(). if APIC_TIMER_TSC diff --git a/drivers/timer/altera_avalon_timer_hal.c b/drivers/timer/altera_avalon_timer_hal.c index 3fd7e698388..c7778789483 100644 --- a/drivers/timer/altera_avalon_timer_hal.c +++ b/drivers/timer/altera_avalon_timer_hal.c @@ -49,7 +49,7 @@ int sys_clock_driver_init(const struct device *device) return 0; } -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { /* Per the Altera Embedded IP Peripherals guide, you cannot * use a timer instance for both the system clock and timestamps diff --git a/drivers/timer/apic_timer.c b/drivers/timer/apic_timer.c index 92aaa40403c..0eb2d3e19ab 100644 --- a/drivers/timer/apic_timer.c +++ b/drivers/timer/apic_timer.c @@ -16,7 +16,7 @@ BUILD_ASSERT(!IS_ENABLED(CONFIG_SMP), "APIC timer doesn't support SMP"); * This driver enables the local APIC as the Zephyr system timer. It supports * both legacy ("tickful") mode as well as TICKLESS_KERNEL. The driver will * work with any APIC that has the ARAT "always running APIC timer" feature - * (CPUID 0x06, EAX bit 2); for the more accurate z_timer_cycle_get_32(), + * (CPUID 0x06, EAX bit 2); for the more accurate sys_clock_cycle_get_32(), * the invariant TSC feature (CPUID 0x80000007: EDX bit 8) is also required. * (Ultimately systems with invariant TSCs should use a TSC-based driver, * and the TSC-related parts should be stripped from this implementation.) @@ -31,7 +31,7 @@ BUILD_ASSERT(!IS_ENABLED(CONFIG_SMP), "APIC timer doesn't support SMP"); * by the local APIC timer block (before it gets to the timer divider). * * CONFIG_APIC_TIMER_TSC=y enables the more accurate TSC-based cycle counter - * for z_timer_cycle_get_32(). This also requires the next options be set. + * for sys_clock_cycle_get_32(). This also requires the next options be set. * * CONFIG_APIC_TIMER_TSC_N= * CONFIG_APIC_TIMER_TSC_M= @@ -187,7 +187,7 @@ uint32_t sys_clock_elapsed(void) #ifdef CONFIG_APIC_TIMER_TSC -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { uint64_t tsc = z_tsc_read(); uint32_t cycles; @@ -198,7 +198,7 @@ uint32_t z_timer_cycle_get_32(void) #else -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { uint32_t ret; uint32_t ccr; diff --git a/drivers/timer/arcv2_timer0.c b/drivers/timer/arcv2_timer0.c index ebc14a9c7dc..c898fb73639 100644 --- a/drivers/timer/arcv2_timer0.c +++ b/drivers/timer/arcv2_timer0.c @@ -437,7 +437,7 @@ uint32_t sys_clock_elapsed(void) return cyc / CYC_PER_TICK; } -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { #if SMP_TIMER_DRIVER return z_arc_connect_gfrc_read() - start_time; diff --git a/drivers/timer/arm_arch_timer.c b/drivers/timer/arm_arch_timer.c index 6eeebd850b5..49995893650 100644 --- a/drivers/timer/arm_arch_timer.c +++ b/drivers/timer/arm_arch_timer.c @@ -109,7 +109,7 @@ uint32_t sys_clock_elapsed(void) return ret; } -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { return (uint32_t)arm_arch_timer_count(); } diff --git a/drivers/timer/cavs_timer.c b/drivers/timer/cavs_timer.c index 269a84e8076..0a3a150d4ad 100644 --- a/drivers/timer/cavs_timer.c +++ b/drivers/timer/cavs_timer.c @@ -176,7 +176,7 @@ uint32_t sys_clock_elapsed(void) return ret; } -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { return count32(); } diff --git a/drivers/timer/cc13x2_cc26x2_rtc_timer.c b/drivers/timer/cc13x2_cc26x2_rtc_timer.c index 18ada986198..3efe9013178 100644 --- a/drivers/timer/cc13x2_cc26x2_rtc_timer.c +++ b/drivers/timer/cc13x2_cc26x2_rtc_timer.c @@ -238,7 +238,7 @@ uint32_t sys_clock_elapsed(void) return ret; } -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { return (AONRTCCurrent64BitValueGet() / RTC_COUNTS_PER_CYCLE) & 0xFFFFFFFF; diff --git a/drivers/timer/cortex_m_systick.c b/drivers/timer/cortex_m_systick.c index bd48d7114a9..5a730905c98 100644 --- a/drivers/timer/cortex_m_systick.c +++ b/drivers/timer/cortex_m_systick.c @@ -238,7 +238,7 @@ uint32_t sys_clock_elapsed(void) return cyc / CYC_PER_TICK; } -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { k_spinlock_key_t key = k_spin_lock(&lock); uint32_t ret = elapsed() + cycle_count; diff --git a/drivers/timer/hpet.c b/drivers/timer/hpet.c index bb9c1063f64..5620c3de93c 100644 --- a/drivers/timer/hpet.c +++ b/drivers/timer/hpet.c @@ -204,7 +204,7 @@ uint32_t sys_clock_elapsed(void) return ret; } -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { return MAIN_COUNTER_REG; } diff --git a/drivers/timer/ite_it8xxx2_timer.c b/drivers/timer/ite_it8xxx2_timer.c index d37c601807d..882f525dc76 100644 --- a/drivers/timer/ite_it8xxx2_timer.c +++ b/drivers/timer/ite_it8xxx2_timer.c @@ -240,7 +240,7 @@ uint32_t sys_clock_elapsed(void) return ret; } -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { return get_timer_combine_count(CTIMER_HW_TIMER_INDEX); } diff --git a/drivers/timer/leon_gptimer.c b/drivers/timer/leon_gptimer.c index 0f1b603cae1..6fd37c10b12 100644 --- a/drivers/timer/leon_gptimer.c +++ b/drivers/timer/leon_gptimer.c @@ -86,7 +86,7 @@ uint32_t sys_clock_elapsed(void) return 0; } -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { volatile struct gptimer_regs *regs = get_regs(); volatile struct gptimer_timer_regs *tmr = ®s->timer[1]; diff --git a/drivers/timer/litex_timer.c b/drivers/timer/litex_timer.c index 01f0a9f51f7..ab9067c2160 100644 --- a/drivers/timer/litex_timer.c +++ b/drivers/timer/litex_timer.c @@ -39,7 +39,7 @@ static void litex_timer_irq_handler(const void *device) irq_unlock(key); } -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { static struct k_spinlock lock; uint32_t timer_total; diff --git a/drivers/timer/mchp_xec_rtos_timer.c b/drivers/timer/mchp_xec_rtos_timer.c index 50800678475..575b0ba3411 100644 --- a/drivers/timer/mchp_xec_rtos_timer.c +++ b/drivers/timer/mchp_xec_rtos_timer.c @@ -286,7 +286,7 @@ uint32_t sys_clock_elapsed(void) * z_impl_k_busy_wait calls here. This code path uses the value as uint32_t. * */ -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { uint32_t ret; uint32_t ccr; diff --git a/drivers/timer/native_posix_timer.c b/drivers/timer/native_posix_timer.c index 65df9a187cc..1070dcb5483 100644 --- a/drivers/timer/native_posix_timer.c +++ b/drivers/timer/native_posix_timer.c @@ -27,7 +27,7 @@ static uint64_t last_tick_time; * Return the current HW cycle counter * (number of microseconds since boot in 32bits) */ -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { return hwm_get_time(); } diff --git a/drivers/timer/npcx_itim_timer.c b/drivers/timer/npcx_itim_timer.c index 36e563554a9..ba4769891d0 100644 --- a/drivers/timer/npcx_itim_timer.c +++ b/drivers/timer/npcx_itim_timer.c @@ -254,7 +254,7 @@ uint32_t sys_clock_elapsed(void) return (uint32_t)((current - cyc_sys_announced) / SYS_CYCLES_PER_TICK); } -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { k_spinlock_key_t key = k_spin_lock(&lock); uint64_t current = npcx_itim_get_sys_cyc64(); diff --git a/drivers/timer/nrf_rtc_timer.c b/drivers/timer/nrf_rtc_timer.c index 9b077f85e23..02cc8f10f9b 100644 --- a/drivers/timer/nrf_rtc_timer.c +++ b/drivers/timer/nrf_rtc_timer.c @@ -393,7 +393,7 @@ uint32_t sys_clock_elapsed(void) return ret; } -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { k_spinlock_key_t key = k_spin_lock(&lock); uint32_t ret = counter_sub(counter(), last_count) + last_count; diff --git a/drivers/timer/riscv_machine_timer.c b/drivers/timer/riscv_machine_timer.c index f2b581966da..725a8f1e9de 100644 --- a/drivers/timer/riscv_machine_timer.c +++ b/drivers/timer/riscv_machine_timer.c @@ -143,7 +143,7 @@ uint32_t sys_clock_elapsed(void) return ret; } -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { return (uint32_t)mtime(); } diff --git a/drivers/timer/rv32m1_lptmr_timer.c b/drivers/timer/rv32m1_lptmr_timer.c index babdec1b950..62fba35d65c 100644 --- a/drivers/timer/rv32m1_lptmr_timer.c +++ b/drivers/timer/rv32m1_lptmr_timer.c @@ -131,7 +131,7 @@ int sys_clock_driver_init(const struct device *unused) return 0; } -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { return cycle_count + SYSTEM_TIMER_INSTANCE->CNR; } diff --git a/drivers/timer/sam0_rtc_timer.c b/drivers/timer/sam0_rtc_timer.c index bee2cf151ad..c07b3b19a46 100644 --- a/drivers/timer/sam0_rtc_timer.c +++ b/drivers/timer/sam0_rtc_timer.c @@ -310,7 +310,7 @@ uint32_t sys_clock_elapsed(void) #endif } -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { /* Just return the absolute value of RTC cycle counter. */ return rtc_count(); diff --git a/drivers/timer/stm32_lptim_timer.c b/drivers/timer/stm32_lptim_timer.c index aa46d1e60d7..2be4bcd0ff1 100644 --- a/drivers/timer/stm32_lptim_timer.c +++ b/drivers/timer/stm32_lptim_timer.c @@ -59,7 +59,7 @@ static void lptim_irq_handler(const struct device *unused) LL_LPTIM_ClearFLAG_ARRM(LPTIM1); /* increase the total nb of autoreload count - * used in the z_timer_cycle_get_32() function. + * used in the sys_clock_cycle_get_32() function. * Reading the CNT register gives a reliable value */ uint32_t autoreload = LL_LPTIM_GetAutoReload(LPTIM1) + 1; @@ -296,7 +296,7 @@ uint32_t sys_clock_elapsed(void) return (uint32_t)(ret); } -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { /* just gives the accumulated count in a number of hw cycles */ diff --git a/drivers/timer/xlnx_psttc_timer.c b/drivers/timer/xlnx_psttc_timer.c index 2d1739ea53d..9849245062d 100644 --- a/drivers/timer/xlnx_psttc_timer.c +++ b/drivers/timer/xlnx_psttc_timer.c @@ -189,7 +189,7 @@ uint32_t sys_clock_elapsed(void) #endif } -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { /* Return the current counter value */ return read_count(); diff --git a/drivers/timer/xtensa_sys_timer.c b/drivers/timer/xtensa_sys_timer.c index e2bd6b81d75..ee33ad5ea87 100644 --- a/drivers/timer/xtensa_sys_timer.c +++ b/drivers/timer/xtensa_sys_timer.c @@ -110,7 +110,7 @@ uint32_t sys_clock_elapsed(void) return ret; } -uint32_t z_timer_cycle_get_32(void) +uint32_t sys_clock_cycle_get_32(void) { return ccount(); } diff --git a/include/arch/arc/v2/misc.h b/include/arch/arc/v2/misc.h index d610f097c51..efc98b5d983 100644 --- a/include/arch/arc/v2/misc.h +++ b/include/arch/arc/v2/misc.h @@ -21,11 +21,11 @@ extern "C" { #ifndef _ASMLANGUAGE extern unsigned int z_arc_cpu_sleep_mode; -extern uint32_t z_timer_cycle_get_32(void); +extern uint32_t sys_clock_cycle_get_32(void); static inline uint32_t arch_k_cycle_get_32(void) { - return z_timer_cycle_get_32(); + return sys_clock_cycle_get_32(); } #endif diff --git a/include/arch/arm/aarch32/misc.h b/include/arch/arm/aarch32/misc.h index 3f157b2cfbb..f65b2f778a6 100644 --- a/include/arch/arm/aarch32/misc.h +++ b/include/arch/arm/aarch32/misc.h @@ -19,11 +19,11 @@ extern "C" { #endif #ifndef _ASMLANGUAGE -extern uint32_t z_timer_cycle_get_32(void); +extern uint32_t sys_clock_cycle_get_32(void); static inline uint32_t arch_k_cycle_get_32(void) { - return z_timer_cycle_get_32(); + return sys_clock_cycle_get_32(); } static ALWAYS_INLINE void arch_nop(void) diff --git a/include/arch/arm/aarch64/misc.h b/include/arch/arm/aarch64/misc.h index 61a3e4a2b46..0fe9a230995 100644 --- a/include/arch/arm/aarch64/misc.h +++ b/include/arch/arm/aarch64/misc.h @@ -20,11 +20,11 @@ extern "C" { #endif #ifndef _ASMLANGUAGE -extern uint32_t z_timer_cycle_get_32(void); +extern uint32_t sys_clock_cycle_get_32(void); static inline uint32_t arch_k_cycle_get_32(void) { - return z_timer_cycle_get_32(); + return sys_clock_cycle_get_32(); } static ALWAYS_INLINE void arch_nop(void) diff --git a/include/arch/nios2/arch.h b/include/arch/nios2/arch.h index aabf81a2959..4a20a27f72a 100644 --- a/include/arch/nios2/arch.h +++ b/include/arch/nios2/arch.h @@ -171,11 +171,11 @@ enum nios2_exception_cause { BIT(NIOS2_EXCEPTION_ECC_DATA_ERR)) -extern uint32_t z_timer_cycle_get_32(void); +extern uint32_t sys_clock_cycle_get_32(void); static inline uint32_t arch_k_cycle_get_32(void) { - return z_timer_cycle_get_32(); + return sys_clock_cycle_get_32(); } static ALWAYS_INLINE void arch_nop(void) diff --git a/include/arch/posix/arch.h b/include/arch/posix/arch.h index 18cc8d70b41..095f90f9d69 100644 --- a/include/arch/posix/arch.h +++ b/include/arch/posix/arch.h @@ -44,11 +44,11 @@ struct __esf { typedef struct __esf z_arch_esf_t; -extern uint32_t z_timer_cycle_get_32(void); +extern uint32_t sys_clock_cycle_get_32(void); static inline uint32_t arch_k_cycle_get_32(void) { - return z_timer_cycle_get_32(); + return sys_clock_cycle_get_32(); } static ALWAYS_INLINE void arch_nop(void) diff --git a/include/arch/riscv/arch.h b/include/arch/riscv/arch.h index bedb533506f..f317eef8d4d 100644 --- a/include/arch/riscv/arch.h +++ b/include/arch/riscv/arch.h @@ -347,11 +347,11 @@ static ALWAYS_INLINE void arch_nop(void) __asm__ volatile("nop"); } -extern uint32_t z_timer_cycle_get_32(void); +extern uint32_t sys_clock_cycle_get_32(void); static inline uint32_t arch_k_cycle_get_32(void) { - return z_timer_cycle_get_32(); + return sys_clock_cycle_get_32(); } #ifdef CONFIG_USERSPACE diff --git a/include/arch/sparc/arch.h b/include/arch/sparc/arch.h index 36880a6940f..5a1464f8c07 100644 --- a/include/arch/sparc/arch.h +++ b/include/arch/sparc/arch.h @@ -92,11 +92,11 @@ static ALWAYS_INLINE void arch_nop(void) __asm__ volatile ("nop"); } -extern uint32_t z_timer_cycle_get_32(void); +extern uint32_t sys_clock_cycle_get_32(void); static inline uint32_t arch_k_cycle_get_32(void) { - return z_timer_cycle_get_32(); + return sys_clock_cycle_get_32(); } diff --git a/include/arch/x86/arch.h b/include/arch/x86/arch.h index 6f952b82836..fb0a6b4296d 100644 --- a/include/arch/x86/arch.h +++ b/include/arch/x86/arch.h @@ -246,11 +246,11 @@ extern "C" { extern void arch_irq_enable(unsigned int irq); extern void arch_irq_disable(unsigned int irq); -extern uint32_t z_timer_cycle_get_32(void); +extern uint32_t sys_clock_cycle_get_32(void); static inline uint32_t arch_k_cycle_get_32(void) { - return z_timer_cycle_get_32(); + return sys_clock_cycle_get_32(); } static ALWAYS_INLINE bool arch_irq_unlocked(unsigned int key) diff --git a/include/arch/xtensa/arch.h b/include/arch/xtensa/arch.h index b0a01945fd8..15cd981ceb2 100644 --- a/include/arch/xtensa/arch.h +++ b/include/arch/xtensa/arch.h @@ -56,11 +56,11 @@ extern void z_irq_spurious(const void *unused); #define XTENSA_ERR_NORET -extern uint32_t z_timer_cycle_get_32(void); +extern uint32_t sys_clock_cycle_get_32(void); static inline uint32_t arch_k_cycle_get_32(void) { - return z_timer_cycle_get_32(); + return sys_clock_cycle_get_32(); } static ALWAYS_INLINE void arch_nop(void) diff --git a/subsys/disk/disk_access_usdhc.c b/subsys/disk/disk_access_usdhc.c index 5fc9590b635..07378a3172e 100644 --- a/subsys/disk/disk_access_usdhc.c +++ b/subsys/disk/disk_access_usdhc.c @@ -718,9 +718,9 @@ enum usdhc_reset { static void usdhc_millsec_delay(unsigned int cycles_to_wait) { - unsigned int start = z_timer_cycle_get_32(); + unsigned int start = sys_clock_cycle_get_32(); - while (z_timer_cycle_get_32() - start < (cycles_to_wait * 1000)) + while (sys_clock_cycle_get_32() - start < (cycles_to_wait * 1000)) ; } diff --git a/tests/arch/x86/info/src/timer.c b/tests/arch/x86/info/src/timer.c index 67d28c5aa65..095fe090579 100644 --- a/tests/arch/x86/info/src/timer.c +++ b/tests/arch/x86/info/src/timer.c @@ -29,7 +29,7 @@ static uint32_t sync(const struct device *cmos) } } while (last == this); - return z_timer_cycle_get_32(); + return sys_clock_cycle_get_32(); } void timer(void)