power_management: port*_CRITICAL vanilla FreeRTOS compliance
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
This commit is contained in:
parent
db8041a67f
commit
a190b527ac
2 changed files with 6 additions and 9 deletions
|
@ -265,7 +265,7 @@ void IRAM_ATTR esp_pm_impl_switch_mode(pm_mode_t mode,
|
|||
{
|
||||
bool need_switch = false;
|
||||
uint32_t mode_mask = BIT(mode);
|
||||
portENTER_CRITICAL(&s_switch_lock);
|
||||
portENTER_CRITICAL_SAFE(&s_switch_lock);
|
||||
uint32_t count;
|
||||
if (lock_or_unlock == MODE_LOCK) {
|
||||
count = ++s_mode_lock_counts[mode];
|
||||
|
@ -292,7 +292,7 @@ void IRAM_ATTR esp_pm_impl_switch_mode(pm_mode_t mode,
|
|||
s_last_mode_change_time = now;
|
||||
#endif // WITH_PROFILING
|
||||
}
|
||||
portEXIT_CRITICAL(&s_switch_lock);
|
||||
portEXIT_CRITICAL_SAFE(&s_switch_lock);
|
||||
if (need_switch && new_mode != s_mode) {
|
||||
do_switch(new_mode);
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ esp_err_t IRAM_ATTR esp_pm_lock_acquire(esp_pm_lock_handle_t handle)
|
|||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
portENTER_CRITICAL(&handle->spinlock);
|
||||
portENTER_CRITICAL_SAFE(&handle->spinlock);
|
||||
if (handle->count++ == 0) {
|
||||
pm_time_t now = 0;
|
||||
#ifdef WITH_PROFILING
|
||||
|
@ -123,7 +123,7 @@ esp_err_t IRAM_ATTR esp_pm_lock_acquire(esp_pm_lock_handle_t handle)
|
|||
handle->times_taken++;
|
||||
#endif
|
||||
}
|
||||
portEXIT_CRITICAL(&handle->spinlock);
|
||||
portEXIT_CRITICAL_SAFE(&handle->spinlock);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ esp_err_t IRAM_ATTR esp_pm_lock_release(esp_pm_lock_handle_t handle)
|
|||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
esp_err_t ret = ESP_OK;
|
||||
portENTER_CRITICAL(&handle->spinlock);
|
||||
portENTER_CRITICAL_SAFE(&handle->spinlock);
|
||||
if (handle->count == 0) {
|
||||
ret = ESP_ERR_INVALID_STATE;
|
||||
goto out;
|
||||
|
@ -151,11 +151,10 @@ esp_err_t IRAM_ATTR esp_pm_lock_release(esp_pm_lock_handle_t handle)
|
|||
esp_pm_impl_switch_mode(handle->mode, MODE_UNLOCK, now);
|
||||
}
|
||||
out:
|
||||
portEXIT_CRITICAL(&handle->spinlock);
|
||||
portEXIT_CRITICAL_SAFE(&handle->spinlock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
esp_err_t esp_pm_dump_locks(FILE* stream)
|
||||
{
|
||||
#ifndef CONFIG_PM_ENABLE
|
||||
|
@ -201,5 +200,3 @@ esp_err_t esp_pm_dump_locks(FILE* stream)
|
|||
#endif
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue