Lines Matching refs:handle
84 esp_err_t esp_pm_lock_delete(esp_pm_lock_handle_t handle) in esp_pm_lock_delete() argument
90 if (handle == NULL) { in esp_pm_lock_delete()
94 if (handle->count > 0) { in esp_pm_lock_delete()
98 SLIST_REMOVE(&s_list, handle, esp_pm_lock, next); in esp_pm_lock_delete()
100 free(handle); in esp_pm_lock_delete()
104 esp_err_t IRAM_ATTR esp_pm_lock_acquire(esp_pm_lock_handle_t handle) in esp_pm_lock_acquire() argument
110 if (handle == NULL) { in esp_pm_lock_acquire()
114 portENTER_CRITICAL_SAFE(&handle->spinlock); in esp_pm_lock_acquire()
115 if (handle->count++ == 0) { in esp_pm_lock_acquire()
120 esp_pm_impl_switch_mode(handle->mode, MODE_LOCK, now); in esp_pm_lock_acquire()
122 handle->last_taken = now; in esp_pm_lock_acquire()
123 handle->times_taken++; in esp_pm_lock_acquire()
126 portEXIT_CRITICAL_SAFE(&handle->spinlock); in esp_pm_lock_acquire()
130 esp_err_t IRAM_ATTR esp_pm_lock_release(esp_pm_lock_handle_t handle) in esp_pm_lock_release() argument
136 if (handle == NULL) { in esp_pm_lock_release()
140 portENTER_CRITICAL_SAFE(&handle->spinlock); in esp_pm_lock_release()
141 if (handle->count == 0) { in esp_pm_lock_release()
145 if (--handle->count == 0) { in esp_pm_lock_release()
149 handle->time_held += now - handle->last_taken; in esp_pm_lock_release()
151 esp_pm_impl_switch_mode(handle->mode, MODE_UNLOCK, now); in esp_pm_lock_release()
154 portEXIT_CRITICAL_SAFE(&handle->spinlock); in esp_pm_lock_release()