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
35
37#define CPATCH_MAGIC_NUMBER 0xBA854092
38
41 /* Length of the memory region in bytes */
42 uint32_t length;
43 /* CRC32-IEEE of the memory region */
44 uint32_t crc;
45} __packed;
46
49 /* Expected to match @ref CPATCH_MAGIC_NUMBER */
50 uint32_t magic_value;
51 /* Major version number of CPatch algorithm this file was generated for */
53 /* Minor version number of CPatch algorithm this file was generated for */
55 /* Input file validation */
57 /* Output file validation */
59 /* Patch data validation */
61 /* CRC32-IEEE of the preceding data in the header */
62 uint32_t header_crc;
63} __packed;
64
73typedef void (*cpatch_progress_cb_t)(size_t output_offset);
74
91int cpatch_patch_start(const struct flash_area *input, const struct flash_area *patch,
92 struct cpatch_header *header);
93
110int cpatch_patch_apply(const struct flash_area *input, const struct flash_area *patch,
111 struct stream_flash_ctx *output, struct cpatch_header *header,
112 infuse_progress_cb_t progress_cb);
113
117
118#ifdef __cplusplus
119}
120#endif
121
122#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:73
Common progress callback.
void(* infuse_progress_cb_t)(uint32_t progress, uint32_t total)
Common progress callback type definition.
Definition progress_cb.h:30
Expected values for various memory regions.
Definition patch.h:40
uint32_t crc
Definition patch.h:44
uint32_t length
Definition patch.h:42
CPatch file header.
Definition patch.h:48
uint8_t version_major
Definition patch.h:52
uint8_t version_minor
Definition patch.h:54
uint32_t magic_value
Definition patch.h:50
struct cpatch_array_validation output_file
Definition patch.h:58
struct cpatch_array_validation patch_file
Definition patch.h:60
uint32_t header_crc
Definition patch.h:62
struct cpatch_array_validation input_file
Definition patch.h:56