rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
link_update_image.h
Go to the documentation of this file.
1
24#ifndef RCBENCH_LINK_UPDATE_IMAGE_H
25#define RCBENCH_LINK_UPDATE_IMAGE_H
26
27#include <stdbool.h>
28#include <stdint.h>
29
30#include "link_sha256.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
37#define LINK_IMAGE_SCAN_BYTES 4096u
39#define LINK_IMAGE_MAX_BLOCKS 8u
41#define LINK_IMAGE_TBYB_BIT 0x80u
42
53int32_t link_update_tbyb_byte(const uint8_t *img, uint32_t len);
54
60typedef struct {
61 link_sha256_t sha;
62 uint32_t pos;
63 uint32_t len;
64 int32_t flag_at;
65 bool flag_set;
67
76void link_image_hash_begin(link_image_hash_t *h, uint32_t len,
77 int32_t flag_at, bool flag_set);
78
89uint8_t link_image_byte(const uint8_t *img, uint32_t at, int32_t flag_at,
90 bool flag_set);
91
103bool link_image_hash_step(link_image_hash_t *h, const uint8_t *src,
104 uint32_t n);
105
113 uint8_t out[LINK_SHA256_BYTES]);
114
125void link_update_build_hash(const uint8_t *img, uint32_t len,
126 uint8_t out[LINK_SHA256_BYTES]);
127
128#ifdef __cplusplus
129}
130#endif
131
132#endif /* RCBENCH_LINK_UPDATE_IMAGE_H */