2021-04-13 06:39:04 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <toolchain.h>
|
|
|
|
#include <irq.h>
|
|
|
|
#include <arch/cpu.h>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Power save idle routine
|
|
|
|
*
|
|
|
|
* This function will be called by the kernel idle loop or possibly within
|
|
|
|
* an implementation of _pm_save_idle in the kernel when the
|
|
|
|
* '_pm_save_flag' variable is non-zero.
|
|
|
|
*/
|
|
|
|
void arch_cpu_idle(void)
|
|
|
|
{
|
2022-03-17 05:07:43 +08:00
|
|
|
/* curiously it arrives here with the interrupts masked
|
2021-04-13 06:39:04 +08:00
|
|
|
* so umask it before wait for an event
|
|
|
|
*/
|
|
|
|
arch_irq_unlock(MSTATUS_IEN);
|
|
|
|
|
|
|
|
/* Wait for interrupt */
|
|
|
|
__asm__ volatile("wfi");
|
|
|
|
}
|