12#ifndef RCBENCH_LINK_DEV_H
13#define RCBENCH_LINK_DEV_H
34#define LINK_DEV_SILENCE_MS 200u
47 void (*
read)(
void *ctx, uint8_t offset, uint8_t
count, uint16_t *out);
49 uint8_t (*
write)(
void *ctx, uint8_t offset, uint8_t
count,
61 uint32_t last_request_ms;
100 void *ctx, uint32_t now_ms);
void link_dev_latch_arm(link_dev_t *d)
Set the arm latch: a cause other than link silence took the outputs down, and the ARM the host goes o...
Definition link_dev.c:60
void link_dev_init(link_dev_t *d, const link_page_t *pages, uint8_t page_count, void *ctx, uint32_t now_ms)
Start with no request heard, out of failsafe and with the arm latch set: the first ARM after a start ...
Definition link_dev.c:44
bool link_dev_arm_latched(const link_dev_t *d)
Whether a write of ARM is refused until the host writes CLEAR.
Definition link_dev.c:67
bool link_dev_apply(const link_dev_t *d, const link_msg_t *req, link_msg_t *reply)
What link_dev_dispatch() answers, without touching the silence watchdog: the same page lookup,...
Definition link_dev.c:120
void link_dev_clear_failsafe(link_dev_t *d, uint32_t now_ms)
Leave failsafe and release the arm latch.
Definition link_dev.c:72
bool link_dev_tick(link_dev_t *d, uint32_t now_ms)
Advance the silence watchdog.
Definition link_dev.c:179
bool link_dev_dispatch(link_dev_t *d, const link_msg_t *req, link_msg_t *reply, uint32_t now_ms)
Decide what to answer, without deciding how to carry it: which page, whether the range fits,...
Definition link_dev.c:100
What crosses the link, independent of the transport: an op, a page, an offset, a count and up to a pa...
The page map: what the panel can ask the IOmcu for, and set.
The IOmcu's end of the link: pages, the silence watchdog and the arm latch.
Definition link_dev.h:56
bool silent
Definition link_dev.h:72
bool arm_latched
The arm latch: while set, a write of ARM is refused.
Definition link_dev.h:85
bool heard
Whether a request has ever arrived.
Definition link_dev.h:71
bool failsafe
Definition link_dev.h:73
One link message: the op, the register window and its values.
Definition link_msg.h:55
One page, as the IOmcu sees it.
Definition link_dev.h:43
uint8_t count
Definition link_dev.h:45
void(*) read(void *ctx, uint8_t offset, uint8_t count, uint16_t *out)
Reads count registers of the page from offset into out.
Definition link_dev.h:47
uint8_t(*) write(void *ctx, uint8_t offset, uint8_t count, const uint16_t *in)
Returns 0 to accept, or a link_nack_t to refuse with a reason.
Definition link_dev.h:49