diff options
author | Øyvind Harboe <oyvind.harboe@zylin.com> | 2011-03-31 18:42:10 +0200 |
---|---|---|
committer | Øyvind Harboe <oyvind.harboe@zylin.com> | 2011-03-31 23:46:56 +0200 |
commit | d76fd2aac798b4b052a50883ac148cbc19080d4a (patch) | |
tree | 2e96b2614909768742024bc612340ce2f6b6ef07 /src | |
parent | 1b9e80f7e6359d59b68a7741c046722bb235a311 (diff) | |
download | openocd+libswd-d76fd2aac798b4b052a50883ac148cbc19080d4a.tar.gz openocd+libswd-d76fd2aac798b4b052a50883ac148cbc19080d4a.tar.bz2 openocd+libswd-d76fd2aac798b4b052a50883ac148cbc19080d4a.tar.xz openocd+libswd-d76fd2aac798b4b052a50883ac148cbc19080d4a.zip |
mips: delete kludgy code that modifies data sent to write_memory()
Could this cause confusion as data sent to write would be flipped
and then if the caller subsequently used the data, e.g. a
compare mismatch might happen?
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/target/mips_m4k.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/target/mips_m4k.c b/src/target/mips_m4k.c index 0508c35f..589ba7a0 100644 --- a/src/target/mips_m4k.c +++ b/src/target/mips_m4k.c @@ -1004,19 +1004,34 @@ static int mips_m4k_bulk_write_memory(struct target *target, uint32_t address, ejtag_info->fast_access_save = -1; } + uint8_t * t = NULL; + /* TAP data register is loaded LSB first (little endian) */ if (target->endianness == TARGET_BIG_ENDIAN) { + t = malloc(count * sizeof(uint32_t)); + if (t == NULL) + { + LOG_ERROR("Out of memory"); + return ERROR_FAIL; + } + uint32_t i, t32; for(i = 0; i < (count * 4); i += 4) { t32 = be_to_h_u32((uint8_t *) &buffer[i]); - h_u32_to_le(&buffer[i], t32); + h_u32_to_le(&t[i], t32); } + + buffer = t; } retval = mips32_pracc_fastdata_xfer(ejtag_info, mips32->fast_data_area, write_t, address, count, (uint32_t*) (void *)buffer); + + if (t != NULL) + free(t); + if (retval != ERROR_OK) { /* FASTDATA access failed, try normal memory write */ |