Lines Matching +full:idle +full:- +full:count
2 * Copyright (c) 2014-2015 Wind River Systems, Inc.
5 * SPDX-License-Identifier: Apache-2.0
37 #define _ARC_V2_TMR_CTRL_NH 0x2 /* count only while not halted */
51 #define MAX_TICKS ((COUNTER_MAX / CYC_PER_TICK) - 1)
104 * @brief Get contents of Timer0 count register
106 * @return Current Timer0 count
114 * @brief Set Timer0 count register to the specified value
152 static ALWAYS_INLINE void timer0_limit_register_set(uint32_t count) in timer0_limit_register_set() argument
154 z_arc_v2_aux_reg_write(_ARC_V2_TMR0_LIMIT, count); in timer0_limit_register_set()
168 * - reprogramming of LIMIT must be clearing the COUNT
169 * - ISR must be clearing the 'overflow_cycles' counter.
170 * - no more than one counter-wrap has occurred between
171 * - the timer reset or the last time the function was called
172 * - and until the current call of the function is completed.
173 * - the function is invoked with interrupts disabled.
227 dticks = (curr_time - last_time) / CYC_PER_TICK; in timer_int_handler()
252 dticks = (cycle_count - announced_cycles) / CYC_PER_TICK; in timer_int_handler()
259 void sys_clock_set_timeout(int32_t ticks, bool idle) in sys_clock_set_timeout() argument
261 /* If the kernel allows us to miss tick announcements in idle, in sys_clock_set_timeout()
262 * then shut off the counter. (Note: we can assume if idle==true in sys_clock_set_timeout()
266 /* as 64-bits GFRC is used as wall clock, it's ok to ignore idle in sys_clock_set_timeout()
268 * However for single core using 32-bits arc timer, idle cannot in sys_clock_set_timeout()
269 * be ignored, as 32-bits timer will overflow in a not-long time. in sys_clock_set_timeout()
293 timer0_limit_register_set(delay - 1); in sys_clock_set_timeout()
301 if (IS_ENABLED(CONFIG_TICKLESS_KERNEL) && idle && ticks == K_TICKS_FOREVER) { in sys_clock_set_timeout()
313 ticks = MIN(MAX_TICKS, (uint32_t)(MAX((int32_t)(ticks - 1), 0))); in sys_clock_set_timeout()
328 unannounced = cycle_count - announced_cycles; in sys_clock_set_timeout()
331 /* We haven't announced for more than half the 32-bit in sys_clock_set_timeout()
346 delay -= unannounced; in sys_clock_set_timeout()
352 timer0_limit_register_set(last_load - 1); in sys_clock_set_timeout()
370 cyc = (z_arc_connect_gfrc_read() - last_time); in sys_clock_elapsed()
372 cyc = elapsed() + cycle_count - announced_cycles; in sys_clock_elapsed()
383 return z_arc_connect_gfrc_read() - start_time; in sys_clock_cycle_get_32()
426 timer0_limit_register_set(CYC_PER_TICK - 1); in sys_clock_driver_init()
437 timer0_limit_register_set(last_load - 1); in sys_clock_driver_init()