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
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
24#ifdef __cplusplus
25extern "C" {
26#endif
27
35#define CPATCH_MAGIC_NUMBER 0xBA854092
36
39 /* Length of the memory region in bytes */
40 uint32_t length;
41 /* CRC32-IEEE of the memory region */
42 uint32_t crc;
43} __packed;
44
47 /* Expected to match @ref CPATCH_MAGIC_NUMBER */
48 uint32_t magic_value;
49 /* Major version number of CPatch algorithm this file was generated for */
51 /* Minor version number of CPatch algorithm this file was generated for */
53 /* Input file validation */
55 /* Output file validation */
57 /* Patch data validation */
59 /* CRC32-IEEE of the preceding data in the header */
60 uint32_t header_crc;
61} __packed;
62
71typedef void (*cpatch_progress_cb_t)(size_t output_offset);
72
89int cpatch_patch_start(const struct flash_area *input, const struct flash_area *patch,
90 struct cpatch_header *header);
91
108int cpatch_patch_apply(const struct flash_area *input, const struct flash_area *patch,
109 struct stream_flash_ctx *output, struct cpatch_header *header,
110 cpatch_progress_cb_t progress_cb);
111
116#ifdef __cplusplus
117}
118#endif
119
120#endif /* INFUSE_SDK_INCLUDE_INFUSE_PATCH_BINARY_H_ */
int cpatch_patch_apply(const struct flash_area *input, const struct flash_area *patch, struct stream_flash_ctx *output, struct cpatch_header *header, cpatch_progress_cb_t progress_cb)
Create an output file by applying a patch file to an input file.
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.
void(* cpatch_progress_cb_t)(size_t output_offset)
Patching output progress callback.
Definition patch.h:71
Expected values for various memory regions.
Definition patch.h:38
uint32_t crc
Definition patch.h:42
uint32_t length
Definition patch.h:40
CPatch file header.
Definition patch.h:46
uint8_t version_major
Definition patch.h:50
uint8_t version_minor
Definition patch.h:52
uint32_t magic_value
Definition patch.h:48
struct cpatch_array_validation output_file
Definition patch.h:56
struct cpatch_array_validation patch_file
Definition patch.h:58
uint32_t header_crc
Definition patch.h:60
struct cpatch_array_validation input_file
Definition patch.h:54