Skip to content

Commit 4cc82c7

Browse files
author
Jiang Jiang Jian
committed
Merge branch 'feat/sleep_retention_expand_module_bitmap_v5.4' into 'release/v5.4'
backport v5.4: expand the number of sleep retention modules supported on different chips See merge request espressif/esp-idf!34691
2 parents 0e966ba + 71f83bd commit 4cc82c7

File tree

49 files changed

+733
-583
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+733
-583
lines changed

components/bt/controller/esp32c5/bt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ static esp_err_t sleep_modem_ble_mac_modem_state_init(uint8_t extra)
385385
int retention_args = extra;
386386
sleep_retention_module_init_param_t init_param = {
387387
.cbs = { .create = { .handle = sleep_modem_ble_mac_retention_init, .arg = &retention_args } },
388-
.depends = BIT(SLEEP_RETENTION_MODULE_BT_BB)
388+
.depends = RETENTION_MODULE_BITMAP_INIT(BT_BB)
389389
};
390390
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_BLE_MAC, &init_param);
391391
if (err == ESP_OK) {

components/bt/controller/esp32c6/bt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ static esp_err_t sleep_modem_ble_mac_modem_state_init(uint8_t extra)
593593
int retention_args = extra;
594594
sleep_retention_module_init_param_t init_param = {
595595
.cbs = { .create = { .handle = sleep_modem_ble_mac_retention_init, .arg = &retention_args } },
596-
.depends = BIT(SLEEP_RETENTION_MODULE_BT_BB)
596+
.depends = RETENTION_MODULE_BITMAP_INIT(BT_BB)
597597
};
598598
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_BLE_MAC, &init_param);
599599
if (err == ESP_OK) {

components/bt/controller/esp32h2/bt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ static esp_err_t sleep_modem_ble_mac_modem_state_init(uint8_t extra)
585585
int retention_args = extra;
586586
sleep_retention_module_init_param_t init_param = {
587587
.cbs = { .create = { .handle = sleep_modem_ble_mac_retention_init, .arg = &retention_args } },
588-
.depends = BIT(SLEEP_RETENTION_MODULE_BT_BB)
588+
.depends = RETENTION_MODULE_BITMAP_INIT(BT_BB)
589589
};
590590
esp_err_t err = sleep_retention_module_init(SLEEP_RETENTION_MODULE_BLE_MAC, &init_param);
591591
if (err == ESP_OK) {

components/driver/twai/twai.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,11 @@ static void twai_free_driver_obj(twai_obj_t *p_obj)
336336

337337
#if TWAI_USE_RETENTION_LINK
338338
const periph_retention_module_t retention_id = twai_reg_retention_info[p_obj->controller_id].module_id;
339-
if (sleep_retention_get_created_modules() & BIT(retention_id)) {
340-
assert(sleep_retention_get_inited_modules() & BIT(retention_id));
339+
if (sleep_retention_is_module_created(retention_id)) {
340+
assert(sleep_retention_is_module_inited(retention_id));
341341
sleep_retention_module_free(retention_id);
342342
}
343-
if (sleep_retention_get_inited_modules() & BIT(retention_id)) {
343+
if (sleep_retention_is_module_inited(retention_id)) {
344344
sleep_retention_module_deinit(retention_id);
345345
}
346346

@@ -408,7 +408,7 @@ static esp_err_t twai_alloc_driver_obj(const twai_general_config_t *g_config, tw
408408
.arg = p_obj,
409409
},
410410
},
411-
.depends = BIT(SLEEP_RETENTION_MODULE_CLOCK_SYSTEM)
411+
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
412412
};
413413
if (sleep_retention_module_init(module, &init_param) != ESP_OK) {
414414
ESP_LOGW(TWAI_TAG, "init sleep retention failed for TWAI%d, power domain may be turned off during sleep", controller_id);

components/esp_driver_gptimer/src/gptimer_common.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void gptimer_create_retention_module(gptimer_group_t *group)
3838
int group_id = group->group_id;
3939
sleep_retention_module_t module = tg_timer_reg_retention_info[group_id].module;
4040
_lock_acquire(&s_platform.mutex);
41-
if ((sleep_retention_get_inited_modules() & BIT(module)) && !(sleep_retention_get_created_modules() & BIT(module))) {
41+
if (sleep_retention_is_module_inited(module) && !sleep_retention_is_module_created(module)) {
4242
if (sleep_retention_module_allocate(module) != ESP_OK) {
4343
// even though the sleep retention module create failed, GPTimer driver should still work, so just warning here
4444
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)
9292
.arg = group
9393
},
9494
},
95-
.depends = BIT(SLEEP_RETENTION_MODULE_CLOCK_SYSTEM)
95+
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
9696
};
9797
if (sleep_retention_module_init(module, &init_param) != ESP_OK) {
9898
// 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)
128128
}
129129
#if GPTIMER_USE_RETENTION_LINK
130130
sleep_retention_module_t module = tg_timer_reg_retention_info[group_id].module;
131-
if (sleep_retention_get_created_modules() & BIT(module)) {
131+
if (sleep_retention_is_module_created(module)) {
132132
sleep_retention_module_free(module);
133133
}
134-
if (sleep_retention_get_inited_modules() & BIT(module)) {
134+
if (sleep_retention_is_module_inited(module)) {
135135
sleep_retention_module_deinit(module);
136136
}
137137
#endif

components/esp_driver_i2s/i2s_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ static i2s_controller_t *i2s_acquire_controller_obj(int id)
268268
.arg = i2s_obj,
269269
},
270270
},
271-
.depends = BIT(SLEEP_RETENTION_MODULE_CLOCK_SYSTEM)
271+
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
272272
};
273273
if (sleep_retention_module_init(module, &init_param) == ESP_OK) {
274274
i2s_obj->slp_retention_mod = module;

components/esp_driver_ledc/src/ledc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ static bool ledc_speed_mode_ctx_create(ledc_mode_t speed_mode)
434434
.arg = NULL,
435435
},
436436
},
437-
.depends = BIT(SLEEP_RETENTION_MODULE_CLOCK_SYSTEM),
437+
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
438438
};
439439
if (sleep_retention_module_init(module, &init_param) != ESP_OK) {
440440
ESP_LOGW(LEDC_TAG, "init sleep retention failed for ledc, power domain may be turned off during sleep");

components/esp_driver_mcpwm/src/mcpwm_com.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ mcpwm_group_t *mcpwm_acquire_group_handle(int group_id)
7373
.arg = group,
7474
},
7575
},
76-
.depends = SLEEP_RETENTION_MODULE_BM_CLOCK_SYSTEM
76+
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
7777
};
7878
// we only do retention init here. Allocate retention module in the unit initialization
7979
if (sleep_retention_module_init(module, &init_param) != ESP_OK) {
@@ -140,10 +140,10 @@ void mcpwm_release_group_handle(mcpwm_group_t *group)
140140
}
141141
#if MCPWM_USE_RETENTION_LINK
142142
const periph_retention_module_t module_id = mcpwm_reg_retention_info[group_id].retention_module;
143-
if (sleep_retention_get_created_modules() & BIT(module_id)) {
143+
if (sleep_retention_is_module_created(module_id)) {
144144
sleep_retention_module_free(module_id);
145145
}
146-
if (sleep_retention_get_inited_modules() & BIT(module_id)) {
146+
if (sleep_retention_is_module_inited(module_id)) {
147147
sleep_retention_module_deinit(module_id);
148148
}
149149
#endif // MCPWM_USE_RETENTION_LINK
@@ -305,7 +305,7 @@ void mcpwm_create_retention_module(mcpwm_group_t *group)
305305
int group_id = group->group_id;
306306
sleep_retention_module_t module_id = mcpwm_reg_retention_info[group_id].retention_module;
307307
_lock_acquire(&s_platform.mutex);
308-
if ((sleep_retention_get_inited_modules() & BIT(module_id)) && !(sleep_retention_get_created_modules() & BIT(module_id))) {
308+
if (sleep_retention_is_module_inited(module_id) && !sleep_retention_is_module_created(module_id)) {
309309
if (sleep_retention_module_allocate(module_id) != ESP_OK) {
310310
// even though the sleep retention module create failed, MCPWM driver should still work, so just warning here
311311
ESP_LOGW(TAG, "create retention module failed, power domain can't turn off");

components/esp_driver_parlio/src/parlio_common.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ parlio_group_t *parlio_acquire_group_handle(int group_id)
5656
.arg = group,
5757
},
5858
},
59-
.depends = SLEEP_RETENTION_MODULE_BM_CLOCK_SYSTEM
59+
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
6060
};
6161
// we only do retention init here. Allocate retention module in the unit initialization
6262
if (sleep_retention_module_init(module_id, &init_param) != ESP_OK) {
@@ -107,11 +107,11 @@ void parlio_release_group_handle(parlio_group_t *group)
107107
if (do_deinitialize) {
108108
#if PARLIO_USE_RETENTION_LINK
109109
const periph_retention_module_t module_id = parlio_reg_retention_info[group_id].retention_module;
110-
if (sleep_retention_get_created_modules() & BIT(module_id)) {
111-
assert(sleep_retention_get_inited_modules() & BIT(module_id));
110+
if (sleep_retention_is_module_created(module_id)) {
111+
assert(sleep_retention_is_module_inited(module_id));
112112
sleep_retention_module_free(module_id);
113113
}
114-
if (sleep_retention_get_inited_modules() & BIT(module_id)) {
114+
if (sleep_retention_is_module_inited(module_id)) {
115115
sleep_retention_module_deinit(module_id);
116116
}
117117
#endif // PARLIO_USE_RETENTION_LINK
@@ -195,7 +195,7 @@ void parlio_create_retention_module(parlio_group_t *group)
195195
sleep_retention_module_t module_id = parlio_reg_retention_info[group_id].retention_module;
196196

197197
_lock_acquire(&s_platform.mutex);
198-
if ((sleep_retention_get_inited_modules() & BIT(module_id)) && !(sleep_retention_get_created_modules() & BIT(module_id))) {
198+
if (sleep_retention_is_module_inited(module_id) && !sleep_retention_is_module_created(module_id)) {
199199
if (sleep_retention_module_allocate(module_id) != ESP_OK) {
200200
// even though the sleep retention module create failed, PARLIO driver should still work, so just warning here
201201
ESP_LOGW(TAG, "create retention module failed, power domain can't turn off");

components/esp_driver_pcnt/src/pulse_cnt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ static pcnt_group_t *pcnt_acquire_group_handle(int group_id)
881881
.arg = group,
882882
},
883883
},
884-
.depends = SLEEP_RETENTION_MODULE_BM_CLOCK_SYSTEM
884+
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
885885
};
886886
// we only do retention init here. Allocate retention module in the unit initialization
887887
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)
928928
if (do_deinitialize) {
929929
#if PCNT_USE_RETENTION_LINK
930930
const periph_retention_module_t module_id = pcnt_reg_retention_info[group_id].retention_module;
931-
if (sleep_retention_get_inited_modules() & BIT(module_id)) {
931+
if (sleep_retention_is_module_inited(module_id)) {
932932
sleep_retention_module_deinit(module_id);
933933
}
934934
#endif // PCNT_USE_RETENTION_LINK

0 commit comments

Comments
 (0)