}
/* write program into RAM */
- mips32_pracc_write_mem32(ejtag_info, source->address, ARRAY_SIZE(handler_code), handler_code);
+ if (write_t != ejtag_info->fast_access_save)
+ {
+ mips32_pracc_write_mem32(ejtag_info, source->address, ARRAY_SIZE(handler_code), handler_code);
+ /* save previous operation to speed to any consecutive read/writes */
+ ejtag_info->fast_access_save = write_t;
+ }
LOG_DEBUG("%s using 0x%.8" PRIx32 " for write handler", __func__, source->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;
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) */
}
}
- 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)
{
retval = mips_m4k_write_memory(target, address, 4, count, buffer);
}
- if (source)
- target_free_working_area(target, source);
-
return retval;
}