59#define ENDPOINTS_SETTLE_MS 300u
91 uint32_t edit_ms, uint32_t now_ms);
bool endpoints_blocked(const endpoints_debt_t *d)
endpoints_block() is not ENDPOINTS_BLOCK_NONE.
Definition endpoints_link.c:122
uint16_t endpoints_min(const endpoints_debt_t *d)
The pair as last published, in us; 0 for NULL.
Definition endpoints_link.c:137
void endpoints_publish(endpoints_debt_t *d, uint16_t min_us, uint16_t max_us, uint32_t now_ms)
An edit of Idle pulse or Full pulse at now_ms, from any task: the pair, then the time,...
Definition endpoints_link.c:84
bool endpoints_held(const endpoints_debt_t *d)
Whether the far end is held disarmed for the debt.
Definition endpoints_link.c:132
endpoints_block_t endpoints_block(const endpoints_debt_t *d)
Why a switch to ARMED with the link up is refused for the pair: ENDPOINTS_BLOCK_OWED while owed,...
Definition endpoints_link.c:111
bool endpoints_owed_after(endpoints_outcome_t outcome)
Whether the debt stands after an attempt that ended in outcome: true only for ENDPOINTS_NO_ANSWER,...
Definition endpoints_link.c:31
uint16_t endpoints_max(const endpoints_debt_t *d)
The Full pulse as last published, in us; 0 for NULL.
Definition endpoints_link.c:142
bool endpoints_owed(const endpoints_debt_t *d)
Whether a pair is owed: true refuses a switch to ARMED with the link up.
Definition endpoints_link.c:127
endpoints_next_t endpoints_take(endpoints_debt_t *d, bool far_disarmed, uint32_t now_ms)
The debt at a poll, on the control task: what endpoints_next() finds.
Definition endpoints_link.c:147
void endpoints_paid(endpoints_debt_t *d, endpoints_outcome_t outcome)
The end of a payment endpoints_take() handed out: owed again on a missing answer, the hold and the bl...
Definition endpoints_link.c:168
void endpoints_recheck(endpoints_debt_t *d)
A binding was written: the throttle channels may have moved, so the pair is owed again,...
Definition endpoints_link.c:104
bool endpoints_page_holds(const uint16_t *page, uint16_t min_us, uint16_t max_us)
Whether every throttle channel of a CHAN_CFG page page (LINK_CC_COUNT registers) holds min_us and max...
Definition endpoints_link.c:48
void endpoints_link_up(endpoints_debt_t *d)
A link-up edge: the pair is owed again and the far end held disarmed until it is paid.
Definition endpoints_link.c:95
endpoints_next_t endpoints_next(bool owed, bool far_disarmed, uint32_t edit_ms, uint32_t now_ms)
What a debt asks of a pass at now_ms.
Definition endpoints_link.c:16
endpoints_block_t
Why a switch to ARMED is refused for the pair, endpoints_block().
Definition endpoints_link.h:118
@ ENDPOINTS_BLOCK_OWED
Owed: an edit, a binding or a link-up not yet paid.
Definition endpoints_link.h:122
@ ENDPOINTS_BLOCK_DIFFERS
The IOmcu acknowledged and stored another pair.
Definition endpoints_link.h:130
@ ENDPOINTS_BLOCK_ORDER
Idle pulse is not below Full pulse: nothing was sent.
Definition endpoints_link.h:126
@ ENDPOINTS_BLOCK_NONE
The pair is in force, or nothing was ever owed.
Definition endpoints_link.h:120
@ ENDPOINTS_BLOCK_REFUSED
The IOmcu refused the write.
Definition endpoints_link.h:128
@ ENDPOINTS_BLOCK_UNKNOWN
The IOmcu refused the read: its range is not known.
Definition endpoints_link.h:124
endpoints_outcome_t
How paying a debt went.
Definition endpoints_link.h:94
@ ENDPOINTS_DIFFERS
The write came back acknowledged, and what the IOmcu stored on a throttle channel is not the pair.
Definition endpoints_link.h:114
@ ENDPOINTS_NO_ANSWER
The read or the write ended unanswered.
Definition endpoints_link.h:96
@ ENDPOINTS_HELD
The page already holds the pair: nothing written.
Definition endpoints_link.h:102
@ ENDPOINTS_TAKEN
The write came back acknowledged: the pair is in force.
Definition endpoints_link.h:104
@ ENDPOINTS_READ_REFUSED
The read came back refused: the range in force is not known.
Definition endpoints_link.h:98
@ ENDPOINTS_ORDER
Idle pulse is not below Full pulse: nothing sent.
Definition endpoints_link.h:100
@ ENDPOINTS_WRITE_REFUSED
The write came back refused: the IOmcu keeps the pair it held, or the frames of the page before the r...
Definition endpoints_link.h:109
endpoints_next_t
What the debt asks of this pass, endpoints_next().
Definition endpoints_link.h:62
@ ENDPOINTS_WAIT_DISARM
Owed, and this pass did not put ARM = 0 at the IOmcu.
Definition endpoints_link.h:66
@ ENDPOINTS_WAIT_SETTLE
Owed, and the last edit is younger than ENDPOINTS_SETTLE_MS.
Definition endpoints_link.h:68
@ ENDPOINTS_PAY
Owed and due: read the page now.
Definition endpoints_link.h:70
@ ENDPOINTS_PAID
Nothing owed.
Definition endpoints_link.h:64
The debt.
Definition endpoints_link.h:162
atomic_uint edit_ms
Definition endpoints_link.h:164
atomic_bool owed
Definition endpoints_link.h:165
atomic_uint pair
Definition endpoints_link.h:163
bool hold
Control task only: raised at a link-up edge, the far end is held disarmed until the debt is paid.
Definition endpoints_link.h:172
uint8_t refused
Control task only: what the last answered payment left, an endpoints_block_t in one byte.
Definition endpoints_link.h:177