diff options
author | Spencer Oliver <ntfreak@users.sourceforge.net> | 2011-01-04 12:29:49 +0000 |
---|---|---|
committer | Spencer Oliver <ntfreak@users.sourceforge.net> | 2011-01-04 12:29:49 +0000 |
commit | 0cd84000daab056dea61eb9d60cca538a3716acd (patch) | |
tree | 693d56f745e551f3cabc1ec9ffaf8a7f8d8ff0a1 /src/target/mips_m4k.c | |
parent | dc1c5a750043a34ff94d51558b5473f567d84604 (diff) | |
download | riscv-openocd-0cd84000daab056dea61eb9d60cca538a3716acd.zip riscv-openocd-0cd84000daab056dea61eb9d60cca538a3716acd.tar.gz riscv-openocd-0cd84000daab056dea61eb9d60cca538a3716acd.tar.bz2 |
mips32: add fastdata loader working area
Add a working area that is preserved between calls to
mips_m4k_bulk_write_memory - this gives us a speed increase
of approx 3kb/sec during flash writes to the pic32mx.
This area is released during a resume/reset.
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
Diffstat (limited to 'src/target/mips_m4k.c')
-rw-r--r-- | src/target/mips_m4k.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/target/mips_m4k.c b/src/target/mips_m4k.c index c0adc06..8afee9c 100644 --- a/src/target/mips_m4k.c +++ b/src/target/mips_m4k.c @@ -964,7 +964,6 @@ static int mips_m4k_bulk_write_memory(struct target *target, uint32_t address, { struct mips32_common *mips32 = target_to_mips32(target); struct mips_ejtag *ejtag_info = &mips32->ejtag_info; - struct working_area *source; int retval; int write_t = 1; @@ -980,12 +979,23 @@ static int mips_m4k_bulk_write_memory(struct target *target, uint32_t address, if (address & 0x3u) return ERROR_TARGET_UNALIGNED_ACCESS; - /* Get memory for block write handler */ - retval = target_alloc_working_area(target, MIPS32_FASTDATA_HANDLER_SIZE, &source); - if (retval != ERROR_OK) + if (mips32->fast_data_area == NULL) { - LOG_WARNING("No working area available, falling back to non-bulk write"); - return mips_m4k_write_memory(target, address, 4, count, buffer); + /* Get memory for block write handler + * we preserve this area between calls and gain a speed increase + * of about 3kb/sec when writing flash + * this will be released/nulled by the system when the target is resumed or reset */ + retval = target_alloc_working_area(target, + MIPS32_FASTDATA_HANDLER_SIZE, + &mips32->fast_data_area); + if (retval != ERROR_OK) + { + LOG_WARNING("No working area available, falling back to non-bulk write"); + return mips_m4k_write_memory(target, address, 4, count, buffer); + } + + /* reset fastadata state so the algo get reloaded */ + ejtag_info->fast_access_save = -1; } /* TAP data register is loaded LSB first (little endian) */ @@ -999,7 +1009,7 @@ static int mips_m4k_bulk_write_memory(struct target *target, uint32_t address, } } - retval = mips32_pracc_fastdata_xfer(ejtag_info, source, write_t, address, + retval = mips32_pracc_fastdata_xfer(ejtag_info, mips32->fast_data_area, write_t, address, count, (uint32_t*) (void *)buffer); if (retval != ERROR_OK) { @@ -1008,9 +1018,6 @@ static int mips_m4k_bulk_write_memory(struct target *target, uint32_t address, retval = mips_m4k_write_memory(target, address, 4, count, buffer); } - if (source) - target_free_working_area(target, source); - return retval; } |