fix(ci): some digital peripherals support sleep retention attach and detach

This commit is contained in:
Li Shuai
2026-04-22 20:47:10 +08:00
committed by BOT
parent d1aaeb25e7
commit e28ee420ac
24 changed files with 196 additions and 26 deletions

View File

@@ -370,6 +370,7 @@ static void twai_free_driver_obj(twai_obj_t *p_obj)
#if TWAI_USE_RETENTION_LINK
const periph_retention_module_t retention_id = twai_reg_retention_info[p_obj->controller_id].module_id;
sleep_retention_module_detach(retention_id);
if (sleep_retention_is_module_created(retention_id)) {
assert(sleep_retention_is_module_inited(retention_id));
sleep_retention_module_free(retention_id);
@@ -443,6 +444,7 @@ static esp_err_t twai_alloc_driver_obj(const twai_general_config_t *g_config, tw
.arg = p_obj,
},
},
.attribute = SLEEP_RETENTION_MODULE_ATTR_ATTACH,
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
};
if (sleep_retention_module_init(module, &init_param) != ESP_OK) {
@@ -452,6 +454,10 @@ static esp_err_t twai_alloc_driver_obj(const twai_general_config_t *g_config, tw
if (g_config->general_flags.sleep_allow_pd) {
if (sleep_retention_module_allocate(module) != ESP_OK) {
ESP_LOGW(TWAI_TAG, "create retention module failed, power domain can't turn off");
} else {
if (sleep_retention_module_attach(module) != ESP_OK) {
ESP_LOGW(TWAI_TAG, "attach retention module failed, power domain can't turn off");
}
}
}
#endif

View File

@@ -37,6 +37,7 @@ void gdma_acquire_sleep_retention(gdma_pair_t* pair)
int pair_id = pair->pair_id;
sleep_retention_module_init_param_t init_param = {
.cbs = { .create = { .handle = sleep_gdma_channel_retention_init, .arg = pair } },
.attribute = SLEEP_RETENTION_MODULE_ATTR_ATTACH,
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
};
sleep_retention_module_t module = gdma_retention_infos[group_id][pair_id].module_id;
@@ -52,6 +53,10 @@ void gdma_acquire_sleep_retention(gdma_pair_t* pair)
if (err != ESP_OK) {
ESP_LOGW(TAG, "fail to allocate retention link list for pair (%d, %d)", group_id, pair_id);
// don't call sleep_retention_module_deinit here, otherwise GDMA peripheral may be powered off during sleep
} else {
if (sleep_retention_module_attach(module) != ESP_OK) {
ESP_LOGW(TAG, "fail to attach retention link list for pair (%d, %d)", group_id, pair_id);
}
}
}
}
@@ -69,13 +74,18 @@ void gdma_release_sleep_retention(gdma_pair_t* pair)
pair_ref_counts[group_id][pair_id]--;
// Last reference, free the module
if (pair_ref_counts[group_id][pair_id] == 0) {
esp_err_t err = sleep_retention_module_free(module);
if (err != ESP_OK) {
ESP_LOGW(TAG, "fail to free the retention link list for pair (%d, %d)", group_id, pair_id);
}
err = sleep_retention_module_deinit(module);
if (err != ESP_OK) {
ESP_LOGW(TAG, "fail to deinit the retention module for pair (%d, %d)", group_id, pair_id);
esp_err_t err = sleep_retention_module_detach(module);
if (err == ESP_OK) {
err = sleep_retention_module_free(module);
if (err != ESP_OK) {
ESP_LOGW(TAG, "fail to free the retention link list for pair (%d, %d)", group_id, pair_id);
}
err = sleep_retention_module_deinit(module);
if (err != ESP_OK) {
ESP_LOGW(TAG, "fail to deinit the retention module for pair (%d, %d)", group_id, pair_id);
}
} else {
ESP_LOGW(TAG, "fail to detach the retention link list for pair (%d, %d)", group_id, pair_id);
}
}
_lock_release(&gdma_sleep_retention_lock);

View File

@@ -32,6 +32,10 @@ static void gptimer_create_retention_module(gptimer_t *timer)
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);
return;
}
if (sleep_retention_module_attach(module) != ESP_OK) {
ESP_LOGW(TAG, "attach retention link failed on TimerGroup%d Timer%d, power domain won't be turned off during sleep", group_id, timer_id);
}
}
}
@@ -73,6 +77,7 @@ static esp_err_t gptimer_register_to_group(gptimer_t *timer)
.arg = (void *)timer
},
},
.attribute = SLEEP_RETENTION_MODULE_ATTR_ATTACH,
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
};
if (sleep_retention_module_init(module, &init_param) != ESP_OK) {
@@ -94,6 +99,9 @@ static void gptimer_unregister_from_group(gptimer_t *timer)
#if GPTIMER_USE_RETENTION_LINK
sleep_retention_module_t module = gptimer_retention_infos[group->group_id][timer_id].module;
if (sleep_retention_is_module_attached(module)) {
sleep_retention_module_detach(module);
}
if (sleep_retention_is_module_created(module)) {
sleep_retention_module_free(module);
}

View File

@@ -110,6 +110,9 @@ static void s_i2s_create_retention_module(i2s_controller_t *i2s_obj)
ESP_LOGW(TAG, "create retention module failed, power domain can't turn off");
} else {
i2s_obj->retention_link_created = true;
if (sleep_retention_module_attach(module) != ESP_OK) {
ESP_LOGW(TAG, "attach retention module failed, power domain can't turn off");
}
}
}
_lock_release(&i2s_obj->mutex);
@@ -209,6 +212,7 @@ static esp_err_t i2s_destroy_controller_obj(i2s_controller_t **i2s_obj)
#if I2S_USE_RETENTION_LINK
if ((*i2s_obj)->slp_retention_mod) {
if ((*i2s_obj)->retention_link_created) {
sleep_retention_module_detach((*i2s_obj)->slp_retention_mod);
sleep_retention_module_free((*i2s_obj)->slp_retention_mod);
}
sleep_retention_module_deinit((*i2s_obj)->slp_retention_mod);
@@ -268,6 +272,7 @@ static i2s_controller_t *i2s_acquire_controller_obj(int id)
.arg = i2s_obj,
},
},
.attribute = SLEEP_RETENTION_MODULE_ATTR_ATTACH,
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
};
if (sleep_retention_module_init(module, &init_param) == ESP_OK) {

View File

@@ -439,6 +439,7 @@ static bool ledc_speed_mode_ctx_create(ledc_mode_t speed_mode)
.arg = NULL,
},
},
.attribute = SLEEP_RETENTION_MODULE_ATTR_ATTACH,
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
};
if (sleep_retention_module_init(module, &init_param) != ESP_OK) {
@@ -971,9 +972,14 @@ esp_err_t ledc_channel_config(const ledc_channel_config_t *ledc_conf)
if (slp_retention_alloc) {
if (sleep_retention_module_allocate(ledc_reg_retention_info[0].module_id) != ESP_OK) {
ESP_LOGW(LEDC_TAG, "create retention module failed, power domain can't turn off");
} else {
if (sleep_retention_module_attach(ledc_reg_retention_info[0].module_id) != ESP_OK) {
ESP_LOGW(LEDC_TAG, "attach retention module failed, power domain can't turn off");
}
}
}
if (slp_retention_free) {
sleep_retention_module_detach(ledc_reg_retention_info[0].module_id);
sleep_retention_module_free(ledc_reg_retention_info[0].module_id);
}
#endif

View File

@@ -87,6 +87,7 @@ TEST_CASE("ledc can output after light sleep (LEDC power domain pd)", "[ledc]")
// ledc driver does not have channel release, we will do retention release here to avoid memory leak
sleep_retention_module_t module = ledc_reg_retention_info[0].module_id;
sleep_retention_module_detach(module);
sleep_retention_module_free(module);
sleep_retention_module_deinit(module);
}

