mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-20 10:46:02 -04:00
fix(lightsleep): fix access pu_cfg after sleep wake wakeup which is linked to flash
This commit is contained in:
parent
ae0824684c
commit
2df2c1cc46
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "esp_attr.h"
|
||||||
#include "soc/soc.h"
|
#include "soc/soc.h"
|
||||||
#include "soc/rtc.h"
|
#include "soc/rtc.h"
|
||||||
#include "soc/rtc_cntl_reg.h"
|
#include "soc/rtc_cntl_reg.h"
|
||||||
@ -28,6 +29,8 @@
|
|||||||
#include "soc/systimer_reg.h"
|
#include "soc/systimer_reg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const DRAM_ATTR rtc_sleep_pu_config_t pu_cfg = RTC_SLEEP_PU_CONFIG_ALL(1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure whether certain peripherals are powered down in deep sleep
|
* Configure whether certain peripherals are powered down in deep sleep
|
||||||
* @param cfg power down flags as rtc_sleep_pu_config_t structure
|
* @param cfg power down flags as rtc_sleep_pu_config_t structure
|
||||||
@ -170,7 +173,6 @@ void rtc_sleep_get_default_config(uint32_t sleep_flags, rtc_sleep_config_t *out_
|
|||||||
void rtc_sleep_init(rtc_sleep_config_t cfg)
|
void rtc_sleep_init(rtc_sleep_config_t cfg)
|
||||||
{
|
{
|
||||||
if (cfg.lslp_mem_inf_fpu) {
|
if (cfg.lslp_mem_inf_fpu) {
|
||||||
rtc_sleep_pu_config_t pu_cfg = RTC_SLEEP_PU_CONFIG_ALL(1);
|
|
||||||
rtc_sleep_pu(pu_cfg);
|
rtc_sleep_pu(pu_cfg);
|
||||||
}
|
}
|
||||||
/* mem force pu */
|
/* mem force pu */
|
||||||
@ -372,7 +374,6 @@ static uint32_t rtc_sleep_finish(uint32_t lslp_mem_inf_fpu)
|
|||||||
|
|
||||||
/* restore config if it is a light sleep */
|
/* restore config if it is a light sleep */
|
||||||
if (lslp_mem_inf_fpu) {
|
if (lslp_mem_inf_fpu) {
|
||||||
rtc_sleep_pu_config_t pu_cfg = RTC_SLEEP_PU_CONFIG_ALL(1);
|
|
||||||
rtc_sleep_pu(pu_cfg);
|
rtc_sleep_pu(pu_cfg);
|
||||||
}
|
}
|
||||||
return reject;
|
return reject;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "esp_attr.h"
|
||||||
#include "soc/soc.h"
|
#include "soc/soc.h"
|
||||||
#include "soc/rtc.h"
|
#include "soc/rtc.h"
|
||||||
#include "soc/rtc_cntl_reg.h"
|
#include "soc/rtc_cntl_reg.h"
|
||||||
@ -30,6 +31,8 @@
|
|||||||
*/
|
*/
|
||||||
static const char *TAG = "rtc_sleep";
|
static const char *TAG = "rtc_sleep";
|
||||||
|
|
||||||
|
static const DRAM_ATTR rtc_sleep_pu_config_t pu_cfg = RTC_SLEEP_PU_CONFIG_ALL(1);
|
||||||
|
|
||||||
void rtc_sleep_pu(rtc_sleep_pu_config_t cfg)
|
void rtc_sleep_pu(rtc_sleep_pu_config_t cfg)
|
||||||
{
|
{
|
||||||
REG_SET_FIELD(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_LSLP_MEM_FORCE_PU, cfg.dig_fpu);
|
REG_SET_FIELD(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_LSLP_MEM_FORCE_PU, cfg.dig_fpu);
|
||||||
@ -201,7 +204,6 @@ void rtc_sleep_get_default_config(uint32_t sleep_flags, rtc_sleep_config_t *out_
|
|||||||
void rtc_sleep_init(rtc_sleep_config_t cfg)
|
void rtc_sleep_init(rtc_sleep_config_t cfg)
|
||||||
{
|
{
|
||||||
if (cfg.lslp_mem_inf_fpu) {
|
if (cfg.lslp_mem_inf_fpu) {
|
||||||
rtc_sleep_pu_config_t pu_cfg = RTC_SLEEP_PU_CONFIG_ALL(1);
|
|
||||||
rtc_sleep_pu(pu_cfg);
|
rtc_sleep_pu(pu_cfg);
|
||||||
}
|
}
|
||||||
if (cfg.bt_pd_en) {
|
if (cfg.bt_pd_en) {
|
||||||
@ -382,7 +384,6 @@ static uint32_t rtc_sleep_finish(uint32_t lslp_mem_inf_fpu)
|
|||||||
|
|
||||||
/* restore config if it is a light sleep */
|
/* restore config if it is a light sleep */
|
||||||
if (lslp_mem_inf_fpu) {
|
if (lslp_mem_inf_fpu) {
|
||||||
rtc_sleep_pu_config_t pu_cfg = RTC_SLEEP_PU_CONFIG_ALL(1);
|
|
||||||
rtc_sleep_pu(pu_cfg);
|
rtc_sleep_pu(pu_cfg);
|
||||||
}
|
}
|
||||||
return reject;
|
return reject;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include "esp_attr.h"
|
||||||
#include "soc/soc.h"
|
#include "soc/soc.h"
|
||||||
#include "soc/rtc.h"
|
#include "soc/rtc.h"
|
||||||
#include "soc/rtc_cntl_reg.h"
|
#include "soc/rtc_cntl_reg.h"
|
||||||
@ -22,6 +23,8 @@
|
|||||||
|
|
||||||
#define RTC_CNTL_MEM_FOLW_CPU (RTC_CNTL_SLOWMEM_FOLW_CPU | RTC_CNTL_FASTMEM_FOLW_CPU)
|
#define RTC_CNTL_MEM_FOLW_CPU (RTC_CNTL_SLOWMEM_FOLW_CPU | RTC_CNTL_FASTMEM_FOLW_CPU)
|
||||||
|
|
||||||
|
static const DRAM_ATTR rtc_sleep_pu_config_t pu_cfg = RTC_SLEEP_PU_CONFIG_ALL(1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure whether certain peripherals are powered up in sleep
|
* Configure whether certain peripherals are powered up in sleep
|
||||||
* @param cfg power down flags as rtc_sleep_pu_config_t structure
|
* @param cfg power down flags as rtc_sleep_pu_config_t structure
|
||||||
@ -175,7 +178,6 @@ void rtc_sleep_get_default_config(uint32_t sleep_flags, rtc_sleep_config_t *out_
|
|||||||
void rtc_sleep_init(rtc_sleep_config_t cfg)
|
void rtc_sleep_init(rtc_sleep_config_t cfg)
|
||||||
{
|
{
|
||||||
if (cfg.lslp_mem_inf_fpu) {
|
if (cfg.lslp_mem_inf_fpu) {
|
||||||
rtc_sleep_pu_config_t pu_cfg = RTC_SLEEP_PU_CONFIG_ALL(1);
|
|
||||||
rtc_sleep_pu(pu_cfg);
|
rtc_sleep_pu(pu_cfg);
|
||||||
}
|
}
|
||||||
/* mem force pu */
|
/* mem force pu */
|
||||||
@ -303,7 +305,6 @@ static uint32_t rtc_sleep_finish(uint32_t lslp_mem_inf_fpu)
|
|||||||
|
|
||||||
/* restore config if it is a light sleep */
|
/* restore config if it is a light sleep */
|
||||||
if (lslp_mem_inf_fpu) {
|
if (lslp_mem_inf_fpu) {
|
||||||
rtc_sleep_pu_config_t pu_cfg = RTC_SLEEP_PU_CONFIG_ALL(1);
|
|
||||||
rtc_sleep_pu(pu_cfg);
|
rtc_sleep_pu(pu_cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user