mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-06-02 09:46:34 +03:00
Introduce int (*updatehook)()
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user