View File

@@ -45,6 +45,7 @@ mcpwm_group_t *mcpwm_acquire_group_handle(int group_id)
.arg = group,
},
},
.attribute = SLEEP_RETENTION_MODULE_ATTR_ATTACH,
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
};
// we only do retention init here. Allocate retention module in the unit initialization
@@ -114,6 +115,7 @@ void mcpwm_release_group_handle(mcpwm_group_t *group)
#endif
#if MCPWM_USE_RETENTION_LINK
const periph_retention_module_t module_id = mcpwm_retention_infos[group_id].retention_module;
sleep_retention_module_detach(module_id);
if (sleep_retention_is_module_created(module_id)) {
sleep_retention_module_free(module_id);
}
@@ -263,6 +265,10 @@ void mcpwm_create_retention_module(mcpwm_group_t *group)
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
ESP_LOGW(TAG, "create retention module failed, power domain can't turn off");
} else {
if (sleep_retention_module_attach(module_id) != ESP_OK) {
ESP_LOGW(TAG, "attach retention module failed, power domain can't turn off");
}
}
}
_lock_release(&s_platform.mutex);

View File

@@ -42,6 +42,7 @@ parlio_group_t *parlio_acquire_group_handle(int group_id)
.arg = group,
},
},
.attribute = SLEEP_RETENTION_MODULE_ATTR_ATTACH,
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
};
// we only do retention init here. Allocate retention module in the unit initialization
@@ -93,6 +94,7 @@ void parlio_release_group_handle(parlio_group_t *group)
if (do_deinitialize) {
#if PARLIO_USE_RETENTION_LINK
const periph_retention_module_t module_id = parlio_retention_infos[group_id].retention_module;
sleep_retention_module_detach(module_id);
if (sleep_retention_is_module_created(module_id)) {
assert(sleep_retention_is_module_inited(module_id));
sleep_retention_module_free(module_id);
@@ -185,6 +187,10 @@ void parlio_create_retention_module(parlio_group_t *group)
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
ESP_LOGW(TAG, "create retention module failed, power domain can't turn off");
} else {
if (sleep_retention_module_attach(module_id) != ESP_OK) {
ESP_LOGW(TAG, "attach retention module failed, power domain can't turn off");
}
}
}
_lock_release(&s_platform.mutex);

