mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 02:37:19 +02:00
feat(ble): use new section for ble sleep on ESP32-C2
(cherry picked from commit ce4e012c8b
)
Co-authored-by: cjin <jinchen@espressif.com>
This commit is contained in:
@ -682,6 +682,11 @@ config BT_LE_PLACE_CONN_RELATED_INTO_IRAM
|
||||
depends on BT_CTRL_RUN_IN_FLASH_ONLY
|
||||
default n
|
||||
|
||||
config BT_LE_PLACE_SLEEP_RELATED_INTO_IRAM
|
||||
bool
|
||||
depends on BT_CTRL_RUN_IN_FLASH_ONLY && BT_LE_SLEEP_ENABLE
|
||||
default y
|
||||
|
||||
config BT_LE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS
|
||||
bool "Enable enhanced Access Address check in CONNECT_IND"
|
||||
default n
|
||||
|
@ -592,13 +592,6 @@ static int esp_intr_free_wrapper(void **ret_handle)
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
void sleep_modem_light_sleep_overhead_set(uint32_t overhead)
|
||||
{
|
||||
esp_ble_set_wakeup_overhead(overhead);
|
||||
}
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
|
||||
modem_clock_lpclk_src_t esp_bt_get_lpclk_src(void)
|
||||
{
|
||||
return s_bt_lpclk_src;
|
||||
@ -613,7 +606,7 @@ void esp_bt_set_lpclk_src(modem_clock_lpclk_src_t clk_src)
|
||||
s_bt_lpclk_src = clk_src;
|
||||
}
|
||||
|
||||
IRAM_ATTR void controller_sleep_cb(uint32_t enable_tick, void *arg)
|
||||
void controller_sleep_cb(uint32_t enable_tick, void *arg)
|
||||
{
|
||||
if (!s_ble_active) {
|
||||
return;
|
||||
@ -626,7 +619,7 @@ IRAM_ATTR void controller_sleep_cb(uint32_t enable_tick, void *arg)
|
||||
s_ble_active = false;
|
||||
}
|
||||
|
||||
IRAM_ATTR void controller_wakeup_cb(void *arg)
|
||||
void controller_wakeup_cb(void *arg)
|
||||
{
|
||||
if (s_ble_active) {
|
||||
return;
|
||||
@ -666,7 +659,7 @@ esp_err_t controller_sleep_init(modem_clock_lpclk_src_t slow_clk_src)
|
||||
esp_sleep_enable_bt_wakeup();
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "Enable light sleep, the wake up source is BLE timer");
|
||||
|
||||
rc = esp_pm_register_inform_out_light_sleep_overhead_callback(sleep_modem_light_sleep_overhead_set);
|
||||
rc = esp_pm_register_inform_out_light_sleep_overhead_callback(esp_ble_set_wakeup_overhead);
|
||||
if (rc != ESP_OK) {
|
||||
goto error;
|
||||
}
|
||||
@ -676,7 +669,7 @@ esp_err_t controller_sleep_init(modem_clock_lpclk_src_t slow_clk_src)
|
||||
error:
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
esp_sleep_disable_bt_wakeup();
|
||||
esp_pm_unregister_inform_out_light_sleep_overhead_callback(sleep_modem_light_sleep_overhead_set);
|
||||
esp_pm_unregister_inform_out_light_sleep_overhead_callback(esp_ble_set_wakeup_overhead);
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
/*lock should release first and then delete*/
|
||||
if (s_pm_lock != NULL) {
|
||||
@ -693,7 +686,7 @@ void controller_sleep_deinit(void)
|
||||
r_ble_rtc_wake_up_state_clr();
|
||||
esp_sleep_disable_bt_wakeup();
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_AUTO);
|
||||
esp_pm_unregister_inform_out_light_sleep_overhead_callback(sleep_modem_light_sleep_overhead_set);
|
||||
esp_pm_unregister_inform_out_light_sleep_overhead_callback(esp_ble_set_wakeup_overhead);
|
||||
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
/*lock should release first and then delete*/
|
||||
|
@ -10,6 +10,10 @@ entries:
|
||||
entries:
|
||||
.conn_iram1+
|
||||
|
||||
[sections:bt_sleep_iram_text]
|
||||
entries:
|
||||
.sleep_iram1+
|
||||
|
||||
[sections:bt_bss]
|
||||
entries:
|
||||
.bss+
|
||||
@ -39,6 +43,10 @@ entries:
|
||||
else:
|
||||
bt_conn_iram_text -> flash_text
|
||||
bt_isr_iram_text -> flash_text
|
||||
if BT_LE_PLACE_SLEEP_RELATED_INTO_IRAM = y:
|
||||
bt_sleep_iram_text -> iram0_bt_text
|
||||
else:
|
||||
bt_sleep_iram_text -> flash_text
|
||||
else:
|
||||
bt_iram_text -> iram0_bt_text
|
||||
bt_bss -> dram0_bt_bss
|
||||
@ -47,6 +55,7 @@ entries:
|
||||
|
||||
bt_conn_iram_text -> iram0_bt_text
|
||||
bt_isr_iram_text -> iram0_bt_text
|
||||
bt_sleep_iram_text -> iram0_bt_text
|
||||
|
||||
# For the following fragments, order matters for
|
||||
# 'ALIGN(4) ALIGN(4, post) SURROUND(sym)', which generates:
|
||||
|
Reference in New Issue
Block a user