change(esp_hw_support): update some modules sleep retention init dependency bitmap

This commit is contained in:
Li Shuai 2024-09-19 12:55:48 +08:00
parent 00a6f825b0
commit bde6b9141f
22 changed files with 50 additions and 50 deletions

View File

@ -385,7 +385,7 @@ static esp_err_t sleep_modem_ble_mac_modem_state_init(uint8_t extra)
int retention_args = extra; int retention_args = extra;
sleep_retention_module_init_param_t init_param = { sleep_retention_module_init_param_t init_param = {
.cbs = { .create = { .handle = sleep_modem_ble_mac_retention_init, .arg = &retention_args } }, .cbs = { .create = { .handle = sleep_modem_ble_mac_retention_init, .arg = &retention_args } },
.depends = BIT(SLEEP_RETENTION_MODULE_BT_BB) .depends = RETENTION_MODULE_BITMAP_INIT(BT_BB)
}; };
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_BLE_MAC, &init_param); esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_BLE_MAC, &init_param);
if (err == ESP_OK) { if (err == ESP_OK) {

View File

@ -593,7 +593,7 @@ static esp_err_t sleep_modem_ble_mac_modem_state_init(uint8_t extra)
int retention_args = extra; int retention_args = extra;
sleep_retention_module_init_param_t init_param = { sleep_retention_module_init_param_t init_param = {
.cbs = { .create = { .handle = sleep_modem_ble_mac_retention_init, .arg = &retention_args } }, .cbs = { .create = { .handle = sleep_modem_ble_mac_retention_init, .arg = &retention_args } },
.depends = BIT(SLEEP_RETENTION_MODULE_BT_BB) .depends = RETENTION_MODULE_BITMAP_INIT(BT_BB)
}; };
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_BLE_MAC, &init_param); esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_BLE_MAC, &init_param);
if (err == ESP_OK) { if (err == ESP_OK) {

View File

@ -585,7 +585,7 @@ static esp_err_t sleep_modem_ble_mac_modem_state_init(uint8_t extra)
int retention_args = extra; int retention_args = extra;
sleep_retention_module_init_param_t init_param = { sleep_retention_module_init_param_t init_param = {
.cbs = { .create = { .handle = sleep_modem_ble_mac_retention_init, .arg = &retention_args } }, .cbs = { .create = { .handle = sleep_modem_ble_mac_retention_init, .arg = &retention_args } },
.depends = BIT(SLEEP_RETENTION_MODULE_BT_BB) .depends = RETENTION_MODULE_BITMAP_INIT(BT_BB)
}; };
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_BLE_MAC, &init_param); esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_BLE_MAC, &init_param);
if (err == ESP_OK) { if (err == ESP_OK) {

View File

@ -347,11 +347,11 @@ static void twai_free_driver_obj(twai_obj_t *p_obj)
#if TWAI_USE_RETENTION_LINK #if TWAI_USE_RETENTION_LINK
const periph_retention_module_t retention_id = twai_reg_retention_info[p_obj->controller_id].module_id; const periph_retention_module_t retention_id = twai_reg_retention_info[p_obj->controller_id].module_id;
if (sleep_retention_get_created_modules() & BIT(retention_id)) { if (sleep_retention_is_module_created(retention_id)) {
assert(sleep_retention_get_inited_modules() & BIT(retention_id)); assert(sleep_retention_is_module_inited(retention_id));
sleep_retention_module_free(retention_id); sleep_retention_module_free(retention_id);
} }
if (sleep_retention_get_inited_modules() & BIT(retention_id)) { if (sleep_retention_is_module_inited(retention_id)) {
sleep_retention_module_deinit(retention_id); sleep_retention_module_deinit(retention_id);
} }
@ -419,7 +419,7 @@ static esp_err_t twai_alloc_driver_obj(const twai_general_config_t *g_config, tw
.arg = p_obj, .arg = p_obj,
}, },
}, },
.depends = BIT(SLEEP_RETENTION_MODULE_CLOCK_SYSTEM) .depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
}; };
if (sleep_retention_module_init(module, &init_param) != ESP_OK) { if (sleep_retention_module_init(module, &init_param) != ESP_OK) {
ESP_LOGW(TWAI_TAG, "init sleep retention failed for TWAI%d, power domain may be turned off during sleep", controller_id); ESP_LOGW(TWAI_TAG, "init sleep retention failed for TWAI%d, power domain may be turned off during sleep", controller_id);

View File

@ -38,7 +38,7 @@ void gptimer_create_retention_module(gptimer_group_t *group)
int group_id = group->group_id; int group_id = group->group_id;
sleep_retention_module_t module = tg_timer_reg_retention_info[group_id].module; sleep_retention_module_t module = tg_timer_reg_retention_info[group_id].module;
_lock_acquire(&s_platform.mutex); _lock_acquire(&s_platform.mutex);
if ((sleep_retention_get_inited_modules() & BIT(module)) && !(sleep_retention_get_created_modules() & BIT(module))) { if (sleep_retention_is_module_inited(module) && !sleep_retention_is_module_created(module)) {
if (sleep_retention_module_allocate(module) != ESP_OK) { if (sleep_retention_module_allocate(module) != ESP_OK) {
// even though the sleep retention module create failed, GPTimer driver should still work, so just warning here // even though the sleep retention module create failed, GPTimer driver should still work, so just warning here
ESP_LOGW(TAG, "create retention link failed %d, power domain won't be turned off during sleep", group_id); ESP_LOGW(TAG, "create retention link failed %d, power domain won't be turned off during sleep", group_id);
@ -92,7 +92,7 @@ gptimer_group_t *gptimer_acquire_group_handle(int group_id)
.arg = group .arg = group
}, },
}, },
.depends = BIT(SLEEP_RETENTION_MODULE_CLOCK_SYSTEM) .depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
}; };
if (sleep_retention_module_init(module, &init_param) != ESP_OK) { if (sleep_retention_module_init(module, &init_param) != ESP_OK) {
// even though the sleep retention module init failed, RMT driver should still work, so just warning here // even though the sleep retention module init failed, RMT driver should still work, so just warning here
@ -128,10 +128,10 @@ void gptimer_release_group_handle(gptimer_group_t *group)
} }
#if GPTIMER_USE_RETENTION_LINK #if GPTIMER_USE_RETENTION_LINK
sleep_retention_module_t module = tg_timer_reg_retention_info[group_id].module; sleep_retention_module_t module = tg_timer_reg_retention_info[group_id].module;
if (sleep_retention_get_created_modules() & BIT(module)) { if (sleep_retention_is_module_created(module)) {
sleep_retention_module_free(module); sleep_retention_module_free(module);
} }
if (sleep_retention_get_inited_modules() & BIT(module)) { if (sleep_retention_is_module_inited(module)) {
sleep_retention_module_deinit(module); sleep_retention_module_deinit(module);
} }
#endif #endif

