|
| void | sense_svc_init (sense_svc_t *v, const sense_svc_io_t *io) |
| | A service with the bus closed; the first step takes its command whole.
|
| static uint64_t | now_us (const sense_svc_t *v) |
| | The service's clock, in µs.
|
| static bool | any_part (const sense_sched_cfg_t *c) |
| | Test whether a configuration enables any part.
|
| static void | set_up (sense_svc_t *v, const sense_cmd_t *cmd) |
| | The set-up: the bus closed, and opened again with a fresh schedule on the command's pins when a part is enabled.
|
| bool | sense_window_over (const sense_window_t *w, int32_t clip_ua, uint16_t limit_ma) |
| | Whether window w of a channel passed limit_ma: its highest current rounded to mA (as SENSE_WIN shows it) above the limit, or a sample clipped at the top of the range when that top, clip_ua (the top code's current, 163.8mV across the shunt), is above the limit.
|
| static void | judge (sense_svc_t *v, const sense_cmd_t *cmd) |
| | The windows that closed in this tick, each channel against its limit, once a window.
|
| static void | capture (sense_svc_t *v, const sense_cmd_t *cmd) |
| | Act on the capture part of a command, once per capture generation.
|
| static bool | part_missing (const sense_sched_t *s) |
| | An enabled part that is not online, whose address a scan may find.
|
| static bool | capture_under_way (const sense_sched_t *s) |
| | Test whether a capture is armed, waiting or moving.
|
| static uint16_t | online_bit (sense_state_t st, uint8_t addr) |
| | The bit a part's address has in PRESENT while it is online, else 0.
|
| static uint16_t | online_mask (const sense_sched_t *s) |
| | The PRESENT mask of the parts online now.
|
| static void | scan (sense_svc_t *v, uint64_t now) |
| | Scan the addresses of the scan range for parts that may have appeared.
|
| static void | snap_capture (const sense_svc_t *v, sense_snap_t *out) |
| | The capture's fields: the schedule's, or lost for an arm refused.
|
| static void | snap (const sense_svc_t *v, sense_snap_t *out) |
| | Fill a snapshot of the service's state.
|
| void | sense_svc_step (sense_svc_t *v, const sense_cmd_t *cmd, sense_snap_t *out) |
| | One tick, every 1ms: cmd acted on, the schedule ticked while the bus is open, and out filled.
|
The IOmcu's sensor service.
See sense_svc.h.
SPDX-License-Identifier: MIT
| bool sense_window_over |
( |
const sense_window_t * | w, |
|
|
int32_t | clip_ua, |
|
|
uint16_t | limit_ma ) |
Whether window w of a channel passed limit_ma: its highest current rounded to mA (as SENSE_WIN shows it) above the limit, or a sample clipped at the top of the range when that top, clip_ua (the top code's current, 163.8mV across the shunt), is above the limit.
Never with a limit of 0, and never for a negative current. The service judges each channel's window once, as it closes, on core 1, so no window is missed however late core 0 takes the snapshot.
- Parameters
-
| w | The window to judge. |
| clip_ua | The current at the top code, in µA. |
| limit_ma | The limit, in mA. |
- Returns
- true when the window passed the limit.