Lines Matching +full:wakeup +full:- +full:and +full:- +full:sleep

4  * SPDX-License-Identifier: Apache-2.0
21 #define MAX_TICKS (((COUNTER_SPAN / 2) - CYC_PER_TICK) / (CYC_PER_TICK))
49 TIMER2->TIMER2_RELOAD_REG = val & TIMER2_TIMER2_RELOAD_REG_TIM_RELOAD_Msk; in set_reload()
57 timer_val_reg = TIMER2->TIMER2_TIMER_VAL_REG & in timer_val_32()
74 timer_val_reg = TIMER2->TIMER2_TIMER_VAL_REG & in timer_val_32_noupdate()
100 * Watchdog default reload value is 0x1FFF (~82s for RC32K and 172s for RCX). in sys_clock_set_timeout()
104 * system never goes to sleep for longer time that watchdog reload value. in sys_clock_set_timeout()
109 if (CRG_TOP->CLK_RCX_REG & CRG_TOP_CLK_RCX_REG_RCX_ENABLE_Msk) { in sys_clock_set_timeout()
114 watchdog_expire_ticks = SYS_WDOG->WATCHDOG_REG * 320; in sys_clock_set_timeout()
119 * ticks must be calculated according to XTAL32K frequency and in sys_clock_set_timeout()
122 watchdog_expire_ticks = SYS_WDOG->WATCHDOG_REG * 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()
130 ticks = CLAMP(ticks - 1, 0, (int32_t)MAX_TICKS); in sys_clock_set_timeout()
134 /* Calculate target timer value and align to full tick */ in sys_clock_set_timeout()
136 target_val = ((target_val + CYC_PER_TICK - 1) / CYC_PER_TICK) * CYC_PER_TICK; in sys_clock_set_timeout()
144 * used for wakeup) is behind timer value or is equal to it. in sys_clock_set_timeout()
148 if ((int32_t)(target_val - timer_val_32_noupdate() - 1) < 0) { in sys_clock_set_timeout()
159 return CYC_TO_TICK(timer_val_32_noupdate() - last_isr_val); in sys_clock_elapsed()
169 TIMER2->TIMER2_CTRL_REG |= TIMER2_TIMER2_CTRL_REG_TIM_EN_Msk; in sys_clock_idle_exit()
174 TIMER2->TIMER2_CTRL_REG &= ~TIMER2_TIMER2_CTRL_REG_TIM_EN_Msk; in sys_clock_disable()
185 TIMER2->TIMER2_CLEAR_IRQ_REG = 1; in timer2_isr()
188 delta = (int32_t)(val - last_isr_val_rounded); in timer2_isr()
204 /* Enable wakeup by TIMER2 */ in sys_clock_driver_init()
211 TIMER2->TIMER2_CTRL_REG = 0; in sys_clock_driver_init()
212 TIMER2->TIMER2_PRESCALER_REG = 0; in sys_clock_driver_init()
213 TIMER2->TIMER2_CTRL_REG |= TIMER2_TIMER2_CTRL_REG_TIM_CLK_EN_Msk; in sys_clock_driver_init()
214 TIMER2->TIMER2_CTRL_REG |= TIMER2_TIMER2_CTRL_REG_TIM_FREE_RUN_MODE_EN_Msk | in sys_clock_driver_init()