View File

@@ -53,6 +53,7 @@ rmt_group_t *rmt_acquire_group_handle(int group_id)
.arg = group,
},
},
.attribute = SLEEP_RETENTION_MODULE_ATTR_ATTACH,
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
};
if (sleep_retention_module_init(module, &init_param) != ESP_OK) {
@@ -105,6 +106,7 @@ void rmt_release_group_handle(rmt_group_t *group)
if (do_deinitialize) {
#if RMT_USE_RETENTION_LINK
sleep_retention_module_t module = rmt_retention_infos[group_id].module;
sleep_retention_module_detach(module);
if (sleep_retention_is_module_created(module)) {
sleep_retention_module_free(module);
}
@@ -294,6 +296,10 @@ void rmt_create_retention_module(rmt_group_t *group)
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
ESP_LOGW(TAG, "create retention link failed, power domain won't be turned off during sleep");
} else {
if (sleep_retention_module_attach(module) != ESP_OK) {
ESP_LOGW(TAG, "attach retention link failed, power domain won't be turned off during sleep");
}
}
}
_lock_release(&s_platform.mutex);

View File

@@ -103,6 +103,10 @@ static void sdm_create_retention_module(sdm_group_t *group)
if (sleep_retention_module_allocate(module) != ESP_OK) {
// even though the sleep retention module create failed, SDM driver should still work, so just warning here
ESP_LOGW(TAG, "create retention link failed on SDM Group%d, power domain won't be turned off during sleep", group_id);
} else {
if (sleep_retention_module_attach(module) != ESP_OK) {
ESP_LOGW(TAG, "attach retention link failed on SDM Group%d, power domain won't be turned off during sleep", group_id);
}
}
}
_lock_release(&s_platform.mutex);
@@ -135,6 +139,7 @@ static sdm_group_t *sdm_acquire_group_handle(int group_id, sdm_clock_source_t cl
.arg = group,
},
},
.attribute = SLEEP_RETENTION_MODULE_ATTR_ATTACH,
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
};
// retention module init must be called BEFORE the hal init
@@ -192,6 +197,7 @@ static void sdm_release_group_handle(sdm_group_t *group)
#if SDM_USE_RETENTION_LINK
sleep_retention_module_t module = soc_sdm_retention_infos[group_id].module;
sleep_retention_module_detach(module);
if (sleep_retention_is_module_created(module)) {
sleep_retention_module_free(module);
}

View File

