diff --git a/components/bt/controller/esp32c6/bt.c b/components/bt/controller/esp32c6/bt.c index 314045fe12..3f53e9aca2 100644 --- a/components/bt/controller/esp32c6/bt.c +++ b/components/bt/controller/esp32c6/bt.c @@ -612,7 +612,7 @@ static esp_err_t sleep_modem_ble_mac_modem_state_init(uint8_t extra) int retention_args = extra; sleep_retention_module_init_param_t init_param = { .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); if (err == ESP_OK) { diff --git a/components/bt/controller/esp32h2/bt.c b/components/bt/controller/esp32h2/bt.c index 97e0213fc3..e4168cb00b 100644 --- a/components/bt/controller/esp32h2/bt.c +++ b/components/bt/controller/esp32h2/bt.c @@ -603,7 +603,7 @@ static esp_err_t sleep_modem_ble_mac_modem_state_init(uint8_t extra) int retention_args = extra; sleep_retention_module_init_param_t init_param = { .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); if (err == ESP_OK) { diff --git a/components/esp_driver_gptimer/src/gptimer.c b/components/esp_driver_gptimer/src/gptimer.c index 0d8ffb38bb..d02717dc38 100644 --- a/components/esp_driver_gptimer/src/gptimer.c +++ b/components/esp_driver_gptimer/src/gptimer.c @@ -41,7 +41,7 @@ static void gptimer_create_retention_module(gptimer_t *timer) int group_id = timer->group->group_id; int timer_id = timer->timer_id; sleep_retention_module_t module = tg_timer_reg_retention_info[group_id][timer_id].module; - 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) { // even though the sleep retention module create failed, GPTimer driver should still work, so just warning here ESP_LOGW(TAG, "create retention link failed on TimerGroup%d Timer%d, power domain won't be turned off during sleep", group_id, timer_id); @@ -86,7 +86,7 @@ static esp_err_t gptimer_register_to_group(gptimer_t *timer) .arg = (void *)timer }, }, - .depends = BIT(SLEEP_RETENTION_MODULE_CLOCK_SYSTEM) + .depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM) }; 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 @@ -107,7 +107,7 @@ static void gptimer_unregister_from_group(gptimer_t *timer) #if GPTIMER_USE_RETENTION_LINK sleep_retention_module_t module = tg_timer_reg_retention_info[group->group_id][timer_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_deinit(module); diff --git a/components/esp_driver_uart/src/uart.c b/components/esp_driver_uart/src/uart.c index 0a316f2674..6e0506a419 100644 --- a/components/esp_driver_uart/src/uart.c +++ b/components/esp_driver_uart/src/uart.c @@ -223,7 +223,7 @@ static void uart_module_enable(uart_port_t 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) { uart_context[uart_num].retention_link_inited = true; diff --git a/components/esp_hw_support/dma/gdma_sleep_retention.c b/components/esp_hw_support/dma/gdma_sleep_retention.c index 00f3a75445..108952a265 100644 --- a/components/esp_hw_support/dma/gdma_sleep_retention.c +++ b/components/esp_hw_support/dma/gdma_sleep_retention.c @@ -36,7 +36,7 @@ static esp_err_t sleep_gdma_channel_retention_init(void *arg) int group_id = parg->group_id; int pair_id = parg->pair_id; - sleep_retention_module_bitmap_t module = GDMA_CH_RETENTION_GET_MODULE_ID(group_id, pair_id); + sleep_retention_module_t module = GDMA_CH_RETENTION_GET_MODULE_ID(group_id, pair_id); esp_err_t err = sleep_retention_entries_create(gdma_chx_regs_retention[group_id][pair_id].link_list, gdma_chx_regs_retention[group_id][pair_id].link_num, REGDMA_LINK_PRI_GDMA, module); if (err == ESP_OK) { ESP_LOGD(TAG, "GDMA pair (%d, %d) retention initialization", group_id, pair_id); @@ -51,9 +51,9 @@ 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 }; sleep_retention_module_init_param_t init_param = { .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_bitmap_t module = GDMA_CH_RETENTION_GET_MODULE_ID(group_id, pair_id); + sleep_retention_module_t module = GDMA_CH_RETENTION_GET_MODULE_ID(group_id, pair_id); esp_err_t err = sleep_retention_module_init(module, &init_param); if (err == ESP_OK) { err = sleep_retention_module_allocate(module); diff --git a/components/esp_phy/src/btbb_init.c b/components/esp_phy/src/btbb_init.c index b73b0babd0..88e0df7573 100644 --- a/components/esp_phy/src/btbb_init.c +++ b/components/esp_phy/src/btbb_init.c @@ -63,7 +63,7 @@ void esp_btbb_enable(void) #if SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_FREERTOS_USE_TICKLESS_IDLE sleep_retention_module_init_param_t init_param = { .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); if (err == ESP_OK) { diff --git a/components/esp_phy/src/phy_init.c b/components/esp_phy/src/phy_init.c index 13c2a5bd09..47b507ba4c 100644 --- a/components/esp_phy/src/phy_init.c +++ b/components/esp_phy/src/phy_init.c @@ -520,7 +520,7 @@ void esp_mac_bb_pd_mem_init(void) #elif SOC_PM_MODEM_RETENTION_BY_REGDMA sleep_retention_module_init_param_t init_param = { .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); if (err != ESP_OK) { diff --git a/components/esp_system/int_wdt.c b/components/esp_system/int_wdt.c index 9a8db626f3..66e00fc493 100644 --- a/components/esp_system/int_wdt.c +++ b/components/esp_system/int_wdt.c @@ -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 = { .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); if (err == ESP_OK) { 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 8b8ed63180..56cf317eea 100644 --- a/components/esp_system/task_wdt/task_wdt_impl_timergroup.c +++ b/components/esp_system/task_wdt/task_wdt_impl_timergroup.c @@ -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 = { .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); if (err == ESP_OK) { diff --git a/components/esp_wifi/src/wifi_init.c b/components/esp_wifi/src/wifi_init.c index 6c9ed3ea68..de3dbf51e8 100644 --- a/components/esp_wifi/src/wifi_init.c +++ b/components/esp_wifi/src/wifi_init.c @@ -352,8 +352,9 @@ esp_err_t esp_wifi_init(const wifi_init_config_t *config) #if SOC_PM_MODEM_RETENTION_BY_REGDMA sleep_retention_module_init_param_t init_param = { .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); if (err != ESP_OK) { ESP_LOGW(TAG, "WiFi MAC sleep retention init failed"); diff --git a/components/ieee802154/driver/esp_ieee802154_dev.c b/components/ieee802154/driver/esp_ieee802154_dev.c index ea39aec7c1..b252457ca7 100644 --- a/components/ieee802154/driver/esp_ieee802154_dev.c +++ b/components/ieee802154/driver/esp_ieee802154_dev.c @@ -1009,10 +1009,9 @@ static esp_err_t ieee802154_sleep_init(void) { esp_err_t err = ESP_OK; #if CONFIG_PM_ENABLE - sleep_retention_module_init_param_t init_param = { - .cbs = { .create = { .handle = ieee802154_sleep_retention_init, .arg = NULL } }, - .depends = BIT(SLEEP_RETENTION_MODULE_BT_BB) | BIT(SLEEP_RETENTION_MODULE_CLOCK_MODEM) - }; + sleep_retention_module_init_param_t init_param = { .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); + 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); if (err == ESP_OK) { err = sleep_retention_module_allocate(SLEEP_RETENTION_MODULE_802154_MAC);