rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
safety_gate.h
Go to the documentation of this file.
1
24
25#pragma once
26
27#include <stdbool.h>
28#include <stdint.h>
29
30#include "heartbeat.h"
31#include "link_dev.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
38typedef struct {
45 bool off;
47 bool arm;
54 uint16_t roles;
56
65bool safety_gate_may_arm(const heartbeat_mon_t *beat, const link_dev_t *dev);
66
78 const link_dev_t *dev);
79
97 link_dev_t *dev, uint16_t *control,
98 uint32_t now_ms);
99
122bool safety_gate_arm_now(bool gate_arm, uint16_t quiet_mask,
123 bool update_holds);
124
144uint8_t safety_gate_control_write(uint16_t *control, uint8_t off, uint8_t n,
145 const uint16_t *in,
146 const heartbeat_mon_t *beat,
147 link_dev_t *dev);
148
162void safety_gate_status(const heartbeat_mon_t *beat, const link_dev_t *dev,
163 const uint16_t *control, uint16_t *state,
164 uint16_t *faults);
165
173bool safety_gate_line_trusted(uint16_t faults);
174
175#ifdef __cplusplus
176}
177#endif
The safety heartbeat: the panel's signal that it is running, and the IOmcu's judgement of whether to ...
safety_gate_t safety_gate_step(heartbeat_mon_t *beat, bool line_edge, link_dev_t *dev, uint16_t *control, uint32_t now_ms)
One pass of the main loop, after the link has been served.
Definition safety_gate.c:24
bool safety_gate_line_trusted(uint16_t faults)
The panel's reading of a STATUS fault bitmap: whether the far end trusts the heartbeat.
Definition safety_gate.c:126
uint8_t safety_gate_control_write(uint16_t *control, uint8_t off, uint8_t n, const uint16_t *in, const heartbeat_mon_t *beat, link_dev_t *dev)
A write to the CONTROL page: link_control_write() with this end's answer to whether the bench may arm...
Definition safety_gate.c:68
void safety_gate_status(const heartbeat_mon_t *beat, const link_dev_t *dev, const uint16_t *control, uint16_t *state, uint16_t *faults)
The STATUS page's state register and the two fault bits this decision owns (LINK_FAULT_LINK_SILENT,...
Definition safety_gate.c:99
bool safety_gate_may_arm(const heartbeat_mon_t *beat, const link_dev_t *dev)
Whether a write of ARM is taken: heartbeat trusted, link out of failsafe, latch clear.
Definition safety_gate.c:14
bool safety_gate_supply_ok(const heartbeat_mon_t *beat, const link_dev_t *dev)
Whether the supply's output may be on: heartbeat trusted and link out of failsafe.
Definition safety_gate.c:19
bool safety_gate_arm_now(bool gate_arm, uint16_t quiet_mask, bool update_holds)
Whether the bank is armed for this pass: the pass's decision (safety_gate_t.arm, gate_arm) and two ho...
Definition safety_gate.c:62
Definition heartbeat.h:118
What a pass decided.
Definition safety_gate.h:38
bool off
The heartbeat stopped being trusted or the link went silent in this pass: the outputs come down now.
Definition safety_gate.h:45
uint16_t roles
The roles armed for this pass, LINK_ARM_ROLES bits: link_arm_roles() of ARM while arm is true,...
Definition safety_gate.h:54
bool arm
Whether the bank is armed for this pass.
Definition safety_gate.h:47