Introduce int (*updatehook)()

This commit is contained in:
Stefan Rueger
2026-04-02 23:12:17 +01:00
parent d1544c18ef
commit 03aa193722
3 changed files with 7 additions and 0 deletions

View File

@@ -981,6 +981,8 @@ typedef struct {
unsigned long ms[LED_N]; // Time in ms after last physical change
} Leds;
typedef struct update UPDATE;
/*
* Any changes in PROGRAMMER, please also ensure changes are made in
* - lexer.l
@@ -1077,6 +1079,7 @@ typedef struct programmer {
void (*teardown)(PROGRAMMER *pgm);
int (*flash_readhook)(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *flm,
const char *fname, int size);
int (*updatehook)(const PROGRAMMER *pgm, const AVRPART *p, const UPDATE *upd, int flags);
// Cached r/w API for terminal reads/writes
int (*write_byte_cached)(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,

View File

@@ -119,6 +119,7 @@ void pgm_init_functions(PROGRAMMER *pgm) {
pgm->parseextparams = NULL;
pgm->readonly = NULL;
pgm->flash_readhook = NULL;
pgm->updatehook = NULL;
}
PROGRAMMER *pgm_new(void) {

View File

@@ -640,6 +640,9 @@ int do_op(const PROGRAMMER *pgm, const AVRPART *p, const UPDATE *upd, enum updat
Filestats fs;
const char *umstr = upd->memstr;
if(pgm->updatehook)
pgm->updatehook(pgm, p, upd, flags);
if(!(flags & UF_NOHEADING)) {
char *heading = update_str(upd);