mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-09-28 03:56:26 +03:00
Provide fileio_mem() function
This commit is contained in:
17
src/fileio.c
17
src/fileio.c
@@ -1547,6 +1547,17 @@ int fileio_fmt_autodetect(const char *fname) {
|
||||
|
||||
|
||||
|
||||
int fileio_mem(int op, const char *filename, FILEFMT format,
|
||||
const AVRPART *p, const AVRMEM *mem, int size) {
|
||||
|
||||
if(size < 0 || op == FIO_READ || op == FIO_READ_FOR_VERIFY)
|
||||
size = mem->size;
|
||||
|
||||
const Segment seg = {0, size};
|
||||
return fileio_segments(op, filename, format, p, mem, 1, &seg);
|
||||
}
|
||||
|
||||
|
||||
int fileio(int op, const char *filename, FILEFMT format,
|
||||
const AVRPART *p, const char *memstr, int size) {
|
||||
|
||||
@@ -1556,11 +1567,7 @@ int fileio(int op, const char *filename, FILEFMT format,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(size < 0 || op == FIO_READ || op == FIO_READ_FOR_VERIFY)
|
||||
size = mem->size;
|
||||
|
||||
const Segment seg = {0, size};
|
||||
return fileio_segments(op, filename, format, p, mem, 1, &seg);
|
||||
return fileio_mem(op, filename, format, p, mem, size);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -479,7 +479,7 @@ typedef struct {
|
||||
|
||||
#define mem_is_in_flash(mem) (!!((mem)->type & MEM_IN_FLASH))
|
||||
#define mem_is_a_fuse(mem) (!!((mem)->type & MEM_IS_A_FUSE))
|
||||
#define mem_is_in_fuses(mem) (!!((mem)->type & (MEM_FUSES | MEM_IS_A_FUSE))) // If fuses exists, that is
|
||||
#define mem_is_in_fuses(mem) (!!((mem)->type & (MEM_FUSES | MEM_IS_A_FUSE))) // If fuses exists!
|
||||
#define mem_is_user_type(mem) (!!((mem)->type & MEM_USER_TYPE))
|
||||
#define mem_is_in_sigrow(mem) (!!((mem)->type & MEM_IN_SIGROW)) // If sigrow exists, that is
|
||||
#define mem_is_readonly(mem) (!!((mem)->type & MEM_READONLY))
|
||||
@@ -1243,6 +1243,9 @@ int fileio_fmt_autodetect_fp(FILE *f);
|
||||
|
||||
int fileio_fmt_autodetect(const char *fname);
|
||||
|
||||
int fileio_mem(int oprwv, const char *filename, FILEFMT format,
|
||||
const AVRPART *p, const AVRMEM *mem, int size);
|
||||
|
||||
int fileio(int oprwv, const char *filename, FILEFMT format,
|
||||
const AVRPART *p, const char *memstr, int size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user