change(esp_hw_support): optimize retention driver RAM cost

This commit is contained in:
wuzhenghui
2026-09-04 18:00:35 +08:00
parent 59512efe9c
commit 64f8bdd2e1
27 changed files with 40 additions and 89 deletions
@@ -1467,10 +1467,6 @@ config SOC_PM_PMU_MIN_SLP_SLOW_CLK_CYCLE_FIXED
bool
default y
config SOC_PM_RETENTION_MODULE_NUM
int
default 40
config SOC_PM_FLASH_KEEP_POWER_IN_LSLP
bool
default y
@@ -7,7 +7,6 @@
#pragma once
#include <stdint.h>
#include "soc_caps.h"
#ifdef __cplusplus
extern "C" {
@@ -57,7 +56,7 @@ typedef enum periph_retention_module {
SLEEP_RETENTION_MODULE_MODEM_PHY = 31,
SLEEP_RETENTION_MODULE_PHY_FE = 32,
SLEEP_RETENTION_MODULE_MAX = SOC_PM_RETENTION_MODULE_NUM - 1
SLEEP_RETENTION_MODULE_MAX,
} periph_retention_module_t;
#define is_top_domain_module(m) (m <= SLEEP_RETENTION_MODULE_SDM0)
@@ -594,8 +594,6 @@
#define SOC_PM_PMU_MIN_SLP_SLOW_CLK_CYCLE_FIXED (1)
#define SOC_PM_RETENTION_MODULE_NUM (40)
#define SOC_PM_FLASH_KEEP_POWER_IN_LSLP (1) /*!<Keep flash on in light sleep to reduce wake latency and current leakage*/
/*-------------------------- CLOCK SUBSYSTEM CAPS ----------------------------------------*/
@@ -1203,10 +1203,6 @@ config SOC_PM_PMU_MIN_SLP_SLOW_CLK_CYCLE_FIXED
bool
default y
config SOC_PM_RETENTION_MODULE_NUM
int
default 32
config SOC_PM_TOP_DEPENDS_ON_RTC_PERIPH
bool
default y
@@ -7,7 +7,6 @@
#pragma once
#include <stdint.h>
#include "soc_caps.h"
#ifdef __cplusplus
extern "C" {
@@ -56,7 +55,7 @@ typedef enum periph_retention_module {
SLEEP_RETENTION_MODULE_802154_MAC = 30,
SLEEP_RETENTION_MODULE_PHY_FE = 31,
SLEEP_RETENTION_MODULE_MAX = SOC_PM_RETENTION_MODULE_NUM - 1
SLEEP_RETENTION_MODULE_MAX,
} periph_retention_module_t;
#define is_top_domain_module(m) (m <= SLEEP_RETENTION_MODULE_SDM0)
@@ -493,8 +493,6 @@
#define SOC_PM_PAU_REGDMA_UPDATE_CACHE_BEFORE_WAIT_COMPARE (1)
#define SOC_PM_PMU_MIN_SLP_SLOW_CLK_CYCLE_FIXED (1)
#define SOC_PM_RETENTION_MODULE_NUM (32)
#define SOC_PM_TOP_DEPENDS_ON_RTC_PERIPH (1)
/*-------------------------- CLOCK SUBSYSTEM CAPS ----------------------------------------*/
@@ -1111,10 +1111,6 @@ config SOC_PM_PMU_MIN_SLP_SLOW_CLK_CYCLE_FIXED
bool
default y
config SOC_PM_RETENTION_MODULE_NUM
int
default 32
config SOC_PM_FLASH_KEEP_POWER_IN_LSLP
bool
default y
@@ -7,7 +7,6 @@
#pragma once
#include <stdint.h>
#include "soc_caps.h"
#ifdef __cplusplus
extern "C" {
@@ -49,7 +48,7 @@ typedef enum periph_retention_module {
SLEEP_RETENTION_MODULE_802154_MAC = 30,
SLEEP_RETENTION_MODULE_PHY_FE = 31,
SLEEP_RETENTION_MODULE_MAX = SOC_PM_RETENTION_MODULE_NUM - 1
SLEEP_RETENTION_MODULE_MAX,
} periph_retention_module_t;
#define is_top_domain_module(m) (m <= SLEEP_RETENTION_MODULE_TEMP_SENSOR)
@@ -457,8 +457,6 @@
#define SOC_PM_PAU_REGDMA_UPDATE_CACHE_BEFORE_WAIT_COMPARE (1)
#define SOC_PM_PMU_MIN_SLP_SLOW_CLK_CYCLE_FIXED (1)
#define SOC_PM_RETENTION_MODULE_NUM (32)
#define SOC_PM_FLASH_KEEP_POWER_IN_LSLP (1) /*!<Keep flash on in light sleep to reduce wake latency and current leakage*/
/*-------------------------- CLOCK SUBSYSTEM CAPS ----------------------------------------*/
@@ -1139,10 +1139,6 @@ config SOC_PM_PAU_REGDMA_UPDATE_CACHE_BEFORE_WAIT_COMPARE
bool
default y
config SOC_PM_RETENTION_MODULE_NUM
int
default 32
config SOC_EXT_MEM_CACHE_TAG_IN_CPU_DOMAIN
bool
default y
@@ -7,7 +7,6 @@
#pragma once
#include <stdint.h>
#include "soc_caps.h"
#ifdef __cplusplus
extern "C" {
@@ -53,7 +52,7 @@ typedef enum periph_retention_module {
SLEEP_RETENTION_MODULE_BT_BB = 29,
SLEEP_RETENTION_MODULE_802154_MAC = 30,
SLEEP_RETENTION_MODULE_MAX = SOC_PM_RETENTION_MODULE_NUM - 1
SLEEP_RETENTION_MODULE_MAX,
} periph_retention_module_t;
#define is_top_domain_module(m) ((m) <= SLEEP_RETENTION_MODULE_SDM0)
@@ -491,8 +491,6 @@
#define SOC_PM_PAU_REGDMA_UPDATE_CACHE_BEFORE_WAIT_COMPARE (1)
#define SOC_PM_RETENTION_MODULE_NUM (32)
#define SOC_EXT_MEM_CACHE_TAG_IN_CPU_DOMAIN (1)
#define SOC_PM_CPU_RETENTION_BY_SW (1)
#define SOC_PM_MODEM_RETENTION_BY_REGDMA (1)
@@ -1003,10 +1003,6 @@ config SOC_PM_PAU_LINK_NUM
int
default 5
config SOC_PM_RETENTION_MODULE_NUM
int
default 32
config SOC_PM_PAU_REGDMA_LINK_CONFIGURABLE
bool
default y
@@ -7,7 +7,6 @@
#pragma once
#include <stdint.h>
#include "soc_caps.h"
#ifdef __cplusplus
extern "C" {
@@ -53,7 +52,7 @@ typedef enum periph_retention_module {
SLEEP_RETENTION_MODULE_BT_BB = 29,
SLEEP_RETENTION_MODULE_802154_MAC = 30,
SLEEP_RETENTION_MODULE_MAX = SOC_PM_RETENTION_MODULE_NUM - 1
SLEEP_RETENTION_MODULE_MAX,
} periph_retention_module_t;
#define is_top_domain_module(m) ((m) <= SLEEP_RETENTION_MODULE_SDM0)
@@ -460,7 +460,6 @@
#define SOC_PM_SUPPORT_VDDSDIO_PD (1)
#define SOC_PM_SUPPORT_TOP_PD (1)
#define SOC_PM_PAU_LINK_NUM (5)
#define SOC_PM_RETENTION_MODULE_NUM (32)
#define SOC_PM_PAU_REGDMA_LINK_CONFIGURABLE (1)
#define SOC_PM_CPU_RETENTION_BY_SW (1)
#define SOC_PM_MODEM_RETENTION_BY_REGDMA (1)
@@ -1227,10 +1227,6 @@ config SOC_PM_PAU_REGDMA_LINK_CONFIGURABLE
bool
default y
config SOC_PM_RETENTION_MODULE_NUM
int
default 64
config SOC_PM_TOP_DEPENDS_ON_RTC_PERIPH
bool
default y
@@ -7,7 +7,6 @@
#pragma once
#include <stdint.h>
#include "soc_caps.h"
#ifdef __cplusplus
extern "C" {
@@ -59,7 +58,7 @@ typedef enum periph_retention_module {
SLEEP_RETENTION_MODULE_802154_MAC = 33,
SLEEP_RETENTION_MODULE_POWER = 34,
SLEEP_RETENTION_MODULE_MAX = SOC_PM_RETENTION_MODULE_NUM - 1
SLEEP_RETENTION_MODULE_MAX,
} periph_retention_module_t;
#define is_top_domain_module(m) ((m) <= SLEEP_RETENTION_MODULE_ASRC)
@@ -514,7 +514,6 @@
#define SOC_PM_PAU_LINK_NUM (4)
#define SOC_PM_PAU_REGDMA_LINK_CONFIGURABLE (1)
#define SOC_PM_RETENTION_MODULE_NUM (64)
#define SOC_PM_TOP_DEPENDS_ON_RTC_PERIPH (1) // In ESP32H4, RTC_PERIPH should be pd only together with TOP, otherwise there is some current leak.
#define SOC_PM_BBPLL_PD_IN_MODEM_STATE (1)
@@ -1827,10 +1827,6 @@ config SOC_SLEEP_TGWDT_STOP_WORKAROUND
bool
default y
config SOC_PM_RETENTION_MODULE_NUM
int
default 64
config SOC_MAIN_POWER_CONTROL_SUPPORTED
bool
default y
@@ -7,7 +7,6 @@
#pragma once
#include <stdint.h>
#include "soc_caps.h"
#ifdef __cplusplus
extern "C" {
@@ -68,9 +67,9 @@ typedef enum periph_retention_module {
SLEEP_RETENTION_MODULE_PPA = 42,
/* PMU REGDMA clock icg */
SLEEP_RETENTION_MODULE_CLOCK_ICG = SOC_PM_RETENTION_MODULE_NUM - 2,
SLEEP_RETENTION_MODULE_CLOCK_ICG = 43,
SLEEP_RETENTION_MODULE_MAX = SOC_PM_RETENTION_MODULE_NUM - 1
SLEEP_RETENTION_MODULE_MAX,
} periph_retention_module_t;
#define is_top_domain_module(m) (((m) <= SLEEP_RETENTION_MODULE_PPA) || ((m) == SLEEP_RETENTION_MODULE_CLOCK_ICG))
@@ -694,8 +694,6 @@
#define SOC_SLEEP_SYSTIMER_STALL_WORKAROUND 1 //TODO IDF-11381: replace with all xtal field clk gate control
#define SOC_SLEEP_TGWDT_STOP_WORKAROUND 1 //TODO IDF-11381: replace with all xtal field clk gate control
#define SOC_PM_RETENTION_MODULE_NUM (64)
#define SOC_MAIN_POWER_CONTROL_SUPPORTED (1) /*!<Supports outputting an enable signal to control the power-on and power-off of the main power supply when powered by VBAT.*/
/*-------------------------- CLOCK SUBSYSTEM CAPS ----------------------------------------*/
@@ -1611,10 +1611,6 @@ config SOC_PM_PMU_MIN_SLP_SLOW_CLK_CYCLE_FIXED
bool
default y
config SOC_PM_RETENTION_MODULE_NUM
int
default 64
config SOC_LP_MAILBOX_SUPPORTED
bool
default y
@@ -7,7 +7,6 @@
#pragma once
#include <stdint.h>
#include "soc_caps.h"
#ifdef __cplusplus
extern "C" {
@@ -82,7 +81,7 @@ typedef enum periph_retention_module {
SLEEP_RETENTION_MODULE_ASRC = 53,
SLEEP_RETENTION_MODULE_MAX = SOC_PM_RETENTION_MODULE_NUM - 1
SLEEP_RETENTION_MODULE_MAX,
} periph_retention_module_t;
#define is_top_domain_module(m) ((m >= SLEEP_RETENTION_MODULE_CLOCK_SYSTEM) && ((m <= SLEEP_RETENTION_MODULE_PPA)))
@@ -608,8 +608,6 @@
*/
#define SOC_PM_PMU_MIN_SLP_SLOW_CLK_CYCLE_FIXED (1)
#define SOC_PM_RETENTION_MODULE_NUM (64)
/*-------------------------- LP_CORE CAPS ------------------------------------*/
#define SOC_LP_MAILBOX_SUPPORTED (1) /*!< LP Core supports LP-mailbox */
#define SOC_LP_CORE_SUPPORT_ETM (1) /*!< LP Core supports ETM wakeup */
+7 -5
View File
@@ -18,6 +18,8 @@ extern "C" {
#if SOC_PAU_SUPPORTED
#include "soc/retention_periph_defs.h"
#define REGDMA_LINK_ENTRY_NUM (SOC_PM_PAU_LINK_NUM) /* Maximum number of REG DMA linked list entries */
#ifndef ARRAY_SIZE
@@ -192,15 +194,15 @@ typedef struct regdma_link_branch_write_wait_body {
volatile uint32_t mask;
} regdma_link_branch_write_wait_body_t;
ESP_STATIC_ASSERT(REGDMA_LINK_ENTRY_NUM <= 16, "regdma link entry number should equal to and less than 16");
ESP_STATIC_ASSERT(REGDMA_LINK_ENTRY_NUM < 16, "regdma link entry number must be less than 16 to pack module into stats");
typedef struct regdma_link_stats {
volatile uint32_t ref: REGDMA_LINK_ENTRY_NUM, /* a bitmap, identifies which entry has referenced the current link */
#if REGDMA_LINK_ENTRY_NUM < 16
reserve: 16 - REGDMA_LINK_ENTRY_NUM,
#endif
module: 16 - REGDMA_LINK_ENTRY_NUM, /* module id; width leaves room beside ref within the low 16 bits */
id: 16; /* REGDMA linked list node unique identifier */
volatile int module; /* a number used to identify the module to which the current node belongs */
} regdma_link_stats_t;
ESP_STATIC_ASSERT(sizeof(regdma_link_stats_t) == 4, "regdma_link_stats_t must be 4 bytes");
ESP_STATIC_ASSERT(SLEEP_RETENTION_MODULE_MAX < (1u << (16 - REGDMA_LINK_ENTRY_NUM)),
"module id exceeds bitfield width");
typedef struct regdma_link_continuous {
regdma_link_stats_t stat;