@@ -946,14 +946,21 @@ esp_err_t spi_bus_initialize(spi_host_device_t host_id, const spi_bus_config_t *
.arg = ctx,
},
},
.attribute = SLEEP_RETENTION_MODULE_ATTR_ATTACH,
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
};
_lock_acquire(&ctx->mutex);
if (sleep_retention_module_init(spi_reg_retention_info[host_id - 1].module_id, &init_param) == ESP_OK) {
if ((bus_config->flags & SPICOMMON_BUSFLAG_SLP_ALLOW_PD) && (sleep_retention_module_allocate(spi_reg_retention_info[host_id - 1].module_id) != ESP_OK)) {
// even though the sleep retention create failed, SPI driver should still work, so just warning here
ESP_LOGW(SPI_TAG, "alloc sleep recover failed, peripherals may hold power on");
if ((bus_config->flags & SPICOMMON_BUSFLAG_SLP_ALLOW_PD)) {
if (sleep_retention_module_allocate(spi_reg_retention_info[host_id - 1].module_id) != ESP_OK) {
// even though the sleep retention create failed, SPI driver should still work, so just warning here
ESP_LOGW(SPI_TAG, "alloc sleep recover failed, peripherals may hold power on");
} else {
if (sleep_retention_module_attach(spi_reg_retention_info[host_id - 1].module_id) != ESP_OK) {
ESP_LOGW(SPI_TAG, "attach sleep recover failed, peripherals may hold power on");
}
}
}
} else {
// even the sleep retention init failed, SPI driver should still work, so just warning here
@@ -1055,6 +1062,7 @@ 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
const periph_retention_module_t retention_id = spi_reg_retention_info[host_id - 1].module_id;
_lock_acquire(&ctx->mutex);
sleep_retention_module_detach(retention_id);
if (sleep_retention_is_module_created(retention_id)) {
assert(sleep_retention_is_module_inited(retention_id));
sleep_retention_module_free(retention_id);

View File

@@ -242,13 +242,20 @@ esp_err_t spi_slave_initialize(spi_host_device_t host, const spi_bus_config_t *b
.arg = spihost[host],
},
},
.attribute = SLEEP_RETENTION_MODULE_ATTR_ATTACH,
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM),
};
if (ESP_OK == sleep_retention_module_init(spi_reg_retention_info[host - 1].module_id, &init_param)) {
if ((bus_config->flags & SPICOMMON_BUSFLAG_SLP_ALLOW_PD) && (sleep_retention_module_allocate(spi_reg_retention_info[host - 1].module_id) != ESP_OK)) {
// even though the sleep retention create failed, SPI driver should still work, so just warning here
ESP_LOGW(SPI_TAG, "Alloc sleep recover failed, spi may hold power on");
if ((bus_config->flags & SPICOMMON_BUSFLAG_SLP_ALLOW_PD)) {
if (sleep_retention_module_allocate(spi_reg_retention_info[host - 1].module_id) != ESP_OK) {
// even though the sleep retention create failed, SPI driver should still work, so just warning here
ESP_LOGW(SPI_TAG, "Alloc sleep recover failed, spi may hold power on");
} else {
if (sleep_retention_module_attach(spi_reg_retention_info[host - 1].module_id) != ESP_OK) {
ESP_LOGW(SPI_TAG, "attach sleep recover failed, spi may hold power on");
}
}
}
} else {
// even the sleep retention init failed, SPI driver should still work, so just warning here
@@ -332,6 +339,7 @@ esp_err_t spi_slave_free(spi_host_device_t host)
#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[spihost[host]->id - 1].module_id;
sleep_retention_module_detach(retention_id);
if (sleep_retention_is_module_created(retention_id)) {
assert(sleep_retention_is_module_inited(retention_id));
sleep_retention_module_free(retention_id);

View File

@@ -200,13 +200,20 @@ esp_err_t spi_slave_hd_init(spi_host_device_t host_id, const spi_bus_config_t *b
.arg = host,
},
},
.attribute = SLEEP_RETENTION_MODULE_ATTR_ATTACH,
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM),
};
if (ESP_OK == sleep_retention_module_init(spi_reg_retention_info[host_id - 1].module_id, &init_param)) {
if ((bus_config->flags & SPICOMMON_BUSFLAG_SLP_ALLOW_PD) && (sleep_retention_module_allocate(spi_reg_retention_info[host_id - 1].module_id) != ESP_OK)) {
// even though the sleep retention create failed, SPI driver should still work, so just warning here
ESP_LOGW(TAG, "Alloc sleep recover failed, spi may hold power on");
if ((bus_config->flags & SPICOMMON_BUSFLAG_SLP_ALLOW_PD)) {
if (sleep_retention_module_allocate(spi_reg_retention_info[host_id - 1].module_id) != ESP_OK) {
// even though the sleep retention create failed, SPI driver should still work, so just warning here
ESP_LOGW(TAG, "Alloc sleep recover failed, spi may hold power on");
} else {
if (sleep_retention_module_attach(spi_reg_retention_info[host_id - 1].module_id) != ESP_OK) {
ESP_LOGW(TAG, "attach sleep recover failed, spi may hold power on");
}
}
}
} else {
// even the sleep retention init failed, SPI driver should still work, so just warning here
@@ -322,6 +329,7 @@ esp_err_t spi_slave_hd_deinit(spi_host_device_t host_id)
#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;
sleep_retention_module_detach(retention_id);
if (sleep_retention_is_module_created(retention_id)) {
assert(sleep_retention_is_module_inited(retention_id));
sleep_retention_module_free(retention_id);

View File

@@ -293,6 +293,7 @@ static void _node_destroy(twai_onchip_ctx_t *twai_ctx)
#endif
#if SOC_TWAI_SUPPORT_SLEEP_RETENTION && CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
const sleep_retention_module_t retention_id = twai_reg_retention_info[twai_ctx->ctrlr_id].module_id;
sleep_retention_module_detach(retention_id);
if (sleep_retention_is_module_created(retention_id)) {
assert(sleep_retention_is_module_inited(retention_id));
sleep_retention_module_free(retention_id);
@@ -707,11 +708,18 @@ esp_err_t twai_new_node_onchip(const twai_onchip_node_config_t *node_config, twa
.arg = node,
},
},
.attribute = SLEEP_RETENTION_MODULE_ATTR_ATTACH,
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
};
if (sleep_retention_module_init(retention_id, &init_param) == ESP_OK) {
if ((node_config->flags.sleep_allow_pd) && (sleep_retention_module_allocate(retention_id) != ESP_OK)) {
ESP_LOGW(TAG, "sleep retention prepare failed, power will hold on");
if (node_config->flags.sleep_allow_pd) {
if (sleep_retention_module_allocate(retention_id) != ESP_OK) {
ESP_LOGW(TAG, "sleep retention allocate failed, power will hold on");
} else {
if (sleep_retention_module_attach(retention_id) != ESP_OK) {
ESP_LOGW(TAG, "sleep retention attach failed, power will hold on");
}
}
}
} else {
ESP_LOGW(TAG, "sleep retention init failed, twai may offline after sleep");

View File

@@ -252,6 +252,7 @@ static bool uart_module_enable(uart_port_t uart_num)
.arg = &uart_context[uart_num],
},
},
.attribute = SLEEP_RETENTION_MODULE_ATTR_ATTACH,
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
};
if (sleep_retention_module_init(module, &init_param) != ESP_OK) {
@@ -1140,12 +1141,17 @@ esp_err_t uart_param_config(uart_port_t uart_num, const uart_config_t *uart_conf
if (sleep_retention_module_allocate(module) != ESP_OK) {
// Even though the sleep retention module create failed, UART driver should still work, so just warning here
ESP_LOGW(UART_TAG, "create retention module failed, power domain can't turn off");
} else {
if (sleep_retention_module_attach(module) != ESP_OK) {
ESP_LOGW(UART_TAG, "attach retention module failed, power domain can't turn off");
}
}
} else {
ESP_LOGW(UART_TAG, "retention module not initialized first, unable to create retention module");
}
} else if (!allow_pd && sleep_retention_is_module_created(module)) {
assert(sleep_retention_is_module_inited(module));
sleep_retention_module_detach(module);
sleep_retention_module_free(module);
}
_lock_release(&(uart_context[uart_num].mutex));
@@ -2146,6 +2152,7 @@ esp_err_t uart_driver_delete(uart_port_t uart_num)
_lock_acquire(&(uart_context[uart_num].mutex));
if (sleep_retention_is_module_created(module)) {
assert(sleep_retention_is_module_inited(module));
sleep_retention_module_detach(module);
sleep_retention_module_free(module);
}
_lock_release(&(uart_context[uart_num].mutex));

View File

@@ -88,6 +88,10 @@ static void etm_create_retention_module(etm_group_t *group)
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
ESP_LOGW(TAG, "create retention link failed on ETM Group%d, power domain won't be turned off during sleep", group_id);
} else {
if (sleep_retention_module_attach(module) != ESP_OK) {
ESP_LOGW(TAG, "attach retention link failed on ETM Group%d, power domain won't be turned off during sleep", group_id);
}
}
}
_lock_release(&s_platform.mutex);
@@ -125,6 +129,7 @@ static etm_group_t *etm_acquire_group_handle(int group_id)
.arg = group,
},
},
.attribute = SLEEP_RETENTION_MODULE_ATTR_ATTACH,
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
};
// retention module init must be called BEFORE the hal init
@@ -172,6 +177,9 @@ static void etm_release_group_handle(etm_group_t *group)
#if ETM_USE_RETENTION_LINK
sleep_retention_module_t module = soc_etm_retention_info[group_id].module;
if (sleep_retention_is_module_attached(module)) {
sleep_retention_module_detach(module);
}
if (sleep_retention_is_module_created(module)) {
sleep_retention_module_free(module);
}

