/Zephyr-latest/tests/kernel/timer/timer_api/src/ |
D | timer_convert.c | 56 TESTFUNC(ms, ticks, floor, 32) 57 TESTFUNC(ms, ticks, floor, 64) 58 TESTFUNC(ms, ticks, near, 32) 59 TESTFUNC(ms, ticks, near, 64) 60 TESTFUNC(ms, ticks, ceil, 32) 61 TESTFUNC(ms, ticks, ceil, 64) 68 TESTFUNC(us, ticks, floor, 32) 69 TESTFUNC(us, ticks, floor, 64) 70 TESTFUNC(us, ticks, near, 32) 71 TESTFUNC(us, ticks, near, 64) [all …]
|
/Zephyr-latest/drivers/counter/ |
D | counter_native_posix.c | 34 uint32_t next_time = top.ticks; /* top.ticks is TOP_VALUE if is_top_set == false */ in schedule_next_isr() 36 if (current_value == top.ticks) { in schedule_next_isr() 42 if (pending_alarm[i].ticks > current_value) { in schedule_next_isr() 44 next_time = MIN(pending_alarm[i].ticks, next_time); in schedule_next_isr() 61 if (is_alarm_pending[i] && (current_value == pending_alarm[i].ticks)) { in counter_isr() 70 if (is_top_set && (current_value == top.ticks)) { in counter_isr() 84 top.ticks = TOP_VALUE; in ctr_init() 90 hw_counter_set_wrap_value((uint64_t)top.ticks + 1); in ctr_init() 113 static int ctr_get_value(const struct device *dev, uint32_t *ticks) in ctr_get_value() argument 117 *ticks = hw_counter_get_value(); in ctr_get_value() [all …]
|
D | counter_handlers.c | 59 uint32_t ticks) in z_vrfy_counter_ticks_to_us() argument 63 (uint32_t)ticks); in z_vrfy_counter_ticks_to_us() 68 uint32_t *ticks) in z_vrfy_counter_get_value() argument 71 K_OOPS(K_SYSCALL_MEMORY_WRITE(ticks, sizeof(*ticks))); in z_vrfy_counter_get_value() 72 return z_impl_counter_get_value((const struct device *)dev, ticks); in z_vrfy_counter_get_value() 77 uint64_t *ticks) in z_vrfy_counter_get_value_64() argument 80 K_OOPS(K_SYSCALL_MEMORY_WRITE(ticks, sizeof(*ticks))); in z_vrfy_counter_get_value_64() 81 return z_impl_counter_get_value_64((const struct device *)dev, ticks); in z_vrfy_counter_get_value_64() 151 uint32_t ticks, uint32_t flags) in z_vrfy_counter_set_guard_period() argument 155 ticks, in z_vrfy_counter_set_guard_period()
|
D | counter_gecko_stimer.c | 46 uint32_t ticks; member 53 uint32_t ticks; member 77 (((struct counter_gecko_data *const)(alarm_data->dev)->data)->top_data.ticks)); in alarm_callback() 96 static int counter_gecko_get_value(const struct device *dev, uint32_t *ticks) in counter_gecko_get_value() argument 100 *ticks = ((sl_sleeptimer_get_tick_count()) % (dev_data->top_data.ticks)); in counter_gecko_get_value() 118 error_code = sl_sleeptimer_start_timer(&top_timer, dev_data->top_data.ticks, top_callback, in counter_gecko_start() 159 dev_data->top_data.ticks = cfg->ticks; in counter_gecko_set_top_value() 163 error_code = sl_sleeptimer_start_periodic_timer(&top_timer, cfg->ticks, top_callback, in counter_gecko_set_top_value() 173 return dev_data->top_data.ticks; in counter_gecko_get_top_value() 185 if ((top_val != 0) && (alarm_cfg->ticks > top_val)) { in counter_gecko_set_alarm() [all …]
|
D | counter_mcux_snvs.c | 57 static int mcux_snvs_get_value(const struct device *dev, uint32_t *ticks) in mcux_snvs_get_value() argument 63 *ticks = tmp; in mcux_snvs_get_value() 66 } while (*ticks != tmp); in mcux_snvs_get_value() 78 uint32_t current, ticks; in mcux_snvs_set_alarm() local 81 ticks = alarm_cfg->ticks; in mcux_snvs_set_alarm() 84 ticks += current; in mcux_snvs_set_alarm() 87 if (ticks < current) { in mcux_snvs_set_alarm() 105 config->base->HPTAMR = (uint32_t)(ticks >> 17U); in mcux_snvs_set_alarm() 106 config->base->HPTALR = (uint32_t)(ticks << 15U); in mcux_snvs_set_alarm() 124 config->base->LPTAR = ticks; in mcux_snvs_set_alarm() [all …]
|
D | counter_max32_rtc.c | 69 static int api_get_value(const struct device *dev, uint32_t *ticks) in api_get_value() argument 87 *ticks = sec; in api_get_value() 89 *ticks += 1; in api_get_value() 100 if (counter_cfg->ticks == 0) { in api_set_top_value() 104 if (counter_cfg->ticks != cfg->info.max_top_value) { in api_set_top_value() 138 uint32_t ticks = alarm_cfg->ticks; in api_set_alarm() local 145 if (ticks == 0) { in api_set_alarm() 146 ticks = 1; in api_set_alarm() 149 if (alarm_cfg->ticks > api_get_top_value(dev)) { in api_set_alarm() 161 ticks += current; in api_set_alarm() [all …]
|
D | counter_ll_stm32_rtc.c | 101 uint32_t ticks; member 237 tick_t ticks; in rtc_stm32_read() local 286 ticks = ts * counter_get_frequency(dev); in rtc_stm32_read() 292 ticks += RTC_SYNCPRE - rtc_subseconds; in rtc_stm32_read() 295 return ticks; in rtc_stm32_read() 300 uint32_t rtc_time, ticks; in rtc_stm32_read() local 312 ticks = rtc_time; in rtc_stm32_read() 314 return ticks; in rtc_stm32_read() 318 static int rtc_stm32_get_value(const struct device *dev, uint32_t *ticks) in rtc_stm32_get_value() argument 320 *ticks = (uint32_t)rtc_stm32_read(dev); in rtc_stm32_get_value() [all …]
|
D | counter_esp32_rtc.c | 52 uint32_t ticks; member 99 static int counter_esp32_get_value(const struct device *dev, uint32_t *ticks) in counter_esp32_get_value() argument 103 *ticks = (uint32_t) rtc_cntl_ll_get_rtc_time(); in counter_esp32_get_value() 114 uint32_t ticks = 0; in counter_esp32_set_alarm() local 119 if (counter_ticks_to_us(dev, alarm_cfg->ticks) <= 30) { in counter_esp32_set_alarm() 128 ticks = (alarm_cfg->flags & COUNTER_ALARM_CFG_ABSOLUTE) ? alarm_cfg->ticks in counter_esp32_set_alarm() 129 : now + alarm_cfg->ticks; in counter_esp32_set_alarm() 131 rtc_cntl_ll_set_wakeup_timer(ticks); in counter_esp32_set_alarm() 164 if (cfg->ticks != config->counter_info.max_top_value) { in counter_esp32_set_top_value()
|
/Zephyr-latest/tests/drivers/timer/nrf_grtc_timer/src/ |
D | main.c | 31 uint64_t exp_ticks = z_nrf_grtc_timer_read() + t.ticks * CYC_PER_TICK; in ZTEST() 32 int64_t ticks; in ZTEST() local 35 ticks = z_nrf_grtc_timer_get_ticks(t); in ZTEST() 36 zassert_true((ticks >= exp_ticks) && (ticks <= (exp_ticks + GRTC_SLEW_TICKS)), in ZTEST() 37 "Unexpected result %" PRId64 " (expected: %" PRId64 ")", ticks, exp_ticks); in ZTEST() 43 t = Z_TIMEOUT_TICKS(Z_TICK_ABS(sys_clock_tick_get() - K_MSEC(1).ticks)); in ZTEST() 45 exp_ticks = z_nrf_grtc_timer_read() - K_MSEC(1).ticks * CYC_PER_TICK; in ZTEST() 46 ticks = z_nrf_grtc_timer_get_ticks(t); in ZTEST() 47 zassert_true((ticks >= (exp_ticks - CYC_PER_TICK + 1)) && in ZTEST() 48 (ticks <= (exp_ticks + GRTC_SLEW_TICKS)), in ZTEST() [all …]
|
/Zephyr-latest/kernel/ |
D | nothread.c | 22 k_ticks_t ticks; in z_impl_k_sleep() local 38 ticks = timeout.ticks; in z_impl_k_sleep() 39 if (Z_TICK_ABS(ticks) <= 0) { in z_impl_k_sleep() 41 ticks_to_wait = ticks; in z_impl_k_sleep() 46 if (Z_TICK_ABS(ticks) > curr_ticks) { in z_impl_k_sleep() 47 ticks_to_wait = Z_TICK_ABS(ticks) - curr_ticks; in z_impl_k_sleep()
|
D | timeout.c | 117 (Z_TICK_ABS(timeout.ticks) >= 0)) { in z_add_timeout() 118 k_ticks_t ticks = Z_TICK_ABS(timeout.ticks) - curr_tick; in z_add_timeout() local 120 to->dticks = MAX(1, ticks); in z_add_timeout() 122 to->dticks = timeout.ticks + 1 + elapsed(); in z_add_timeout() 161 k_ticks_t ticks = 0; in timeout_rem() local 164 ticks += t->dticks; in timeout_rem() 170 return ticks; in timeout_rem() 175 k_ticks_t ticks = 0; in z_timeout_remaining() local 179 ticks = timeout_rem(timeout) - elapsed(); in z_timeout_remaining() 183 return ticks; in z_timeout_remaining() [all …]
|
/Zephyr-latest/drivers/timer/ |
D | mcux_os_timer.c | 87 int32_t ticks; in mcux_lpc_ostick_set_counter_timeout() local 92 ticks = counter_us_to_ticks(counter_dev, timeout); in mcux_lpc_ostick_set_counter_timeout() 93 ticks = CLAMP(ticks, 1, counter_get_max_top_value(counter_dev)); in mcux_lpc_ostick_set_counter_timeout() 95 top_cfg.ticks = ticks; in mcux_lpc_ostick_set_counter_timeout() 103 alarm_cfg.ticks = ticks; in mcux_lpc_ostick_set_counter_timeout() 172 void sys_clock_set_timeout(int32_t ticks, bool idle) in sys_clock_set_timeout() argument 188 if (mcux_lpc_ostick_set_counter_timeout(ticks) == 0) { in sys_clock_set_timeout() 198 ticks = ticks == K_TICKS_FOREVER ? MAX_TICKS : ticks; in sys_clock_set_timeout() 199 ticks = CLAMP(ticks - 1, 0, (int32_t)MAX_TICKS); in sys_clock_set_timeout() 203 uint32_t adj, cyc = ticks * CYC_PER_TICK; in sys_clock_set_timeout()
|
D | sam0_rtc_timer.c | 163 uint32_t ticks = (count - rtc_last) / CYCLES_PER_TICK; in rtc_isr() local 165 sys_clock_announce(ticks); in rtc_isr() 166 rtc_last += ticks * CYCLES_PER_TICK; in rtc_isr() 185 void sys_clock_set_timeout(int32_t ticks, bool idle) in sys_clock_set_timeout() argument 191 ticks = (ticks == K_TICKS_FOREVER) ? MAX_TICKS : ticks; in sys_clock_set_timeout() 192 ticks = CLAMP(ticks - 1, 0, (int32_t) MAX_TICKS); in sys_clock_set_timeout() 196 uint32_t timeout = ticks * CYCLES_PER_TICK + count % CYCLES_PER_TICK; in sys_clock_set_timeout() 210 if (ticks == K_TICKS_FOREVER) { in sys_clock_set_timeout() 218 if (ticks < 1) { in sys_clock_set_timeout() 219 ticks = 1; in sys_clock_set_timeout() [all …]
|
D | cc13xx_cc26xx_rtc_timer.c | 101 uint64_t ticks, currCount; in rtc_isr() 111 ticks = (currCount - rtc_last) / RTC_COUNTS_PER_TICK; in rtc_isr() 113 rtc_last += ticks * RTC_COUNTS_PER_TICK; in rtc_isr() 116 sys_clock_announce(ticks); in rtc_isr() 190 void sys_clock_set_timeout(int32_t ticks, bool idle) in sys_clock_set_timeout() argument 196 ticks = (ticks == K_TICKS_FOREVER) ? MAX_TICKS : ticks; in sys_clock_set_timeout() 197 ticks = CLAMP(ticks - 1, 0, (int32_t) MAX_TICKS); in sys_clock_set_timeout() 203 uint64_t timeout = ticks * RTC_COUNTS_PER_TICK + in sys_clock_set_timeout()
|
D | smartbond_timer.c | 84 void sys_clock_set_timeout(int32_t ticks, bool idle) in sys_clock_set_timeout() argument 93 if (ticks == K_TICKS_FOREVER) { in sys_clock_set_timeout() 125 if (watchdog_expire_ticks - 2 < ticks) { in sys_clock_set_timeout() 126 ticks = watchdog_expire_ticks - 2; in sys_clock_set_timeout() 129 ticks = (ticks == K_TICKS_FOREVER) ? MAX_TICKS : ticks; in sys_clock_set_timeout() 130 ticks = CLAMP(ticks - 1, 0, (int32_t)MAX_TICKS); in sys_clock_set_timeout() 135 target_val = timer_val + TICK_TO_CYC(ticks); in sys_clock_set_timeout()
|
D | silabs_sleeptimer_timer.c | 64 static void sleeptimer_clock_set_timeout(int32_t ticks, struct sleeptimer_timer_data *timer) in sleeptimer_clock_set_timeout() argument 70 ticks = (ticks == K_TICKS_FOREVER) ? timer->max_timeout_ticks : ticks; in sleeptimer_clock_set_timeout() 71 ticks = CLAMP(ticks, 0, timer->max_timeout_ticks); in sleeptimer_clock_set_timeout() 78 uint32_t next = ticks * timer->cyc_per_tick; in sleeptimer_clock_set_timeout() 104 void sys_clock_set_timeout(int32_t ticks, bool idle) in sys_clock_set_timeout() argument 108 sleeptimer_clock_set_timeout(ticks, &g_sleeptimer_timer_data); in sys_clock_set_timeout()
|
D | mips_cp0_timer.c | 64 void sys_clock_set_timeout(int32_t ticks, bool idle) in sys_clock_set_timeout() argument 72 ticks = ticks == K_TICKS_FOREVER ? MAX_TICKS : ticks; in sys_clock_set_timeout() 73 ticks = CLAMP(ticks - 1, 0, (int32_t)MAX_TICKS); in sys_clock_set_timeout() 77 uint32_t delay_wanted = ticks * CYC_PER_TICK; in sys_clock_set_timeout()
|
D | xtensa_sys_timer.c | 66 void sys_clock_set_timeout(int32_t ticks, bool idle) in sys_clock_set_timeout() argument 71 ticks = ticks == K_TICKS_FOREVER ? MAX_TICKS : ticks; in sys_clock_set_timeout() 72 ticks = CLAMP(ticks - 1, 0, (int32_t)MAX_TICKS); in sys_clock_set_timeout() 78 cyc = ticks * CYC_PER_TICK; in sys_clock_set_timeout()
|
/Zephyr-latest/include/zephyr/drivers/ |
D | counter.h | 123 uint8_t chan_id, uint32_t ticks, 149 uint32_t ticks; member 174 uint32_t ticks; member 215 uint32_t *ticks); 217 uint64_t *ticks); 230 uint32_t ticks, 317 uint64_t ticks = (us * z_impl_counter_get_frequency(dev)) / USEC_PER_SEC; in z_impl_counter_us_to_ticks() local 319 return (ticks > (uint64_t)UINT32_MAX) ? UINT32_MAX : ticks; in z_impl_counter_us_to_ticks() 330 __syscall uint64_t counter_ticks_to_us(const struct device *dev, uint32_t ticks); 333 uint32_t ticks) in z_impl_counter_ticks_to_us() argument [all …]
|
/Zephyr-latest/tests/drivers/timer/nrf_rtc_timer/src/ |
D | main.c | 91 int64_t ticks = z_nrf_rtc_timer_get_ticks(t); in test_timeout() local 93 .target_time = ticks, in test_timeout() 94 .window = ext_window ? 100 : (Z_TICK_ABS(t.ticks) ? 0 : 32), in test_timeout() 99 z_nrf_rtc_timer_set(chan, (uint64_t)ticks, timeout_handler, &test_data); in test_timeout() 116 Z_TIMEOUT_TICKS(Z_TICK_ABS(sys_clock_tick_get() + K_MSEC(1).ticks)); in ZTEST() 131 Z_TIMEOUT_TICKS(Z_TICK_ABS(sys_clock_tick_get() - K_MSEC(1).ticks)); in ZTEST() 182 uint64_t exp_ticks = z_nrf_rtc_timer_read() + t.ticks; in ZTEST() 183 int ticks; in ZTEST() local 186 ticks = z_nrf_rtc_timer_get_ticks(t); in ZTEST() 187 zassert_true((ticks >= exp_ticks) && (ticks <= (exp_ticks + 1)), in ZTEST() [all …]
|
/Zephyr-latest/tests/drivers/counter/counter_basic_api/src/ |
D | test_counter.c | 180 top_cfg.ticks = counter_get_max_top_value(dev); in counter_tear_down_instance() 224 .ticks = counter_get_top_value(dev) - 1 in set_top_value_capable() 233 cfg.ticks++; in set_top_value_capable() 272 top_cfg.ticks = counter_us_to_ticks(dev, counter_period_us); in test_set_top_value_with_alarm_instance() 321 top_cfg.ticks = counter_us_to_ticks(dev, counter_period_us); in test_set_top_value_without_alarm_instance() 342 zassert_true(counter_get_top_value(dev) == top_cfg.ticks, in test_set_top_value_without_alarm_instance() 402 uint32_t ticks; in test_single_shot_alarm_instance() local 412 ticks = counter_us_to_ticks(dev, counter_period_us); in test_single_shot_alarm_instance() 413 top_cfg.ticks = ticks; in test_single_shot_alarm_instance() 436 cntr_alarm_cfg.ticks = ticks + 1; in test_single_shot_alarm_instance() [all …]
|
/Zephyr-latest/tests/drivers/counter/maxim_ds3231_api/src/ |
D | test_counter.c | 49 top_cfg.ticks = counter_get_max_top_value(dev); in counter_tear_down_instance() 87 .ticks = counter_get_top_value(dev) - 1 in set_top_value_capable() 96 cfg.ticks++; in set_top_value_capable() 125 top_cfg.ticks = counter_us_to_ticks(dev, COUNTER_PERIOD_US); in test_set_top_value_with_alarm_instance() 171 top_cfg.ticks = counter_us_to_ticks(dev, COUNTER_PERIOD_US); in test_set_top_value_without_alarm_instance() 192 zassert_true(counter_get_top_value(dev) == top_cfg.ticks, in test_set_top_value_without_alarm_instance() 238 uint32_t ticks; in test_single_shot_alarm_instance() local 246 ticks = counter_us_to_ticks(dev, COUNTER_PERIOD_US); in test_single_shot_alarm_instance() 247 top_cfg.ticks = ticks; in test_single_shot_alarm_instance() 269 alarm_cfg.ticks = ticks + 1; in test_single_shot_alarm_instance() [all …]
|
/Zephyr-latest/subsys/pm/policy/ |
D | policy_events.c | 45 int64_t ticks = -1; in pm_policy_next_event_ticks() local 52 ticks = next_event->uptime_ticks - k_uptime_ticks(); in pm_policy_next_event_ticks() 54 if (ticks < 0) { in pm_policy_next_event_ticks() 55 ticks = 0; in pm_policy_next_event_ticks() 59 return ticks; in pm_policy_next_event_ticks()
|
/Zephyr-latest/kernel/include/ |
D | timeout_q.h | 47 static inline void z_add_thread_timeout(struct k_thread *thread, k_timeout_t ticks) in z_add_thread_timeout() argument 49 z_add_timeout(&thread->base.timeout, z_thread_timeout, ticks); in z_add_thread_timeout() 68 #define z_set_timeout_expiry(ticks, is_idle) do {} while (false) 70 static inline void z_add_thread_timeout(struct k_thread *thread, k_timeout_t ticks) 73 ARG_UNUSED(ticks);
|
/Zephyr-latest/boards/qemu/cortex_m0/ |
D | nrf_timer_timer.c | 133 static void set_protected_absolute_ticks(uint32_t ticks) in set_protected_absolute_ticks() argument 139 set_absolute_ticks(ticks); in set_protected_absolute_ticks() 165 void sys_clock_set_timeout(int32_t ticks, bool idle) in sys_clock_set_timeout() argument 174 ticks = (ticks == K_TICKS_FOREVER) ? MAX_TICKS : ticks; in sys_clock_set_timeout() 175 ticks = CLAMP(ticks - 1, 0, (int32_t)MAX_TICKS); in sys_clock_set_timeout() 185 ticks = 0; in sys_clock_set_timeout() 192 cyc = ticks * CYC_PER_TICK + 1 + unannounced; in sys_clock_set_timeout()
|