rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
out_store.h
Go to the documentation of this file.
1
61#ifndef RCBENCH_OUT_STORE_H
62#define RCBENCH_OUT_STORE_H
63
64#include <stdbool.h>
65#include <stdint.h>
66
67#include "link_pages.h"
68#include "out_store_rec.h"
69
87
106void out_store_save(const out_store_t *cfg, uint32_t now_ms);
107
111#define OUT_STORE_SETTLE_MS 400u
112
129#define OUT_STORE_QUIET_MS 5u
130
135#define OUT_STORE_SECTORS 2u
136
143#define OUT_STORE_GAP_WAIT_MS 1000u
144
145/*
146 * Where core 1 stands decides how a window opens. Until either call below,
147 * core 1 is taken as not launched: a window is interrupts off and the
148 * operation run directly, which is what the boot's reclaims use. The
149 * caller makes one of the two calls straight after launching core 1, with
150 * no store call in between.
151 */
152
157void out_store_core1_parkable(void);
158
171void out_store_off(void);
172
178bool out_store_is_off(void);
179
191#define OUT_STORE_LOCKOUT_MS 10u
192
197#define OUT_STORE_REFUSED_WAIT_MS 1000u
198
211
225out_store_step_t out_store_tick(bool driving, uint32_t quiet_ms,
226 uint32_t now_ms);
227
247bool out_store_reclaim(bool driving, uint32_t quiet_ms);
248
254bool out_store_pending(void);
255
266uint32_t out_store_last_erase_us(void);
267
277uint32_t out_store_last_program_us(void);
278
290uint8_t out_store_last_record(void);
291
292/*
293 * The firmware update's flash access (link_update_dev.h), through the same
294 * windows as the store's own: interrupts off on this core and core 1 parked,
295 * or nothing at all while the store is off. An erase or a program here
296 * holds this core for its length; the panel waits for the answer to the
297 * COMMIT that caused it, so no request is in flight to be lost.
298 */
299
306bool out_store_window_open(void);
307
317bool out_store_flash_erase(uint32_t off);
318
331bool out_store_flash_program(uint32_t off, const uint8_t *data, uint32_t len);
332
342bool out_store_flash_call(void (*fn)(void *), void *arg);
343
344#endif /* RCBENCH_OUT_STORE_H */
bool out_store_is_off(void)
Whether out_store_off() has been called.
Definition out_store.c:315
bool out_store_load(out_store_t *out)
Read what was saved.
Definition out_store.c:451
bool out_store_flash_program(uint32_t off, const uint8_t *data, uint32_t len)
Program len bytes, whole 256-byte pages up to one sector, at flash offset off, below the store.
Definition out_store.c:607
bool out_store_window_open(void)
Whether a window may open now: the store is not off, no save is waiting, and core 1 did not refuse th...
Definition out_store.c:592
uint32_t out_store_last_erase_us(void)
How long the last sector erase held interrupts off, in microseconds.
Definition out_store.c:504
uint8_t out_store_last_record(void)
Which of the 16 record slots the store last used (of the 32 one-page slots before version 8 while the...
Definition out_store.c:508
void out_store_off(void)
Switch the store's writing off for this boot: core 1 was launched and did not register for the flash ...
Definition out_store.c:309
bool out_store_flash_erase(uint32_t off)
Erase the 4KiB sector at flash offset off, below the store.
Definition out_store.c:597
bool out_store_pending(void)
Whether a save has been asked for and not yet reached flash.
Definition out_store.c:502
bool out_store_flash_call(void(*fn)(void *), void *arg)
Run fn inside a window: the boot ROM's BUY, which rewrites flash.
Definition out_store.c:618
bool out_store_reclaim(bool driving, uint32_t quiet_ms)
Erase a sector that holds nothing still wanted.
Definition out_store.c:570
void out_store_save(const out_store_t *cfg, uint32_t now_ms)
Ask for cfg to be written.
Definition out_store.c:485
out_store_step_t out_store_tick(bool driving, uint32_t quiet_ms, uint32_t now_ms)
Take a deferred save if it is safe to.
Definition out_store.c:510
uint32_t out_store_last_program_us(void)
How long the last page program held interrupts off, in microseconds.
Definition out_store.c:506
void out_store_core1_parkable(void)
Core 1 registered for the flash lock-out: every window from now on through flash_safe_execute(),...
Definition out_store.c:302
out_store_step_t
What a pass of out_store_tick() did.
Definition out_store.h:202
@ OUT_STORE_REFUSED
Definition out_store.h:209
@ OUT_STORE_ERASED
Definition out_store.h:204
@ OUT_STORE_IDLE
Definition out_store.h:203
@ OUT_STORE_WROTE
Definition out_store.h:205
What a record in the IOmcu's output store carries, and how a record an earlier build wrote is read.
What is kept: the two pages that describe the outputs; the PD mini's wiring – SUPPLY's ENABLE to BAUD...
Definition out_store_rec.h:86