esp-idf/components/esp32
Ivan Grokhotkov 22dd3103bd pm: fix entering light sleep in single core mode
Tickless idle/light sleep procedure had a bug in single core mode.
Consider the flow of events:
1. Idle task runs and calls vApplicationIdleHook
2. This calls esp_vApplicationIdleHook, which calls esp_pm_impl_idle_hook, and pm lock for RTOS on the current core is released.
3. Then esp_vApplicationIdleHook calls esp_pm_impl_waiti, which checks that s_entered_light_sleep[core_id]==false and goes into waiti state.
4. Some interrupt happens, calls esp_pm_impl_isr_hook, which takes pm lock for RTOS. PM state goes back to CPU_FREQ_MAX.
5. Once the interrupt is over, vApplicationIdleHook returns, and Idle task continues to run, finally reaching the call to vApplicationSleep.
6. vApplicationSleep does not enter light sleep, because esp_pm_impl_isr_hook has already changed PM state from IDLE to CPU_FREQ_MAX.

This didn’t happen in dual core mode, because waiti state of one CPU was interrupted by CCOMPARE update interrupt from the other CPU, in which case PM lock for FreeRTOS was not taken.

Fix by inverting the meaning of the flag (for convenience) and only setting it to true when vApplicationSleep actually fails to enter light sleep.
2018-11-05 12:18:29 +08:00
..
hwcrypto
include Merge branch 'bugfix/release_some_memory_on_single_core_mode' into 'master' 2018-10-30 15:53:31 +08:00
ld components/bt: Point ACL RX buffer ptr to ACL RX buffer if ACL RX buffer ptr is null 2018-11-01 17:33:44 +08:00
lib@ee0d0b152f wifi: bugfix of assert when do wps with mikrotik 2018-10-29 13:29:41 +00:00
test cmake: Add support for test build 2018-10-20 12:07:24 +08:00
CMakeLists.txt event: Implement event loop library 2018-10-26 13:14:19 +08:00
Kconfig Spiram: Add option to reserve MMU banks; add himem API to make use of those banks 2018-10-15 14:32:58 +08:00
Makefile.projbuild
brownout.c
cache_err_int.c
cache_sram_mmu.c Spiram: Add option to reserve MMU banks; add himem API to make use of those banks 2018-10-15 14:32:58 +08:00
clk.c
coexist.c
coexist_internal.h
component.mk doc: update document of external memory 2018-09-26 10:39:57 +08:00
core_dump.c
cpu_start.c Merge branch 'bugfix/release_some_memory_on_single_core_mode' into 'master' 2018-10-30 15:53:31 +08:00
crosscore_int.c
dbg_stubs.c
dport_access.c
dport_panic_highint_hdl.S
esp_clk_internal.h
esp_err_to_name.c HTTP Server : Added esp_ prefix to http_server component files 2018-10-24 17:32:20 +05:30
esp_err_to_name.c.in
esp_himem.c Spiram: Add option to reserve MMU banks; add himem API to make use of those banks 2018-10-15 14:32:58 +08:00
esp_system_internal.h
esp_timer.c
esp_timer_esp32.c
esp_timer_impl.h
ets_timer_legacy.c
event_default_handlers.c
event_loop.c event: Implement event loop library 2018-10-26 13:14:19 +08:00
fast_crypto_ops.c
freertos_hooks.c esp32: fix regression introduced in automatic light sleep pm 2018-09-26 08:52:15 +05:30
gdbstub.c
hw_random.c
int_wdt.c
intr_alloc.c intr: fix a type mismatch warning 2018-10-21 15:11:45 +08:00
ipc.c
lib_printf.c
libhal.a
panic.c esp32: Add macro to check a condition without abort 2018-10-09 08:57:23 +02:00
phy.h
phy_init.c esp32: fix WiFi timer inaccurate bug 2018-10-17 09:47:25 +08:00
phy_init_data.h
pm_esp32.c pm: fix entering light sleep in single core mode 2018-11-05 12:18:29 +08:00
pm_impl.h esp32: fix regression introduced in automatic light sleep pm 2018-09-26 08:52:15 +05:30
pm_locks.c
pm_trace.c
pm_trace.h
reset_reason.c
restore.c
sleep_modes.c uart: fix uart_tx_wait_idle to wait for fifo empty 2018-10-15 20:08:16 +08:00
spiram.c Spiram: Add option to reserve MMU banks; add himem API to make use of those banks 2018-10-15 14:32:58 +08:00
spiram_psram.c bugfix(psram): fix psram driver 2018-10-08 19:55:13 +08:00
spiram_psram.h bugfix(psram): fix psram driver 2018-10-08 19:55:13 +08:00
stack_check.c
system_api.c
task_wdt.c esp32: Add macro to check a condition without abort 2018-10-09 08:57:23 +02:00
wifi_init.c
wifi_os_adapter.c