mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 12:35:28 +00:00
sleep: fix deadlock in esp_timer_impl_advance after light sleep
When light sleep is started, the other CPU gets halted using DPORT stall mechanism. This can happen while it is inside an esp_timer critical section, which may lead to a deadlock. This change adds functions to take and release esp_timer lock before entering DPORT critical section, preventing the deadlock.
This commit is contained in:
@@ -84,3 +84,18 @@ uint64_t esp_timer_impl_get_time();
|
||||
* @return minimal period of periodic timer, in microseconds
|
||||
*/
|
||||
uint64_t esp_timer_impl_get_min_period_us();
|
||||
|
||||
/**
|
||||
* @brief obtain internal critical section used esp_timer implementation
|
||||
* This can be used when a sequence of calls to esp_timer has to be made,
|
||||
* and it is necessary that the state of the timer is consistent between
|
||||
* the calls. Should be treated in the same way as a spinlock.
|
||||
* Call esp_timer_impl_unlock to release the lock
|
||||
*/
|
||||
void esp_timer_impl_lock();
|
||||
|
||||
|
||||
/**
|
||||
* @brief counterpart of esp_timer_impl_lock
|
||||
*/
|
||||
void esp_timer_impl_unlock();
|
||||
|
Reference in New Issue
Block a user