View File

@@ -15,6 +15,7 @@ bool peripheral_domain_pd_allowed(void)
#if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
const sleep_retention_module_bitmap_t inited_modules = sleep_retention_get_inited_modules();
const sleep_retention_module_bitmap_t created_modules = sleep_retention_get_created_modules();
const sleep_retention_module_bitmap_t retained_modules = sleep_retention_get_retained_modules();
sleep_retention_module_bitmap_t mask = RETENTION_MODULE_BITMAP_INIT(NULL);
RETENTION_MODULE_BITMAP_SET(&mask, SLEEP_RETENTION_MODULE_SYS_PERIPH);
@@ -82,7 +83,15 @@ bool peripheral_domain_pd_allowed(void)
const sleep_retention_module_bitmap_t peripheral_domain_inited_modules = sleep_retention_module_bitmap_and(inited_modules, mask);
const sleep_retention_module_bitmap_t peripheral_domain_created_modules = sleep_retention_module_bitmap_and(created_modules, mask);
return sleep_retention_module_bitmap_eq(peripheral_domain_inited_modules, peripheral_domain_created_modules);
bool ic = sleep_retention_module_bitmap_eq(peripheral_domain_inited_modules, peripheral_domain_created_modules);
sleep_retention_module_bitmap_t mask_ign = mask;
mask_ign.bitmap[SLEEP_RETENTION_MODULE_TEMP_SENSOR >> 5] &= ~BIT(SLEEP_RETENTION_MODULE_TEMP_SENSOR % 32);
const sleep_retention_module_bitmap_t peripheral_domain_created_ign_modules = sleep_retention_module_bitmap_and(created_modules, mask_ign);
const sleep_retention_module_bitmap_t peripheral_domain_retained_modules = sleep_retention_module_bitmap_and(retained_modules, mask_ign);
bool cr = sleep_retention_module_bitmap_eq(peripheral_domain_created_ign_modules, peripheral_domain_retained_modules);
return ic && cr;
#else
return false;
#endif

