diff options
author | Øyvind Harboe <oyvind.harboe@zylin.com> | 2011-03-31 23:31:37 +0200 |
---|---|---|
committer | Øyvind Harboe <oyvind.harboe@zylin.com> | 2011-03-31 23:36:45 +0200 |
commit | 667c65552e56aeb4d08aa1ec8b1fb9fc29117201 (patch) | |
tree | e2cf3da87ac0a647cbe6e4186c8169002359b3cc /src | |
parent | e1f5055bb089d1f854777da1d200e7551cdd3a4f (diff) | |
download | riscv-openocd-667c65552e56aeb4d08aa1ec8b1fb9fc29117201.zip riscv-openocd-667c65552e56aeb4d08aa1ec8b1fb9fc29117201.tar.gz riscv-openocd-667c65552e56aeb4d08aa1ec8b1fb9fc29117201.tar.bz2 |
mips: fix mips_ejtag_set_instr error handling
this fn does not fail, it queues data.
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/target/mips_ejtag.c | 22 | ||||
-rw-r--r-- | src/target/mips_ejtag.h | 2 |
2 files changed, 10 insertions, 14 deletions
diff --git a/src/target/mips_ejtag.c b/src/target/mips_ejtag.c index 6ce702f..8e1404f 100644 --- a/src/target/mips_ejtag.c +++ b/src/target/mips_ejtag.c @@ -28,13 +28,12 @@ #include "mips32.h" #include "mips_ejtag.h" -int mips_ejtag_set_instr(struct mips_ejtag *ejtag_info, int new_instr) +void mips_ejtag_set_instr(struct mips_ejtag *ejtag_info, int new_instr) { struct jtag_tap *tap; tap = ejtag_info->tap; - if (tap == NULL) - return ERROR_FAIL; + assert(tap != NULL); if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != (uint32_t)new_instr) { @@ -48,8 +47,6 @@ int mips_ejtag_set_instr(struct mips_ejtag *ejtag_info, int new_instr) jtag_add_ir_scan(tap, &field, TAP_IDLE); } - - return ERROR_OK; } int mips_ejtag_get_idcode(struct mips_ejtag *ejtag_info, uint32_t *idcode) @@ -98,9 +95,8 @@ int mips_ejtag_drscan_32(struct mips_ejtag *ejtag_info, uint32_t *data) { struct jtag_tap *tap; tap = ejtag_info->tap; + assert(tap != NULL); - if (tap == NULL) - return ERROR_FAIL; struct scan_field field; uint8_t t[4], r[4]; int retval; @@ -129,9 +125,8 @@ int mips_ejtag_drscan_8(struct mips_ejtag *ejtag_info, uint32_t *data) { struct jtag_tap *tap; tap = ejtag_info->tap; + assert(tap != NULL); - if (tap == NULL) - return ERROR_FAIL; struct scan_field field; uint8_t t[4] = {0, 0, 0, 0}, r[4]; int retval; @@ -219,7 +214,10 @@ int mips_ejtag_enter_debug(struct mips_ejtag *ejtag_info) mips_ejtag_drscan_32(ejtag_info, &ejtag_ctrl); LOG_DEBUG("ejtag_ctrl: 0x%8.8" PRIx32 "", ejtag_ctrl); if ((ejtag_ctrl & EJTAG_CTRL_BRKST) == 0) - LOG_DEBUG("Failed to enter Debug Mode!"); + { + LOG_ERROR("Failed to enter Debug Mode!"); + return ERROR_FAIL; + } return ERROR_OK; } @@ -311,9 +309,7 @@ int mips_ejtag_fastdata_scan(struct mips_ejtag *ejtag_info, int write_t, uint32_ { struct jtag_tap *tap; tap = ejtag_info->tap; - - if (tap == NULL) - return ERROR_FAIL; + assert(tap != NULL); struct scan_field fields[2]; uint8_t spracc = 0; diff --git a/src/target/mips_ejtag.h b/src/target/mips_ejtag.h index 0db0504..63b6093 100644 --- a/src/target/mips_ejtag.h +++ b/src/target/mips_ejtag.h @@ -131,7 +131,7 @@ struct mips_ejtag int fast_access_save; }; -int mips_ejtag_set_instr(struct mips_ejtag *ejtag_info, +void mips_ejtag_set_instr(struct mips_ejtag *ejtag_info, int new_instr); int mips_ejtag_enter_debug(struct mips_ejtag *ejtag_info); int mips_ejtag_exit_debug(struct mips_ejtag *ejtag_info); |