arm_adi_v5: add API send_sequence() and use it
[openocd.git] / src / target / arm_adi_v5.c
index d2ec960a82076f2ab7b3eba7c9b78b578a89da11..2d47da3ea6c24787ea8671e48e167c3c9076b51a 100644 (file)
@@ -804,26 +804,9 @@ int mem_ap_init(struct adiv5_ap *ap)
  */
 int dap_to_swd(struct adiv5_dap *dap)
 {
-       int retval;
-
        LOG_DEBUG("Enter SWD mode");
 
-       if (transport_is_jtag()) {
-               retval =  jtag_add_tms_seq(swd_seq_jtag_to_swd_len,
-                               swd_seq_jtag_to_swd, TAP_INVALID);
-               if (retval == ERROR_OK)
-                       retval = jtag_execute_queue();
-               return retval;
-       }
-
-       if (transport_is_swd()) {
-               const struct swd_driver *swd = adiv5_dap_swd_driver(dap);
-
-               return swd->switch_seq(JTAG_TO_SWD);
-       }
-
-       LOG_ERROR("Nor JTAG nor SWD transport");
-       return ERROR_FAIL;
+       return dap_send_sequence(dap, JTAG_TO_SWD);
 }
 
 /**
@@ -839,26 +822,9 @@ int dap_to_swd(struct adiv5_dap *dap)
  */
 int dap_to_jtag(struct adiv5_dap *dap)
 {
-       int retval;
-
        LOG_DEBUG("Enter JTAG mode");
 
-       if (transport_is_jtag()) {
-               retval = jtag_add_tms_seq(swd_seq_swd_to_jtag_len,
-                               swd_seq_swd_to_jtag, TAP_RESET);
-               if (retval == ERROR_OK)
-                       retval = jtag_execute_queue();
-               return retval;
-       }
-
-       if (transport_is_swd()) {
-               const struct swd_driver *swd = adiv5_dap_swd_driver(dap);
-
-               return swd->switch_seq(SWD_TO_JTAG);
-       }
-
-       LOG_ERROR("Nor JTAG nor SWD transport");
-       return ERROR_FAIL;
+       return dap_send_sequence(dap, SWD_TO_JTAG);
 }
 
 /* CID interpretation -- see ARM IHI 0029B section 3

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)