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>
This commit is contained in:
David Brownell 2009-12-18 10:09:35 -08:00
parent 7641934197
commit 013b05f7f8
1 changed files with 4 additions and 2 deletions

View File

@ -534,14 +534,16 @@ COMMAND_HANDLER(handle_flash_fill_command)
for (wrote = 0; wrote < (count*wordsize); wrote += cur_size) for (wrote = 0; wrote < (count*wordsize); wrote += cur_size)
{ {
cur_size = MIN((count*wordsize - wrote), sizeof(chunk));
struct flash_bank *bank; struct flash_bank *bank;
bank = get_flash_bank_by_addr(target, address); bank = get_flash_bank_by_addr(target, address);
if (bank == NULL) if (bank == NULL)
{ {
retval = ERROR_FAIL; retval = ERROR_FAIL;
goto done; goto done;
} }
cur_size = MIN((count * wordsize - wrote), chunksize);
err = flash_driver_write(bank, chunk, address - bank->base + wrote, cur_size); err = flash_driver_write(bank, chunk, address - bank->base + wrote, cur_size);
if (err != ERROR_OK) if (err != ERROR_OK)
{ {
@ -576,7 +578,7 @@ COMMAND_HANDLER(handle_flash_fill_command)
duration_elapsed(&bench), duration_kbps(&bench, wrote)); duration_elapsed(&bench), duration_kbps(&bench, wrote));
} }
done: done:
free(readback); free(readback);
free(chunk); free(chunk);