ARM: ADIv5, deadcode cleanup
authorDavid Brownell <dbrownell@users.sourceforge.net>
Sun, 21 Feb 2010 22:54:54 +0000 (14:54 -0800)
committerDavid Brownell <dbrownell@users.sourceforge.net>
Sun, 21 Feb 2010 22:54:54 +0000 (14:54 -0800)
I have no idea what the scan_inout_check() was *expecting* to achieve by
issuing a read of the DP_RDBUFF register.  But in any case, that code was
clearly never being called ("invalue" always NULL) ... so remove it, and
the associated comment.

Also rename it as ap_write_check(), facilitating a cleanup of its single
call site by removing constant parameters.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
src/target/arm_adi_v5.c

index d7afb58541e0a3ceac9c570953a67cdbd9a0d6af..66b947e78fc6a08a65e86f9f5398b4c4716f5f28 100644 (file)
@@ -188,23 +188,24 @@ static int adi_jtag_dp_scan_u32(struct swjdp_common *swjdp,
        return retval;
 }
 
-/* scan_inout_check adds one extra inscan for DPAP_READ commands to read variables */
-static int scan_inout_check(struct swjdp_common *swjdp,
-               uint8_t instr, uint8_t reg_addr, uint8_t RnW,
-               uint8_t *outvalue, uint8_t *invalue)
+/**
+ * Utility to write AP registers.
+ */
+static int ap_write_check(struct swjdp_common *dap,
+               uint8_t reg_addr, uint8_t *outvalue)
 {
-       adi_jtag_dp_scan(swjdp, instr, reg_addr, RnW, outvalue, NULL, NULL);
+       adi_jtag_dp_scan(dap, JTAG_DP_APACC, reg_addr, DPAP_WRITE,
+                       outvalue, NULL, NULL);
 
-       if ((RnW == DPAP_READ) && (invalue != NULL))
-               adi_jtag_dp_scan(swjdp, JTAG_DP_DPACC,
-                               DP_RDBUFF, DPAP_READ, 0, invalue, &swjdp->ack);
+       /* REVISIT except in dap_setup_accessport() almost all call paths
+        * set up COMPOSITE.  Probably worth just inlining the scan...
+        */
 
        /* In TRANS_MODE_ATOMIC all JTAG_DP_APACC transactions wait for
         * ack = OK/FAULT and the check CTRL_STAT
         */
-       if ((instr == JTAG_DP_APACC)
-                       && (swjdp->trans_mode == TRANS_MODE_ATOMIC))
-               return jtagdp_transaction_endcheck(swjdp);
+       if (dap->trans_mode == TRANS_MODE_ATOMIC)
+               return jtagdp_transaction_endcheck(dap);
 
        return ERROR_OK;
 }
@@ -432,8 +433,7 @@ static int dap_ap_write_reg(struct swjdp_common *swjdp,
        if (retval != ERROR_OK)
                return retval;
 
-       return scan_inout_check(swjdp, JTAG_DP_APACC, reg_addr,
-                       DPAP_WRITE, out_value_buf, NULL);
+       return ap_write_check(swjdp, reg_addr, out_value_buf);
 }
 
 /**

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)