From f071399adea2130328bccd482eb5de3c3cc02201 Mon Sep 17 00:00:00 2001 From: dongheng Date: Mon, 22 Apr 2019 17:48:40 +0800 Subject: [PATCH] feat(freertos): Add CPU wait to save power --- components/esp8266/include/driver/soc.h | 10 ++++++++++ components/freertos/port/esp8266/port.c | 2 ++ 2 files changed, 12 insertions(+) diff --git a/components/esp8266/include/driver/soc.h b/components/esp8266/include/driver/soc.h index cbbfcd6b..d2a7c3f1 100644 --- a/components/esp8266/include/driver/soc.h +++ b/components/esp8266/include/driver/soc.h @@ -128,6 +128,16 @@ static inline uint32_t soc_get_int_mask(void) return mask & enable & ETS_INT_MASK; } +static inline void soc_wait_int(void) +{ + __asm__ __volatile__( + "waiti 0\n" + : + : + : "memory" + ); +} + #ifdef __cplusplus } #endif diff --git a/components/freertos/port/esp8266/port.c b/components/freertos/port/esp8266/port.c index 8810836b..b11b0c5e 100644 --- a/components/freertos/port/esp8266/port.c +++ b/components/freertos/port/esp8266/port.c @@ -342,6 +342,8 @@ void esp_internal_idle_hook(void) esp_task_wdt_reset(); pmIdleHook(); + + soc_wait_int(); } #ifndef DISABLE_FREERTOS