View File

@@ -15,6 +15,7 @@ bool peripheral_domain_pd_allowed(void)
#if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
const sleep_retention_module_bitmap_t inited_modules = sleep_retention_get_inited_modules();
const sleep_retention_module_bitmap_t created_modules = sleep_retention_get_created_modules();
const sleep_retention_module_bitmap_t retained_modules = sleep_retention_get_retained_modules();
sleep_retention_module_bitmap_t mask = RETENTION_MODULE_BITMAP_INIT(NULL);
RETENTION_MODULE_BITMAP_SET(&mask, SLEEP_RETENTION_MODULE_SYS_PERIPH);
@@ -79,7 +80,15 @@ bool peripheral_domain_pd_allowed(void)
const sleep_retention_module_bitmap_t peripheral_domain_inited_modules = sleep_retention_module_bitmap_and(inited_modules, mask);
const sleep_retention_module_bitmap_t peripheral_domain_created_modules = sleep_retention_module_bitmap_and(created_modules, mask);
return sleep_retention_module_bitmap_eq(peripheral_domain_inited_modules, peripheral_domain_created_modules);
bool ic = sleep_retention_module_bitmap_eq(peripheral_domain_inited_modules, peripheral_domain_created_modules);
sleep_retention_module_bitmap_t mask_ign = mask;
mask_ign.bitmap[SLEEP_RETENTION_MODULE_TEMP_SENSOR >> 5] &= ~BIT(SLEEP_RETENTION_MODULE_TEMP_SENSOR % 32);
const sleep_retention_module_bitmap_t peripheral_domain_created_ign_modules = sleep_retention_module_bitmap_and(created_modules, mask_ign);
const sleep_retention_module_bitmap_t peripheral_domain_retained_modules = sleep_retention_module_bitmap_and(retained_modules, mask_ign);
bool cr = sleep_retention_module_bitmap_eq(peripheral_domain_created_ign_modules, peripheral_domain_retained_modules);
return ic && cr;
#else
return false;
#endif

View File

@@ -15,6 +15,7 @@ bool peripheral_domain_pd_allowed(void)
#if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
const sleep_retention_module_bitmap_t inited_modules = sleep_retention_get_inited_modules();
const sleep_retention_module_bitmap_t created_modules = sleep_retention_get_created_modules();
const sleep_retention_module_bitmap_t retained_modules = sleep_retention_get_retained_modules();
sleep_retention_module_bitmap_t mask = RETENTION_MODULE_BITMAP_INIT(NULL);
RETENTION_MODULE_BITMAP_SET(&mask, SLEEP_RETENTION_MODULE_SYS_PERIPH);
@@ -62,7 +63,15 @@ bool peripheral_domain_pd_allowed(void)
const sleep_retention_module_bitmap_t peripheral_domain_inited_modules = sleep_retention_module_bitmap_and(inited_modules, mask);
const sleep_retention_module_bitmap_t peripheral_domain_created_modules = sleep_retention_module_bitmap_and(created_modules, mask);
return sleep_retention_module_bitmap_eq(peripheral_domain_inited_modules, peripheral_domain_created_modules);
bool ic = sleep_retention_module_bitmap_eq(peripheral_domain_inited_modules, peripheral_domain_created_modules);
sleep_retention_module_bitmap_t mask_ign = mask;
mask_ign.bitmap[SLEEP_RETENTION_MODULE_TEMP_SENSOR >> 5] &= ~BIT(SLEEP_RETENTION_MODULE_TEMP_SENSOR % 32);
const sleep_retention_module_bitmap_t peripheral_domain_created_ign_modules = sleep_retention_module_bitmap_and(created_modules, mask_ign);
const sleep_retention_module_bitmap_t peripheral_domain_retained_modules = sleep_retention_module_bitmap_and(retained_modules, mask_ign);
bool cr = sleep_retention_module_bitmap_eq(peripheral_domain_created_ign_modules, peripheral_domain_retained_modules);
return ic && cr;
#else
return false;
#endif

