Example #1
0
/**
 *
 * @brief Power management policy when kernel stops idling
 *
 * This routine is invoked when the kernel leaves the idle state.
 * Routine can be modified to wake up other devices.
 * The routine is invoked from interrupt thread, with interrupts disabled.
 *
 * @return N/A
 */
void _sys_power_save_idle_exit(int32_t ticks)
{
#if (defined(CONFIG_SYS_POWER_LOW_POWER_STATE) || \
	defined(CONFIG_SYS_POWER_DEEP_SLEEP) || \
	defined(CONFIG_DEVICE_POWER_MANAGEMENT))
	/* Any idle wait based on CPU low power state will be exited by
	 * interrupt. This function is called within that interrupt's
	 * ISR context.  _sys_soc_resume() needs to be called here
	 * to handle exit from CPU low power states. This gives an
	 * opportunity for device states altered in _sys_soc_suspend()
	 * to be restored before the kernel schedules another thread.
	 * _sys_soc_resume() is not called from here for deep sleep
	 * exit. Deep sleep recovery happens at cold boot path.
	 */
	_sys_soc_resume();
#endif
#ifdef CONFIG_TICKLESS_IDLE
	if ((ticks == TICKS_UNLIMITED) || ticks >= _sys_idle_threshold_ticks) {
		/* Resume normal periodic system timer interrupts */

		_timer_idle_exit();
	}
#else
	ARG_UNUSED(ticks);
#endif /* CONFIG_TICKLESS_IDLE */
}
Example #2
0
void _sys_power_save_idle_exit(int32_t ticks)
{
#if defined(CONFIG_SYS_POWER_LOW_POWER_STATE)
	/* Some CPU low power states require notification at the ISR
	 * to allow any operations that needs to be done before kernel
	 * switches task or processes nested interrupts. This can be
	 * disabled by calling _sys_soc_pm_idle_exit_notification_disable().
	 * Alternatively it can be simply ignored if not required.
	 */
	if (_sys_pm_idle_exit_notify) {
		_sys_soc_resume();
	}
#endif
#ifdef CONFIG_TICKLESS_IDLE
	if ((ticks == K_FOREVER) || ticks >= _sys_idle_threshold_ticks) {
		/* Resume normal periodic system timer interrupts */

		_timer_idle_exit();
	}
#else
	ARG_UNUSED(ticks);
#endif /* CONFIG_TICKLESS_IDLE */
}