mips: fix mips_ejtag_set_instr error handling
authorØyvind Harboe <oyvind.harboe@zylin.com>
Thu, 31 Mar 2011 21:31:37 +0000 (23:31 +0200)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Thu, 31 Mar 2011 21:36:45 +0000 (23:36 +0200)
this fn does not fail, it queues data.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
src/target/mips_ejtag.c
src/target/mips_ejtag.h

index 6ce702fdbb0c43e07809c97db49b5b06a64c4250..8e1404f1868eee2acc1504355f31df49ea47368b 100644 (file)
 #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;
index 0db0504a79dbb36d3cd0046d1793ea56ea1497bf..63b6093ca25c353562d15fea6386b2a4d9763b3c 100644 (file)
@@ -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);

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)