rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
tone_page.h
Go to the documentation of this file.
1
31
32#pragma once
33
34#include <stdbool.h>
35#include <stdint.h>
36
37#include "link_pages.h"
38#include "outputs.h"
39#include "tone.h"
40#include "tone_svc.h"
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
49typedef struct {
51 uint16_t evt_sel;
52 uint16_t gen;
53 uint16_t cap_gen;
54 bool refused;
57 /* What core 1 last said, under set-up gen. */
58 bool running,
62 uint16_t window, win_freq_dhz, win_periods;
63 uint32_t lost, glitches;
64 uint32_t seen_lost, seen_glitches;
65 /* The beeps of this capture. */
67 uint64_t n;
68 uint64_t first;
69 uint32_t ms_shift;
71 bool broke;
74
83
91void tone_page_defaults(uint16_t *cfg);
92
122uint8_t tone_page_write(tone_page_t *p, uint8_t off, uint8_t n,
123 const uint16_t *in, const outputs_t *o,
124 uint64_t taken);
125
137void tone_page_read(const tone_page_t *p, uint8_t off, uint8_t n,
138 uint16_t *out);
139
155void tone_page_restore(tone_page_t *p, const uint16_t *cfg,
156 const outputs_t *o, uint64_t taken);
157
168void tone_page_revert(tone_page_t *p, const uint16_t *cfg, bool refused);
169
178
188
196
210void tone_page_recapture(tone_page_t *p, uint32_t shift_ms);
211
218bool tone_page_enabled(const tone_page_t *p);
219
226uint8_t tone_page_pin(const tone_page_t *p);
227
234bool tone_page_wanted(const tone_page_t *p);
235
242uint64_t tone_page_pins(const tone_page_t *p);
243
254bool tone_page_pin_free(const tone_page_t *p, const outputs_t *o,
255 uint64_t taken);
256
267uint8_t tone_page_slots_check(const tone_page_t *p, const uint16_t *slots);
268
278void tone_page_cmd(const tone_page_t *p, bool run, tone_cmd_t *cmd);
279
291 const tone_rec_t *rec, size_t n);
292
308void tone_page_beeps(tone_page_t *p, uint16_t gen, uint16_t cap_gen,
309 const tone_rec_t *rec, size_t n);
310
317void tone_page_dropped(tone_page_t *p, uint32_t n);
318
319#ifdef __cplusplus
320}
321#endif
The intermediary every output goes through: one set of rules for arming, clamping,...
The state of a bank of channels and slots.
Definition outputs.h:143
The order from core 0.
Definition tone_svc.h:65
The TONE page state: the set-up, what core 1 last reported, and the beep ring of the capture.
Definition tone_page.h:49
uint32_t glitches
Definition tone_page.h:63
bool beep
Definition tone_page.h:60
bool broke
Definition tone_page.h:71
uint32_t seen_glitches
Definition tone_page.h:64
uint16_t cfg[LINK_TN_CONFIG_COUNT]
Definition tone_page.h:50
tone_t scratch
Definition tone_page.h:72
uint32_t ms_shift
Definition tone_page.h:69
bool no_capture
Definition tone_page.h:55
bool refused
Definition tone_page.h:54
bool overrun
Definition tone_page.h:59
bool running
Definition tone_page.h:58
uint16_t evt_sel
Definition tone_page.h:51
bool tone
Definition tone_page.h:61
uint16_t gen
Definition tone_page.h:52
uint64_t first
Definition tone_page.h:68
uint16_t cap_gen
Definition tone_page.h:53
uint64_t n
Definition tone_page.h:67
A finished beep, in the TONE page's units.
Definition tone_svc.h:82
What the service reports each pass.
Definition tone_svc.h:92
Detector state. The fields belong to tone.c.
Definition tone.h:240
ESC (electronic speed controller) tones from the edges of one motor phase.
void tone_page_restore(tone_page_t *p, const uint16_t *cfg, const outputs_t *o, uint64_t taken)
The set-up kept in flash, loaded as a write would, at boot.
Definition tone_page.c:248
void tone_page_cmd(const tone_page_t *p, bool run, tone_cmd_t *cmd)
The order for core 1; run is whether the capture runs now.
Definition tone_page.c:335
void tone_page_recapture(tone_page_t *p, uint32_t shift_ms)
The capture starts again with the ring kept: a refused write that put the old set-up back.
Definition tone_page.c:309
void tone_page_refuse(tone_page_t *p)
The wiring could not take the pin of an enabled set-up.
Definition tone_page.c:281
uint8_t tone_page_pin(const tone_page_t *p)
The configured pin, from register LINK_TN_PIN.
Definition tone_page.c:47
void tone_page_capture(tone_page_t *p)
The capture starts again (the tap enabled, or its pin moved): the ring empties and the order carries ...
Definition tone_page.c:298
void tone_page_dropped(tone_page_t *p, uint32_t n)
n beeps lost between the cores, added to LOST.
Definition tone_page.c:392
void tone_page_publish(tone_page_t *p, const tone_status_t *st, const tone_rec_t *rec, size_t n)
What core 1 handed back: its status, and the n beeps it finished.
Definition tone_page.c:351
void tone_page_defaults(uint16_t *cfg)
The set-up as a page starts, into cfg (LINK_TN_CONFIG_COUNT registers): the tap off,...
Definition tone_page.c:19
void tone_page_init(tone_page_t *p)
Set the page to its start: the defaults, and the first beep number 1.
Definition tone_page.c:33
void tone_page_no_capture(tone_page_t *p)
No capture runs this boot (core 1 did not start): an enabled set-up is refused as tone_page_refuse() ...
Definition tone_page.c:290
bool tone_page_enabled(const tone_page_t *p)
Whether ENABLE bit 0 (the tap) is set.
Definition tone_page.c:42
void tone_page_beeps(tone_page_t *p, uint16_t gen, uint16_t cap_gen, const tone_rec_t *rec, size_t n)
n beeps finished by core 1 under set-up gen and capture cap_gen, into the ring; dropped when the capt...
Definition tone_page.c:377
uint8_t tone_page_slots_check(const tone_page_t *p, const uint16_t *slots)
LINK_NACK_BAD_VALUE for an OUTPUTS page (slots, LINK_OS_COUNT registers) that binds a slot to the tap...
Definition tone_page.c:319
void tone_page_revert(tone_page_t *p, const uint16_t *cfg, bool refused)
Put back the set-up cfg and refusal state a write replaced, after the wiring could not take it.
Definition tone_page.c:270
uint8_t tone_page_write(tone_page_t *p, uint8_t off, uint8_t n, const uint16_t *in, const outputs_t *o, uint64_t taken)
A write, validated whole before any of it is stored.
Definition tone_page.c:196
void tone_page_read(const tone_page_t *p, uint8_t off, uint8_t n, uint16_t *out)
A TONE page read.
Definition tone_page.c:434
bool tone_page_pin_free(const tone_page_t *p, const outputs_t *o, uint64_t taken)
Whether the configured pin is free for the tap, as a write of ENABLE would judge it: the pull-down is...
Definition tone_page.c:129
bool tone_page_wanted(const tone_page_t *p)
Whether the capture is to run: enabled and not refused.
Definition tone_page.c:52
uint64_t tone_page_pins(const tone_page_t *p)
The pin as a reservation mask; 0 unless the capture is wanted.
Definition tone_page.c:57
The tone service: what core 1 runs for the phase tap each 1ms tick.