15#ifndef RCBENCH_LINK_UPDATE_DEV_H
16#define RCBENCH_LINK_UPDATE_DEV_H
33#define LINK_UPD_HASH_STEP 1024u
44#define LINK_UPD_SILENCE_MS 5000u
50#define LINK_UPD_SWEEP_MS 1000u
56#define LINK_UPD_RESTART_MS 20u
65 bool (*
erase)(
void *ctx, uint32_t off);
67 bool (*
program)(
void *ctx, uint32_t off,
const uint8_t *data);
74 bool (*
buy)(
void *ctx);
97 uint16_t data[LINK_UPD_DATA_COUNT];
106 uint32_t restart_at_ms;
137 const uint8_t *running,
const uint8_t *target,
138 uint32_t slot_bytes, uint16_t slot);
149 uint8_t count, uint16_t *out);
160 uint8_t count,
const uint16_t *in);
170 uint8_t count, uint16_t *out);
182 uint8_t count,
const uint16_t *in);
220 uint8_t n,
const uint16_t *in);
The page map: what the panel can ask the IOmcu for, and set.
#define LINK_UPD_SECTOR_BYTES
Bytes in a flash sector, the unit of an erase.
Definition link_pages.h:2633
SHA-256 (Secure Hash Algorithm, 256-bit digest), as FIPS (Federal Information Processing Standard) 18...
#define LINK_SHA256_BYTES
Bytes in a digest.
Definition link_sha256.h:27
uint8_t link_update_dev_write_ctl(link_update_dev_t *u, uint8_t offset, uint8_t count, const uint16_t *in)
Write registers of the UPDATE_CTL page: one command and its arguments.
Definition link_update_dev.c:410
void link_update_dev_poll(link_update_dev_t *u, uint32_t now_ms)
The work that does not fit a reply: LINK_UPD_HASH_STEP bytes of a hash, the restart LINK_UPD_RESTART_...
Definition link_update_dev.c:500
void link_update_dev_init(link_update_dev_t *u, const link_update_io_t *io, const uint8_t *running, const uint8_t *target, uint32_t slot_bytes, uint16_t slot)
Start idle. slot is LINK_UPD_SLOT as the boot ROM reports it: the running slot, LINK_UPD_SLOT_NONE wi...
Definition link_update_dev.c:21
void link_update_dev_read_ctl(link_update_dev_t *u, uint8_t offset, uint8_t count, uint16_t *out)
The two pages' handlers, for the caller's link_page_t table.
Definition link_update_dev.c:376
void link_update_dev_read_data(link_update_dev_t *u, uint8_t offset, uint8_t count, uint16_t *out)
Read registers of the UPDATE_DATA page.
Definition link_update_dev.c:438
uint8_t link_update_dev_write_data(link_update_dev_t *u, uint8_t offset, uint8_t count, const uint16_t *in)
Write registers of the UPDATE_DATA page: stage part of a block.
Definition link_update_dev.c:450
bool link_update_dev_holds_arm(const link_update_dev_t *u)
True while ARM is refused: a session runs or an image waits for BUY.
Definition link_update_dev.c:555
bool link_update_dev_refuses_arm(const link_update_dev_t *u, uint8_t off, uint8_t n, const uint16_t *in)
Whether a write of n CONTROL registers from off is refused for the update: it asks for a non-zero ARM...
Definition link_update_dev.c:564
What both ends of the IOmcu update need to know about an RP2350 image: where its TBYB (try before you...
A SHA-256 over len bytes fed in pieces, the byte at flag_at read with LINK_IMAGE_TBYB_BIT set or clea...
Definition link_update_image.h:60
The state of the IOmcu's side of one update session.
Definition link_update_dev.h:83
uint8_t expect[LINK_SHA256_BYTES]
Definition link_update_dev.h:101
const uint8_t * target
Definition link_update_dev.h:86
uint8_t sector[LINK_UPD_SECTOR_BYTES]
Definition link_update_dev.h:117
bool sweep
Definition link_update_dev.h:111
uint32_t slot_bytes
Definition link_update_dev.h:87
bool sweep_tried
Definition link_update_dev.h:113
uint16_t slot
Definition link_update_dev.h:88
uint8_t first[LINK_UPD_SECTOR_BYTES]
Definition link_update_dev.h:116
uint16_t blocks
Definition link_update_dev.h:95
uint8_t digest_of
Definition link_update_dev.h:99
bool heard
Definition link_update_dev.h:108
uint8_t state
Definition link_update_dev.h:90
uint32_t size
Definition link_update_dev.h:93
link_image_hash_t hash
Definition link_update_dev.h:102
uint8_t digest[LINK_SHA256_BYTES]
Definition link_update_dev.h:100
uint32_t heard_ms
Definition link_update_dev.h:110
uint16_t regs_cmd[4]
Definition link_update_dev.h:92
uint32_t sweep_ms
Definition link_update_dev.h:114
uint8_t error
Definition link_update_dev.h:91
const uint8_t * running
Definition link_update_dev.h:85
uint16_t next
Definition link_update_dev.h:94
The flash, gate, boot ROM and restart callbacks of the update.
Definition link_update_dev.h:61
bool(*) erase(void *ctx, uint32_t off)
Erase the 4KiB sector off bytes into the slot being written.
Definition link_update_dev.h:65
void(*) restart(void *ctx)
Restart into the slot written, as a flash update boot.
Definition link_update_dev.h:76
bool(*) buy(void *ctx)
Buy the image on trial; true when the boot ROM took it.
Definition link_update_dev.h:74
bool(*) program(void *ctx, uint32_t off, const uint8_t *data)
Program the 4KiB sector at off from data.
Definition link_update_dev.h:67
bool(*) gate(void *ctx)
True while flash may be written: the bank not driving, the supply's output off, no servo programming ...
Definition link_update_dev.h:72