summaryrefslogtreecommitdiff
path: root/src/flash
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2010-09-28 15:37:56 +0200
committerØyvind Harboe <oyvind.harboe@zylin.com>2010-09-29 08:43:27 +0200
commit3a693ef526575633cc350a69aa1a5d1f08e64c46 (patch)
tree6af64277137ac59254bf20d7d3ca175728a709bd /src/flash
parentecad76061f6edff5db67ad05e6514dff6cd6efc7 (diff)
downloadopenocd+libswd-3a693ef526575633cc350a69aa1a5d1f08e64c46.tar.gz
openocd+libswd-3a693ef526575633cc350a69aa1a5d1f08e64c46.tar.bz2
openocd+libswd-3a693ef526575633cc350a69aa1a5d1f08e64c46.tar.xz
openocd+libswd-3a693ef526575633cc350a69aa1a5d1f08e64c46.zip
fileio: refactor struct fileio to be an opaque structure
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Diffstat (limited to 'src/flash')
-rw-r--r--src/flash/mflash.c8
-rw-r--r--src/flash/nand/fileio.c2
-rw-r--r--src/flash/nand/tcl.c4
-rw-r--r--src/flash/nor/tcl.c8
4 files changed, 11 insertions, 11 deletions
diff --git a/src/flash/mflash.c b/src/flash/mflash.c
index 26b85b1f..272127be 100644
--- a/src/flash/mflash.c
+++ b/src/flash/mflash.c
@@ -726,8 +726,8 @@ COMMAND_HANDLER(mg_write_cmd)
return ERROR_FAIL;
}
- cnt = fileio.size / MG_FILEIO_CHUNK;
- res = fileio.size % MG_FILEIO_CHUNK;
+ cnt = fileio_size(&fileio) / MG_FILEIO_CHUNK;
+ res = fileio_size(&fileio) % MG_FILEIO_CHUNK;
struct duration bench;
duration_start(&bench);
@@ -752,8 +752,8 @@ COMMAND_HANDLER(mg_write_cmd)
if (duration_measure(&bench) == ERROR_OK)
{
command_print(CMD_CTX, "wrote %ld bytes from file %s "
- "in %fs (%0.3f kB/s)", (long)fileio.size, CMD_ARGV[1],
- duration_elapsed(&bench), duration_kbps(&bench, fileio.size));
+ "in %fs (%0.3f kB/s)", (long)fileio_size(&fileio), CMD_ARGV[1],
+ duration_elapsed(&bench), duration_kbps(&bench, fileio_size(&fileio)));
}
free(buffer);
diff --git a/src/flash/nand/fileio.c b/src/flash/nand/fileio.c
index 3e397ebd..0a006fc0 100644
--- a/src/flash/nand/fileio.c
+++ b/src/flash/nand/fileio.c
@@ -180,7 +180,7 @@ COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state,
return retval;
if (!need_size)
- state->size = state->fileio.size;
+ state->size = fileio_size(&state->fileio);
*dev = nand;
diff --git a/src/flash/nand/tcl.c b/src/flash/nand/tcl.c
index 57bbe00e..a54f8ea8 100644
--- a/src/flash/nand/tcl.c
+++ b/src/flash/nand/tcl.c
@@ -389,8 +389,8 @@ COMMAND_HANDLER(handle_nand_dump_command)
if (nand_fileio_finish(&s) == ERROR_OK)
{
command_print(CMD_CTX, "dumped %ld bytes in %fs (%0.3f KiB/s)",
- (long)s.fileio.size, duration_elapsed(&s.bench),
- duration_kbps(&s.bench, s.fileio.size));
+ (long)fileio_size(&s.fileio), duration_elapsed(&s.bench),
+ duration_kbps(&s.bench, fileio_size(&s.fileio)));
}
return ERROR_OK;
}
diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c
index 8604b4b3..f36ab7da 100644
--- a/src/flash/nor/tcl.c
+++ b/src/flash/nor/tcl.c
@@ -604,9 +604,9 @@ COMMAND_HANDLER(handle_flash_write_bank_command)
return ERROR_OK;
}
- buffer = malloc(fileio.size);
+ buffer = malloc(fileio_size(&fileio));
size_t buf_cnt;
- if (fileio_read(&fileio, fileio.size, buffer, &buf_cnt) != ERROR_OK)
+ if (fileio_read(&fileio, fileio_size(&fileio), buffer, &buf_cnt) != ERROR_OK)
{
free(buffer);
fileio_close(&fileio);
@@ -622,8 +622,8 @@ COMMAND_HANDLER(handle_flash_write_bank_command)
{
command_print(CMD_CTX, "wrote %ld bytes from file %s to flash bank %u"
" at offset 0x%8.8" PRIx32 " in %fs (%0.3f KiB/s)",
- (long)fileio.size, CMD_ARGV[1], p->bank_number, offset,
- duration_elapsed(&bench), duration_kbps(&bench, fileio.size));
+ (long)fileio_size(&fileio), CMD_ARGV[1], p->bank_number, offset,
+ duration_elapsed(&bench), duration_kbps(&bench, fileio_size(&fileio)));
}
fileio_close(&fileio);