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

The IOmcu's firmware update over the link: link_update_dev on this board's flash and boot ROM. More...

#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Functions

void update_hw_init (bool(*busy)(void))
 Read the boot ROM's word on this boot – which slot runs, whether it is on trial – and check the partition table against the layout this build has.
void update_hw_ctl_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out)
 The two pages' handlers, for the link_page_t table.
uint8_t update_hw_ctl_write (void *ctx, uint8_t off, uint8_t n, const uint16_t *in)
 Writes the UPDATE_CTL page, for the link_page_t table.
void update_hw_data_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out)
 Reads the UPDATE_DATA page, for the link_page_t table.
uint8_t update_hw_data_write (void *ctx, uint8_t off, uint8_t n, const uint16_t *in)
 Writes the UPDATE_DATA page, for the link_page_t table.
void update_hw_poll (uint32_t now_ms)
 Once per pass: a slice of a hash, the restart after ACTIVATE, an owed erase of the other slot's first sector, the end of a session that has had no update request for 5s.
bool update_hw_holds_arm (void)
 True while ARM is refused: an update session or an image on trial.
bool update_hw_refuses_arm (uint8_t off, uint8_t n, const uint16_t *in)
 Whether a CONTROL write is refused for the update (link_update_dev.h).
int update_hw_slot (void)
 For the console: the slot running, 0 or 1, or -1 without a table.
bool update_hw_on_trial (void)
 For the console: whether the running image waits for its BUY.

Detailed Description

The IOmcu's firmware update over the link: link_update_dev on this board's flash and boot ROM.

The flash holds the partition table of partitions.json: slots A and B of 2036KiB each, and the store. The image runs from one slot; the update writes the other through the store's flash windows (out_store.h), restarts into it as a flash update boot, and the boot ROM keeps it once the panel writes BUY. Without a partition table – an image loaded before the table was installed – UPDATE_CTL reports no slots and every command that writes is refused.

SPDX-License-Identifier: MIT

Function Documentation

◆ update_hw_ctl_read()

void update_hw_ctl_read ( void * ctx,
uint8_t off,
uint8_t n,
uint16_t * out )

The two pages' handlers, for the link_page_t table.

Parameters
ctxUnused.
offFirst register to read.
nNumber of registers to read.
outReceives the register values.

◆ update_hw_ctl_write()

uint8_t update_hw_ctl_write ( void * ctx,
uint8_t off,
uint8_t n,
const uint16_t * in )

Writes the UPDATE_CTL page, for the link_page_t table.

Parameters
ctxUnused.
offFirst register to write.
nNumber of registers to write.
inThe register values to write.
Returns
0 to accept, or a link_nack_t to refuse.

◆ update_hw_data_read()

void update_hw_data_read ( void * ctx,
uint8_t off,
uint8_t n,
uint16_t * out )

Reads the UPDATE_DATA page, for the link_page_t table.

Parameters
ctxUnused.
offFirst register to read.
nNumber of registers to read.
outReceives the register values.

◆ update_hw_data_write()

uint8_t update_hw_data_write ( void * ctx,
uint8_t off,
uint8_t n,
const uint16_t * in )

Writes the UPDATE_DATA page, for the link_page_t table.

Parameters
ctxUnused.
offFirst register to write.
nNumber of registers to write.
inThe register values to write.
Returns
0 to accept, or a link_nack_t to refuse.

◆ update_hw_holds_arm()

bool update_hw_holds_arm ( void )

True while ARM is refused: an update session or an image on trial.

Returns
True when ARM is refused.

◆ update_hw_init()

void update_hw_init ( bool(* busy )(void))

Read the boot ROM's word on this boot – which slot runs, whether it is on trial – and check the partition table against the layout this build has.

busy says whether flash may not be written now: the bank driving, the supply on, a servo programming session.

Parameters
busyReturns true while flash may not be written now.

◆ update_hw_on_trial()

bool update_hw_on_trial ( void )

For the console: whether the running image waits for its BUY.

Returns
True when the running image is on trial.

◆ update_hw_poll()

void update_hw_poll ( uint32_t now_ms)

Once per pass: a slice of a hash, the restart after ACTIVATE, an owed erase of the other slot's first sector, the end of a session that has had no update request for 5s.

Parameters
now_msThe pass's clock in ms.

◆ update_hw_refuses_arm()

bool update_hw_refuses_arm ( uint8_t off,
uint8_t n,
const uint16_t * in )

Whether a CONTROL write is refused for the update (link_update_dev.h).

Parameters
offFirst register of the write.
nNumber of registers in the write.
inThe register values of the write.
Returns
True when the write is refused.

◆ update_hw_slot()

int update_hw_slot ( void )

For the console: the slot running, 0 or 1, or -1 without a table.

Returns
The slot running, 0 or 1, or -1 without a partition table.