summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-03-05 07:41:04 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-03-05 07:41:04 +0000
commit0f3c9f8f060428d07679dab3311b3337e9d10338 (patch)
treee358e3abbdd7477c381f8dd98071c2576ac5c11c /src
parent86c0f4cafc6fca5fae2b284cbbd3f44a288480c0 (diff)
downloadopenocd+libswd-0f3c9f8f060428d07679dab3311b3337e9d10338.tar.gz
openocd+libswd-0f3c9f8f060428d07679dab3311b3337e9d10338.tar.bz2
openocd+libswd-0f3c9f8f060428d07679dab3311b3337e9d10338.tar.xz
openocd+libswd-0f3c9f8f060428d07679dab3311b3337e9d10338.zip
Audrius Urmanavičius <didele.deze@gmail.com> cleanup flash fill
git-svn-id: svn://svn.berlios.de/openocd/trunk@1399 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src')
-rw-r--r--src/flash/flash.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/flash/flash.c b/src/flash/flash.c
index 1572e5cd..916ac24d 100644
--- a/src/flash/flash.c
+++ b/src/flash/flash.c
@@ -727,6 +727,7 @@ int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cmd, char
u32 count;
u8 chunk[1024];
u32 wrote = 0;
+ u32 cur_size = 0;
int chunk_count;
char *duration_text;
duration_t duration;
@@ -786,9 +787,9 @@ int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cmd, char
duration_start_measure(&duration);
- for (wrote=0; wrote<(count*wordsize); wrote+=sizeof(chunk))
+ for (wrote=0; wrote<(count*wordsize); wrote += cur_size)
{
- int cur_size = MIN( (count*wordsize - wrote) , 1024 );
+ cur_size = MIN( (count*wordsize - wrote), sizeof(chunk) );
flash_bank_t *bank;
bank = get_flash_bank_by_addr(target, address);
if(bank == NULL)
@@ -798,7 +799,6 @@ int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cmd, char
err = flash_driver_write(bank, chunk, address - bank->base + wrote, cur_size);
if (err!=ERROR_OK)
return err;
- wrote += cur_size;
}
if ((retval = duration_stop_measure(&duration, &duration_text)) != ERROR_OK)