View File

@ -268,7 +268,7 @@ static i2s_controller_t *i2s_acquire_controller_obj(int id)
.arg = i2s_obj, .arg = i2s_obj,
}, },
}, },
.depends = BIT(SLEEP_RETENTION_MODULE_CLOCK_SYSTEM) .depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
}; };
if (sleep_retention_module_init(module, &init_param) == ESP_OK) { if (sleep_retention_module_init(module, &init_param) == ESP_OK) {
i2s_obj->slp_retention_mod = module; i2s_obj->slp_retention_mod = module;

View File

@ -434,7 +434,7 @@ static bool ledc_speed_mode_ctx_create(ledc_mode_t speed_mode)
.arg = NULL, .arg = NULL,
}, },
}, },
.depends = BIT(SLEEP_RETENTION_MODULE_CLOCK_SYSTEM), .depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
}; };
if (sleep_retention_module_init(module, &init_param) != ESP_OK) { if (sleep_retention_module_init(module, &init_param) != ESP_OK) {
ESP_LOGW(LEDC_TAG, "init sleep retention failed for ledc, power domain may be turned off during sleep"); ESP_LOGW(LEDC_TAG, "init sleep retention failed for ledc, power domain may be turned off during sleep");

View File

@ -73,7 +73,7 @@ mcpwm_group_t *mcpwm_acquire_group_handle(int group_id)
.arg = group, .arg = group,
}, },
}, },
.depends = SLEEP_RETENTION_MODULE_BM_CLOCK_SYSTEM .depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
}; };
// we only do retention init here. Allocate retention module in the unit initialization // we only do retention init here. Allocate retention module in the unit initialization
if (sleep_retention_module_init(module, &init_param) != ESP_OK) { if (sleep_retention_module_init(module, &init_param) != ESP_OK) {
@ -140,10 +140,10 @@ void mcpwm_release_group_handle(mcpwm_group_t *group)
} }
#if MCPWM_USE_RETENTION_LINK #if MCPWM_USE_RETENTION_LINK
const periph_retention_module_t module_id = mcpwm_reg_retention_info[group_id].retention_module; const periph_retention_module_t module_id = mcpwm_reg_retention_info[group_id].retention_module;
if (sleep_retention_get_created_modules() & BIT(module_id)) { if (sleep_retention_is_module_created(module_id)) {
sleep_retention_module_free(module_id); sleep_retention_module_free(module_id);
} }
if (sleep_retention_get_inited_modules() & BIT(module_id)) { if (sleep_retention_is_module_inited(module_id)) {
sleep_retention_module_deinit(module_id); sleep_retention_module_deinit(module_id);
} }
#endif // MCPWM_USE_RETENTION_LINK #endif // MCPWM_USE_RETENTION_LINK
@ -305,7 +305,7 @@ void mcpwm_create_retention_module(mcpwm_group_t *group)
int group_id = group->group_id; int group_id = group->group_id;
sleep_retention_module_t module_id = mcpwm_reg_retention_info[group_id].retention_module; sleep_retention_module_t module_id = mcpwm_reg_retention_info[group_id].retention_module;
_lock_acquire(&s_platform.mutex); _lock_acquire(&s_platform.mutex);
if ((sleep_retention_get_inited_modules() & BIT(module_id)) && !(sleep_retention_get_created_modules() & BIT(module_id))) { if (sleep_retention_is_module_inited(module_id) && !sleep_retention_is_module_created(module_id)) {
if (sleep_retention_module_allocate(module_id) != ESP_OK) { if (sleep_retention_module_allocate(module_id) != ESP_OK) {
// even though the sleep retention module create failed, MCPWM driver should still work, so just warning here // even though the sleep retention module create failed, MCPWM driver should still work, so just warning here
ESP_LOGW(TAG, "create retention module failed, power domain can't turn off"); ESP_LOGW(TAG, "create retention module failed, power domain can't turn off");

View File

@ -56,7 +56,7 @@ parlio_group_t *parlio_acquire_group_handle(int group_id)
.arg = group, .arg = group,
}, },
}, },
.depends = SLEEP_RETENTION_MODULE_BM_CLOCK_SYSTEM .depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
}; };
// we only do retention init here. Allocate retention module in the unit initialization // we only do retention init here. Allocate retention module in the unit initialization
if (sleep_retention_module_init(module_id, &init_param) != ESP_OK) { if (sleep_retention_module_init(module_id, &init_param) != ESP_OK) {
@ -107,11 +107,11 @@ void parlio_release_group_handle(parlio_group_t *group)
if (do_deinitialize) { if (do_deinitialize) {
#if PARLIO_USE_RETENTION_LINK #if PARLIO_USE_RETENTION_LINK
const periph_retention_module_t module_id = parlio_reg_retention_info[group_id].retention_module; const periph_retention_module_t module_id = parlio_reg_retention_info[group_id].retention_module;
if (sleep_retention_get_created_modules() & BIT(module_id)) { if (sleep_retention_is_module_created(module_id)) {
assert(sleep_retention_get_inited_modules() & BIT(module_id)); assert(sleep_retention_is_module_inited(module_id));
sleep_retention_module_free(module_id); sleep_retention_module_free(module_id);
} }
if (sleep_retention_get_inited_modules() & BIT(module_id)) { if (sleep_retention_is_module_inited(module_id)) {
sleep_retention_module_deinit(module_id); sleep_retention_module_deinit(module_id);
} }
#endif // PARLIO_USE_RETENTION_LINK #endif // PARLIO_USE_RETENTION_LINK
@ -195,7 +195,7 @@ void parlio_create_retention_module(parlio_group_t *group)
sleep_retention_module_t module_id = parlio_reg_retention_info[group_id].retention_module; sleep_retention_module_t module_id = parlio_reg_retention_info[group_id].retention_module;
_lock_acquire(&s_platform.mutex); _lock_acquire(&s_platform.mutex);
if ((sleep_retention_get_inited_modules() & BIT(module_id)) && !(sleep_retention_get_created_modules() & BIT(module_id))) { if (sleep_retention_is_module_inited(module_id) && !sleep_retention_is_module_created(module_id)) {
if (sleep_retention_module_allocate(module_id) != ESP_OK) { if (sleep_retention_module_allocate(module_id) != ESP_OK) {
// even though the sleep retention module create failed, PARLIO driver should still work, so just warning here // even though the sleep retention module create failed, PARLIO driver should still work, so just warning here
ESP_LOGW(TAG, "create retention module failed, power domain can't turn off"); ESP_LOGW(TAG, "create retention module failed, power domain can't turn off");

View File

@ -881,7 +881,7 @@ static pcnt_group_t *pcnt_acquire_group_handle(int group_id)
.arg = group, .arg = group,
}, },
}, },
.depends = SLEEP_RETENTION_MODULE_BM_CLOCK_SYSTEM .depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
}; };
// we only do retention init here. Allocate retention module in the unit initialization // we only do retention init here. Allocate retention module in the unit initialization
if (sleep_retention_module_init(module_id, &init_param) != ESP_OK) { if (sleep_retention_module_init(module_id, &init_param) != ESP_OK) {
@ -928,7 +928,7 @@ static void pcnt_release_group_handle(pcnt_group_t *group)
if (do_deinitialize) { if (do_deinitialize) {
#if PCNT_USE_RETENTION_LINK #if PCNT_USE_RETENTION_LINK
const periph_retention_module_t module_id = pcnt_reg_retention_info[group_id].retention_module; const periph_retention_module_t module_id = pcnt_reg_retention_info[group_id].retention_module;
if (sleep_retention_get_inited_modules() & BIT(module_id)) { if (sleep_retention_is_module_inited(module_id)) {
sleep_retention_module_deinit(module_id); sleep_retention_module_deinit(module_id);
} }
#endif // PCNT_USE_RETENTION_LINK #endif // PCNT_USE_RETENTION_LINK

View File

@ -83,7 +83,7 @@ rmt_group_t *rmt_acquire_group_handle(int group_id)
.arg = group, .arg = group,
}, },
}, },
.depends = BIT(SLEEP_RETENTION_MODULE_CLOCK_SYSTEM) .depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
}; };
if (sleep_retention_module_init(module, &init_param) != ESP_OK) { if (sleep_retention_module_init(module, &init_param) != ESP_OK) {
// even though the sleep retention module init failed, RMT driver should still work, so just warning here // even though the sleep retention module init failed, RMT driver should still work, so just warning here
@ -146,10 +146,10 @@ void rmt_release_group_handle(rmt_group_t *group)
if (do_deinitialize) { if (do_deinitialize) {
#if RMT_USE_RETENTION_LINK #if RMT_USE_RETENTION_LINK
sleep_retention_module_t module = rmt_reg_retention_info[group_id].module; sleep_retention_module_t module = rmt_reg_retention_info[group_id].module;
if (sleep_retention_get_created_modules() & BIT(module)) { if (sleep_retention_is_module_created(module)) {
sleep_retention_module_free(module); sleep_retention_module_free(module);
} }
if (sleep_retention_get_inited_modules() & BIT(module)) { if (sleep_retention_is_module_inited(module)) {
sleep_retention_module_deinit(module); sleep_retention_module_deinit(module);
} }
#endif #endif
@ -313,7 +313,7 @@ void rmt_create_retention_module(rmt_group_t *group)
int group_id = group->group_id; int group_id = group->group_id;
sleep_retention_module_t module = rmt_reg_retention_info[group_id].module; sleep_retention_module_t module = rmt_reg_retention_info[group_id].module;
_lock_acquire(&s_platform.mutex); _lock_acquire(&s_platform.mutex);
if ((sleep_retention_get_inited_modules() & BIT(module)) && !(sleep_retention_get_created_modules() & BIT(module))) { if (sleep_retention_is_module_inited(module) && !sleep_retention_is_module_created(module)) {
if (sleep_retention_module_allocate(module) != ESP_OK) { if (sleep_retention_module_allocate(module) != ESP_OK) {
// even though the sleep retention module create failed, RMT driver should still work, so just warning here // even though the sleep retention module create failed, RMT driver should still work, so just warning here
ESP_LOGW(TAG, "create retention link failed, power domain won't be turned off during sleep"); ESP_LOGW(TAG, "create retention link failed, power domain won't be turned off during sleep");

View File

@ -867,7 +867,7 @@ esp_err_t spi_bus_initialize(spi_host_device_t host_id, const spi_bus_config_t *
.arg = ctx, .arg = ctx,
}, },
}, },
.depends = BIT(SLEEP_RETENTION_MODULE_CLOCK_SYSTEM), .depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
}; };
_lock_acquire(&ctx->mutex); _lock_acquire(&ctx->mutex);
@ -971,11 +971,11 @@ esp_err_t spi_bus_free(spi_host_device_t host_id)
#if SOC_SPI_SUPPORT_SLEEP_RETENTION && CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP #if SOC_SPI_SUPPORT_SLEEP_RETENTION && CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
const periph_retention_module_t retention_id = spi_reg_retention_info[host_id - 1].module_id; const periph_retention_module_t retention_id = spi_reg_retention_info[host_id - 1].module_id;
_lock_acquire(&ctx->mutex); _lock_acquire(&ctx->mutex);
if (sleep_retention_get_created_modules() & BIT(retention_id)) { if (sleep_retention_is_module_created(retention_id)) {
assert(sleep_retention_get_inited_modules() & BIT(retention_id)); assert(sleep_retention_is_module_inited(retention_id));
sleep_retention_module_free(retention_id); sleep_retention_module_free(retention_id);
} }
if (sleep_retention_get_inited_modules() & BIT(retention_id)) { if (sleep_retention_is_module_inited(retention_id)) {
sleep_retention_module_deinit(retention_id); sleep_retention_module_deinit(retention_id);
} }
_lock_release(&ctx->mutex); _lock_release(&ctx->mutex);

View File

@ -108,7 +108,7 @@ static esp_err_t s_temperature_sensor_sleep_retention_init(void *arg)
void temperature_sensor_create_retention_module(temperature_sensor_handle_t tsens) void temperature_sensor_create_retention_module(temperature_sensor_handle_t tsens)
{ {
sleep_retention_module_t module_id = temperature_sensor_regs_retention.module_id; sleep_retention_module_t module_id = temperature_sensor_regs_retention.module_id;
if ((sleep_retention_get_inited_modules() & BIT(module_id)) && !(sleep_retention_get_created_modules() & BIT(module_id))) { if (sleep_retention_is_module_inited(module_id) && !sleep_retention_is_module_created(module_id)) {
if (sleep_retention_module_allocate(module_id) != ESP_OK) { if (sleep_retention_module_allocate(module_id) != ESP_OK) {
// even though the sleep retention module_id create failed, temperature sensor driver should still work, so just warning here // even though the sleep retention module_id create failed, temperature sensor driver should still work, so just warning here
ESP_LOGW(TAG, "create retention link failed, power domain won't be turned off during sleep"); ESP_LOGW(TAG, "create retention link failed, power domain won't be turned off during sleep");
@ -196,10 +196,10 @@ esp_err_t temperature_sensor_uninstall(temperature_sensor_handle_t tsens)
#if TEMPERATURE_SENSOR_USE_RETENTION_LINK #if TEMPERATURE_SENSOR_USE_RETENTION_LINK
sleep_retention_module_t module_id = temperature_sensor_regs_retention.module_id; sleep_retention_module_t module_id = temperature_sensor_regs_retention.module_id;
if (sleep_retention_get_created_modules() & BIT(module_id)) { if (sleep_retention_is_module_created(module_id)) {
sleep_retention_module_free(temperature_sensor_regs_retention.module_id); sleep_retention_module_free(temperature_sensor_regs_retention.module_id);
} }
if (sleep_retention_get_inited_modules() & BIT(module_id)) { if (sleep_retention_is_module_inited(module_id)) {
sleep_retention_module_deinit(temperature_sensor_regs_retention.module_id); sleep_retention_module_deinit(temperature_sensor_regs_retention.module_id);
} }
#endif // TEMPERATURE_SENSOR_USE_RETENTION_LINK #endif // TEMPERATURE_SENSOR_USE_RETENTION_LINK

View File

@ -229,7 +229,7 @@ static void uart_module_enable(uart_port_t uart_num)
.arg = &uart_context[uart_num], .arg = &uart_context[uart_num],
}, },
}, },
.depends = BIT(SLEEP_RETENTION_MODULE_CLOCK_SYSTEM), .depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
}; };
if (sleep_retention_module_init(module, &init_param) == ESP_OK) { if (sleep_retention_module_init(module, &init_param) == ESP_OK) {
uart_context[uart_num].retention_link_inited = true; uart_context[uart_num].retention_link_inited = true;

View File

@ -49,7 +49,7 @@ esp_err_t gdma_sleep_retention_init(int group_id, int pair_id)
gdma_channel_retention_arg_t arg = { .group_id = group_id, .pair_id = pair_id }; gdma_channel_retention_arg_t arg = { .group_id = group_id, .pair_id = pair_id };
sleep_retention_module_init_param_t init_param = { sleep_retention_module_init_param_t init_param = {
.cbs = { .create = { .handle = sleep_gdma_channel_retention_init, .arg = &arg } }, .cbs = { .create = { .handle = sleep_gdma_channel_retention_init, .arg = &arg } },
.depends = BIT(SLEEP_RETENTION_MODULE_CLOCK_SYSTEM) .depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
}; };
sleep_retention_module_t module = gdma_chx_regs_retention[group_id][pair_id].module_id; sleep_retention_module_t module = gdma_chx_regs_retention[group_id][pair_id].module_id;
esp_err_t err = sleep_retention_module_init(module, &init_param); esp_err_t err = sleep_retention_module_init(module, &init_param);

View File

@ -89,7 +89,7 @@ static void etm_create_retention_module(etm_group_t *group)
int group_id = group->group_id; int group_id = group->group_id;
sleep_retention_module_t module = etm_reg_retention_info[group_id].module; sleep_retention_module_t module = etm_reg_retention_info[group_id].module;
_lock_acquire(&s_platform.mutex); _lock_acquire(&s_platform.mutex);
if ((sleep_retention_get_inited_modules() & BIT(module)) && !(sleep_retention_get_created_modules() & BIT(module))) { if (sleep_retention_is_module_inited(module) && !sleep_retention_is_module_created(module)) {
if (sleep_retention_module_allocate(module) != ESP_OK) { if (sleep_retention_module_allocate(module) != ESP_OK) {
// even though the sleep retention module create failed, ETM driver should still work, so just warning here // even though the sleep retention module create failed, ETM driver should still work, so just warning here
ESP_LOGW(TAG, "create retention link failed %d, power domain won't be turned off during sleep", group_id); ESP_LOGW(TAG, "create retention link failed %d, power domain won't be turned off during sleep", group_id);
@ -128,7 +128,7 @@ static etm_group_t *etm_acquire_group_handle(int group_id)
.arg = group, .arg = group,
}, },
}, },
.depends = BIT(SLEEP_RETENTION_MODULE_CLOCK_SYSTEM) .depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
}; };
if (sleep_retention_module_init(module, &init_param) != ESP_OK) { if (sleep_retention_module_init(module, &init_param) != ESP_OK) {
// even though the sleep retention module init failed, ETM driver may still work, so just warning here // even though the sleep retention module init failed, ETM driver may still work, so just warning here
@ -175,10 +175,10 @@ static void etm_release_group_handle(etm_group_t *group)
if (do_deinitialize) { if (do_deinitialize) {
#if ETM_USE_RETENTION_LINK #if ETM_USE_RETENTION_LINK
sleep_retention_module_t module = etm_reg_retention_info[group_id].module; sleep_retention_module_t module = etm_reg_retention_info[group_id].module;
if (sleep_retention_get_created_modules() & BIT(module)) { if (sleep_retention_is_module_created(module)) {
sleep_retention_module_free(module); sleep_retention_module_free(module);
} }
if (sleep_retention_get_inited_modules() & BIT(module)) { if (sleep_retention_is_module_inited(module)) {
sleep_retention_module_deinit(module); sleep_retention_module_deinit(module);
} }
#endif #endif

View File

@ -63,7 +63,7 @@ void esp_btbb_enable(void)
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_FREERTOS_USE_TICKLESS_IDLE #if SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_FREERTOS_USE_TICKLESS_IDLE
sleep_retention_module_init_param_t init_param = { sleep_retention_module_init_param_t init_param = {
.cbs = { .create = { .handle = btbb_sleep_retention_init, .arg = NULL } }, .cbs = { .create = { .handle = btbb_sleep_retention_init, .arg = NULL } },
.depends = BIT(SLEEP_RETENTION_MODULE_CLOCK_MODEM) .depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_MODEM)
}; };
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_BT_BB, &init_param); esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_BT_BB, &init_param);
if (err == ESP_OK) { if (err == ESP_OK) {

View File

@ -516,7 +516,7 @@ void esp_mac_bb_pd_mem_init(void)
#elif SOC_PM_MODEM_RETENTION_BY_REGDMA #elif SOC_PM_MODEM_RETENTION_BY_REGDMA
sleep_retention_module_init_param_t init_param = { sleep_retention_module_init_param_t init_param = {
.cbs = { .create = { .handle = sleep_retention_wifi_bb_init, .arg = NULL } }, .cbs = { .create = { .handle = sleep_retention_wifi_bb_init, .arg = NULL } },
.depends = BIT(SLEEP_RETENTION_MODULE_CLOCK_MODEM) .depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_MODEM)
}; };
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_WIFI_BB, &init_param); esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_WIFI_BB, &init_param);
if (err != ESP_OK) { if (err != ESP_OK) {

View File

@ -72,7 +72,7 @@ static esp_err_t esp_int_wdt_retention_enable(uint32_t group_id)
{ {
sleep_retention_module_init_param_t init_param = { sleep_retention_module_init_param_t init_param = {
.cbs = { .create = { .handle = sleep_int_wdt_retention_init, .arg = &group_id } }, .cbs = { .create = { .handle = sleep_int_wdt_retention_init, .arg = &group_id } },
.depends = BIT(SLEEP_RETENTION_MODULE_CLOCK_SYSTEM) .depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
}; };
esp_err_t err = sleep_retention_module_init((group_id == 0) ? SLEEP_RETENTION_MODULE_TG0_WDT : SLEEP_RETENTION_MODULE_TG1_WDT, &init_param); esp_err_t err = sleep_retention_module_init((group_id == 0) ? SLEEP_RETENTION_MODULE_TG0_WDT : SLEEP_RETENTION_MODULE_TG1_WDT, &init_param);
if (err == ESP_OK) { if (err == ESP_OK) {

View File

@ -65,7 +65,7 @@ static esp_err_t esp_task_wdt_retention_enable(uint32_t group_id)
{ {
sleep_retention_module_init_param_t init_param = { sleep_retention_module_init_param_t init_param = {
.cbs = { .create = { .handle = sleep_task_wdt_retention_init, .arg = &group_id } }, .cbs = { .create = { .handle = sleep_task_wdt_retention_init, .arg = &group_id } },
.depends = BIT(SLEEP_RETENTION_MODULE_CLOCK_SYSTEM) .depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
}; };
esp_err_t err = sleep_retention_module_init((group_id == 0) ? SLEEP_RETENTION_MODULE_TG0_WDT : SLEEP_RETENTION_MODULE_TG1_WDT, &init_param); esp_err_t err = sleep_retention_module_init((group_id == 0) ? SLEEP_RETENTION_MODULE_TG0_WDT : SLEEP_RETENTION_MODULE_TG1_WDT, &init_param);
if (err == ESP_OK) { if (err == ESP_OK) {

View File

@ -352,8 +352,9 @@ esp_err_t esp_wifi_init(const wifi_init_config_t *config)
#if SOC_PM_MODEM_RETENTION_BY_REGDMA #if SOC_PM_MODEM_RETENTION_BY_REGDMA
sleep_retention_module_init_param_t init_param = { sleep_retention_module_init_param_t init_param = {
.cbs = { .create = { .handle = init_wifi_mac_sleep_retention, .arg = NULL } }, .cbs = { .create = { .handle = init_wifi_mac_sleep_retention, .arg = NULL } },
.depends = BIT(SLEEP_RETENTION_MODULE_WIFI_BB) | BIT(SLEEP_RETENTION_MODULE_CLOCK_MODEM)
}; };
init_param.depends.bitmap[SLEEP_RETENTION_MODULE_WIFI_BB >> 5] |= BIT(SLEEP_RETENTION_MODULE_WIFI_BB % 32);
init_param.depends.bitmap[SLEEP_RETENTION_MODULE_CLOCK_MODEM >> 5] |= BIT(SLEEP_RETENTION_MODULE_CLOCK_MODEM % 32);
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_WIFI_MAC, &init_param); esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_WIFI_MAC, &init_param);
if (err != ESP_OK) { if (err != ESP_OK) {
ESP_LOGW(TAG, "WiFi MAC sleep retention init failed"); ESP_LOGW(TAG, "WiFi MAC sleep retention init failed");

View File

@ -978,10 +978,9 @@ static esp_err_t ieee802154_sleep_init(void)
{ {
esp_err_t err = ESP_OK; esp_err_t err = ESP_OK;
#if CONFIG_PM_ENABLE #if CONFIG_PM_ENABLE
sleep_retention_module_init_param_t init_param = { sleep_retention_module_init_param_t init_param = { .cbs = { .create = { .handle = ieee802154_sleep_retention_init, .arg = NULL } } };
.cbs = { .create = { .handle = ieee802154_sleep_retention_init, .arg = NULL } }, init_param.depends.bitmap[SLEEP_RETENTION_MODULE_BT_BB >> 5] |= BIT(SLEEP_RETENTION_MODULE_BT_BB % 32);
.depends = BIT(SLEEP_RETENTION_MODULE_BT_BB) | BIT(SLEEP_RETENTION_MODULE_CLOCK_MODEM) init_param.depends.bitmap[SLEEP_RETENTION_MODULE_CLOCK_MODEM >> 5] |= BIT(SLEEP_RETENTION_MODULE_CLOCK_MODEM % 32);
};
err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_802154_MAC, &init_param); err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_802154_MAC, &init_param);
if (err == ESP_OK) { if (err == ESP_OK) {
err = sleep_retention_module_allocate(SLEEP_RETENTION_MODULE_802154_MAC); err = sleep_retention_module_allocate(SLEEP_RETENTION_MODULE_802154_MAC);