76#define HITEC_PIO_CYCLES_PER_BIT 16u
78#define HITEC_PIO_TICK_CYCLES 2u
83#define HITEC_PIO_MIN_DIV 4u
85#define HITEC_PIO_MAX_DIV 65535u
89#define HITEC_PIO_SYNC_SYS_CYCLES 2u
96#define HITEC_PIO_MAX_ERROR_PPM 500u
99#define HITEC_PIO_LEAD_CYCLES 8u
104#define HITEC_PIO_BYTE_CYCLES 157u
109#define HITEC_PIO_ANSWER_CYCLES 165u
114#define HITEC_PIO_ANSWER_CYCLES_TO_EDGE 160u
116#define HITEC_PIO_ANSWER_BITS 10u
121#define HITEC_PIO_ANSWER_DROP_BITS 6u
123#define HITEC_PIO_DRAIN_CYCLES 2u
126#define HITEC_PIO_PROGRAM_WORDS 30u
135#define HITEC_PIO_IDLE_PC 1u
136#define HITEC_PIO_BIT_PC 8u
137#define HITEC_PIO_RELEASE_PC 11u
138#define HITEC_PIO_ASK_PC 22u
139#define HITEC_PIO_ANSWER_PC 24u
141#define HITEC_PIO_DRAIN_PC 28u
146#define HITEC_PIO_STAMP_BITS 23u
148#define HITEC_PIO_MAX_WINDOW_TICKS ((1u << HITEC_PIO_STAMP_BITS) - 1u)
150#define HITEC_PIO_MAX_LEAD ((1u << 30) - 1u)
157#define HITEC_PIO_TX_WORDS 11u
279 unsigned n,
bool full,
bool lost,
bool aborted,
void hitec_pio_capture(const hitec_pio_clock_t *clock, const hitec_pio_run_t *run, const uint32_t *stamps, unsigned n, bool full, bool lost, bool aborted, bool cut, hitec_capture_t *out)
The capture from the n words the program pushed, in their order.
Definition hitec_pio.c:299
unsigned hitec_pio_tx(const hitec_pio_clock_t *clock, uint8_t drive, const hitec_xfer_t *xfer, uint32_t *words, hitec_pio_run_t *run)
The word stream for xfer on a line with drive (hitec_drive_t).
Definition hitec_pio.c:178
bool hitec_pio_clock(uint32_t sys_hz, uint8_t family, hitec_pio_clock_t *out)
The divider for family at a system clock of sys_hz.
Definition hitec_pio.c:41
bool hitec_pio_answer_due(const hitec_pio_run_t *run, unsigned n, unsigned pc)
Whether the answer of run is still to go out with n bytes received and the state machine at pc,...
Definition hitec_pio.c:288
uint32_t hitec_pio_bit_ns(const hitec_pio_clock_t *clock)
The bit time clock gives, in ns, rounded to nearest.
Definition hitec_pio.c:75
uint32_t hitec_pio_cycles_ns(const hitec_pio_clock_t *clock, uint64_t cycles)
cycles state machine cycles of clock, in ns, rounded down.
Definition hitec_pio.c:83
Hitec servo programming protocols: frames, transactions, the reply decoders and the driver interface.
What the receiver took, in the order the bytes came.
Definition hitec_wire.h:398
The divider and the counts a system clock gives for one family.
Definition hitec_pio.h:160
uint32_t div256
Definition hitec_pio.h:162
uint32_t err_ppm
Definition hitec_pio.h:164
uint8_t family
Definition hitec_pio.h:165
uint32_t sys_hz
Definition hitec_pio.h:161
One transaction, as hitec_pio_tx() laid it out.
Definition hitec_pio.h:169
uint32_t window_ns
Definition hitec_pio.h:170
uint8_t family
Definition hitec_pio.h:181
uint32_t window_ticks
Definition hitec_pio.h:171
uint32_t lead_ns
From the lead's first change of direction to the release, in ns.
Definition hitec_pio.h:175
uint8_t max_rx
Definition hitec_pio.h:182
uint8_t answer
Definition hitec_pio.h:183
uint32_t span_us
An upper bound of the transaction's time from the hand-over of the stream: lead, bits,...
Definition hitec_pio.h:180
One transaction.
Definition hitec_wire.h:233