104#ifndef RCBENCH_HITEC_PORT_H
105#define RCBENCH_HITEC_PORT_H
121#define HITEC_PORT_STOP_MS 50u
125#define HITEC_PORT_BUSY_MS 10000u
127#define HITEC_PORT_SUPPLY_MS LINK_HITEC_SUPPLY_MS
151 bool (*
take)(
void *
ctx, uint8_t port, uint8_t
pin, uint8_t family,
152 uint8_t drive, uint8_t rx);
257 const uint16_t *in, uint32_t now_ms);
bool hitec_port_supply_hold(const hitec_port_t *p)
The port holds the SUPPLY page (supply_page_hold()): every state but LINK_HITEC_FREE,...
Definition hitec_port.c:968
void hitec_port_bench_armed(hitec_port_t *p, bool armed)
Whether the bank is armed: OPEN is refused while it is.
Definition hitec_port.c:954
uint8_t hitec_port_quiet_mask(const hitec_port_t *p)
Bit n: programming port n renders no PWM pulse.
Definition hitec_port.c:943
uint8_t hitec_port_write(hitec_port_t *p, uint8_t off, uint8_t n, const uint16_t *in, uint32_t now_ms)
A write of the page: 0, or the LINK_NACK_* reason with nothing changed.
Definition hitec_port.c:645
bool hitec_port_frame_out(const hitec_port_t *p, uint32_t now_ms)
A byte may be on the wire: a SEND from its start until the lead and the bytes have had their time,...
Definition hitec_port.c:973
uint8_t hitec_port_pin_mask(const hitec_port_t *p)
Bit n: programming port n's pin is the wire driver's.
Definition hitec_port.c:949
void hitec_port_other_mask(hitec_port_t *p, uint8_t mask)
Bit n: the KST page holds programming port n (kst_port_quiet_mask()). OPEN on it is refused with LINK...
Definition hitec_port.c:961
void hitec_port_step(hitec_port_t *p, bool safe, bool stop, uint32_t now_ms)
One pass.
Definition hitec_port.c:881
link_hitec_state_t hitec_port_state(const hitec_port_t *p)
Where the port is.
Definition hitec_port.c:938
void hitec_port_read(const hitec_port_t *p, uint8_t off, uint8_t n, uint16_t *out)
A read of the page, LINK_HT_*.
Definition hitec_port.c:767
bool hitec_port_init(hitec_port_t *p, const hitec_port_hw_t *hw)
Prepare a free port.
Definition hitec_port.c:920
Hitec servo programming protocols: frames, transactions, the reply decoders and the driver interface.
The page map: what the panel can ask the IOmcu for, and set.
link_hitec_state_t
Where the port is.
Definition link_pages.h:2377
#define LINK_HT_W_CMD_FRAME
Registers of the command, from LINK_HT_W_CMD: one frame.
Definition link_pages.h:2350
#define LINK_HT_W_STAGED
The staged registers a command's CRC covers, from LINK_HT_W_LINE.
Definition link_pages.h:2352
The intermediary every output goes through: one set of rules for arming, clamping,...
What the receiver took, in the order the bytes came.
Definition hitec_wire.h:398
A pin driver.
Definition hitec_wire.h:544
What the port needs from the hardware.
Definition hitec_port.h:138
void(*) abort(void *ctx)
Cut the running transaction: the next poll() hands back what came, marked aborted.
Definition hitec_port.h:158
hitec_driver_t driver
The wire driver.
Definition hitec_port.h:173
void * ctx
The caller's context, passed as the first argument of each hook.
Definition hitec_port.h:141
uint8_t ports
Programming ports the build has, 1 to LINK_PG_PORTS_MAX.
Definition hitec_port.h:143
void(*) give(void *ctx)
Close the wire driver and give the pin back to the generator.
Definition hitec_port.h:154
uint8_t(*) pin(void *ctx, uint8_t port)
Definition hitec_port.h:146
bool(*) supply_set(void *ctx, bool on, uint16_t mv, uint16_t ma)
Definition hitec_port.h:168
void(*) run(void *ctx, hitec_port_run_t *out)
What the driver says about the line; NULL: nothing.
Definition hitec_port.h:160
bool(*) take(void *ctx, uint8_t port, uint8_t pin, uint8_t family, uint8_t drive, uint8_t rx)
Definition hitec_port.h:151
void(*) supply(void *ctx, supply_port_view_t *out)
What the supply says now (supply_page_port_view()).
Definition hitec_port.h:165
What the driver says about the line and the running transaction.
Definition hitec_port.h:130
uint32_t span_us
Definition hitec_port.h:133
uint32_t bit_ns
Definition hitec_port.h:134
uint32_t lead_ns
Definition hitec_port.h:131
The state of one Hitec port: the hardware, the staged registers, the running or last transaction and ...
Definition hitec_port.h:180
uint8_t drive
Definition hitec_port.h:201
uint8_t rx_mode
Definition hitec_port.h:218
uint8_t pin
Definition hitec_port.h:199
uint8_t read_on
Definition hitec_port.h:222
uint16_t off_ms
Definition hitec_port.h:196
uint8_t keyed
Definition hitec_port.h:215
uint8_t result
Definition hitec_port.h:203
uint16_t count
Definition hitec_port.h:193
uint8_t family
Definition hitec_port.h:200
uint8_t stopped
Definition hitec_port.h:214
uint8_t view
Definition hitec_port.h:208
uint8_t has_cap
Definition hitec_port.h:213
uint8_t state
Definition hitec_port.h:197
uint16_t mv
Definition hitec_port.h:194
uint8_t op
Definition hitec_port.h:202
uint8_t dec
Definition hitec_port.h:206
uint8_t rx_line
Definition hitec_port.h:219
uint8_t off_seen
Definition hitec_port.h:217
uint8_t other
Definition hitec_port.h:211
uint8_t has_pin
Definition hitec_port.h:212
uint8_t safe
Definition hitec_port.h:209
uint32_t t1_ms
Definition hitec_port.h:189
uint8_t armed
Definition hitec_port.h:210
hitec_port_run_t info
Definition hitec_port.h:187
uint8_t port
Definition hitec_port.h:198
uint8_t rx
Definition hitec_port.h:205
uint16_t ma
Definition hitec_port.h:195
uint32_t start_us
Definition hitec_port.h:190
uint32_t t0_ms
Definition hitec_port.h:188
hitec_reply_t reply
Definition hitec_port.h:186
uint8_t cutting
Definition hitec_port.h:216
hitec_xfer_t xfer
Definition hitec_port.h:184
uint8_t refusal
Definition hitec_port.h:204
uint8_t supply_on
Definition hitec_port.h:221
hitec_capture_t cap
Definition hitec_port.h:185
uint8_t dec_arg
Definition hitec_port.h:207
uint32_t cap_us
Definition hitec_port.h:191
uint16_t seq
Definition hitec_port.h:192
A decoded reply.
Definition hitec_wire.h:468
One transaction.
Definition hitec_wire.h:233
The supply as a programming port sees it (kst_port.h).
Definition supply_page.h:85
The SUPPLY link page at the IOmcu: a PD mini on a PIO UART, its wiring, what it is to do and what it ...