|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
SENSE_WIN_A and SENSE_WIN_B, read for the log. More...
Macros | |
| #define | NONE 0xFFu |
Functions | |
| void | sense_win_link_init (sense_win_link_t *s) |
| Sets up the SENSE_WIN link state. | |
| void | sense_win_link_lost (sense_win_link_t *s) |
| The link went: nothing read is the IOmcu's now. | |
| void | sense_win_link_came_up (sense_win_link_t *s, uint16_t minor) |
An IOmcu answered with protocol minor minor; below LINK_MINOR_SENSE_MAP nothing is sent to it. | |
| void | sense_win_link_want (sense_win_link_t *s, uint8_t parts) |
| The parts enabled in the map the IOmcu holds, bit a for 0x40 + a: the pages to read. | |
| bool | sense_win_link_next (sense_win_link_t *s, uint32_t now_ms, sense_win_link_op_t *op) |
The next read owed at now_ms into op; false for none. | |
| void | sense_win_link_done (sense_win_link_t *s, int result, const uint16_t *regs) |
| How it went: SENSE_WIN_LINK_ACK with the registers read, a NACK's reason, or SENSE_WIN_LINK_NO_ANSWER. | |
| static bool | holds (bool have, const uint16_t *r, uint16_t window) |
Whether a read r kept as have holds window window. | |
| bool | sense_win_link_window (const sense_win_link_t *s, uint16_t window, bench_chw_t *out) |
The channels whose last or previous read holds window number window into out: out->ok bit c for channel c with readings, its current and voltage flags, and the figures; every other channel 0. | |
| void | sense_win_link_ring (bench_chw_t *out, unsigned fast, const bench_state_t *b) |
FAST's channel fast (0 to 11) of out from the window ring's window that b carries in its first channel (sense_link_win_bench()): the ring holds every window of FAST, the pages only the last. | |
Variables | |
| static const uint8_t | k_page [2] |
|
static |
Whether a read r kept as have holds window window.
| have | true when the read was kept. |
| r | The registers read. |
| window | The window number. |
| void sense_win_link_came_up | ( | sense_win_link_t * | s, |
| uint16_t | minor ) |
An IOmcu answered with protocol minor minor; below LINK_MINOR_SENSE_MAP nothing is sent to it.
| s | The link state. |
| minor | The IOmcu's protocol minor version. |
| void sense_win_link_done | ( | sense_win_link_t * | s, |
| int | result, | ||
| const uint16_t * | regs ) |
How it went: SENSE_WIN_LINK_ACK with the registers read, a NACK's reason, or SENSE_WIN_LINK_NO_ANSWER.
BAD_PAGE stops the reads until the next link-up.
| s | The link state. |
| result | The result: an acknowledgement, a NACK's reason or SENSE_WIN_LINK_NO_ANSWER. |
| regs | The registers read, or NULL for a write. |
| void sense_win_link_init | ( | sense_win_link_t * | s | ) |
Sets up the SENSE_WIN link state.
| s | The link state to set up. |
| void sense_win_link_lost | ( | sense_win_link_t * | s | ) |
The link went: nothing read is the IOmcu's now.
| s | The link state. |
| bool sense_win_link_next | ( | sense_win_link_t * | s, |
| uint32_t | now_ms, | ||
| sense_win_link_op_t * | op ) |
The next read owed at now_ms into op; false for none.
With both pages due, a second call gives the other.
| s | The link state. |
| now_ms | The time, in ms. |
| op | Receives the read owed. |
| void sense_win_link_ring | ( | bench_chw_t * | out, |
| unsigned | fast, | ||
| const bench_state_t * | b ) |
FAST's channel fast (0 to 11) of out from the window ring's window that b carries in its first channel (sense_link_win_bench()): the ring holds every window of FAST, the pages only the last.
Nothing for a fast of LINK_SM_FAST_NONE or a b with no new window.
| out | Receives the channels. |
| fast | FAST's channel, 0 to 11, or LINK_SM_FAST_NONE. |
| b | The state that carries the window. |
| void sense_win_link_want | ( | sense_win_link_t * | s, |
| uint8_t | parts ) |
The parts enabled in the map the IOmcu holds, bit a for 0x40 + a: the pages to read.
A page no longer wanted forgets its last read.
| s | The link state. |
| parts | The parts to read: bit a for part a. |
| bool sense_win_link_window | ( | const sense_win_link_t * | s, |
| uint16_t | window, | ||
| bench_chw_t * | out ) |
The channels whose last or previous read holds window number window into out: out->ok bit c for channel c with readings, its current and voltage flags, and the figures; every other channel 0.
Returns whether any channel has readings. out is always written.
| s | The link state. |
| window | The window number to find. |
| out | Receives the channels. |
|
static |