View File

@@ -15,6 +15,7 @@ bool peripheral_domain_pd_allowed(void)
#if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
const sleep_retention_module_bitmap_t inited_modules = sleep_retention_get_inited_modules();
const sleep_retention_module_bitmap_t created_modules = sleep_retention_get_created_modules();
const sleep_retention_module_bitmap_t retained_modules = sleep_retention_get_retained_modules();
sleep_retention_module_bitmap_t mask = RETENTION_MODULE_BITMAP_INIT(NULL);
RETENTION_MODULE_BITMAP_SET(&mask, SLEEP_RETENTION_MODULE_SYS_PERIPH);
@@ -80,7 +81,16 @@ bool peripheral_domain_pd_allowed(void)
const sleep_retention_module_bitmap_t peripheral_domain_inited_modules = sleep_retention_module_bitmap_and(inited_modules, mask);
const sleep_retention_module_bitmap_t peripheral_domain_created_modules = sleep_retention_module_bitmap_and(created_modules, mask);
return sleep_retention_module_bitmap_eq(peripheral_domain_inited_modules, peripheral_domain_created_modules);
bool ic = sleep_retention_module_bitmap_eq(peripheral_domain_inited_modules, peripheral_domain_created_modules);
sleep_retention_module_bitmap_t mask_ign = mask;
mask_ign.bitmap[SLEEP_RETENTION_MODULE_TEMP_SENSOR >> 5] &= ~BIT(SLEEP_RETENTION_MODULE_TEMP_SENSOR % 32);
const sleep_retention_module_bitmap_t peripheral_domain_created_ign_modules = sleep_retention_module_bitmap_and(created_modules, mask_ign);
const sleep_retention_module_bitmap_t peripheral_domain_retained_modules = sleep_retention_module_bitmap_and(retained_modules, mask_ign);
bool cr = sleep_retention_module_bitmap_eq(peripheral_domain_created_ign_modules, peripheral_domain_retained_modules);
return ic && cr;
#else
return false;
#endif

View File

@@ -15,6 +15,7 @@ bool peripheral_domain_pd_allowed(void)
#if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
const sleep_retention_module_bitmap_t inited_modules = sleep_retention_get_inited_modules();
const sleep_retention_module_bitmap_t created_modules = sleep_retention_get_created_modules();
const sleep_retention_module_bitmap_t retained_modules = sleep_retention_get_retained_modules();
sleep_retention_module_bitmap_t mask = RETENTION_MODULE_BITMAP_INIT(NULL);
RETENTION_MODULE_BITMAP_SET(&mask, SLEEP_RETENTION_MODULE_SYS_PERIPH);
@@ -79,7 +80,15 @@ bool peripheral_domain_pd_allowed(void)
const sleep_retention_module_bitmap_t peripheral_domain_inited_modules = sleep_retention_module_bitmap_and(inited_modules, mask);
const sleep_retention_module_bitmap_t peripheral_domain_created_modules = sleep_retention_module_bitmap_and(created_modules, mask);
return sleep_retention_module_bitmap_eq(peripheral_domain_inited_modules, peripheral_domain_created_modules);
bool ic = sleep_retention_module_bitmap_eq(peripheral_domain_inited_modules, peripheral_domain_created_modules);
sleep_retention_module_bitmap_t mask_ign = mask;
mask_ign.bitmap[SLEEP_RETENTION_MODULE_TEMP_SENSOR >> 5] &= ~BIT(SLEEP_RETENTION_MODULE_TEMP_SENSOR % 32);
const sleep_retention_module_bitmap_t peripheral_domain_created_ign_modules = sleep_retention_module_bitmap_and(created_modules, mask_ign);
const sleep_retention_module_bitmap_t peripheral_domain_retained_modules = sleep_retention_module_bitmap_and(retained_modules, mask_ign);
bool cr = sleep_retention_module_bitmap_eq(peripheral_domain_created_ign_modules, peripheral_domain_retained_modules);
return ic && cr;
#else
return false;
#endif

View File

