|
| static bool | well_short (uint32_t got, uint32_t of) |
| | Test whether fewer replies came back than the shortfall ratio allows.
|
| uint8_t | link_bringup_status_count (uint16_t minor) |
| | How many STATUS registers to read from an IOmcu of protocol minor minor: LINK_ST_COUNT from LINK_MINOR_REFUSED, LINK_ST_COUNT_V420 before it.
|
| bool | link_bringup_take_status (link_bringup_t *b, const link_msg_t *st, uint16_t *faults) |
| | Take a STATUS reply read from register 0 into b and the fault bitmap into faults (either may be NULL).
|
| void | link_bringup_add_rtt (link_bringup_t *b, uint32_t us) |
| | Fold one round-trip measurement in.
|
| link_diag_t | link_bringup_diagnose (const link_bringup_t *b) |
| | Name the most fundamental thing that is wrong.
|
| static uint32_t | since (uint32_t now, uint32_t prev) |
| | One counter's count since the previous snapshot.
|
| void | link_bringup_window (const link_bringup_t *now, const link_bringup_t *prev, link_bringup_t *out) |
| | The counts of one report window: what happened between two snapshots, for link_bringup_diagnose() to judge the recent link rather than the whole session.
|
| const char * | link_diag_text (link_diag_t d) |
| | One line naming the fault.
|
| const char * | link_diag_hint (link_diag_t d) |
| | One line naming what to check, in the order worth checking it.
|
Bring-up of the link: status replies, round-trip times and the diagnosis.
SPDX-License-Identifier: MIT
Take a STATUS reply read from register 0 into b and the fault bitmap into faults (either may be NULL).
False, and nothing taken, for anything but a DATA reply from offset 0 with at least LINK_ST_COUNT_V420 registers. A reply that ends before LINK_ST_REFUSED_HI clears have_refused and dev_refused: an older IOmcu counts no refusals, and a count is not carried over from an IOmcu that answered before it.
- Parameters
-
| b | The counters to fill; may be NULL. |
| st | The STATUS reply. |
| faults | Receives the fault bitmap; may be NULL. |
- Returns
- true when the reply was taken, else false.
The counts of one report window: what happened between two snapshots, for link_bringup_diagnose() to judge the recent link rather than the whole session.
Each counter of out is now - prev. A counter that is lower in now than in prev counts from 0 again – an IOmcu that restarted, or a 16-bit status register that wrapped – and its window count is the value in now. A restarted counter that has passed its previous figure by the time of now is not told from one that kept counting, and its window count is short by the previous figure.
Flags, identity, the round-trip figures and the IOmcu's two CAN error counters are taken from now: have_status, have_refused, have_identity, proto_major, proto_minor, rt_samples, rt_min_us, rt_max_us, rt_mean_us, dev_crc_errors and dev_resyncs. The error counters are levels that good frames lower, so a difference of two readings can be 0 while errors keep coming.
- Parameters
-
| now | The counters at this report. |
| prev | The counters at the previous report; NULL for the first report, which makes the window everything since the counters started (the same as an all-zero prev). |
| out | Receives the window; may be the same object as now. |