mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 12:14:32 +02:00
app_update: Add definition for esp_ota_abort
Closes: https://github.com/espressif/esp-idf/issues/5329 Merges: https://github.com/espressif/esp-idf/pull/5331 Signed-off-by: Shubham Kulkarni <shubham.kulkarni@espressif.com>
This commit is contained in:
committed by
Shubham Kulkarni
parent
820e092a8d
commit
d5d722c66f
@@ -302,16 +302,33 @@ esp_err_t esp_ota_write_with_offset(esp_ota_handle_t handle, const void *data, s
|
|||||||
return ESP_ERR_INVALID_ARG;
|
return ESP_ERR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t esp_ota_end(esp_ota_handle_t handle)
|
static ota_ops_entry_t *get_ota_ops_entry(esp_ota_handle_t handle)
|
||||||
{
|
{
|
||||||
ota_ops_entry_t *it;
|
ota_ops_entry_t *it = NULL;
|
||||||
esp_err_t ret = ESP_OK;
|
|
||||||
|
|
||||||
for (it = LIST_FIRST(&s_ota_ops_entries_head); it != NULL; it = LIST_NEXT(it, entries)) {
|
for (it = LIST_FIRST(&s_ota_ops_entries_head); it != NULL; it = LIST_NEXT(it, entries)) {
|
||||||
if (it->handle == handle) {
|
if (it->handle == handle) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return it;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t esp_ota_abort(esp_ota_handle_t handle)
|
||||||
|
{
|
||||||
|
ota_ops_entry_t *it = get_ota_ops_entry(handle);
|
||||||
|
|
||||||
|
if (it == NULL) {
|
||||||
|
return ESP_ERR_NOT_FOUND;
|
||||||
|
}
|
||||||
|
LIST_REMOVE(it, entries);
|
||||||
|
free(it);
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t esp_ota_end(esp_ota_handle_t handle)
|
||||||
|
{
|
||||||
|
ota_ops_entry_t *it = get_ota_ops_entry(handle);
|
||||||
|
esp_err_t ret = ESP_OK;
|
||||||
|
|
||||||
if (it == NULL) {
|
if (it == NULL) {
|
||||||
return ESP_ERR_NOT_FOUND;
|
return ESP_ERR_NOT_FOUND;
|
||||||
|
@@ -157,6 +157,18 @@ esp_err_t esp_ota_write_with_offset(esp_ota_handle_t handle, const void *data, s
|
|||||||
*/
|
*/
|
||||||
esp_err_t esp_ota_end(esp_ota_handle_t handle);
|
esp_err_t esp_ota_end(esp_ota_handle_t handle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Abort OTA update, free the handle and memory associated with it.
|
||||||
|
*
|
||||||
|
* @param handle obtained from esp_ota_begin().
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - ESP_OK: Handle and its associated memory is freed successfully.
|
||||||
|
* - ESP_ERR_NOT_FOUND: OTA handle was not found.
|
||||||
|
*/
|
||||||
|
esp_err_t esp_ota_abort(esp_ota_handle_t handle);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configure OTA data for a new boot partition
|
* @brief Configure OTA data for a new boot partition
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user