jtag: getting the JTAG speed can fail
[openocd.git] / src / jtag / drivers / amt_jtagaccel.c
index 974761e75fc511327e6b03c80d2a897501d4c793..552d04d20ef82002c0b396b485353880d5623acc 100644 (file)
@@ -22,8 +22,6 @@
 #endif
 
 #include <jtag/interface.h>
-#include <jtag/commands.h>
-
 
 #if PARPORT_USE_PPDEV == 1
 #include <linux/parport.h>
 #endif
 #endif
 
+/**
+ * @file
+ * Support the Amontec Chameleon POD with JTAG Accelerator support.
+ * This is a parallel port JTAG adapter with a CPLD between the
+ * parallel port and the JTAG connection.  VHDL code running in the
+ * CPLD significantly accelerates JTAG operations compared to the
+ * bitbanging "Wiggler" style of most parallel port adapters.
+ */
+
 /* configuration */
 static uint16_t amt_jtagaccel_port;
 
@@ -184,7 +191,8 @@ static void amt_jtagaccel_state_move(void)
 
        aw_scan_tms_5 = 0x40 | (tms_scan[0] & 0x1f);
        AMT_AW(aw_scan_tms_5);
-       int jtag_speed = jtag_get_speed();
+       int retval = jtag_get_speed(&jtag_speed);
+       assert(retval == ERROR_OK);
        if (jtag_speed > 3 || rtck_enabled)
                amt_wait_scan_busy();
 
@@ -242,7 +250,9 @@ static void amt_jtagaccel_scan(bool ir_scan, enum scan_type type, uint8_t *buffe
        uint8_t dr_tdo;
        uint8_t aw_tms_scan;
        uint8_t tms_scan[2];
-       int jtag_speed = jtag_get_speed();
+       int jtag_speed_var;
+       int retval = jtag_get_speed(&jtag_speed_var);
+       assert(retval == ERROR_OK);
 
        if (ir_scan)
                amt_jtagaccel_end_state(TAP_IRSHIFT);
@@ -260,7 +270,7 @@ static void amt_jtagaccel_scan(bool ir_scan, enum scan_type type, uint8_t *buffe
 
                dw_tdi_scan = buf_get_u32(buffer, bit_count, (scan_size - 1) % 8) & 0xff;
                AMT_DW(dw_tdi_scan);
-               if (jtag_speed > 3 || rtck_enabled)
+               if (jtag_speed_var > 3 || rtck_enabled)
                        amt_wait_scan_busy();
 
                if ((type == SCAN_IN) || (type == SCAN_IO))
@@ -278,7 +288,7 @@ static void amt_jtagaccel_scan(bool ir_scan, enum scan_type type, uint8_t *buffe
        {
                dw_tdi_scan = buf_get_u32(buffer, bit_count, 8) & 0xff;
                AMT_DW(dw_tdi_scan);
-               if (jtag_speed > 3 || rtck_enabled)
+               if (jtag_speed_var > 3 || rtck_enabled)
                        amt_wait_scan_busy();
 
                if ((type == SCAN_IN) || (type == SCAN_IO))
@@ -295,7 +305,7 @@ static void amt_jtagaccel_scan(bool ir_scan, enum scan_type type, uint8_t *buffe
        tms_scan[1] = amt_jtagaccel_tap_move[tap_move_ndx(tap_get_state())][tap_move_ndx(tap_get_end_state())][1];
        aw_tms_scan = 0x40 | (tms_scan[0] & 0x1f) | (buf_get_u32(buffer, bit_count, 1) << 5);
        AMT_AW(aw_tms_scan);
-       if (jtag_speed > 3 || rtck_enabled)
+       if (jtag_speed_var > 3 || rtck_enabled)
                amt_wait_scan_busy();
 
        if ((type == SCAN_IN) || (type == SCAN_IO))
@@ -309,7 +319,7 @@ static void amt_jtagaccel_scan(bool ir_scan, enum scan_type type, uint8_t *buffe
        {
                aw_tms_scan = 0x40 | (tms_scan[1] & 0x1f);
                AMT_AW(aw_tms_scan);
-               if (jtag_speed > 3 || rtck_enabled)
+               if (jtag_speed_var > 3 || rtck_enabled)
                        amt_wait_scan_busy();
        }
        tap_set_state(tap_get_end_state());
@@ -349,7 +359,7 @@ static int amt_jtagaccel_execute_queue(void)
                                amt_jtagaccel_end_state(cmd->cmd.runtest->end_state);
                                amt_jtagaccel_runtest(cmd->cmd.runtest->num_cycles);
                                break;
-                       case JTAG_STATEMOVE:
+                       case JTAG_TLR_RESET:
 #ifdef _DEBUG_JTAG_IO_
                                LOG_DEBUG("statemove end in %i", cmd->cmd.statemove->end_state);
 #endif
@@ -495,7 +505,9 @@ static int amt_jtagaccel_init(void)
        aw_control_fsm |= 0x04;
        AMT_AW(aw_control_fsm);
 
-       amt_jtagaccel_speed(jtag_get_speed());
+       int jtag_speed_var;
+       int retval = jtag_get_speed(&jtag_speed_var);
+       amt_jtagaccel_speed(jtag_speed_var);
 
        enum reset_types jtag_reset_config = jtag_get_reset_config();
        if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
@@ -573,15 +585,21 @@ static const struct command_registration amtjtagaccel_command_handlers[] = {
                .name = "parport_port",
                .handler = &amt_jtagaccel_handle_parport_port_command,
                .mode = COMMAND_CONFIG,
-               .help = "configure the parallel port to use",
-               .usage = "<port_num>",
+               .help = "configure or display the parallel port to use",
+               .usage = "[port_num]",
        },
        {
+               /**
+                * @todo Remove this "rtck" command; just use the standard
+                * mechanism to enable/disable adaptive clocking.  First
+                * implement the standard mechanism and deprecate "rtck";
+                * after a year or so, it'll be safe to remove this.
+                */
                .name = "rtck",
                .handler = &amt_jtagaccel_handle_rtck_command,
                .mode = COMMAND_CONFIG,
-               .help = "enable RTCK",
-               .usage = "<enable|disable>",
+               .help = "configure or display RTCK support",
+               .usage = "[enable|disable]",
        },
        COMMAND_REGISTRATION_DONE
 };

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)