rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
fw_upload.h
Go to the documentation of this file.
1
25
26#ifndef RCBENCH_FW_UPLOAD_H
27#define RCBENCH_FW_UPLOAD_H
28
29#include <stdbool.h>
30#include <stdint.h>
31
32#include "fw_image.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
45
47typedef struct {
48 uint8_t *buf;
49 uint32_t cap;
50 uint32_t slot;
51 uint32_t bytes;
52 uint32_t done;
56 bool checking;
60
69void fw_upload_init(fw_upload_t *u, uint8_t *buf, uint32_t cap,
70 uint32_t slot);
71
81fw_err_t fw_upload_begin(fw_upload_t *u, uint32_t bytes);
82
91fw_err_t fw_upload_add(fw_upload_t *u, const uint8_t *data, uint32_t len);
92
101fw_err_t fw_upload_end(fw_upload_t *u, bool whole);
102
117fw_err_t fw_upload_seal(fw_upload_t *u, bool whole);
118
128 const fw_image_info_t *info);
129
137bool fw_upload_busy(const fw_upload_t *u);
138
145
151unsigned fw_upload_percent(const fw_upload_t *u);
152
153#ifdef __cplusplus
154}
155#endif
156
157#endif /* RCBENCH_FW_UPLOAD_H */
The panel's application image, read from memory: what it is, whether it is whole, and whether it is o...
fw_err_t
Definition fw_image.h:61
unsigned fw_upload_percent(const fw_upload_t *u)
Received of announced.
Definition fw_upload.c:130
void fw_upload_init(fw_upload_t *u, uint8_t *buf, uint32_t cap, uint32_t slot)
An upload into buf of cap bytes, for a slot of slot bytes: IDLE.
Definition fw_upload.c:12
bool fw_upload_busy(const fw_upload_t *u)
Whether the buffer is in use: bytes arriving, or a check under way. A caller frees the buffer of an u...
Definition fw_upload.c:117
fw_err_t fw_upload_begin(fw_upload_t *u, uint32_t bytes)
A source announces bytes.
Definition fw_upload.c:21
fw_err_t fw_upload_checked(fw_upload_t *u, fw_err_t e, const fw_image_info_t *info)
The second half: the answer of the check over a sealed upload.
Definition fw_upload.c:86
fw_err_t fw_upload_end(fw_upload_t *u, bool whole)
The source is done; the image is checked at once.
Definition fw_upload.c:105
fw_err_t fw_upload_add(fw_upload_t *u, const uint8_t *data, uint32_t len)
len more bytes.
Definition fw_upload.c:56
void fw_upload_discard(fw_upload_t *u)
Drop what is received or staged: IDLE. During a check, IDLE once fw_upload_checked() has its answer.
Definition fw_upload.c:122
fw_err_t fw_upload_seal(fw_upload_t *u, bool whole)
The first half of fw_upload_end(), for a check run without the caller's lock: the bytes are whole and...
Definition fw_upload.c:71
fw_up_state_t
Where an upload is.
Definition fw_upload.h:39
@ FW_UP_RECEIVING
Definition fw_upload.h:41
@ FW_UP_IDLE
Definition fw_upload.h:40
@ FW_UP_FAILED
Definition fw_upload.h:43
@ FW_UP_STAGED
Definition fw_upload.h:42
Definition fw_image.h:83
An upload into a buffer the caller owns.
Definition fw_upload.h:47
fw_image_info_t info
Definition fw_upload.h:55
fw_up_state_t state
Definition fw_upload.h:53
uint32_t done
Definition fw_upload.h:52
bool checking
Definition fw_upload.h:56
fw_err_t err
Definition fw_upload.h:54
uint32_t bytes
Definition fw_upload.h:51
uint32_t slot
Definition fw_upload.h:50
uint8_t * buf
Definition fw_upload.h:48
uint32_t cap
Definition fw_upload.h:49