/Zephyr-Core-3.4.0/drivers/timer/ |
D | xtensa_sys_timer.c | 15 #define CYC_PER_TICK (sys_clock_hw_cycles_per_sec() \ macro 18 #define MAX_TICKS ((MAX_CYC - CYC_PER_TICK) / CYC_PER_TICK) 49 uint32_t dticks = (curr - last_count) / CYC_PER_TICK; in ccompare_isr() 51 last_count += dticks * CYC_PER_TICK; in ccompare_isr() 54 uint32_t next = last_count + CYC_PER_TICK; in ccompare_isr() 57 next += CYC_PER_TICK; in ccompare_isr() 78 cyc = ticks * CYC_PER_TICK; in sys_clock_set_timeout() 79 adj = (curr - last_count) + (CYC_PER_TICK - 1); in sys_clock_set_timeout() 85 cyc = (cyc / CYC_PER_TICK) * CYC_PER_TICK; in sys_clock_set_timeout() 89 cyc += CYC_PER_TICK; in sys_clock_set_timeout() [all …]
|
D | mips_cp0_timer.c | 20 #define CYC_PER_TICK ((uint32_t)((uint64_t)sys_clock_hw_cycles_per_sec() \ macro 23 #define MAX_TICKS ((MAX_CYC - CYC_PER_TICK) / CYC_PER_TICK) 47 uint32_t dticks = ((now - last_count) / CYC_PER_TICK); in timer_isr() 52 uint32_t next = last_count + CYC_PER_TICK; in timer_isr() 55 next += CYC_PER_TICK; in timer_isr() 77 uint32_t delay_wanted = ticks * CYC_PER_TICK; in sys_clock_set_timeout() 80 uint32_t adj = (current_count - last_count) + (CYC_PER_TICK - 1); in sys_clock_set_timeout() 87 delay_wanted = (delay_wanted / CYC_PER_TICK) * CYC_PER_TICK; in sys_clock_set_timeout() 90 delay_wanted += CYC_PER_TICK; in sys_clock_set_timeout() 104 uint32_t ticks_elapsed = (get_cp0_count() - last_count) / CYC_PER_TICK; in sys_clock_elapsed() [all …]
|
D | mcux_os_timer.c | 19 #define CYC_PER_TICK ((uint32_t)((uint64_t)sys_clock_hw_cycles_per_sec() \ macro 22 #define MAX_TICKS ((MAX_CYC - CYC_PER_TICK) / CYC_PER_TICK) 37 uint32_t dticks = (uint32_t)((now - last_count) / CYC_PER_TICK); in mcux_lpc_ostick_isr() 42 last_count += dticks * CYC_PER_TICK; in mcux_lpc_ostick_isr() 45 uint64_t next = last_count + CYC_PER_TICK; in mcux_lpc_ostick_isr() 48 next += CYC_PER_TICK; in mcux_lpc_ostick_isr() 71 uint32_t adj, cyc = ticks * CYC_PER_TICK; in sys_clock_set_timeout() 74 adj = (uint32_t)(now - last_count) + (CYC_PER_TICK - 1); in sys_clock_set_timeout() 80 cyc = (cyc / CYC_PER_TICK) * CYC_PER_TICK; in sys_clock_set_timeout() 83 cyc += CYC_PER_TICK; in sys_clock_set_timeout() [all …]
|
D | esp32c3_sys_timer.c | 23 #define CYC_PER_TICK ((uint32_t)((uint64_t)sys_clock_hw_cycles_per_sec() \ macro 26 #define MAX_TICKS ((MAX_CYC - CYC_PER_TICK) / CYC_PER_TICK) 68 uint64_t dticks = (uint64_t)((now - last_count) / CYC_PER_TICK); in sys_timer_isr() 70 last_count += dticks * CYC_PER_TICK; in sys_timer_isr() 73 uint64_t next = last_count + CYC_PER_TICK; in sys_timer_isr() 76 next += CYC_PER_TICK; in sys_timer_isr() 95 uint32_t adj, cyc = ticks * CYC_PER_TICK; in sys_clock_set_timeout() 98 adj = (uint32_t)(now - last_count) + (CYC_PER_TICK - 1); in sys_clock_set_timeout() 104 cyc = (cyc / CYC_PER_TICK) * CYC_PER_TICK; in sys_clock_set_timeout() 107 cyc += CYC_PER_TICK; in sys_clock_set_timeout() [all …]
|
D | mcux_gpt_timer.c | 24 #define CYC_PER_TICK (sys_clock_hw_cycles_per_sec() \ macro 27 #define MAX_TICKS ((COUNTER_MAX / CYC_PER_TICK) - 1) 28 #define MAX_CYCLES (MAX_TICKS * CYC_PER_TICK) 107 tick_delta += (MAX_CYCLES - announced_cycles) / CYC_PER_TICK; in mcux_imx_gpt_isr() 114 tick_delta += (now - announced_cycles) / CYC_PER_TICK; in mcux_imx_gpt_isr() 115 announced_cycles += (((now - announced_cycles) / CYC_PER_TICK) * in mcux_imx_gpt_isr() 116 CYC_PER_TICK); in mcux_imx_gpt_isr() 121 rollover_cycles += CYC_PER_TICK; in mcux_imx_gpt_isr() 152 adj = (now - announced_cycles) + (CYC_PER_TICK - 1); in sys_clock_set_timeout() 154 next = ticks * CYC_PER_TICK; in sys_clock_set_timeout() [all …]
|
D | arm_arch_timer.c | 17 #define CYC_PER_TICK cyc_per_tick macro 19 #define CYC_PER_TICK (uint32_t)(sys_clock_hw_cycles_per_sec() \ macro 61 uint32_t delta_ticks = (cycle_diff_t)delta_cycles / CYC_PER_TICK; in arm_arch_timer_compare_isr() 63 last_cycle += (cycle_diff_t)delta_ticks * CYC_PER_TICK; in arm_arch_timer_compare_isr() 68 uint64_t next_cycle = last_cycle + CYC_PER_TICK; in arm_arch_timer_compare_isr() 123 ticks = CLAMP(ticks, 0, (cycle_diff_t)-1 / 2 / CYC_PER_TICK); in sys_clock_set_timeout() 127 uint64_t next_cycle = (last_tick + last_elapsed + ticks) * CYC_PER_TICK; in sys_clock_set_timeout() 148 uint32_t delta_ticks = (cycle_diff_t)delta_cycles / CYC_PER_TICK; in sys_clock_elapsed() 193 arm_arch_timer_set_compare(last_cycle + CYC_PER_TICK); in smp_timer_init() 210 last_tick = arm_arch_timer_count() / CYC_PER_TICK; in sys_clock_driver_init() [all …]
|
D | intel_adsp_timer.c | 36 #define CYC_PER_TICK (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC \ macro 39 #define MAX_TICKS ((MAX_CYC - CYC_PER_TICK) / CYC_PER_TICK) 42 BUILD_ASSERT(MIN_DELAY < CYC_PER_TICK); 112 dticks = (curr - last_count) / CYC_PER_TICK; in compare_isr() 118 last_count += dticks * CYC_PER_TICK; in compare_isr() 121 uint64_t next = last_count + CYC_PER_TICK; in compare_isr() 124 next += CYC_PER_TICK; in compare_isr() 145 uint32_t adj, cyc = ticks * CYC_PER_TICK; in sys_clock_set_timeout() 148 adj = (uint32_t)(curr - last_count) + (CYC_PER_TICK - 1); in sys_clock_set_timeout() 154 cyc = (cyc / CYC_PER_TICK) * CYC_PER_TICK; in sys_clock_set_timeout() [all …]
|
D | cortex_m_systick.c | 17 #define CYC_PER_TICK (sys_clock_hw_cycles_per_sec() \ macro 19 #define MAX_TICKS ((k_ticks_t)(COUNTER_MAX / CYC_PER_TICK) - 1) 20 #define MAX_CYCLES (MAX_TICKS * CYC_PER_TICK) 31 #define MIN_DELAY MAX(1024U, ((uint32_t)CYC_PER_TICK/16U)) 146 dticks = (cycle_count - announced_cycles) / CYC_PER_TICK; in sys_clock_isr() 147 announced_cycles += dticks * CYC_PER_TICK; in sys_clock_isr() 198 delay = ticks * CYC_PER_TICK; in sys_clock_set_timeout() 202 delay = DIV_ROUND_UP(delay, CYC_PER_TICK) * CYC_PER_TICK; in sys_clock_set_timeout() 246 return cyc / CYC_PER_TICK; in sys_clock_elapsed() 274 last_load = CYC_PER_TICK - 1; in sys_clock_driver_init()
|
D | arcv2_timer0.c | 48 #define CYC_PER_TICK (sys_clock_hw_cycles_per_sec() \ macro 51 #define MAX_TICKS ((COUNTER_MAX / CYC_PER_TICK) - 1) 52 #define MAX_CYCLES (MAX_TICKS * CYC_PER_TICK) 227 dticks = (curr_time - last_time) / CYC_PER_TICK; in timer_int_handler() 229 last_time += dticks * CYC_PER_TICK; in timer_int_handler() 252 dticks = (cycle_count - announced_cycles) / CYC_PER_TICK; in timer_int_handler() 253 announced_cycles += dticks * CYC_PER_TICK; in timer_int_handler() 289 delay = MAX(ticks * CYC_PER_TICK, MIN_DELAY); in sys_clock_set_timeout() 340 delay = ticks * CYC_PER_TICK; in sys_clock_set_timeout() 344 delay = DIV_ROUND_UP(delay, CYC_PER_TICK) * CYC_PER_TICK; in sys_clock_set_timeout() [all …]
|
D | riscv_machine_timer.c | 76 #define CYC_PER_TICK (uint32_t)(sys_clock_hw_cycles_per_sec() \ macro 149 uint32_t dticks = (cycle_diff_t)dcycles / CYC_PER_TICK; in timer_isr() 151 last_count += (cycle_diff_t)dticks * CYC_PER_TICK; in timer_isr() 156 uint64_t next = last_count + CYC_PER_TICK; in timer_isr() 187 ticks = CLAMP(ticks, 0, (cycle_diff_t)-1 / 2 / CYC_PER_TICK); in sys_clock_set_timeout() 191 uint64_t cyc = (last_ticks + last_elapsed + ticks) * CYC_PER_TICK; in sys_clock_set_timeout() 206 uint32_t dticks = (cycle_diff_t)dcycles / CYC_PER_TICK; in sys_clock_elapsed() 229 last_ticks = mtime() / CYC_PER_TICK; in sys_clock_driver_init() 230 last_count = last_ticks * CYC_PER_TICK; in sys_clock_driver_init() 231 set_mtimecmp(last_count + CYC_PER_TICK); in sys_clock_driver_init() [all …]
|
D | apic_tsc.c | 15 #define CYC_PER_TICK (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC \ macro 42 uint32_t ticks = (rdtsc() - last_announce) / CYC_PER_TICK; in isr() 44 last_announce += ticks * CYC_PER_TICK; in isr() 67 uint64_t expires = now + MAX(ticks - 1, 0) * CYC_PER_TICK; in sys_clock_set_timeout() 69 expires = last_announce + (((expires - last_announce + CYC_PER_TICK - 1) in sys_clock_set_timeout() 70 / CYC_PER_TICK) * CYC_PER_TICK); in sys_clock_set_timeout() 91 uint32_t ret = (rdtsc() - last_announce) / CYC_PER_TICK; in sys_clock_elapsed()
|
D | nrf_rtc_timer.c | 37 #define CYC_PER_TICK (sys_clock_hw_cycles_per_sec() \ macro 39 #define MAX_TICKS ((COUNTER_HALF_SPAN - CYC_PER_TICK) / CYC_PER_TICK) 40 #define MAX_CYCLES (MAX_TICKS * CYC_PER_TICK) 440 uint32_t dticks = (uint32_t)(expire_time - last_count) / CYC_PER_TICK; in sys_clock_timeout_handler() 442 last_count += dticks * CYC_PER_TICK; in sys_clock_timeout_handler() 450 compare_set(chan, last_count + CYC_PER_TICK, in sys_clock_timeout_handler() 608 cyc = MAX_TICKS * CYC_PER_TICK; in sys_clock_set_timeout() 615 cyc *= CYC_PER_TICK; in sys_clock_set_timeout() 634 cyc = DIV_ROUND_UP(cyc, CYC_PER_TICK) * CYC_PER_TICK; in sys_clock_set_timeout() 656 return (z_nrf_rtc_timer_read() - last_count) / CYC_PER_TICK; in sys_clock_elapsed() [all …]
|
/Zephyr-Core-3.4.0/boards/arm/qemu_cortex_m0/ |
D | nrf_timer_timer.c | 21 #define CYC_PER_TICK (sys_clock_hw_cycles_per_sec() \ macro 23 #define MAX_TICKS ((COUNTER_HALF_SPAN - CYC_PER_TICK) / CYC_PER_TICK) 24 #define MAX_CYCLES (MAX_TICKS * CYC_PER_TICK) 150 uint32_t dticks = counter_sub(t, last_count) / CYC_PER_TICK; in timer0_nrf_isr() 152 last_count += dticks * CYC_PER_TICK; in timer0_nrf_isr() 158 set_absolute_ticks(last_count + CYC_PER_TICK); in timer0_nrf_isr() 191 cyc = ticks * CYC_PER_TICK + 1 + unannounced; in sys_clock_set_timeout() 192 cyc += (CYC_PER_TICK - 1); in sys_clock_set_timeout() 193 cyc = (cyc / CYC_PER_TICK) * CYC_PER_TICK; in sys_clock_set_timeout() 220 uint32_t ret = counter_sub(counter(), last_count) / CYC_PER_TICK; in sys_clock_elapsed() [all …]
|