esp_timer: Adds IRAM_ATTR for esp_timer_restart and esp_timer_is_active

Closes https://github.com/espressif/esp-idf/issues/10522
Closes https://github.com/espressif/esp-idf/issues/10859
This commit is contained in:
KonstantinKondrashov 2023-03-01 19:54:38 +08:00
parent ef4b1b7704
commit b1315b27c5
2 changed files with 11 additions and 6 deletions

View File

@ -47,10 +47,6 @@ entries:
archive: libesp_timer.a archive: libesp_timer.a
entries: entries:
if PM_SLP_IRAM_OPT = y: if PM_SLP_IRAM_OPT = y:
# esp_timer_restart is called from task_wdt_timer_feed, so put it
# in IRAM if task_wdt_timer_feed itself is in IRAM.
if ESP_TASK_WDT_USE_ESP_TIMER = y:
esp_timer:esp_timer_restart (noflash)
if ESP_TIMER_IMPL_TG0_LAC = y: if ESP_TIMER_IMPL_TG0_LAC = y:
esp_timer_impl_lac:esp_timer_impl_lock (noflash) esp_timer_impl_lac:esp_timer_impl_lock (noflash)
esp_timer_impl_lac:esp_timer_impl_unlock (noflash) esp_timer_impl_lac:esp_timer_impl_unlock (noflash)

View File

@ -141,7 +141,13 @@ esp_err_t esp_timer_create(const esp_timer_create_args_t* args,
return ESP_OK; return ESP_OK;
} }
esp_err_t esp_timer_restart(esp_timer_handle_t timer, uint64_t timeout_us) /*
* We have placed this function in IRAM to ensure consistency with the esp_timer API.
* esp_timer_start_once, esp_timer_start_periodic and esp_timer_stop are in IRAM.
* But actually in IDF esp_timer_restart is used only in one place, which requires keeping
* in IRAM when PM_SLP_IRAM_OPT = y and ESP_TASK_WDT USE ESP_TIMER = y.
*/
esp_err_t IRAM_ATTR esp_timer_restart(esp_timer_handle_t timer, uint64_t timeout_us)
{ {
esp_err_t ret = ESP_OK; esp_err_t ret = ESP_OK;
@ -704,7 +710,10 @@ esp_err_t IRAM_ATTR esp_timer_get_expiry_time(esp_timer_handle_t timer, uint64_t
return ESP_OK; return ESP_OK;
} }
bool esp_timer_is_active(esp_timer_handle_t timer) bool IRAM_ATTR esp_timer_is_active(esp_timer_handle_t timer)
{ {
if (timer == NULL) {
return false;
}
return timer_armed(timer); return timer_armed(timer);
} }