@@ -15,6 +15,7 @@ bool peripheral_domain_pd_allowed(void)
#if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
const sleep_retention_module_bitmap_t inited_modules = sleep_retention_get_inited_modules();
const sleep_retention_module_bitmap_t created_modules = sleep_retention_get_created_modules();
const sleep_retention_module_bitmap_t retained_modules = sleep_retention_get_retained_modules();
sleep_retention_module_bitmap_t mask = RETENTION_MODULE_BITMAP_INIT(NULL);
RETENTION_MODULE_BITMAP_SET(&mask, SLEEP_RETENTION_MODULE_SYS_PERIPH);
@@ -83,7 +84,15 @@ bool peripheral_domain_pd_allowed(void)
const sleep_retention_module_bitmap_t peripheral_domain_inited_modules = sleep_retention_module_bitmap_and(inited_modules, mask);
const sleep_retention_module_bitmap_t peripheral_domain_created_modules = sleep_retention_module_bitmap_and(created_modules, mask);
return sleep_retention_module_bitmap_eq(peripheral_domain_inited_modules, peripheral_domain_created_modules);
bool ic = sleep_retention_module_bitmap_eq(peripheral_domain_inited_modules, peripheral_domain_created_modules);
sleep_retention_module_bitmap_t mask_ign = mask;
mask_ign.bitmap[SLEEP_RETENTION_MODULE_TEMP_SENSOR >> 5] &= ~BIT(SLEEP_RETENTION_MODULE_TEMP_SENSOR % 32);
const sleep_retention_module_bitmap_t peripheral_domain_created_ign_modules = sleep_retention_module_bitmap_and(created_modules, mask_ign);
const sleep_retention_module_bitmap_t peripheral_domain_retained_modules = sleep_retention_module_bitmap_and(retained_modules, mask_ign);
bool cr = sleep_retention_module_bitmap_eq(peripheral_domain_created_ign_modules, peripheral_domain_retained_modules);
return ic && cr;
#else
return false;
#endif

View File

@@ -15,6 +15,7 @@ bool peripheral_domain_pd_allowed(void)
#if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
const sleep_retention_module_bitmap_t inited_modules = sleep_retention_get_inited_modules();
const sleep_retention_module_bitmap_t created_modules = sleep_retention_get_created_modules();
const sleep_retention_module_bitmap_t retained_modules = sleep_retention_get_retained_modules();
sleep_retention_module_bitmap_t mask = RETENTION_MODULE_BITMAP_INIT(NULL);
RETENTION_MODULE_BITMAP_SET(&mask, SLEEP_RETENTION_MODULE_SYS_PERIPH);
@@ -107,7 +108,10 @@ bool peripheral_domain_pd_allowed(void)
const sleep_retention_module_bitmap_t peripheral_domain_inited_modules = sleep_retention_module_bitmap_and(inited_modules, mask);
const sleep_retention_module_bitmap_t peripheral_domain_created_modules = sleep_retention_module_bitmap_and(created_modules, mask);
return sleep_retention_module_bitmap_eq(peripheral_domain_inited_modules, peripheral_domain_created_modules);
const sleep_retention_module_bitmap_t peripheral_domain_retained_modules = sleep_retention_module_bitmap_and(retained_modules, mask);
bool ic = sleep_retention_module_bitmap_eq(peripheral_domain_inited_modules, peripheral_domain_created_modules);
bool cr = sleep_retention_module_bitmap_eq(peripheral_domain_created_modules, peripheral_domain_retained_modules);
return ic && cr;
#else
return false;
#endif

View File

@@ -15,6 +15,7 @@ bool peripheral_domain_pd_allowed(void)
#if CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
const sleep_retention_module_bitmap_t inited_modules = sleep_retention_get_inited_modules();
const sleep_retention_module_bitmap_t created_modules = sleep_retention_get_created_modules();
const sleep_retention_module_bitmap_t retained_modules = sleep_retention_get_retained_modules();
sleep_retention_module_bitmap_t mask = RETENTION_MODULE_BITMAP_INIT(NULL);
RETENTION_MODULE_BITMAP_SET(&mask, SLEEP_RETENTION_MODULE_SYS_PERIPH);
@@ -97,7 +98,10 @@ bool peripheral_domain_pd_allowed(void)
const sleep_retention_module_bitmap_t peripheral_domain_inited_modules = sleep_retention_module_bitmap_and(inited_modules, mask);
const sleep_retention_module_bitmap_t peripheral_domain_created_modules = sleep_retention_module_bitmap_and(created_modules, mask);
return sleep_retention_module_bitmap_eq(peripheral_domain_inited_modules, peripheral_domain_created_modules);
const sleep_retention_module_bitmap_t peripheral_domain_retained_modules = sleep_retention_module_bitmap_and(retained_modules, mask);
bool ic = sleep_retention_module_bitmap_eq(peripheral_domain_inited_modules, peripheral_domain_created_modules);
bool cr = sleep_retention_module_bitmap_eq(peripheral_domain_created_modules, peripheral_domain_retained_modules);
return ic && cr;
#else
return false;
#endif