Lines Matching refs:handle
76 esp_err_t esp_pm_lock_delete(esp_pm_lock_handle_t handle) in esp_pm_lock_delete() argument
82 if (handle == NULL) { in esp_pm_lock_delete()
86 if (handle->count > 0) { in esp_pm_lock_delete()
90 SLIST_REMOVE(&s_list, handle, esp_pm_lock, next); in esp_pm_lock_delete()
92 free(handle); in esp_pm_lock_delete()
96 esp_err_t IRAM_ATTR esp_pm_lock_acquire(esp_pm_lock_handle_t handle) in esp_pm_lock_acquire() argument
102 if (handle == NULL) { in esp_pm_lock_acquire()
106 portENTER_CRITICAL_SAFE(&handle->spinlock); in esp_pm_lock_acquire()
107 if (handle->count++ == 0) { in esp_pm_lock_acquire()
112 esp_pm_impl_switch_mode(handle->mode, MODE_LOCK, now); in esp_pm_lock_acquire()
114 handle->last_taken = now; in esp_pm_lock_acquire()
115 handle->times_taken++; in esp_pm_lock_acquire()
118 portEXIT_CRITICAL_SAFE(&handle->spinlock); in esp_pm_lock_acquire()
122 esp_err_t IRAM_ATTR esp_pm_lock_release(esp_pm_lock_handle_t handle) in esp_pm_lock_release() argument
128 if (handle == NULL) { in esp_pm_lock_release()
132 portENTER_CRITICAL_SAFE(&handle->spinlock); in esp_pm_lock_release()
133 if (handle->count == 0) { in esp_pm_lock_release()
137 if (--handle->count == 0) { in esp_pm_lock_release()
141 handle->time_held += now - handle->last_taken; in esp_pm_lock_release()
143 esp_pm_impl_switch_mode(handle->mode, MODE_UNLOCK, now); in esp_pm_lock_release()
146 portEXIT_CRITICAL_SAFE(&handle->spinlock); in esp_pm_lock_release()