Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
patch.h
Go to the documentation of this file.
1
14
15#ifndef INFUSE_SDK_INCLUDE_INFUSE_PATCH_BINARY_H_
16#define INFUSE_SDK_INCLUDE_INFUSE_PATCH_BINARY_H_
17
18#include <stdint.h>
19
20#include <zephyr/storage/flash_map.h>
21#include <zephyr/storage/stream_flash.h>
22#include <zephyr/toolchain.h>
23
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
36
38#define CPATCH_MAGIC_NUMBER 0xBA854092
39
43 uint32_t length;
45 uint32_t crc;
46} __packed;
47
65
74typedef void (*cpatch_progress_cb_t)(size_t output_offset);
75
92int cpatch_patch_start(const struct flash_area *input, const struct flash_area *patch,
93 struct cpatch_header *header);
94
111int cpatch_patch_apply(const struct flash_area *input, const struct flash_area *patch,
112 struct stream_flash_ctx *output, struct cpatch_header *header,
113 infuse_progress_cb_t progress_cb);
114
118
119#ifdef __cplusplus
120}
121#endif
122
123#endif /* INFUSE_SDK_INCLUDE_INFUSE_PATCH_BINARY_H_ */
int cpatch_patch_start(const struct flash_area *input, const struct flash_area *patch, struct cpatch_header *header)
Validate patch file and input data region.
int cpatch_patch_apply(const struct flash_area *input, const struct flash_area *patch, struct stream_flash_ctx *output, struct cpatch_header *header, infuse_progress_cb_t progress_cb)
Create an output file by applying a patch file to an input file.
void(* cpatch_progress_cb_t)(size_t output_offset)
Patching output progress callback.
Definition patch.h:74
void(* infuse_progress_cb_t)(uint32_t progress, uint32_t total)
Common progress callback type.
Definition progress_cb.h:32
Common progress callback.
Expected values for various memory regions.
Definition patch.h:41
uint32_t crc
CRC32-IEEE of the memory region.
Definition patch.h:45
uint32_t length
Length of the memory region in bytes.
Definition patch.h:43
CPatch file header.
Definition patch.h:49
uint8_t version_major
Major version number of CPatch algorithm this file was generated for.
Definition patch.h:53
uint8_t version_minor
Minor version number of CPatch algorithm this file was generated for.
Definition patch.h:55
uint32_t magic_value
Expected to match CPATCH_MAGIC_NUMBER.
Definition patch.h:51
struct cpatch_array_validation output_file
Output file validation.
Definition patch.h:59
struct cpatch_array_validation patch_file
Patch data validation.
Definition patch.h:61
uint32_t header_crc
CRC32-IEEE of the preceding data in the header.
Definition patch.h:63
struct cpatch_array_validation input_file
Input file validation.
Definition patch.h:57