mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
Merge branch 'feat/pm_components_ram_optimize_v5.5' into 'release/v5.5'
feat(pm): pm components ram optimize (v5.5) See merge request espressif/esp-idf!52427
This commit is contained in:
@@ -17,7 +17,7 @@ extern "C" {
|
||||
#include "esp_regdma.h"
|
||||
#include "soc/retention_periph_defs.h"
|
||||
|
||||
#define SLEEP_RETENTION_MODULE_BITMAP_SZ ((SLEEP_RETENTION_MODULE_MAX >> 5) + 1)
|
||||
#define SLEEP_RETENTION_MODULE_BITMAP_SZ (((SLEEP_RETENTION_MODULE_MAX - 1) >> 5) + 1)
|
||||
|
||||
/**
|
||||
* @file sleep_retention.h
|
||||
|
||||
@@ -34,7 +34,13 @@ entries:
|
||||
if IDF_TARGET_ESP32S3 = y || IDF_TARGET_ESP32C2 = y || IDF_TARGET_ESP32C3 = y:
|
||||
rtc_sleep:rtc_sleep_pu (noflash)
|
||||
if SOC_PMU_SUPPORTED = y && SOC_LIGHT_SLEEP_SUPPORTED = y:
|
||||
pmu_sleep (noflash)
|
||||
if SPIRAM_FLASH_LOAD_TO_PSRAM = y || PM_SLP_IRAM_OPT = y:
|
||||
pmu_sleep (noflash)
|
||||
else:
|
||||
if SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE != y:
|
||||
pmu_sleep:pmu_sleep_start (noflash)
|
||||
pmu_sleep:pmu_sleep_finish (noflash)
|
||||
pmu_sleep:pmu_sleep_get_wakup_retention_cost (noflash)
|
||||
sleep_mspi (noflash)
|
||||
if SPIRAM_FLASH_LOAD_TO_PSRAM = y:
|
||||
pmu_init (noflash)
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "esp_log.h"
|
||||
#include "esp_check.h"
|
||||
#include "esp_attr.h"
|
||||
@@ -53,7 +55,7 @@ static esp_err_t sleep_phy_retention_init(void *arg)
|
||||
{
|
||||
#define PHY_ENTRY() (BIT(SOC_PM_PAU_REGDMA_LINK_IDX_PHY))
|
||||
|
||||
static sleep_retention_entries_config_t phy_modem_config[] = {
|
||||
static const sleep_retention_entries_config_t phy_modem_config_template[] = {
|
||||
[0] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x00), MODEM_LPCON_CLK_CONF_REG, MODEM_LPCON_CLK_I2C_MST_EN, MODEM_LPCON_CLK_I2C_MST_EN_M, 1, 0), .owner = PHY_ENTRY() }, /* I2C MST enable */
|
||||
|
||||
/* Reset SET_FREQ fsm */
|
||||
@@ -94,10 +96,17 @@ static esp_err_t sleep_phy_retention_init(void *arg)
|
||||
[26] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x1a), PMU_SLP_WAKEUP_CNTL7_REG, 0x200000, 0xffff0000, 1, 0), .owner = PHY_ENTRY() },
|
||||
[27] = { .config = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x1b), PMU_SLP_WAKEUP_CNTL7_REG, 0x9730000, 0xffff0000, 0, 1), .owner = PHY_ENTRY() }
|
||||
};
|
||||
sleep_retention_entries_config_t *phy_modem_config = malloc(sizeof(phy_modem_config_template));
|
||||
if (phy_modem_config == NULL) {
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
memcpy(phy_modem_config, phy_modem_config_template, sizeof(phy_modem_config_template));
|
||||
|
||||
extern uint32_t phy_ana_i2c_master_burst_rf_onoff(bool on);
|
||||
phy_modem_config[5].config.write_wait.value = phy_ana_i2c_master_burst_rf_onoff(true);
|
||||
phy_modem_config[17].config.write_wait.value = phy_ana_i2c_master_burst_rf_onoff(false);
|
||||
esp_err_t err = sleep_retention_entries_create(phy_modem_config, ARRAY_SIZE(phy_modem_config), 7, SLEEP_RETENTION_MODULE_MODEM_PHY);
|
||||
esp_err_t err = sleep_retention_entries_create(phy_modem_config, ARRAY_SIZE(phy_modem_config_template), 7, SLEEP_RETENTION_MODULE_MODEM_PHY);
|
||||
free(phy_modem_config);
|
||||
ESP_RETURN_ON_ERROR(err, TAG, "failed to allocate modem phy link");
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "esp_attr.h"
|
||||
|
||||
#include "soc/soc_caps.h"
|
||||
@@ -51,7 +53,7 @@ esp_err_t sleep_phy_link_init(void **link_context)
|
||||
esp_err_t err = ESP_OK;
|
||||
|
||||
#if SOC_PM_PAU_REGDMA_LINK_MODEM
|
||||
static regdma_link_config_t phy_modem_config[] = {
|
||||
static const regdma_link_config_t phy_modem_config_template[] = {
|
||||
[0] = REGDMA_LINK_CONTINUOUS_INIT(REGDMA_MODEM_FE_LINK(0), MODEM_FE_DATA_BASE, MODEM_FE_DATA_BASE, 41, 0, 0),
|
||||
[1] = REGDMA_LINK_CONTINUOUS_INIT(REGDMA_MODEM_FE_LINK(1), MODEM_FE_CTRL_BASE, MODEM_FE_CTRL_BASE, 87, 0, 0),
|
||||
|
||||
@@ -106,12 +108,18 @@ esp_err_t sleep_phy_link_init(void **link_context)
|
||||
[39] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x25), PMU_SLP_WAKEUP_CNTL7_REG, 0x200000, 0xffff0000, 1, 0),
|
||||
[40] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x26), PMU_SLP_WAKEUP_CNTL7_REG, 0x9730000, 0xffff0000, 0, 1)
|
||||
};
|
||||
regdma_link_config_t *phy_modem_config = malloc(sizeof(phy_modem_config_template));
|
||||
if (phy_modem_config == NULL) {
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
memcpy(phy_modem_config, phy_modem_config_template, sizeof(phy_modem_config_template));
|
||||
|
||||
extern uint32_t phy_ana_i2c_master_burst_rf_onoff(bool on);
|
||||
phy_modem_config[8].write_wait.value = phy_ana_i2c_master_burst_rf_onoff(true);
|
||||
phy_modem_config[24].write_wait.value = phy_ana_i2c_master_burst_rf_onoff(false);
|
||||
|
||||
void *link = NULL;
|
||||
for (int i = ARRAY_SIZE(phy_modem_config) - 1; (err == ESP_OK) && (i >= 0); i--) {
|
||||
for (int i = ARRAY_SIZE(phy_modem_config_template) - 1; (err == ESP_OK) && (i >= 0); i--) {
|
||||
void *next = regdma_link_init_safe(&phy_modem_config[i], false, 0, link);
|
||||
if (next) {
|
||||
link = next;
|
||||
@@ -120,6 +128,7 @@ esp_err_t sleep_phy_link_init(void **link_context)
|
||||
err = ESP_ERR_NO_MEM;
|
||||
}
|
||||
}
|
||||
free(phy_modem_config);
|
||||
if (err == ESP_OK) {
|
||||
pau_regdma_set_modem_link_addr(link);
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "esp_attr.h"
|
||||
|
||||
#include "soc/soc_caps.h"
|
||||
@@ -48,7 +50,7 @@ esp_err_t sleep_phy_link_init(void **link_context)
|
||||
esp_err_t err = ESP_OK;
|
||||
|
||||
#if SOC_PM_PAU_REGDMA_LINK_MODEM
|
||||
static regdma_link_config_t phy_modem_config[] = {
|
||||
static const regdma_link_config_t phy_modem_config_template[] = {
|
||||
[0] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x00), MODEM_LPCON_CLK_CONF_REG, MODEM_LPCON_CLK_I2C_MST_EN, MODEM_LPCON_CLK_I2C_MST_EN_M, 1, 0), /* I2C MST enable */
|
||||
|
||||
/* Reset SET_FREQ fsm */
|
||||
@@ -101,12 +103,18 @@ esp_err_t sleep_phy_link_init(void **link_context)
|
||||
[36] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x24), PMU_SLP_WAKEUP_CNTL7_REG, 0x200000, 0xffff0000, 1, 0),
|
||||
[37] = REGDMA_LINK_WRITE_INIT(REGDMA_PHY_LINK(0x25), PMU_SLP_WAKEUP_CNTL7_REG, 0x9730000, 0xffff0000, 0, 1)
|
||||
};
|
||||
regdma_link_config_t *phy_modem_config = malloc(sizeof(phy_modem_config_template));
|
||||
if (phy_modem_config == NULL) {
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
memcpy(phy_modem_config, phy_modem_config_template, sizeof(phy_modem_config_template));
|
||||
|
||||
extern uint32_t phy_ana_i2c_master_burst_rf_onoff(bool on);
|
||||
phy_modem_config[5].write_wait.value = phy_ana_i2c_master_burst_rf_onoff(true);
|
||||
phy_modem_config[21].write_wait.value = phy_ana_i2c_master_burst_rf_onoff(false);
|
||||
|
||||
void *link = NULL;
|
||||
for (int i = ARRAY_SIZE(phy_modem_config) - 1; (err == ESP_OK) && (i >= 0); i--) {
|
||||
for (int i = ARRAY_SIZE(phy_modem_config_template) - 1; (err == ESP_OK) && (i >= 0); i--) {
|
||||
void *next = regdma_link_init_safe(&phy_modem_config[i], false, 0, link);
|
||||
if (next) {
|
||||
link = next;
|
||||
@@ -115,6 +123,7 @@ esp_err_t sleep_phy_link_init(void **link_context)
|
||||
err = ESP_ERR_NO_MEM;
|
||||
}
|
||||
}
|
||||
free(phy_modem_config);
|
||||
if (err == ESP_OK) {
|
||||
pau_regdma_set_modem_link_addr(link);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ void pmu_sleep_enable_regdma_backup(void)
|
||||
pmu_hal_hp_set_sleep_active_backup_enable(PMU_instance()->hal);
|
||||
}
|
||||
|
||||
void pmu_sleep_disable_regdma_backup(void)
|
||||
IRAM_ATTR void pmu_sleep_disable_regdma_backup(void)
|
||||
{
|
||||
assert(PMU_instance()->hal);
|
||||
pmu_hal_hp_set_sleep_active_backup_disable(PMU_instance()->hal);
|
||||
|
||||
@@ -753,7 +753,7 @@ static void print_info_continuous_wrapper(FILE *out, void *link)
|
||||
regdma_link_head_t head = REGDMA_LINK_HEAD(link);
|
||||
regdma_link_continuous_t *cons = __containerof(link, regdma_link_continuous_t, head);
|
||||
fprintf(out, LOG_COLOR_I " [%02d/%04x] link_ptr:%p, head: {mode:%s len:%d branch:%s skip_r:%s skip_b:%s eof:%s}, next:%p, backup start:%p, restore start:%p, buff_ptr:%p\n" LOG_RESET_COLOR,
|
||||
__builtin_ffs(cons->stat.module) - 1, cons->stat.id, link,
|
||||
cons->stat.module, cons->stat.id, link,
|
||||
s_link_mode_str[cons->head.mode], cons->head.length, s_boolean_str[cons->head.branch], s_boolean_str[cons->head.skip_r], s_boolean_str[cons->head.skip_b], s_boolean_str[cons->head.eof],
|
||||
cons->body.next,
|
||||
cons->body.backup, cons->body.restore,
|
||||
@@ -766,7 +766,7 @@ static void print_info_addr_map_wrapper(FILE *out, void *link)
|
||||
regdma_link_head_t head = REGDMA_LINK_HEAD(link);
|
||||
regdma_link_addr_map_t *map = __containerof(link, regdma_link_addr_map_t, head);
|
||||
fprintf(out, LOG_COLOR_I " [%02d/%04x] link_ptr:%p, head: {mode:%s len:%d branch:%s skip_r:%s skip_b:%s eof:%s}, next:%p, backup start:%p, restore start:%p, buff_ptr:%p, map:{%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32"}\n" LOG_RESET_COLOR,
|
||||
__builtin_ffs(map->stat.module) - 1, map->stat.id, link,
|
||||
map->stat.module, map->stat.id, link,
|
||||
s_link_mode_str[map->head.mode], map->head.length, s_boolean_str[map->head.branch], s_boolean_str[map->head.skip_r], s_boolean_str[map->head.skip_b], s_boolean_str[map->head.eof],
|
||||
map->body.next,
|
||||
map->body.backup, map->body.restore,
|
||||
@@ -778,7 +778,7 @@ static void print_info_write_wait_wrapper(FILE *out, void *link)
|
||||
{
|
||||
regdma_link_write_wait_t *ww = __containerof(link, regdma_link_write_wait_t, head);
|
||||
fprintf(out, LOG_COLOR_I " [%02d/%04x] link_ptr:%p, head: {mode:%s len:%d branch:%s skip_r:%s skip_b:%s eof:%s}, next:%p, backup start:%p, value:%"PRIx32", mask:%"PRIx32"\n" LOG_RESET_COLOR,
|
||||
__builtin_ffs(ww->stat.module) - 1, ww->stat.id, link,
|
||||
ww->stat.module, ww->stat.id, link,
|
||||
s_link_mode_str[ww->head.mode], ww->head.length, s_boolean_str[ww->head.branch], s_boolean_str[ww->head.skip_r], s_boolean_str[ww->head.skip_b], s_boolean_str[ww->head.eof],
|
||||
ww->body.next,
|
||||
ww->body.backup, ww->body.value, ww->body.mask);
|
||||
@@ -789,7 +789,7 @@ static void print_info_branch_continuous_wrapper(FILE *out, void *link)
|
||||
regdma_link_head_t head = REGDMA_LINK_HEAD(link);
|
||||
regdma_link_branch_continuous_t *cons = __containerof(link, regdma_link_branch_continuous_t, head);
|
||||
fprintf(out, LOG_COLOR_I " [%02d/%04x] link_ptr:%p, head: {mode:%s len:%d branch:%s skip_r:%s skip_b:%s eof:%s}, next:{%p, %p, %p, %p}, backup start:%p, restore start:%p, buff_ptr:%p\n" LOG_RESET_COLOR,
|
||||
__builtin_ffs(cons->stat.module) - 1, cons->stat.id, link,
|
||||
cons->stat.module, cons->stat.id, link,
|
||||
s_link_mode_str[cons->head.mode], cons->head.length, s_boolean_str[cons->head.branch], s_boolean_str[cons->head.skip_r], s_boolean_str[cons->head.skip_b], s_boolean_str[cons->head.eof],
|
||||
cons->body.next[0], cons->body.next[1], cons->body.next[2], cons->body.next[3],
|
||||
cons->body.backup, cons->body.restore,
|
||||
@@ -802,7 +802,7 @@ static void print_info_branch_addr_map_wrapper(FILE *out, void *link)
|
||||
regdma_link_head_t head = REGDMA_LINK_HEAD(link);
|
||||
regdma_link_branch_addr_map_t *map = __containerof(link, regdma_link_branch_addr_map_t, head);
|
||||
fprintf(out, LOG_COLOR_I " [%02d/%04x] link_ptr:%p, head: {mode:%s len:%d branch:%s skip_r:%s skip_b:%s eof:%s}, next:{%p, %p, %p, %p}, backup start:%p, restore start:%p, buff_ptr:%p, map:{%"PRIx32",%"PRIx32",%"PRIx32",%"PRIx32"}\n" LOG_RESET_COLOR,
|
||||
__builtin_ffs(map->stat.module) - 1, map->stat.id, link,
|
||||
map->stat.module, map->stat.id, link,
|
||||
s_link_mode_str[map->head.mode], map->head.length, s_boolean_str[map->head.branch], s_boolean_str[map->head.skip_r], s_boolean_str[map->head.skip_b], s_boolean_str[map->head.eof],
|
||||
map->body.next[0], map->body.next[1], map->body.next[2], map->body.next[3],
|
||||
map->body.backup, map->body.restore,
|
||||
@@ -814,7 +814,7 @@ static void print_info_branch_write_wait_wrapper(FILE *out, void *link)
|
||||
{
|
||||
regdma_link_branch_write_wait_t *ww = __containerof(link, regdma_link_branch_write_wait_t, head);
|
||||
fprintf(out, LOG_COLOR_I " [%02d/%04x] link_ptr:%p, head: {mode:%s len:%d branch:%s skip_r:%s skip_b:%s eof:%s}, next:{%p, %p, %p, %p}, backup start:%p, value:%"PRIx32", mask:%"PRIx32"\n" LOG_RESET_COLOR,
|
||||
__builtin_ffs(ww->stat.module) - 1, ww->stat.id, link,
|
||||
ww->stat.module, ww->stat.id, link,
|
||||
s_link_mode_str[ww->head.mode], ww->head.length, s_boolean_str[ww->head.branch], s_boolean_str[ww->head.skip_r], s_boolean_str[ww->head.skip_b], s_boolean_str[ww->head.eof],
|
||||
ww->body.next[0], ww->body.next[1], ww->body.next[2], ww->body.next[3],
|
||||
ww->body.backup, ww->body.value, ww->body.mask);
|
||||
|
||||
@@ -110,6 +110,7 @@ static inline sleep_retention_module_attribute_t get_attributes(struct sleep_ret
|
||||
|
||||
static inline bool module_is_passive(struct sleep_retention_module_object * const self)
|
||||
{
|
||||
assert(self);
|
||||
return (get_attributes(self) & SLEEP_RETENTION_MODULE_ATTR_PASSIVE) ? true : false;
|
||||
}
|
||||
|
||||
@@ -184,7 +185,7 @@ typedef struct {
|
||||
#define SLEEP_RETENTION_REGDMA_LINK_NR_PRIORITIES (8u)
|
||||
#define SLEEP_RETENTION_REGDMA_LINK_HIGHEST_PRIORITY (0)
|
||||
#define SLEEP_RETENTION_REGDMA_LINK_LOWEST_PRIORITY (SLEEP_RETENTION_REGDMA_LINK_NR_PRIORITIES - 1)
|
||||
#define SLEEP_RETENTION_MODULE_INVALID ((sleep_retention_module_t)(-1)) /* the final node does not belong to any module */
|
||||
#define SLEEP_RETENTION_MODULE_INVALID ((sleep_retention_module_t)(SLEEP_RETENTION_MODULE_MAX)) /* the final node does not belong to any module */
|
||||
struct {
|
||||
sleep_retention_entries_t entries;
|
||||
uint32_t entries_bitmap: REGDMA_LINK_ENTRY_NUM;
|
||||
@@ -199,7 +200,7 @@ typedef struct {
|
||||
sleep_retention_module_bitmap_t inited_modules;
|
||||
sleep_retention_module_bitmap_t created_modules;
|
||||
|
||||
struct sleep_retention_module_object instance[SLEEP_RETENTION_MODULE_MAX + 1];
|
||||
struct sleep_retention_module_object *instance[SLEEP_RETENTION_MODULE_MAX];
|
||||
|
||||
#define EXTRA_LINK_NUM (REGDMA_LINK_ENTRY_NUM - 1)
|
||||
} sleep_retention_t;
|
||||
@@ -213,6 +214,33 @@ static DRAM_ATTR __attribute__((unused)) sleep_retention_t s_retention = {
|
||||
#define SLEEP_RETENTION_ENTRY_BITMAP_MASK (BIT(REGDMA_LINK_ENTRY_NUM) - 1)
|
||||
#define SLEEP_RETENTION_ENTRY_BITMAP(bitmap) ((bitmap) & SLEEP_RETENTION_ENTRY_BITMAP_MASK)
|
||||
|
||||
|
||||
static struct sleep_retention_module_object * instance(sleep_retention_module_t module)
|
||||
{
|
||||
return (module >= SLEEP_RETENTION_MODULE_MAX) ? NULL : s_retention.instance[module];
|
||||
}
|
||||
|
||||
static esp_err_t instance_allocate(sleep_retention_module_t module)
|
||||
{
|
||||
if (s_retention.instance[module] != NULL) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
struct sleep_retention_module_object *obj = (struct sleep_retention_module_object *)heap_caps_calloc(
|
||||
1, sizeof(struct sleep_retention_module_object), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
||||
if (obj == NULL) {
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
s_retention.instance[module] = obj;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static void instance_free(sleep_retention_module_t module)
|
||||
{
|
||||
heap_caps_free(s_retention.instance[module]);
|
||||
s_retention.instance[module] = NULL;
|
||||
}
|
||||
|
||||
|
||||
static esp_err_t sleep_retention_entries_create_impl(const sleep_retention_entries_config_t retent[], int num, regdma_link_priority_t priority, sleep_retention_module_t module);
|
||||
static void sleep_retention_entries_join(void);
|
||||
|
||||
@@ -325,7 +353,7 @@ static void sleep_retention_entries_stats(void)
|
||||
|
||||
void sleep_retention_dump_modules(FILE *out)
|
||||
{
|
||||
for (int i = SLEEP_RETENTION_MODULE_MIN; i <= SLEEP_RETENTION_MODULE_MAX; i++) {
|
||||
for (int i = SLEEP_RETENTION_MODULE_MIN; i < SLEEP_RETENTION_MODULE_MAX; i++) {
|
||||
bool inited = sleep_retention_is_module_inited(i);
|
||||
bool created = sleep_retention_is_module_created(i);
|
||||
bool is_top = is_top_domain_module(i);
|
||||
@@ -489,13 +517,17 @@ static void sleep_retention_entries_all_destroy_wrapper(sleep_retention_module_t
|
||||
priority++;
|
||||
}
|
||||
} while (priority < SLEEP_RETENTION_REGDMA_LINK_NR_PRIORITIES);
|
||||
s_retention.created_modules.bitmap[module >> 5] &= ~BIT(module % 32);
|
||||
/* INVALID (== MAX) is a non-module sentinel; skip bitmap updates. */
|
||||
if (module < SLEEP_RETENTION_MODULE_MAX) {
|
||||
s_retention.created_modules.bitmap[module >> 5] &= ~BIT(module % 32);
|
||||
}
|
||||
_lock_release_recursive(&s_retention.lock);
|
||||
}
|
||||
|
||||
static void sleep_retention_entries_do_destroy(sleep_retention_module_t module)
|
||||
{
|
||||
assert(SLEEP_RETENTION_MODULE_MIN <= module && module <= SLEEP_RETENTION_MODULE_MAX);
|
||||
/* Allow SLEEP_RETENTION_MODULE_INVALID for final-default rollback. */
|
||||
assert(SLEEP_RETENTION_MODULE_MIN <= module && module <= SLEEP_RETENTION_MODULE_INVALID);
|
||||
_lock_acquire_recursive(&s_retention.lock);
|
||||
sleep_retention_entries_join();
|
||||
sleep_retention_entries_stats();
|
||||
@@ -505,7 +537,7 @@ static void sleep_retention_entries_do_destroy(sleep_retention_module_t module)
|
||||
|
||||
static void sleep_retention_entries_destroy(sleep_retention_module_t module)
|
||||
{
|
||||
assert(SLEEP_RETENTION_MODULE_MIN <= module && module <= SLEEP_RETENTION_MODULE_MAX);
|
||||
assert(SLEEP_RETENTION_MODULE_MIN <= module && module < SLEEP_RETENTION_MODULE_MAX);
|
||||
_lock_acquire_recursive(&s_retention.lock);
|
||||
sleep_retention_entries_do_destroy(module);
|
||||
uint32_t created_modules = 0;
|
||||
@@ -636,7 +668,7 @@ esp_err_t sleep_retention_entries_create(const sleep_retention_entries_config_t
|
||||
if (priority >= SLEEP_RETENTION_REGDMA_LINK_NR_PRIORITIES) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
if (module < SLEEP_RETENTION_MODULE_MIN || module > SLEEP_RETENTION_MODULE_MAX) {
|
||||
if (module < SLEEP_RETENTION_MODULE_MIN || module >= SLEEP_RETENTION_MODULE_MAX) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
esp_err_t err = sleep_retention_entries_check_and_create_final_default();
|
||||
@@ -677,7 +709,7 @@ sleep_retention_module_bitmap_t IRAM_ATTR sleep_retention_get_created_modules(vo
|
||||
|
||||
bool sleep_retention_is_module_inited(sleep_retention_module_t module)
|
||||
{
|
||||
if (module < SLEEP_RETENTION_MODULE_MIN || module > SLEEP_RETENTION_MODULE_MAX) {
|
||||
if (module < SLEEP_RETENTION_MODULE_MIN || module >= SLEEP_RETENTION_MODULE_MAX) {
|
||||
return false;
|
||||
}
|
||||
_lock_acquire_recursive(&s_retention.lock);
|
||||
@@ -688,7 +720,7 @@ bool sleep_retention_is_module_inited(sleep_retention_module_t module)
|
||||
|
||||
bool sleep_retention_is_module_created(sleep_retention_module_t module)
|
||||
{
|
||||
if (module < SLEEP_RETENTION_MODULE_MIN || module > SLEEP_RETENTION_MODULE_MAX) {
|
||||
if (module < SLEEP_RETENTION_MODULE_MIN || module >= SLEEP_RETENTION_MODULE_MAX) {
|
||||
return false;
|
||||
}
|
||||
_lock_acquire_recursive(&s_retention.lock);
|
||||
@@ -733,7 +765,7 @@ bool IRAM_ATTR sleep_retention_module_bitmap_eq(sleep_retention_module_bitmap_t
|
||||
|
||||
esp_err_t sleep_retention_module_init(sleep_retention_module_t module, sleep_retention_module_init_param_t *param)
|
||||
{
|
||||
if (module < SLEEP_RETENTION_MODULE_MIN || module > SLEEP_RETENTION_MODULE_MAX) {
|
||||
if (module < SLEEP_RETENTION_MODULE_MIN || module >= SLEEP_RETENTION_MODULE_MAX) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
if (param == NULL || param->cbs.create.handle == NULL) {
|
||||
@@ -755,10 +787,14 @@ esp_err_t sleep_retention_module_init(sleep_retention_module_t module, sleep_ret
|
||||
if (module_is_created(module) || module_is_inited(module)) {
|
||||
err = ESP_ERR_INVALID_STATE;
|
||||
} else {
|
||||
sleep_retention_module_object_ctor(&s_retention.instance[module], ¶m->cbs);
|
||||
set_dependencies(&s_retention.instance[module], param->depends);
|
||||
set_attributes(&s_retention.instance[module], param->attribute);
|
||||
s_retention.inited_modules.bitmap[module >> 5] |= BIT(module % 32);
|
||||
err = instance_allocate(module);
|
||||
if (err == ESP_OK) {
|
||||
struct sleep_retention_module_object *mod = instance(module);
|
||||
sleep_retention_module_object_ctor(mod, ¶m->cbs);
|
||||
set_dependencies(mod, param->depends);
|
||||
set_attributes(mod, param->attribute);
|
||||
s_retention.inited_modules.bitmap[module >> 5] |= BIT(module % 32);
|
||||
}
|
||||
}
|
||||
_lock_release_recursive(&s_retention.lock);
|
||||
return err;
|
||||
@@ -766,7 +802,7 @@ esp_err_t sleep_retention_module_init(sleep_retention_module_t module, sleep_ret
|
||||
|
||||
esp_err_t sleep_retention_module_deinit(sleep_retention_module_t module)
|
||||
{
|
||||
if (module < SLEEP_RETENTION_MODULE_MIN || module > SLEEP_RETENTION_MODULE_MAX) {
|
||||
if (module < SLEEP_RETENTION_MODULE_MIN || module >= SLEEP_RETENTION_MODULE_MAX) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
@@ -776,9 +812,11 @@ esp_err_t sleep_retention_module_deinit(sleep_retention_module_t module)
|
||||
if (module_is_created(module) || !module_is_inited(module)) {
|
||||
err = ESP_ERR_INVALID_STATE;
|
||||
} else {
|
||||
clr_attributes(&s_retention.instance[module]);
|
||||
clr_dependencies(&s_retention.instance[module]);
|
||||
sleep_retention_module_object_dtor(&s_retention.instance[module]);
|
||||
struct sleep_retention_module_object *mod = instance(module);
|
||||
clr_attributes(mod);
|
||||
clr_dependencies(mod);
|
||||
sleep_retention_module_object_dtor(mod);
|
||||
instance_free(module);
|
||||
s_retention.inited_modules.bitmap[module >> 5] &= ~BIT(module % 32);
|
||||
uint32_t inited_modules = 0;
|
||||
for (int i = 0; i < SLEEP_RETENTION_MODULE_BITMAP_SZ; i++) {
|
||||
@@ -797,27 +835,30 @@ esp_err_t sleep_retention_module_deinit(sleep_retention_module_t module)
|
||||
|
||||
static esp_err_t sleep_retention_passive_module_allocate(sleep_retention_module_t module)
|
||||
{
|
||||
assert(module >= SLEEP_RETENTION_MODULE_MIN && module <= SLEEP_RETENTION_MODULE_MAX);
|
||||
assert(module >= SLEEP_RETENTION_MODULE_MIN && module < SLEEP_RETENTION_MODULE_MAX);
|
||||
|
||||
esp_err_t err = ESP_OK;
|
||||
_lock_acquire_recursive(&s_retention.lock);
|
||||
assert(module_is_passive(&s_retention.instance[module]) && "Illegal dependency");
|
||||
assert(module_is_inited(module) && "All passive module must be inited first!");
|
||||
struct sleep_retention_module_object *mod = instance(module);
|
||||
assert(module_is_passive(mod) && "Illegal dependency");
|
||||
if (!module_is_created(module)) {
|
||||
sleep_retention_module_bitmap_t depends = get_dependencies(&s_retention.instance[module]);
|
||||
sleep_retention_module_bitmap_t depends = get_dependencies(mod);
|
||||
for (int i = 0; ((err == ESP_OK) && (i < SLEEP_RETENTION_MODULE_BITMAP_SZ)); i++) {
|
||||
uint32_t bitmap = depends.bitmap[i];
|
||||
for (int j = 0; (err == ESP_OK) && bitmap; bitmap >>= 1, j++) {
|
||||
if (bitmap & BIT(0)) {
|
||||
set_reference(&s_retention.instance[(i << 5) + j], module);
|
||||
err = sleep_retention_passive_module_allocate((i << 5) + j);
|
||||
sleep_retention_module_t dep_module = (sleep_retention_module_t)((i << 5) + j);
|
||||
assert(module_is_inited(dep_module));
|
||||
set_reference(instance(dep_module), module);
|
||||
err = sleep_retention_passive_module_allocate(dep_module);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (err == ESP_OK) {
|
||||
sleep_retention_callback_t fn = s_retention.instance[module].cbs.create.handle;
|
||||
sleep_retention_callback_t fn = mod->cbs.create.handle;
|
||||
if (fn) {
|
||||
err = (*fn)(s_retention.instance[module].cbs.create.arg);
|
||||
err = (*fn)(mod->cbs.create.arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -827,37 +868,42 @@ static esp_err_t sleep_retention_passive_module_allocate(sleep_retention_module_
|
||||
|
||||
esp_err_t sleep_retention_module_allocate(sleep_retention_module_t module)
|
||||
{
|
||||
if (module < SLEEP_RETENTION_MODULE_MIN || module > SLEEP_RETENTION_MODULE_MAX) {
|
||||
if (module < SLEEP_RETENTION_MODULE_MIN || module >= SLEEP_RETENTION_MODULE_MAX) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
esp_err_t err = ESP_OK;
|
||||
_lock_acquire_recursive(&s_retention.lock);
|
||||
if (!module_is_passive(&s_retention.instance[module])) {
|
||||
if (module_is_inited(module) && !module_is_created(module)) {
|
||||
sleep_retention_module_bitmap_t depends = get_dependencies(&s_retention.instance[module]);
|
||||
if (!module_is_inited(module)) {
|
||||
err = ESP_ERR_INVALID_STATE;
|
||||
} else {
|
||||
struct sleep_retention_module_object *mod = instance(module);
|
||||
if (module_is_passive(mod)) {
|
||||
err = ESP_ERR_NOT_ALLOWED;
|
||||
} else if (!module_is_created(module)) {
|
||||
sleep_retention_module_bitmap_t depends = get_dependencies(mod);
|
||||
for (int i = 0; ((err == ESP_OK) && (i < SLEEP_RETENTION_MODULE_BITMAP_SZ)); i++) {
|
||||
uint32_t bitmap = depends.bitmap[i];
|
||||
for (int j = 0; (err == ESP_OK) && bitmap; bitmap >>= 1, j++) {
|
||||
if (bitmap & BIT(0)) {
|
||||
set_reference(&s_retention.instance[(i << 5) + j], module);
|
||||
if (module_is_passive(&s_retention.instance[(i << 5) + j])) { /* the callee ensures this module is inited */
|
||||
err = sleep_retention_passive_module_allocate((i << 5) + j);
|
||||
sleep_retention_module_t dep_module = (sleep_retention_module_t)((i << 5) + j);
|
||||
assert(module_is_inited(dep_module));
|
||||
set_reference(instance(dep_module), module);
|
||||
if (module_is_inited(dep_module) && module_is_passive(instance(dep_module))) {
|
||||
err = sleep_retention_passive_module_allocate(dep_module);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (err == ESP_OK) {
|
||||
sleep_retention_callback_t fn = s_retention.instance[module].cbs.create.handle;
|
||||
sleep_retention_callback_t fn = mod->cbs.create.handle;
|
||||
if (fn) {
|
||||
err = (*fn)(s_retention.instance[module].cbs.create.arg);
|
||||
err = (*fn)(mod->cbs.create.arg);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
err = ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
} else {
|
||||
err = ESP_ERR_NOT_ALLOWED;
|
||||
}
|
||||
_lock_release_recursive(&s_retention.lock);
|
||||
return err;
|
||||
@@ -865,23 +911,26 @@ esp_err_t sleep_retention_module_allocate(sleep_retention_module_t module)
|
||||
|
||||
static esp_err_t sleep_retention_passive_module_free(sleep_retention_module_t module)
|
||||
{
|
||||
assert(module >= SLEEP_RETENTION_MODULE_MIN && module <= SLEEP_RETENTION_MODULE_MAX);
|
||||
assert(module >= SLEEP_RETENTION_MODULE_MIN && module < SLEEP_RETENTION_MODULE_MAX);
|
||||
|
||||
esp_err_t err = ESP_OK;
|
||||
_lock_acquire_recursive(&s_retention.lock);
|
||||
assert(module_is_passive(&s_retention.instance[module]) && "Illegal dependency");
|
||||
assert(module_is_inited(module) && "All passive module must be inited first!");
|
||||
struct sleep_retention_module_object *mod = instance(module);
|
||||
assert(module_is_passive(mod) && "Illegal dependency");
|
||||
if (module_is_created(module)) {
|
||||
if (!references_exist(&s_retention.instance[module])) {
|
||||
if (!references_exist(mod)) {
|
||||
sleep_retention_entries_destroy(module);
|
||||
|
||||
sleep_retention_module_bitmap_t depends = get_dependencies(&s_retention.instance[module]);
|
||||
sleep_retention_module_bitmap_t depends = get_dependencies(mod);
|
||||
for (int i = 0; ((err == ESP_OK) && (i < SLEEP_RETENTION_MODULE_BITMAP_SZ)); i++) {
|
||||
uint32_t bitmap = depends.bitmap[i];
|
||||
for (int j = 0; (err == ESP_OK) && bitmap; bitmap >>= 1, j++) {
|
||||
if (bitmap & BIT(0)) {
|
||||
clr_reference(&s_retention.instance[(i << 5) + j], module);
|
||||
err = sleep_retention_passive_module_free((i << 5) + j);
|
||||
sleep_retention_module_t dep_module = (sleep_retention_module_t)((i << 5) + j);
|
||||
assert(module_is_inited(dep_module));
|
||||
clr_reference(instance(dep_module), module);
|
||||
err = sleep_retention_passive_module_free(dep_module);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -893,24 +942,31 @@ static esp_err_t sleep_retention_passive_module_free(sleep_retention_module_t mo
|
||||
|
||||
esp_err_t sleep_retention_module_free(sleep_retention_module_t module)
|
||||
{
|
||||
if (module < SLEEP_RETENTION_MODULE_MIN || module > SLEEP_RETENTION_MODULE_MAX) {
|
||||
if (module < SLEEP_RETENTION_MODULE_MIN || module >= SLEEP_RETENTION_MODULE_MAX) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
esp_err_t err = ESP_OK;
|
||||
_lock_acquire_recursive(&s_retention.lock);
|
||||
if (!module_is_passive(&s_retention.instance[module])) {
|
||||
if (module_is_inited(module) && module_is_created(module)) {
|
||||
if (!module_is_inited(module)) {
|
||||
err = ESP_ERR_INVALID_STATE;
|
||||
} else {
|
||||
struct sleep_retention_module_object *mod = instance(module);
|
||||
if (module_is_passive(mod)) {
|
||||
err = ESP_ERR_NOT_ALLOWED;
|
||||
} else if (module_is_created(module)) {
|
||||
sleep_retention_entries_destroy(module);
|
||||
|
||||
sleep_retention_module_bitmap_t depends = get_dependencies(&s_retention.instance[module]);
|
||||
sleep_retention_module_bitmap_t depends = get_dependencies(mod);
|
||||
for (int i = 0; ((err == ESP_OK) && (i < SLEEP_RETENTION_MODULE_BITMAP_SZ)); i++) {
|
||||
uint32_t bitmap = depends.bitmap[i];
|
||||
for (int j = 0; (err == ESP_OK) && bitmap; bitmap >>= 1, j++) {
|
||||
if (bitmap & BIT(0)) {
|
||||
clr_reference(&s_retention.instance[(i << 5) + j], module);
|
||||
if (module_is_passive(&s_retention.instance[(i << 5) + j])) {
|
||||
err = sleep_retention_passive_module_free((i << 5) + j);
|
||||
sleep_retention_module_t dep_module = (sleep_retention_module_t)((i << 5) + j);
|
||||
assert(module_is_inited(dep_module));
|
||||
clr_reference(instance(dep_module), module);
|
||||
if (module_is_inited(dep_module) && module_is_passive(instance(dep_module))) {
|
||||
err = sleep_retention_passive_module_free(dep_module);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -918,8 +974,6 @@ esp_err_t sleep_retention_module_free(sleep_retention_module_t module)
|
||||
} else {
|
||||
err = ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
} else {
|
||||
err = ESP_ERR_NOT_ALLOWED;
|
||||
}
|
||||
_lock_release_recursive(&s_retention.lock);
|
||||
return err;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "soc/soc.h"
|
||||
#include "soc/lp_aon_struct.h"
|
||||
#include "hal/misc.h"
|
||||
#include "esp_attr.h"
|
||||
#include "esp32c5/rom/rtc.h"
|
||||
|
||||
|
||||
@@ -75,7 +76,7 @@ static inline uint32_t lp_aon_ll_ext1_get_wakeup_pins(void)
|
||||
* Set the flag to inform
|
||||
* @param true: deepsleep false: lightsleep
|
||||
*/
|
||||
static inline void lp_aon_ll_inform_wakeup_type(bool dslp)
|
||||
FORCE_INLINE_ATTR void lp_aon_ll_inform_wakeup_type(bool dslp)
|
||||
{
|
||||
if (dslp) {
|
||||
REG_SET_BIT(RTC_SLEEP_MODE_REG, BIT(0)); /* Tell rom to run deep sleep wake stub */
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "soc/soc.h"
|
||||
#include "soc/lp_aon_struct.h"
|
||||
#include "hal/misc.h"
|
||||
#include "esp_attr.h"
|
||||
#include "esp32c6/rom/rtc.h"
|
||||
|
||||
|
||||
@@ -75,7 +76,7 @@ static inline uint32_t lp_aon_ll_ext1_get_wakeup_pins(void)
|
||||
* Set the flag to inform
|
||||
* @param true: deepsleep false: lightsleep
|
||||
*/
|
||||
static inline void lp_aon_ll_inform_wakeup_type(bool dslp)
|
||||
FORCE_INLINE_ATTR void lp_aon_ll_inform_wakeup_type(bool dslp)
|
||||
{
|
||||
if (dslp) {
|
||||
REG_SET_BIT(RTC_SLEEP_MODE_REG, BIT(0)); /* Tell rom to run deep sleep wake stub */
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "soc/soc.h"
|
||||
#include "soc/lp_aon_struct.h"
|
||||
#include "hal/misc.h"
|
||||
#include "esp_attr.h"
|
||||
#include "esp32c61/rom/rtc.h"
|
||||
|
||||
|
||||
@@ -75,7 +76,7 @@ static inline uint32_t lp_aon_ll_ext1_get_wakeup_pins(void)
|
||||
* Set the flag to inform
|
||||
* @param true: deepsleep false: lightsleep
|
||||
*/
|
||||
static inline void lp_aon_ll_inform_wakeup_type(bool dslp)
|
||||
FORCE_INLINE_ATTR void lp_aon_ll_inform_wakeup_type(bool dslp)
|
||||
{
|
||||
if (dslp) {
|
||||
REG_SET_BIT(RTC_SLEEP_MODE_REG, BIT(0)); /* Tell rom to run deep sleep wake stub */
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "soc/soc.h"
|
||||
#include "soc/lp_aon_struct.h"
|
||||
#include "hal/misc.h"
|
||||
#include "esp_attr.h"
|
||||
#include "esp32h2/rom/rtc.h"
|
||||
|
||||
|
||||
@@ -75,7 +76,7 @@ static inline uint32_t lp_aon_ll_ext1_get_wakeup_pins(void)
|
||||
* Set the flag to inform
|
||||
* @param true: deepsleep false: lightsleep
|
||||
*/
|
||||
static inline void lp_aon_ll_inform_wakeup_type(bool dslp)
|
||||
FORCE_INLINE_ATTR void lp_aon_ll_inform_wakeup_type(bool dslp)
|
||||
{
|
||||
if (dslp) {
|
||||
REG_SET_BIT(RTC_SLEEP_MODE_REG, BIT(0)); /* Tell rom to run deep sleep wake stub */
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "soc/soc.h"
|
||||
#include "soc/lp_aon_struct.h"
|
||||
#include "hal/misc.h"
|
||||
#include "esp_attr.h"
|
||||
#include "esp32h21/rom/rtc.h"
|
||||
|
||||
|
||||
@@ -75,7 +76,7 @@ static inline uint32_t lp_aon_ll_ext1_get_wakeup_pins(void)
|
||||
* Set the flag to inform
|
||||
* @param true: deepsleep false: lightsleep
|
||||
*/
|
||||
static inline void lp_aon_ll_inform_wakeup_type(bool dslp)
|
||||
FORCE_INLINE_ATTR void lp_aon_ll_inform_wakeup_type(bool dslp)
|
||||
{
|
||||
if (dslp) {
|
||||
REG_SET_BIT(RTC_SLEEP_MODE_REG, BIT(0)); /* Tell rom to run deep sleep wake stub */
|
||||
|
||||
@@ -1759,10 +1759,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_CLK_RC_FAST_SUPPORT_CALIBRATION
|
||||
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) \
|
||||
|
||||
@@ -676,8 +676,6 @@
|
||||
|
||||
#define SOC_PM_PMU_MIN_SLP_SLOW_CLK_CYCLE_FIXED (1)
|
||||
|
||||
#define SOC_PM_RETENTION_MODULE_NUM (40)
|
||||
|
||||
/*-------------------------- CLOCK SUBSYSTEM CAPS ----------------------------------------*/
|
||||
#define SOC_CLK_RC_FAST_SUPPORT_CALIBRATION (1)
|
||||
#define SOC_MODEM_CLOCK_IS_INDEPENDENT (1)
|
||||
|
||||
@@ -1519,10 +1519,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_CLK_RC_FAST_SUPPORT_CALIBRATION
|
||||
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) \
|
||||
|
||||
@@ -591,8 +591,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)
|
||||
|
||||
/*-------------------------- CLOCK SUBSYSTEM CAPS ----------------------------------------*/
|
||||
#define SOC_CLK_RC_FAST_SUPPORT_CALIBRATION (1)
|
||||
#define SOC_MODEM_CLOCK_IS_INDEPENDENT (1)
|
||||
|
||||
@@ -1239,10 +1239,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_CLK_RC_FAST_SUPPORT_CALIBRATION
|
||||
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) \
|
||||
|
||||
@@ -495,8 +495,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)
|
||||
|
||||
/*-------------------------- CLOCK SUBSYSTEM CAPS ----------------------------------------*/
|
||||
#define SOC_CLK_RC_FAST_SUPPORT_CALIBRATION (1)
|
||||
#define SOC_MODEM_CLOCK_IS_INDEPENDENT (1)
|
||||
|
||||
@@ -1467,10 +1467,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) \
|
||||
|
||||
@@ -587,8 +587,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)
|
||||
|
||||
@@ -855,10 +855,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) \
|
||||
|
||||
@@ -536,7 +536,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)
|
||||
|
||||
@@ -2183,10 +2183,6 @@ config SOC_SLEEP_TGWDT_STOP_WORKAROUND
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_PM_RETENTION_MODULE_NUM
|
||||
int
|
||||
default 64
|
||||
|
||||
config SOC_PSRAM_VDD_POWER_MPLL
|
||||
bool
|
||||
default y
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "soc_caps.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -65,7 +64,7 @@ typedef enum periph_retention_module {
|
||||
SLEEP_RETENTION_MODULE_DMA2D = 41,
|
||||
SLEEP_RETENTION_MODULE_PPA = 42,
|
||||
|
||||
SLEEP_RETENTION_MODULE_MAX = SOC_PM_RETENTION_MODULE_NUM - 1
|
||||
SLEEP_RETENTION_MODULE_MAX,
|
||||
} periph_retention_module_t;
|
||||
|
||||
#define is_top_domain_module(m) \
|
||||
|
||||
@@ -801,8 +801,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)
|
||||
|
||||
/*-------------------------- PSRAM CAPS ----------------------------*/
|
||||
#define SOC_PSRAM_VDD_POWER_MPLL (1)
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -181,15 +183,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;
|
||||
|
||||
Reference in New Issue
Block a user