rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
fw_boot.h
1/*
2 * The first start after an update: keep the new build, or go back.
3 *
4 * The bootloader is built with rollback: a build's first start is a trial
5 * (pending verify), and a restart while it still is starts the build
6 * before it. fw_boot_decide() is the order of the calls that settle the
7 * trial; the calls themselves are the panel's (fw_ota.c), so the host
8 * suite runs the order against fakes.
9 *
10 * A failed start is never kept. When marking it invalid returns -- the
11 * call restarts on success -- the panel restarts anyway, which leaves the
12 * trial unconfirmed and so goes back too. Marking a good start valid can
13 * fail: the build then runs this once, and the next start goes back.
14 *
15 * Pure C, no ESP-IDF (Espressif Internet-of-Things Development Framework).
16 *
17 * SPDX-License-Identifier: MIT
18 */
19
20#ifndef RCBENCH_FW_BOOT_H
21#define RCBENCH_FW_BOOT_H
22
23#include <stdbool.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29typedef enum {
30 FW_BOOT_NORMAL = 0,
31 FW_BOOT_UPDATED,
32 FW_BOOT_ROLLED_BACK,
33 FW_BOOT_UNCONFIRMED,
34} fw_boot_t;
35
36typedef struct {
38 bool (*pending)(void *ctx);
40 void (*mark_invalid)(void *ctx);
42 bool (*mark_valid)(void *ctx);
44 void (*restart)(void *ctx);
46 bool (*last_invalid)(void *ctx);
47 void *ctx;
49
59fw_boot_t fw_boot_decide(const fw_boot_ops_t *ops, bool ui_up, bool noted);
60
61#ifdef __cplusplus
62}
63#endif
64
65#endif /* RCBENCH_FW_BOOT_H */
Definition fw_boot.h:36
bool(*) last_invalid(void *ctx)
Definition fw_boot.h:46
void(*) mark_invalid(void *ctx)
Definition fw_boot.h:40
bool(*) mark_valid(void *ctx)
Definition fw_boot.h:42
bool(*) pending(void *ctx)
Definition fw_boot.h:38
void(*) restart(void *ctx)
Definition fw_boot.h:44