Chapter 2. API Reference
• lock_type: Power management constraint which the lock should control
• arg: argument, value depends on lock_type, see esp_pm_lock_type_t
• name: arbitrary string identifying the lock (e.g."wifi" or"spi" ). Used by the esp_pm_dump_locks
function to list existing locks. May be set to NULL. If not set to NULL, must point to a string which
is valid for the lifetime of the lock.
• [out]
esp_pm_lock_delete, esp_pm_lock_acquire, esp_pm_lock_release. Must not be NULL.
esp_err_t esp_pm_lock_acquire(esp_pm_lock_handle_t
Take a power management lock.
Once the lock is taken, power management algorithm will not switch to the mode specified in a call to
esp_pm_lock_create, or any of the lower power modes (higher numeric values of 'mode').
The lock is recursive, in the sense that if esp_pm_lock_acquire is called a number of times,
esp_pm_lock_release has to be called the same number of times in order to release the lock.
This function may be called from an ISR.
This function is not thread-safe w.r.t. calls to other esp_pm_lock_* functions for the same handle.
Return
• ESP_OK on success
• ESP_ERR_INVALID_ARG if the handle is invalid
• ESP_ERR_NOT_SUPPORTED if CONFIG_PM_ENABLE is not enabled in sdkconfig
Parameters
• handle: handle obtained from esp_pm_lock_create function
esp_err_t esp_pm_lock_release(esp_pm_lock_handle_t
Release the lock taken using esp_pm_lock_acquire.
Call to this functions removes power management restrictions placed when taking the lock.
Locks are recursive, so if esp_pm_lock_acquire is called a number of times, esp_pm_lock_release has to be
called the same number of times in order to actually release the lock.
This function may be called from an ISR.
This function is not thread-safe w.r.t. calls to other esp_pm_lock_* functions for the same handle.
Return
• ESP_OK on success
• ESP_ERR_INVALID_ARG if the handle is invalid
• ESP_ERR_INVALID_STATE if lock is not acquired
• ESP_ERR_NOT_SUPPORTED if CONFIG_PM_ENABLE is not enabled in sdkconfig
Parameters
• handle: handle obtained from esp_pm_lock_create function
esp_err_t esp_pm_lock_delete(esp_pm_lock_handle_t
Delete a lock created using esp_pm_lock.
The lock must be released before calling this function.
This function must not be called from an ISR.
Return
• ESP_OK on success
• ESP_ERR_INVALID_ARG if the handle argument is NULL
• ESP_ERR_INVALID_STATE if the lock is still acquired
• ESP_ERR_NOT_SUPPORTED if CONFIG_PM_ENABLE is not enabled in sdkconfig
Parameters
• handle: handle obtained from esp_pm_lock_create function
esp_err_t
esp_pm_dump_locks(FILE *stream)
Dump the list of all locks to stderr
This function dumps debugging information about locks created using esp_pm_lock_create to an output stream.
Espressif Systems
out_handle: handle returned from this function. Use this handle when calling
Submit Document Feedback
handle)
handle)
handle)
1034
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?