mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2025-02-28 13:17:10 +00:00
* toolbox: compress: moved decompressor implementation to separate func * toolbox: compress: callback-based api; cli: storage unpack command * toolbox: compress: separate r/w contexts for stream api * targets: f18: sync API * compress: naming fixes & cleanup * toolbox: compress: using hs buffer size for stream buffers * toolbox: tar: heatshrink stream mode * toolbox: compress: docs & small cleanup * toolbox: tar: header support for .hs; updater: now uses .hs for resources; .hs.tar: now rewindable * toolbox: compress: fixed hs stream tail handling * updater: reworked progress for resources cleanup; rebalanced stage weights * updater: single-pass decompression; scripts: print resources compression ratio * updater: fixed warnings * toolbox: tar: doxygen * docs: update * docs: info or tarhs format; scripts: added standalone compression/decompression tool for heatshrink-formatted streams * scripts: tarhs: fixed parameter handling * cli: storage extract command; toolbox: tar: guess type based on extension * unit_tests: added test for streamed raw hs decompressor `compress_decode_streamed` * unit_tests: compress: added extraction test for .tar.hs * rpc: autodetect compressed archives * scripts: minor cleanup of common parts * scripts: update: now using in-memory intermediate tar stream * scripts: added hs.py wrapper for heatshrink-related ops (single object and directory-as-tar compression) * scripts: naming fixes * Toolbox: export compress_config_heatshrink_default as const symbol * Toolbox: fix various types naming * Toolbox: more of types naming fixes * Toolbox: use size_t in compress io callbacks and structures * UnitTests: update to match new compress API * Toolbox: proper path_extract_extension usage Co-authored-by: あく <alleteam@gmail.com>
90 lines
2.2 KiB
C
90 lines
2.2 KiB
C
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <update_util/update_manifest.h>
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
#define UPDATE_DELAY_OPERATION_OK 10
|
|
#define UPDATE_DELAY_OPERATION_ERROR INT_MAX
|
|
|
|
typedef enum {
|
|
UpdateTaskStageProgress = 0,
|
|
|
|
UpdateTaskStageReadManifest,
|
|
UpdateTaskStageLfsBackup,
|
|
|
|
UpdateTaskStageRadioImageValidate,
|
|
UpdateTaskStageRadioErase,
|
|
UpdateTaskStageRadioWrite,
|
|
UpdateTaskStageRadioInstall,
|
|
UpdateTaskStageRadioBusy,
|
|
|
|
UpdateTaskStageOBValidation,
|
|
|
|
UpdateTaskStageValidateDFUImage,
|
|
UpdateTaskStageFlashWrite,
|
|
UpdateTaskStageFlashValidate,
|
|
|
|
UpdateTaskStageLfsRestore,
|
|
UpdateTaskStageResourcesFileCleanup,
|
|
UpdateTaskStageResourcesDirCleanup,
|
|
UpdateTaskStageResourcesFileUnpack,
|
|
UpdateTaskStageSplashscreenInstall,
|
|
|
|
UpdateTaskStageCompleted,
|
|
UpdateTaskStageError,
|
|
UpdateTaskStageOBError,
|
|
UpdateTaskStageMAX
|
|
} UpdateTaskStage;
|
|
|
|
inline bool update_stage_is_error(const UpdateTaskStage stage) {
|
|
return stage >= UpdateTaskStageError;
|
|
}
|
|
|
|
typedef enum {
|
|
UpdateTaskStageGroupMisc = 0,
|
|
UpdateTaskStageGroupPreUpdate = 1 << 1,
|
|
UpdateTaskStageGroupFirmware = 1 << 2,
|
|
UpdateTaskStageGroupOptionBytes = 1 << 3,
|
|
UpdateTaskStageGroupRadio = 1 << 4,
|
|
UpdateTaskStageGroupPostUpdate = 1 << 5,
|
|
UpdateTaskStageGroupResources = 1 << 6,
|
|
UpdateTaskStageGroupSplashscreen = 1 << 7,
|
|
} UpdateTaskStageGroup;
|
|
|
|
typedef struct {
|
|
UpdateTaskStage stage;
|
|
uint8_t overall_progress, stage_progress;
|
|
FuriString* status;
|
|
UpdateTaskStageGroup groups;
|
|
uint32_t total_progress_points;
|
|
uint32_t completed_stages_points;
|
|
} UpdateTaskState;
|
|
|
|
typedef struct UpdateTask UpdateTask;
|
|
|
|
typedef void (
|
|
*updateProgressCb)(const char* status, const uint8_t stage_pct, bool failed, void* state);
|
|
|
|
UpdateTask* update_task_alloc(void);
|
|
|
|
void update_task_free(UpdateTask* update_task);
|
|
|
|
void update_task_set_progress_cb(UpdateTask* update_task, updateProgressCb cb, void* state);
|
|
|
|
void 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
|