1 /* 2 * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #pragma once 8 #include <stdint.h> 9 #include "sdkconfig.h" 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 14 15 /** 16 * @file sleep_cpu.h 17 * 18 * This file contains declarations of cpu retention related functions in light sleep mode. 19 */ 20 21 #if SOC_PM_SUPPORT_CPU_PD 22 23 /** 24 * @brief Whether to allow the cpu power domain to be powered off. 25 * 26 * In light sleep mode, only when the system can provide enough memory 27 * for cpu retention, the cpu power domain can be powered off. 28 */ 29 bool cpu_domain_pd_allowed(void); 30 31 /** 32 * @brief Configure the parameters of the CPU domain during the sleep process 33 * 34 * @param light_sleep_enable true for enable light sleep mode, false for disable light sleep mode 35 * 36 * @return 37 * - ESP_OK on success 38 */ 39 esp_err_t sleep_cpu_configure(bool light_sleep_enable); 40 41 #endif 42 43 #if SOC_PM_SUPPORT_CPU_PD && SOC_PM_CPU_RETENTION_BY_RTCCNTL 44 45 /** 46 * @brief Enable cpu retention of some modules. 47 * 48 * In light sleep mode, before the system goes to sleep, enable the cpu 49 * retention of modules such as CPU and I/D-cache tag memory. 50 */ 51 void sleep_enable_cpu_retention(void); 52 53 /** 54 * @brief Disable cpu retention of some modules. 55 * 56 * In light sleep mode, after the system exits sleep, disable the cpu 57 * retention of moudles such as CPU and I/D-cache tag memory. 58 */ 59 void sleep_disable_cpu_retention(void); 60 61 #endif // SOC_PM_SUPPORT_CPU_PD && SOC_PM_CPU_RETENTION_BY_RTCCNTL 62 63 64 #if SOC_PM_SUPPORT_CPU_PD && SOC_PM_CPU_RETENTION_BY_SW 65 66 esp_err_t esp_sleep_cpu_retention(uint32_t (*goto_sleep)(uint32_t, uint32_t, uint32_t, bool), 67 uint32_t wakeup_opt, uint32_t reject_opt, uint32_t lslp_mem_inf_fpu, bool dslp); 68 69 #endif // SOC_PM_SUPPORT_CPU_PD && SOC_PM_CPU_RETENTION_BY_SW 70 71 #ifdef __cplusplus 72 } 73 #endif 74