mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-09-28 12:06:59 +03:00
Provide memstats_mem()
This commit is contained in:
@@ -1307,6 +1307,7 @@ char *update_str(const UPDATE *upd);
|
||||
int do_op(const PROGRAMMER *pgm, const AVRPART *p, const UPDATE *upd,
|
||||
enum updateflags flags);
|
||||
int memstats(const AVRPART *p, const char *memstr, int size, Filestats *fsp);
|
||||
int memstats_mem(const AVRPART *p, const AVRMEM *mem, int size, Filestats *fsp);
|
||||
|
||||
// Helper functions for dry run to determine file access
|
||||
int update_is_okfile(const char *fn);
|
||||
|
||||
12
src/update.c
12
src/update.c
@@ -146,7 +146,6 @@ char *update_str(const UPDATE *upd) {
|
||||
|
||||
// Memory statistics considering holes after a file read returned size bytes
|
||||
int memstats(const AVRPART *p, const char *memstr, int size, Filestats *fsp) {
|
||||
Filestats ret = { 0 };
|
||||
AVRMEM *mem = avr_locate_mem(p, memstr);
|
||||
|
||||
if(!mem) {
|
||||
@@ -154,8 +153,15 @@ int memstats(const AVRPART *p, const char *memstr, int size, Filestats *fsp) {
|
||||
return LIBAVRDUDE_GENERAL_FAILURE;
|
||||
}
|
||||
|
||||
return memstats_mem(p, mem, size, fsp);
|
||||
}
|
||||
|
||||
// Memory statistics considering holes after a file read returned size bytes
|
||||
int memstats_mem(const AVRPART *p, const AVRMEM *mem, int size, Filestats *fsp) {
|
||||
Filestats ret = { 0 };
|
||||
|
||||
if(!mem->buf || !mem->tags) {
|
||||
pmsg_error("%s %s is not set\n", p->desc, memstr);
|
||||
pmsg_error("%s %s is not set\n", p->desc, mem->desc);
|
||||
return LIBAVRDUDE_GENERAL_FAILURE;
|
||||
}
|
||||
|
||||
@@ -164,7 +170,7 @@ int memstats(const AVRPART *p, const char *memstr, int size, Filestats *fsp) {
|
||||
pgsize = 1;
|
||||
|
||||
if(size < 0 || size > mem->size) {
|
||||
pmsg_error("size %d at odds with %s %s size %d\n", size, p->desc, memstr, mem->size);
|
||||
pmsg_error("size %d at odds with %s %s size %d\n", size, p->desc, mem->desc, mem->size);
|
||||
return LIBAVRDUDE_GENERAL_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user