diff options
author | Øyvind Harboe <oyvind.harboe@zylin.com> | 2011-03-31 23:46:32 +0200 |
---|---|---|
committer | Øyvind Harboe <oyvind.harboe@zylin.com> | 2011-03-31 23:46:56 +0200 |
commit | 0c1ebf2673ef02c5fef7677cbf09d4ad4fa3c533 (patch) | |
tree | 9a401addc8d54451fa9773cb29c4be153ca25c8e | |
parent | 83ab5ad2408c7d67ea490986f887c432f229e0ef (diff) | |
download | openocd+libswd-0c1ebf2673ef02c5fef7677cbf09d4ad4fa3c533.tar.gz openocd+libswd-0c1ebf2673ef02c5fef7677cbf09d4ad4fa3c533.tar.bz2 openocd+libswd-0c1ebf2673ef02c5fef7677cbf09d4ad4fa3c533.tar.xz openocd+libswd-0c1ebf2673ef02c5fef7677cbf09d4ad4fa3c533.zip |
mips: mips32_pracc_exec error propagation fixes
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
-rw-r--r-- | src/target/mips32_pracc.c | 32 | ||||
-rw-r--r-- | src/target/mips_ejtag.c | 18 |
2 files changed, 21 insertions, 29 deletions
diff --git a/src/target/mips32_pracc.c b/src/target/mips32_pracc.c index 0ee5715d..54274abf 100644 --- a/src/target/mips32_pracc.c +++ b/src/target/mips32_pracc.c @@ -446,7 +446,7 @@ static int mips32_pracc_read_mem16(struct mips_ejtag *ejtag_info, uint32_t addr, uint32_t *param_out = malloc(count * sizeof(uint32_t)); int i; -// int retval; + int retval = ERROR_OK; int blocksize; int bytesread; uint32_t param_in[2]; @@ -462,7 +462,7 @@ static int mips32_pracc_read_mem16(struct mips_ejtag *ejtag_info, uint32_t addr, param_in[0] = addr; param_in[1] = blocksize; - mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \ + retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, ARRAY_SIZE(param_in), param_in, count, param_out, 1); // count -= blocksize; @@ -477,7 +477,7 @@ static int mips32_pracc_read_mem16(struct mips_ejtag *ejtag_info, uint32_t addr, free(param_out); - return ERROR_OK; + return retval; } static int mips32_pracc_read_mem8(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint8_t *buf) @@ -523,7 +523,7 @@ static int mips32_pracc_read_mem8(struct mips_ejtag *ejtag_info, uint32_t addr, uint32_t *param_out = malloc(count * sizeof(uint32_t)); int i; -// int retval; + int retval = ERROR_OK; int blocksize; int bytesread; uint32_t param_in[2]; @@ -539,7 +539,7 @@ static int mips32_pracc_read_mem8(struct mips_ejtag *ejtag_info, uint32_t addr, param_in[0] = addr; param_in[1] = blocksize; - mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \ + retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, ARRAY_SIZE(param_in), param_in, count, param_out, 1); // count -= blocksize; @@ -554,7 +554,7 @@ static int mips32_pracc_read_mem8(struct mips_ejtag *ejtag_info, uint32_t addr, free(param_out); - return ERROR_OK; + return retval; } int mips32_pracc_write_mem(struct mips_ejtag *ejtag_info, uint32_t addr, int size, int count, void *buf) @@ -616,12 +616,13 @@ static int mips32_pracc_write_mem32(struct mips_ejtag *ejtag_info, uint32_t addr memcpy(¶m_in[2], buf, count * sizeof(uint32_t)); - mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \ + int retval; + retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, count + 2, param_in, 0, NULL, 1); free(param_in); - return ERROR_OK; + return retval; } static int mips32_pracc_write_u32(struct mips_ejtag *ejtag_info, uint32_t addr, uint32_t *buf) @@ -650,10 +651,8 @@ static int mips32_pracc_write_u32(struct mips_ejtag *ejtag_info, uint32_t addr, param_in[0] = addr; param_in[1] = *buf; - mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \ + return mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, ARRAY_SIZE(param_in), param_in, 0, NULL, 1); - - return ERROR_OK; } static int mips32_pracc_write_mem16(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint16_t *buf) @@ -706,12 +705,13 @@ static int mips32_pracc_write_mem16(struct mips_ejtag *ejtag_info, uint32_t addr param_in[i + 2] = buf[i]; } - mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \ + int retval; + retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, count + 2, param_in, 0, NULL, 1); free(param_in); - return ERROR_OK; + return retval; } static int mips32_pracc_write_mem8(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint8_t *buf) @@ -765,7 +765,7 @@ static int mips32_pracc_write_mem8(struct mips_ejtag *ejtag_info, uint32_t addr, param_in[i + 2] = buf[i]; } - retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \ + retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, count + 2, param_in, 0, NULL, 1); free(param_in); @@ -837,7 +837,7 @@ int mips32_pracc_write_regs(struct mips_ejtag *ejtag_info, uint32_t *regs) int retval; - retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \ + retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, MIPS32NUMCOREREGS, regs, 0, NULL, 1); return retval; @@ -912,7 +912,7 @@ int mips32_pracc_read_regs(struct mips_ejtag *ejtag_info, uint32_t *regs) int retval; - retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \ + retval = mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, 0, NULL, MIPS32NUMCOREREGS, regs, 1); return retval; diff --git a/src/target/mips_ejtag.c b/src/target/mips_ejtag.c index f9eaef19..9df8a021 100644 --- a/src/target/mips_ejtag.c +++ b/src/target/mips_ejtag.c @@ -162,10 +162,8 @@ static int mips_ejtag_step_enable(struct mips_ejtag *ejtag_info) MIPS32_MFC0(1,31,0), /* move COP0 DeSave to $1 */ }; - mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \ - 0, NULL, 0, NULL, 1); - - return ERROR_OK; + return mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, + 0, NULL, 0, NULL, 1); } static int mips_ejtag_step_disable(struct mips_ejtag *ejtag_info) @@ -187,10 +185,8 @@ static int mips_ejtag_step_disable(struct mips_ejtag *ejtag_info) MIPS32_MFC0(15,31,0), /* move COP0 DeSave to $15 */ }; - mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \ + return mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, 0, NULL, 0, NULL, 1); - - return ERROR_OK; } int mips_ejtag_config_step(struct mips_ejtag *ejtag_info, int enable_step) @@ -228,9 +224,7 @@ int mips_ejtag_exit_debug(struct mips_ejtag *ejtag_info) inst = MIPS32_DRET; /* execute our dret instruction */ - mips32_pracc_exec(ejtag_info, 1, &inst, 0, NULL, 0, NULL, 0); - - return ERROR_OK; + return mips32_pracc_exec(ejtag_info, 1, &inst, 0, NULL, 0, NULL, 0); } int mips_ejtag_read_debug(struct mips_ejtag *ejtag_info, uint32_t* debug_reg) @@ -252,10 +246,8 @@ int mips_ejtag_read_debug(struct mips_ejtag *ejtag_info, uint32_t* debug_reg) MIPS32_MFC0(15,31,0), /* move COP0 DeSave to $15 */ }; - mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, \ + return mips32_pracc_exec(ejtag_info, ARRAY_SIZE(code), code, 0, NULL, 1, debug_reg, 1); - - return ERROR_OK; } int mips_ejtag_init(struct mips_ejtag *ejtag_info) |