sleep_cpu.h 1.8 KB

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