unleashed-firmware/applications/updater/util/update_task.h
hedger 7ce305fca3
[FL-2269] Core2 OTA (#1144)
* C2OTA: wip
* Update Cube to 1.13.3
* Fixed prio
* Functional Core2 updater
* Removed hardware CRC usage; code cleanup & linter fixes
* Moved hardcoded stack params to copro.mk
* Fixing CI bundling of core2 fw
* Removed last traces of hardcoded radio stack
* OB processing draft
* Python scripts cleanup
* Support for comments in ob data
* Sacrificed SD card icon in favor of faster update. Waiting for Storage fix
* Additional handling for OB mismatched values
* Description for new furi_hal apis; spelling fixes
* Rework of OB write, WIP
* Properly restarting OB verification loop
* Split update_task_workers.c
* Checking OBs after enabling post-update mode
* Moved OB verification before flashing
* Removed ob.data for custom stacks
* Fixed progress calculation for OB
* Removed unnecessary OB mask cast

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2022-04-27 18:53:48 +03:00

70 lines
No EOL
1.6 KiB
C

#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <update_util/update_manifest.h>
#include <stdint.h>
#include <stdbool.h>
#include <m-string.h>
#define UPDATE_DELAY_OPERATION_OK 600
#define UPDATE_DELAY_OPERATION_ERROR INT_MAX
typedef enum {
UpdateTaskStageProgress,
UpdateTaskStageReadManifest,
UpdateTaskStageValidateDFUImage,
UpdateTaskStageFlashWrite,
UpdateTaskStageFlashValidate,
UpdateTaskStageRadioImageValidate,
UpdateTaskStageRadioErase,
UpdateTaskStageRadioWrite,
UpdateTaskStageRadioInstall,
UpdateTaskStageRadioBusy,
UpdateTaskStageOBValidation,
UpdateTaskStageLfsBackup,
UpdateTaskStageLfsRestore,
UpdateTaskStageResourcesUpdate,
UpdateTaskStageCompleted,
UpdateTaskStageError,
UpdateTaskStageOBError
} UpdateTaskStage;
typedef struct {
UpdateTaskStage stage;
uint8_t progress;
uint8_t current_stage_idx;
uint8_t total_stages;
string_t status;
} UpdateTaskState;
typedef struct UpdateTask UpdateTask;
typedef void (*updateProgressCb)(
const char* status,
const uint8_t stage_pct,
const uint8_t idx_stage,
const uint8_t total_stages,
bool failed,
void* state);
UpdateTask* update_task_alloc();
void update_task_free(UpdateTask* update_task);
void update_task_set_progress_cb(UpdateTask* update_task, updateProgressCb cb, void* state);
bool update_task_start(UpdateTask* update_task);
bool update_task_is_running(UpdateTask* update_task);
UpdateTaskState const* update_task_get_state(UpdateTask* update_task);
UpdateManifest const* update_task_get_manifest(UpdateTask* update_task);
#ifdef __cplusplus
}
#endif