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>
pull/6275/head
lucastcox 2020-11-23 10:10:25 +05:30 zatwierdzone przez Shubham Kulkarni
rodzic 820e092a8d
commit d5d722c66f
2 zmienionych plików z 33 dodań i 4 usunięć

Wyświetl plik

@ -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;
}
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;
esp_err_t ret = ESP_OK;
ota_ops_entry_t *it = NULL;
for (it = LIST_FIRST(&s_ota_ops_entries_head); it != NULL; it = LIST_NEXT(it, entries)) {
if (it->handle == handle) {
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) {
return ESP_ERR_NOT_FOUND;

Wyświetl plik

@ -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);
/**
* @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
*