summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2009-12-18 10:09:35 -0800
committerDavid Brownell <dbrownell@users.sourceforge.net>2009-12-18 10:09:35 -0800
commit013b05f7f813f0d0c15a6bb20068e9423a28bd0d (patch)
tree3fc7e3029dedde466c630b915dd920b840ecde82 /src
parent7641934197abbd851127afcb0b7cebc30242f717 (diff)
downloadopenocd+libswd-013b05f7f813f0d0c15a6bb20068e9423a28bd0d.tar.gz
openocd+libswd-013b05f7f813f0d0c15a6bb20068e9423a28bd0d.tar.bz2
openocd+libswd-013b05f7f813f0d0c15a6bb20068e9423a28bd0d.tar.xz
openocd+libswd-013b05f7f813f0d0c15a6bb20068e9423a28bd0d.zip
Subject: flash fill[bwh] should use bulk i/o
It's currently allocating a big buffer but writing it out in units of sizeof(host's pointer) ... sub-optimal. Plus fix a couple minor coding style goofs. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Diffstat (limited to 'src')
-rw-r--r--src/flash/nor/tcl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c
index 1e933b27..b5e1b2ce 100644
--- a/src/flash/nor/tcl.c
+++ b/src/flash/nor/tcl.c
@@ -534,14 +534,16 @@ COMMAND_HANDLER(handle_flash_fill_command)
for (wrote = 0; wrote < (count*wordsize); wrote += cur_size)
{
- cur_size = MIN((count*wordsize - wrote), sizeof(chunk));
struct flash_bank *bank;
+
bank = get_flash_bank_by_addr(target, address);
if (bank == NULL)
{
retval = ERROR_FAIL;
goto done;
}
+
+ cur_size = MIN((count * wordsize - wrote), chunksize);
err = flash_driver_write(bank, chunk, address - bank->base + wrote, cur_size);
if (err != ERROR_OK)
{
@@ -576,7 +578,7 @@ COMMAND_HANDLER(handle_flash_fill_command)
duration_elapsed(&bench), duration_kbps(&bench, wrote));
}
- done:
+done:
free(readback);
free(chunk);