diff --git a/arch/xtensa/src/esp32/esp32_idle.c b/arch/xtensa/src/esp32/esp32_idle.c index 40787ba15db..d51a457f710 100644 --- a/arch/xtensa/src/esp32/esp32_idle.c +++ b/arch/xtensa/src/esp32/esp32_idle.c @@ -22,13 +22,17 @@ * Included Files ****************************************************************************/ +#include + #include #include #include -#include + +#include #include #include #include +#include #include "esp32_pm.h" #include "xtensa.h" @@ -45,6 +49,18 @@ * Pre-processor Definitions ****************************************************************************/ +/* Does the board support an IDLE LED to indicate that the board is in the + * IDLE state? + */ + +#ifdef CONFIG_ARCH_LEDS_CPU_ACTIVITY +# define BEGIN_IDLE() board_autoled_off(LED_CPU) +# define END_IDLE() +#else +# define BEGIN_IDLE() +# define END_IDLE() +#endif + /* Values for the RTC Alarm to wake up from the PM_STANDBY mode * (which corresponds to ESP32 stop mode). If this alarm expires, * the logic in this file will wakeup from PM_STANDBY mode and @@ -266,9 +282,11 @@ void up_idle(void) * sleep in a reduced power mode until an interrupt occurs to save power */ + BEGIN_IDLE(); #if XCHAL_HAVE_INTERRUPTS __asm__ __volatile__ ("waiti 0"); #endif + END_IDLE(); /* Perform IDLE mode power management */ diff --git a/arch/xtensa/src/esp32/esp32_irq.c b/arch/xtensa/src/esp32/esp32_irq.c index 82f01a97405..efd1c43861d 100644 --- a/arch/xtensa/src/esp32/esp32_irq.c +++ b/arch/xtensa/src/esp32/esp32_irq.c @@ -32,7 +32,9 @@ #include #include +#include #include +#include #include "xtensa.h" @@ -924,6 +926,10 @@ uint32_t *xtensa_int_decode(uint32_t cpuints, uint32_t *regs) int cpu; #endif +#ifdef CONFIG_ARCH_LEDS_CPU_ACTIVITY + board_autoled_on(LED_CPU); +#endif + #ifdef CONFIG_SMP /* Select PRO or APP CPU interrupt mapping table */