From 1854036f92faeba354572834f7f3af81bb18391a Mon Sep 17 00:00:00 2001 From: wuzhenghui Date: Wed, 22 May 2024 12:01:16 +0800 Subject: [PATCH] change(esp_hw_support): use union retention link priority definiation --- components/driver/i2c/i2c.c | 2 +- components/esp_driver_i2c/i2c_common.c | 2 +- components/esp_hw_support/sleep_system_peripheral.c | 4 ++-- components/esp_system/int_wdt.c | 2 +- .../esp_system/task_wdt/task_wdt_impl_timergroup.c | 2 +- components/soc/include/soc/regdma.h | 9 ++++++--- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/components/driver/i2c/i2c.c b/components/driver/i2c/i2c.c index 591177dda8..eb315a4ec4 100644 --- a/components/driver/i2c/i2c.c +++ b/components/driver/i2c/i2c.c @@ -280,7 +280,7 @@ static void i2c_hw_enable(i2c_port_t i2c_num) static esp_err_t i2c_sleep_retention_init(void *arg) { i2c_port_t i2c_num = *(i2c_port_t *)arg; - esp_err_t ret = sleep_retention_entries_create(i2c_regs_retention[i2c_num].link_list, i2c_regs_retention[i2c_num].link_num, REGDMA_LINK_PRI_7, I2C_SLEEP_RETENTION_MODULE(i2c_num)); + esp_err_t ret = sleep_retention_entries_create(i2c_regs_retention[i2c_num].link_list, i2c_regs_retention[i2c_num].link_num, REGDMA_LINK_PRI_I2C, I2C_SLEEP_RETENTION_MODULE(i2c_num)); ESP_RETURN_ON_ERROR(ret, I2C_TAG, "failed to allocate mem for sleep retention"); return ret; } diff --git a/components/esp_driver_i2c/i2c_common.c b/components/esp_driver_i2c/i2c_common.c index f0daf1a3b8..8c3f86952e 100644 --- a/components/esp_driver_i2c/i2c_common.c +++ b/components/esp_driver_i2c/i2c_common.c @@ -52,7 +52,7 @@ static esp_err_t s_i2c_sleep_retention_init(void *arg) { i2c_bus_t *bus = (i2c_bus_t *)arg; i2c_port_num_t port_num = bus->port_num; - esp_err_t ret = sleep_retention_entries_create(i2c_regs_retention[port_num].link_list, i2c_regs_retention[port_num].link_num, REGDMA_LINK_PRI_7, I2C_SLEEP_RETENTION_MODULE(port_num)); + esp_err_t ret = sleep_retention_entries_create(i2c_regs_retention[port_num].link_list, i2c_regs_retention[port_num].link_num, REGDMA_LINK_PRI_I2C, I2C_SLEEP_RETENTION_MODULE(port_num)); ESP_RETURN_ON_ERROR(ret, TAG, "failed to allocate mem for sleep retention"); return ret; } diff --git a/components/esp_hw_support/sleep_system_peripheral.c b/components/esp_hw_support/sleep_system_peripheral.c index 531f3dd670..cd36fe7f52 100644 --- a/components/esp_hw_support/sleep_system_peripheral.c +++ b/components/esp_hw_support/sleep_system_peripheral.c @@ -84,7 +84,7 @@ static __attribute__((unused)) esp_err_t sleep_sys_periph_systimer_retention_ini #if SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE esp_err_t sleep_sys_periph_l2_cache_retention_init(void) { - esp_err_t err = sleep_retention_entries_create(l2_cache_regs_retention, ARRAY_SIZE(l2_cache_regs_retention), REGDMA_LINK_PRI_5, SLEEP_RETENTION_MODULE_SYS_PERIPH); + esp_err_t err = sleep_retention_entries_create(l2_cache_regs_retention, ARRAY_SIZE(l2_cache_regs_retention), REGDMA_LINK_PRI_SYS_PERIPH_HIGH, SLEEP_RETENTION_MODULE_SYS_PERIPH); ESP_RETURN_ON_ERROR(err, TAG, "failed to allocate memory for digital peripherals (L2 Cache) retention"); ESP_LOGI(TAG, "L2 Cache sleep retention initialization"); return ESP_OK; @@ -94,7 +94,7 @@ esp_err_t sleep_sys_periph_l2_cache_retention_init(void) #if SOC_PAU_IN_TOP_DOMAIN esp_err_t sleep_pau_retention_init(void) { - esp_err_t err = sleep_retention_entries_create(pau_regs_retention, ARRAY_SIZE(pau_regs_retention), REGDMA_LINK_PRI_7, SLEEP_RETENTION_MODULE_SYS_PERIPH); + esp_err_t err = sleep_retention_entries_create(pau_regs_retention, ARRAY_SIZE(pau_regs_retention), REGDMA_LINK_PRI_SYS_PERIPH_LOW, SLEEP_RETENTION_MODULE_SYS_PERIPH); ESP_RETURN_ON_ERROR(err, TAG, "failed to allocate memory for system (PAU) retention"); ESP_LOGI(TAG, "PAU sleep retention initialization"); return ESP_OK; diff --git a/components/esp_system/int_wdt.c b/components/esp_system/int_wdt.c index 68d031d533..9a8db626f3 100644 --- a/components/esp_system/int_wdt.c +++ b/components/esp_system/int_wdt.c @@ -59,7 +59,7 @@ static esp_err_t sleep_int_wdt_retention_init(void *arg) uint32_t group_id = *(uint32_t *)arg; esp_err_t err = sleep_retention_entries_create(tg_wdt_regs_retention[group_id].link_list, tg_wdt_regs_retention[group_id].link_num, - REGDMA_LINK_PRI_6, + REGDMA_LINK_PRI_SYS_PERIPH_LOW, (group_id == 0) ? SLEEP_RETENTION_MODULE_TG0_WDT : SLEEP_RETENTION_MODULE_TG1_WDT); if (err == ESP_OK) { ESP_LOGD(TAG, "Interrupt watchdog timer retention initialization"); diff --git a/components/esp_system/task_wdt/task_wdt_impl_timergroup.c b/components/esp_system/task_wdt/task_wdt_impl_timergroup.c index 533a4f2461..8b8ed63180 100644 --- a/components/esp_system/task_wdt/task_wdt_impl_timergroup.c +++ b/components/esp_system/task_wdt/task_wdt_impl_timergroup.c @@ -52,7 +52,7 @@ static esp_err_t sleep_task_wdt_retention_init(void *arg) uint32_t group_id = *(uint32_t *)arg; esp_err_t err = sleep_retention_entries_create(tg_wdt_regs_retention[group_id].link_list, tg_wdt_regs_retention[group_id].link_num, - REGDMA_LINK_PRI_6, + REGDMA_LINK_PRI_SYS_PERIPH_LOW, (group_id == 0) ? SLEEP_RETENTION_MODULE_TG0_WDT : SLEEP_RETENTION_MODULE_TG1_WDT); if (err == ESP_OK) { ESP_LOGD(TAG, "Task watchdog timer retention initialization"); diff --git a/components/soc/include/soc/regdma.h b/components/soc/include/soc/regdma.h index 2243d1113a..b6fd9ff00e 100644 --- a/components/soc/include/soc/regdma.h +++ b/components/soc/include/soc/regdma.h @@ -60,9 +60,12 @@ extern "C" { #define REGDMA_LINK_PRI_BT_MAC_BB REGDMA_LINK_PRI_5 #define REGDMA_LINK_PRI_SYS_PERIPH_HIGH REGDMA_LINK_PRI_5 // INT_MTX & HP_SYSTEM & Console UART #define REGDMA_LINK_PRI_SYS_PERIPH_LOW REGDMA_LINK_PRI_6 // TG0 & IO MUX & SPI MEM & Systimer -#define REGDMA_LINK_PRI_IEEE802154 REGDMA_LINK_PRI_7 -#define REGDMA_LINK_PRI_GDMA REGDMA_LINK_PRI_7 -#define REGDMA_LINK_PRI_RMT REGDMA_LINK_PRI_7 +#define REGDMA_LINK_PRI_GENERAL_PERIPH REGDMA_LINK_PRI_7 // Low retenion priority for general peripherals +#define REGDMA_LINK_PRI_IEEE802154 REGDMA_LINK_PRI_GENERAL_PERIPH +#define REGDMA_LINK_PRI_GDMA REGDMA_LINK_PRI_GENERAL_PERIPH +#define REGDMA_LINK_PRI_RMT REGDMA_LINK_PRI_GENERAL_PERIPH +#define REGDMA_LINK_PRI_GPTIMER REGDMA_LINK_PRI_GENERAL_PERIPH +#define REGDMA_LINK_PRI_I2C REGDMA_LINK_PRI_GENERAL_PERIPH typedef enum { REGDMA_LINK_PRI_0 = 0,