rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
flash_gate.c File Reference

When the panel may write its own flash, and when the IOmcu may not write its own. More...

#include "flash_gate.h"

Functions

bool flash_gate_open (bool armed, bool supply)
 Whether a flash operation may start now.
bool flash_gate_busy (bool driving, bool supply_on, bool pd_on, bool kst_session)
 Whether the IOmcu's flash may not be written now, for the store and for the firmware update alike.

Detailed Description

When the panel may write its own flash, and when the IOmcu may not write its own.

See flash_gate.h.

SPDX-License-Identifier: MIT

Function Documentation

◆ flash_gate_busy()

bool flash_gate_busy ( bool driving,
bool supply_on,
bool pd_on,
bool kst_session )

Whether the IOmcu's flash may not be written now, for the store and for the firmware update alike.

The bank driving: a window stops this core and steps no output. The supply asked on or perhaps on: its UART replies would overrun the 8-byte FIFO in a 19ms window, and an OFF asked over the link would wait for it. A KST session: a flash write stalls the pass that steps it.

False only when all four arguments are false.

Parameters
drivingtrue when the bank is driving (outputs_driving()).
supply_ontrue when the SUPPLY page's output register is non-zero.
pd_ontrue when the PD mini is open and may be on (pdmini_may_be_on()).
kst_sessiontrue when the KST port is out of PWM.
Returns
true when the flash may not be written.

◆ flash_gate_open()

bool flash_gate_open ( bool armed,
bool supply )

Whether a flash operation may start now.

True only when both armed and supply are false.

Parameters
armedtrue when the bank is armed, or an arm is waiting for the line to settle (arming_link_needed()): a stall inside the settle can cost the far end's trust in the heartbeat and so the arm.
supplytrue when the supply's output is on, or an ON for it is queued and not yet taken.
Returns
true when a flash operation may start.