rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
touch_loss.h
Go to the documentation of this file.
1
29
30#ifndef RCBENCH_TOUCH_LOSS_H
31#define RCBENCH_TOUCH_LOSS_H
32
33#include <stdbool.h>
34#include <stdint.h>
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40/* ------------------------------------------------ numbered event streams */
41
51typedef struct {
52 uint32_t next;
54
61
73uint32_t touch_seq_take(touch_seq_rx_t *rx, uint32_t seq);
74
87uint32_t touch_seq_tail(touch_seq_rx_t *rx, uint32_t published);
88
89/* ------------------------------------------------------------ the STOP mark */
90
111bool stop_mark_keeps(uint32_t mark, uint32_t cur, bool cur_is_event);
112
113/* --------------------------------------------------------- the arm watch */
114
126typedef struct {
127 bool on;
128 uint32_t loss_gen;
129 uint32_t drv_gaps;
130 uint32_t arm_gen;
132
148bool arm_watch_take_ok(uint32_t loss_gen_stamp, uint32_t loss_gen_now,
149 uint32_t lost_notice_seq, uint32_t consumed_seq);
150
159void arm_watch_begin(arm_watch_t *w, uint32_t loss_gen_stamp,
160 uint32_t drv_gaps_at_take, uint32_t arm_gen);
161
176bool arm_watch_lost(arm_watch_t *w, uint32_t loss_gen_now,
177 uint32_t drv_gaps_now, uint32_t acked_arm_gen);
178
185
186#ifdef __cplusplus
187}
188#endif
189
190#endif /* RCBENCH_TOUCH_LOSS_H */
Whether an arm stands until the render loop has seen it.
Definition touch_loss.h:126
uint32_t drv_gaps
Definition touch_loss.h:129
uint32_t arm_gen
Definition touch_loss.h:130
uint32_t loss_gen
Definition touch_loss.h:128
The consumer's side of one numbered stream.
Definition touch_loss.h:51
uint32_t next
Definition touch_loss.h:52
uint32_t touch_seq_take(touch_seq_rx_t *rx, uint32_t seq)
An event numbered seq has been taken off the queue.
Definition touch_loss.c:24
bool arm_watch_take_ok(uint32_t loss_gen_stamp, uint32_t loss_gen_now, uint32_t lost_notice_seq, uint32_t consumed_seq)
May an arm taken now go ahead?
Definition touch_loss.c:53
void arm_watch_begin(arm_watch_t *w, uint32_t loss_gen_stamp, uint32_t drv_gaps_at_take, uint32_t arm_gen)
An arm was applied: watch it from here.
Definition touch_loss.c:75
uint32_t touch_seq_tail(touch_seq_rx_t *rx, uint32_t published)
The queue has been drained.
Definition touch_loss.c:39
void touch_seq_rx_init(touch_seq_rx_t *rx)
Nothing taken yet: the first event is expected to carry 1.
Definition touch_loss.c:17
bool stop_mark_keeps(uint32_t mark, uint32_t cur, bool cur_is_event)
Whether the mark of a STOP the control task applied stays across a loss the render loop has found.
Definition touch_loss.c:63
void arm_watch_end(arm_watch_t *w)
The bench disarmed for any reason: nothing is left to watch.
Definition touch_loss.c:103
bool arm_watch_lost(arm_watch_t *w, uint32_t loss_gen_now, uint32_t drv_gaps_now, uint32_t acked_arm_gen)
One look, once the snapshot has been published.
Definition touch_loss.c:87