tcl/drscan: handle invalid syntax with a conditional, not assert
[openocd.git] / src / jtag / tcl.c
1 /***************************************************************************
2 * Copyright (C) 2005 by Dominic Rath *
3 * Dominic.Rath@gmx.de *
4 * *
5 * Copyright (C) 2007-2010 Øyvind Harboe *
6 * oyvind.harboe@zylin.com *
7 * *
8 * Copyright (C) 2009 SoftPLC Corporation *
9 * http://softplc.com *
10 * dick@softplc.com *
11 * *
12 * Copyright (C) 2009 Zachary T Welch *
13 * zw@superlucidity.net *
14 * *
15 * This program is free software; you can redistribute it and/or modify *
16 * it under the terms of the GNU General Public License as published by *
17 * the Free Software Foundation; either version 2 of the License, or *
18 * (at your option) any later version. *
19 * *
20 * This program is distributed in the hope that it will be useful, *
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
23 * GNU General Public License for more details. *
24 * *
25 * You should have received a copy of the GNU General Public License *
26 * along with this program; if not, write to the *
27 * Free Software Foundation, Inc., *
28 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
29 ***************************************************************************/
30
31 #ifdef HAVE_CONFIG_H
32 #include "config.h"
33 #endif
34
35 #include "jtag.h"
36 #include "swd.h"
37 #include "minidriver.h"
38 #include "interface.h"
39 #include "interfaces.h"
40 #include "tcl.h"
41
42 #ifdef HAVE_STRINGS_H
43 #include <strings.h>
44 #endif
45
46 #include <helper/time_support.h>
47
48 /**
49 * @file
50 * Holds support for accessing JTAG-specific mechanisms from TCl scripts.
51 */
52
53 static const Jim_Nvp nvp_jtag_tap_event[] = {
54 { .value = JTAG_TRST_ASSERTED, .name = "post-reset" },
55 { .value = JTAG_TAP_EVENT_SETUP, .name = "setup" },
56 { .value = JTAG_TAP_EVENT_ENABLE, .name = "tap-enable" },
57 { .value = JTAG_TAP_EVENT_DISABLE, .name = "tap-disable" },
58
59 { .name = NULL, .value = -1 }
60 };
61
62 struct jtag_tap *jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *o)
63 {
64 const char *cp = Jim_GetString(o, NULL);
65 struct jtag_tap *t = cp ? jtag_tap_by_string(cp) : NULL;
66 if (NULL == cp)
67 cp = "(unknown)";
68 if (NULL == t)
69 Jim_SetResultFormatted(interp, "Tap '%s' could not be found", cp);
70 return t;
71 }
72
73 static bool scan_is_safe(tap_state_t state)
74 {
75 switch (state) {
76 case TAP_RESET:
77 case TAP_IDLE:
78 case TAP_DRPAUSE:
79 case TAP_IRPAUSE:
80 return true;
81 default:
82 return false;
83 }
84 }
85
86 static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args)
87 {
88 int retval;
89 struct scan_field *fields;
90 int num_fields;
91 int field_count = 0;
92 int i, e;
93 struct jtag_tap *tap;
94 tap_state_t endstate;
95
96 /* args[1] = device
97 * args[2] = num_bits
98 * args[3] = hex string
99 * ... repeat num bits and hex string ...
100 *
101 * .. optionally:
102 * args[N-2] = "-endstate"
103 * args[N-1] = statename
104 */
105 if ((argc < 4) || ((argc % 2) != 0)) {
106 Jim_WrongNumArgs(interp, 1, args, "wrong arguments");
107 return JIM_ERR;
108 }
109
110 endstate = TAP_IDLE;
111
112 script_debug(interp, "drscan", argc, args);
113
114 /* validate arguments as numbers */
115 e = JIM_OK;
116 for (i = 2; i < argc; i += 2) {
117 long bits;
118 const char *cp;
119
120 e = Jim_GetLong(interp, args[i], &bits);
121 /* If valid - try next arg */
122 if (e == JIM_OK)
123 continue;
124
125 /* Not valid.. are we at the end? */
126 if (((i + 2) != argc)) {
127 /* nope, then error */
128 return e;
129 }
130
131 /* it could be: "-endstate FOO"
132 * e.g. DRPAUSE so we can issue more instructions
133 * before entering RUN/IDLE and executing them.
134 */
135
136 /* get arg as a string. */
137 cp = Jim_GetString(args[i], NULL);
138 /* is it the magic? */
139 if (0 == strcmp("-endstate", cp)) {
140 /* is the statename valid? */
141 cp = Jim_GetString(args[i + 1], NULL);
142
143 /* see if it is a valid state name */
144 endstate = tap_state_by_name(cp);
145 if (endstate < 0) {
146 /* update the error message */
147 Jim_SetResultFormatted(interp, "endstate: %s invalid", cp);
148 } else {
149 if (!scan_is_safe(endstate))
150 LOG_WARNING("drscan with unsafe "
151 "endstate \"%s\"", cp);
152
153 /* valid - so clear the error */
154 e = JIM_OK;
155 /* and remove the last 2 args */
156 argc -= 2;
157 }
158 }
159
160 /* Still an error? */
161 if (e != JIM_OK)
162 return e; /* too bad */
163 } /* validate args */
164
165 assert(e == JIM_OK);
166
167 tap = jtag_tap_by_jim_obj(interp, args[1]);
168 if (tap == NULL)
169 return JIM_ERR;
170
171 num_fields = (argc-2)/2;
172 if (num_fields <= 0) {
173 Jim_SetResultString(interp, "drscan: no scan fields supplied", -1);
174 return JIM_ERR;
175 }
176 fields = malloc(sizeof(struct scan_field) * num_fields);
177 for (i = 2; i < argc; i += 2) {
178 long bits;
179 int len;
180 const char *str;
181
182 Jim_GetLong(interp, args[i], &bits);
183 str = Jim_GetString(args[i + 1], &len);
184
185 fields[field_count].num_bits = bits;
186 void *t = malloc(DIV_ROUND_UP(bits, 8));
187 fields[field_count].out_value = t;
188 str_to_buf(str, len, t, bits, 0);
189 fields[field_count].in_value = t;
190 field_count++;
191 }
192
193 jtag_add_dr_scan(tap, num_fields, fields, endstate);
194
195 retval = jtag_execute_queue();
196 if (retval != ERROR_OK) {
197 Jim_SetResultString(interp, "drscan: jtag execute failed", -1);
198 return JIM_ERR;
199 }
200
201 field_count = 0;
202 Jim_Obj *list = Jim_NewListObj(interp, NULL, 0);
203 for (i = 2; i < argc; i += 2) {
204 long bits;
205 char *str;
206
207 Jim_GetLong(interp, args[i], &bits);
208 str = buf_to_str(fields[field_count].in_value, bits, 16);
209 free(fields[field_count].in_value);
210
211 Jim_ListAppendElement(interp, list, Jim_NewStringObj(interp, str, strlen(str)));
212 free(str);
213 field_count++;
214 }
215
216 Jim_SetResult(interp, list);
217
218 free(fields);
219
220 return JIM_OK;
221 }
222
223
224 static int Jim_Command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *args)
225 {
226 tap_state_t states[8];
227
228 if ((argc < 2) || ((size_t)argc > (ARRAY_SIZE(states) + 1))) {
229 Jim_WrongNumArgs(interp, 1, args, "wrong arguments");
230 return JIM_ERR;
231 }
232
233 script_debug(interp, "pathmove", argc, args);
234
235 int i;
236 for (i = 0; i < argc-1; i++) {
237 const char *cp;
238 cp = Jim_GetString(args[i + 1], NULL);
239 states[i] = tap_state_by_name(cp);
240 if (states[i] < 0) {
241 /* update the error message */
242 Jim_SetResultFormatted(interp, "endstate: %s invalid", cp);
243 return JIM_ERR;
244 }
245 }
246
247 if ((jtag_add_statemove(states[0]) != ERROR_OK) || (jtag_execute_queue() != ERROR_OK)) {
248 Jim_SetResultString(interp, "pathmove: jtag execute failed", -1);
249 return JIM_ERR;
250 }
251
252 jtag_add_pathmove(argc - 2, states + 1);
253
254 if (jtag_execute_queue() != ERROR_OK) {
255 Jim_SetResultString(interp, "pathmove: failed", -1);
256 return JIM_ERR;
257 }
258
259 return JIM_OK;
260 }
261
262
263 static int Jim_Command_flush_count(Jim_Interp *interp, int argc, Jim_Obj *const *args)
264 {
265 script_debug(interp, "flush_count", argc, args);
266
267 Jim_SetResult(interp, Jim_NewIntObj(interp, jtag_get_flush_queue_count()));
268
269 return JIM_OK;
270 }
271
272 /* REVISIT Just what about these should "move" ... ?
273 * These registrations, into the main JTAG table?
274 *
275 * There's a minor compatibility issue, these all show up twice;
276 * that's not desirable:
277 * - jtag drscan ... NOT DOCUMENTED!
278 * - drscan ...
279 *
280 * The "irscan" command (for example) doesn't show twice.
281 */
282 static const struct command_registration jtag_command_handlers_to_move[] = {
283 {
284 .name = "drscan",
285 .mode = COMMAND_EXEC,
286 .jim_handler = Jim_Command_drscan,
287 .help = "Execute Data Register (DR) scan for one TAP. "
288 "Other TAPs must be in BYPASS mode.",
289 .usage = "tap_name [num_bits value]* ['-endstate' state_name]",
290 },
291 {
292 .name = "flush_count",
293 .mode = COMMAND_EXEC,
294 .jim_handler = Jim_Command_flush_count,
295 .help = "Returns the number of times the JTAG queue "
296 "has been flushed.",
297 },
298 {
299 .name = "pathmove",
300 .mode = COMMAND_EXEC,
301 .jim_handler = Jim_Command_pathmove,
302 .usage = "start_state state1 [state2 [state3 ...]]",
303 .help = "Move JTAG state machine from current state "
304 "(start_state) to state1, then state2, state3, etc.",
305 },
306 COMMAND_REGISTRATION_DONE
307 };
308
309
310 enum jtag_tap_cfg_param {
311 JCFG_EVENT
312 };
313
314 static Jim_Nvp nvp_config_opts[] = {
315 { .name = "-event", .value = JCFG_EVENT },
316
317 { .name = NULL, .value = -1 }
318 };
319
320 static int jtag_tap_configure_event(Jim_GetOptInfo *goi, struct jtag_tap *tap)
321 {
322 if (goi->argc == 0) {
323 Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event <event-name> ...");
324 return JIM_ERR;
325 }
326
327 Jim_Nvp *n;
328 int e = Jim_GetOpt_Nvp(goi, nvp_jtag_tap_event, &n);
329 if (e != JIM_OK) {
330 Jim_GetOpt_NvpUnknown(goi, nvp_jtag_tap_event, 1);
331 return e;
332 }
333
334 if (goi->isconfigure) {
335 if (goi->argc != 1) {
336 Jim_WrongNumArgs(goi->interp,
337 goi->argc,
338 goi->argv,
339 "-event <event-name> <event-body>");
340 return JIM_ERR;
341 }
342 } else {
343 if (goi->argc != 0) {
344 Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event <event-name>");
345 return JIM_ERR;
346 }
347 }
348
349 struct jtag_tap_event_action *jteap = tap->event_action;
350 /* replace existing event body */
351 bool found = false;
352 while (jteap) {
353 if (jteap->event == (enum jtag_event)n->value) {
354 found = true;
355 break;
356 }
357 jteap = jteap->next;
358 }
359
360 Jim_SetEmptyResult(goi->interp);
361
362 if (goi->isconfigure) {
363 if (!found)
364 jteap = calloc(1, sizeof(*jteap));
365 else if (NULL != jteap->body)
366 Jim_DecrRefCount(goi->interp, jteap->body);
367
368 jteap->interp = goi->interp;
369 jteap->event = n->value;
370
371 Jim_Obj *o;
372 Jim_GetOpt_Obj(goi, &o);
373 jteap->body = Jim_DuplicateObj(goi->interp, o);
374 Jim_IncrRefCount(jteap->body);
375
376 if (!found) {
377 /* add to head of event list */
378 jteap->next = tap->event_action;
379 tap->event_action = jteap;
380 }
381 } else if (found) {
382 jteap->interp = goi->interp;
383 Jim_SetResult(goi->interp,
384 Jim_DuplicateObj(goi->interp, jteap->body));
385 }
386 return JIM_OK;
387 }
388
389 static int jtag_tap_configure_cmd(Jim_GetOptInfo *goi, struct jtag_tap *tap)
390 {
391 /* parse config or cget options */
392 while (goi->argc > 0) {
393 Jim_SetEmptyResult(goi->interp);
394
395 Jim_Nvp *n;
396 int e = Jim_GetOpt_Nvp(goi, nvp_config_opts, &n);
397 if (e != JIM_OK) {
398 Jim_GetOpt_NvpUnknown(goi, nvp_config_opts, 0);
399 return e;
400 }
401
402 switch (n->value) {
403 case JCFG_EVENT:
404 e = jtag_tap_configure_event(goi, tap);
405 if (e != JIM_OK)
406 return e;
407 break;
408 default:
409 Jim_SetResultFormatted(goi->interp, "unknown event: %s", n->name);
410 return JIM_ERR;
411 }
412 }
413
414 return JIM_OK;
415 }
416
417 static int is_bad_irval(int ir_length, jim_wide w)
418 {
419 jim_wide v = 1;
420
421 v <<= ir_length;
422 v -= 1;
423 v = ~v;
424 return (w & v) != 0;
425 }
426
427 static int jim_newtap_expected_id(Jim_Nvp *n, Jim_GetOptInfo *goi,
428 struct jtag_tap *pTap)
429 {
430 jim_wide w;
431 int e = Jim_GetOpt_Wide(goi, &w);
432 if (e != JIM_OK) {
433 Jim_SetResultFormatted(goi->interp, "option: %s bad parameter", n->name);
434 return e;
435 }
436
437 unsigned expected_len = sizeof(uint32_t) * pTap->expected_ids_cnt;
438 uint32_t *new_expected_ids = malloc(expected_len + sizeof(uint32_t));
439 if (new_expected_ids == NULL) {
440 Jim_SetResultFormatted(goi->interp, "no memory");
441 return JIM_ERR;
442 }
443
444 memcpy(new_expected_ids, pTap->expected_ids, expected_len);
445
446 new_expected_ids[pTap->expected_ids_cnt] = w;
447
448 free(pTap->expected_ids);
449 pTap->expected_ids = new_expected_ids;
450 pTap->expected_ids_cnt++;
451
452 return JIM_OK;
453 }
454
455 #define NTAP_OPT_IRLEN 0
456 #define NTAP_OPT_IRMASK 1
457 #define NTAP_OPT_IRCAPTURE 2
458 #define NTAP_OPT_ENABLED 3
459 #define NTAP_OPT_DISABLED 4
460 #define NTAP_OPT_EXPECTED_ID 5
461 #define NTAP_OPT_VERSION 6
462
463 static int jim_newtap_ir_param(Jim_Nvp *n, Jim_GetOptInfo *goi,
464 struct jtag_tap *pTap)
465 {
466 jim_wide w;
467 int e = Jim_GetOpt_Wide(goi, &w);
468 if (e != JIM_OK) {
469 Jim_SetResultFormatted(goi->interp,
470 "option: %s bad parameter", n->name);
471 return e;
472 }
473 switch (n->value) {
474 case NTAP_OPT_IRLEN:
475 if (w > (jim_wide) (8 * sizeof(pTap->ir_capture_value))) {
476 LOG_WARNING("%s: huge IR length %d",
477 pTap->dotted_name, (int) w);
478 }
479 pTap->ir_length = w;
480 break;
481 case NTAP_OPT_IRMASK:
482 if (is_bad_irval(pTap->ir_length, w)) {
483 LOG_ERROR("%s: IR mask %x too big",
484 pTap->dotted_name,
485 (int) w);
486 return JIM_ERR;
487 }
488 if ((w & 3) != 3)
489 LOG_WARNING("%s: nonstandard IR mask", pTap->dotted_name);
490 pTap->ir_capture_mask = w;
491 break;
492 case NTAP_OPT_IRCAPTURE:
493 if (is_bad_irval(pTap->ir_length, w)) {
494 LOG_ERROR("%s: IR capture %x too big",
495 pTap->dotted_name, (int) w);
496 return JIM_ERR;
497 }
498 if ((w & 3) != 1)
499 LOG_WARNING("%s: nonstandard IR value",
500 pTap->dotted_name);
501 pTap->ir_capture_value = w;
502 break;
503 default:
504 return JIM_ERR;
505 }
506 return JIM_OK;
507 }
508
509 static int jim_newtap_cmd(Jim_GetOptInfo *goi)
510 {
511 struct jtag_tap *pTap;
512 int x;
513 int e;
514 Jim_Nvp *n;
515 char *cp;
516 const Jim_Nvp opts[] = {
517 { .name = "-irlen", .value = NTAP_OPT_IRLEN },
518 { .name = "-irmask", .value = NTAP_OPT_IRMASK },
519 { .name = "-ircapture", .value = NTAP_OPT_IRCAPTURE },
520 { .name = "-enable", .value = NTAP_OPT_ENABLED },
521 { .name = "-disable", .value = NTAP_OPT_DISABLED },
522 { .name = "-expected-id", .value = NTAP_OPT_EXPECTED_ID },
523 { .name = "-ignore-version", .value = NTAP_OPT_VERSION },
524 { .name = NULL, .value = -1 },
525 };
526
527 pTap = calloc(1, sizeof(struct jtag_tap));
528 if (!pTap) {
529 Jim_SetResultFormatted(goi->interp, "no memory");
530 return JIM_ERR;
531 }
532
533 /*
534 * we expect CHIP + TAP + OPTIONS
535 * */
536 if (goi->argc < 3) {
537 Jim_SetResultFormatted(goi->interp, "Missing CHIP TAP OPTIONS ....");
538 free(pTap);
539 return JIM_ERR;
540 }
541 Jim_GetOpt_String(goi, &cp, NULL);
542 pTap->chip = strdup(cp);
543
544 Jim_GetOpt_String(goi, &cp, NULL);
545 pTap->tapname = strdup(cp);
546
547 /* name + dot + name + null */
548 x = strlen(pTap->chip) + 1 + strlen(pTap->tapname) + 1;
549 cp = malloc(x);
550 sprintf(cp, "%s.%s", pTap->chip, pTap->tapname);
551 pTap->dotted_name = cp;
552
553 LOG_DEBUG("Creating New Tap, Chip: %s, Tap: %s, Dotted: %s, %d params",
554 pTap->chip, pTap->tapname, pTap->dotted_name, goi->argc);
555
556 /* IEEE specifies that the two LSBs of an IR scan are 01, so make
557 * that the default. The "-irlen" and "-irmask" options are only
558 * needed to cope with nonstandard TAPs, or to specify more bits.
559 */
560 pTap->ir_capture_mask = 0x03;
561 pTap->ir_capture_value = 0x01;
562
563 while (goi->argc) {
564 e = Jim_GetOpt_Nvp(goi, opts, &n);
565 if (e != JIM_OK) {
566 Jim_GetOpt_NvpUnknown(goi, opts, 0);
567 free(cp);
568 free(pTap);
569 return e;
570 }
571 LOG_DEBUG("Processing option: %s", n->name);
572 switch (n->value) {
573 case NTAP_OPT_ENABLED:
574 pTap->disabled_after_reset = false;
575 break;
576 case NTAP_OPT_DISABLED:
577 pTap->disabled_after_reset = true;
578 break;
579 case NTAP_OPT_EXPECTED_ID:
580 e = jim_newtap_expected_id(n, goi, pTap);
581 if (JIM_OK != e) {
582 free(cp);
583 free(pTap);
584 return e;
585 }
586 break;
587 case NTAP_OPT_IRLEN:
588 case NTAP_OPT_IRMASK:
589 case NTAP_OPT_IRCAPTURE:
590 e = jim_newtap_ir_param(n, goi, pTap);
591 if (JIM_OK != e) {
592 free(cp);
593 free(pTap);
594 return e;
595 }
596 break;
597 case NTAP_OPT_VERSION:
598 pTap->ignore_version = true;
599 break;
600 } /* switch (n->value) */
601 } /* while (goi->argc) */
602
603 /* default is enabled-after-reset */
604 pTap->enabled = !pTap->disabled_after_reset;
605
606 /* Did all the required option bits get cleared? */
607 if (pTap->ir_length != 0) {
608 jtag_tap_init(pTap);
609 return JIM_OK;
610 }
611
612 Jim_SetResultFormatted(goi->interp,
613 "newtap: %s missing IR length",
614 pTap->dotted_name);
615 jtag_tap_free(pTap);
616 return JIM_ERR;
617 }
618
619 static void jtag_tap_handle_event(struct jtag_tap *tap, enum jtag_event e)
620 {
621 struct jtag_tap_event_action *jteap;
622
623 for (jteap = tap->event_action; jteap != NULL; jteap = jteap->next) {
624 if (jteap->event != e)
625 continue;
626
627 Jim_Nvp *nvp = Jim_Nvp_value2name_simple(nvp_jtag_tap_event, e);
628 LOG_DEBUG("JTAG tap: %s event: %d (%s)\n\taction: %s",
629 tap->dotted_name, e, nvp->name,
630 Jim_GetString(jteap->body, NULL));
631
632 if (Jim_EvalObj(jteap->interp, jteap->body) != JIM_OK) {
633 Jim_MakeErrorMessage(jteap->interp);
634 LOG_USER("%s", Jim_GetString(Jim_GetResult(jteap->interp), NULL));
635 continue;
636 }
637
638 switch (e) {
639 case JTAG_TAP_EVENT_ENABLE:
640 case JTAG_TAP_EVENT_DISABLE:
641 /* NOTE: we currently assume the handlers
642 * can't fail. Right here is where we should
643 * really be verifying the scan chains ...
644 */
645 tap->enabled = (e == JTAG_TAP_EVENT_ENABLE);
646 LOG_INFO("JTAG tap: %s %s", tap->dotted_name,
647 tap->enabled ? "enabled" : "disabled");
648 break;
649 default:
650 break;
651 }
652 }
653 }
654
655 static int jim_jtag_arp_init(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
656 {
657 Jim_GetOptInfo goi;
658 Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
659 if (goi.argc != 0) {
660 Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
661 return JIM_ERR;
662 }
663 struct command_context *context = current_command_context(interp);
664 int e = jtag_init_inner(context);
665 if (e != ERROR_OK) {
666 Jim_Obj *eObj = Jim_NewIntObj(goi.interp, e);
667 Jim_SetResultFormatted(goi.interp, "error: %#s", eObj);
668 Jim_FreeNewObj(goi.interp, eObj);
669 return JIM_ERR;
670 }
671 return JIM_OK;
672 }
673
674 static int jim_jtag_arp_init_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
675 {
676 int e = ERROR_OK;
677 Jim_GetOptInfo goi;
678 Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
679 if (goi.argc != 0) {
680 Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
681 return JIM_ERR;
682 }
683 struct command_context *context = current_command_context(interp);
684 if (transport_is_jtag())
685 e = jtag_init_reset(context);
686 else if (transport_is_swd())
687 e = swd_init_reset(context);
688
689 if (e != ERROR_OK) {
690 Jim_Obj *eObj = Jim_NewIntObj(goi.interp, e);
691 Jim_SetResultFormatted(goi.interp, "error: %#s", eObj);
692 Jim_FreeNewObj(goi.interp, eObj);
693 return JIM_ERR;
694 }
695 return JIM_OK;
696 }
697
698 int jim_jtag_newtap(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
699 {
700 Jim_GetOptInfo goi;
701 Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
702 return jim_newtap_cmd(&goi);
703 }
704
705 static bool jtag_tap_enable(struct jtag_tap *t)
706 {
707 if (t->enabled)
708 return false;
709 jtag_tap_handle_event(t, JTAG_TAP_EVENT_ENABLE);
710 if (!t->enabled)
711 return false;
712
713 /* FIXME add JTAG sanity checks, w/o TLR
714 * - scan chain length grew by one (this)
715 * - IDs and IR lengths are as expected
716 */
717 jtag_call_event_callbacks(JTAG_TAP_EVENT_ENABLE);
718 return true;
719 }
720 static bool jtag_tap_disable(struct jtag_tap *t)
721 {
722 if (!t->enabled)
723 return false;
724 jtag_tap_handle_event(t, JTAG_TAP_EVENT_DISABLE);
725 if (t->enabled)
726 return false;
727
728 /* FIXME add JTAG sanity checks, w/o TLR
729 * - scan chain length shrank by one (this)
730 * - IDs and IR lengths are as expected
731 */
732 jtag_call_event_callbacks(JTAG_TAP_EVENT_DISABLE);
733 return true;
734 }
735
736 int jim_jtag_tap_enabler(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
737 {
738 const char *cmd_name = Jim_GetString(argv[0], NULL);
739 Jim_GetOptInfo goi;
740 Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
741 if (goi.argc != 1) {
742 Jim_SetResultFormatted(goi.interp, "usage: %s <name>", cmd_name);
743 return JIM_ERR;
744 }
745
746 struct jtag_tap *t;
747
748 t = jtag_tap_by_jim_obj(goi.interp, goi.argv[0]);
749 if (t == NULL)
750 return JIM_ERR;
751
752 if (strcasecmp(cmd_name, "tapisenabled") == 0) {
753 /* do nothing, just return the value */
754 } else if (strcasecmp(cmd_name, "tapenable") == 0) {
755 if (!jtag_tap_enable(t)) {
756 LOG_WARNING("failed to enable tap %s", t->dotted_name);
757 return JIM_ERR;
758 }
759 } else if (strcasecmp(cmd_name, "tapdisable") == 0) {
760 if (!jtag_tap_disable(t)) {
761 LOG_WARNING("failed to disable tap %s", t->dotted_name);
762 return JIM_ERR;
763 }
764 } else {
765 LOG_ERROR("command '%s' unknown", cmd_name);
766 return JIM_ERR;
767 }
768 bool e = t->enabled;
769 Jim_SetResult(goi.interp, Jim_NewIntObj(goi.interp, e));
770 return JIM_OK;
771 }
772
773 int jim_jtag_configure(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
774 {
775 const char *cmd_name = Jim_GetString(argv[0], NULL);
776 Jim_GetOptInfo goi;
777 Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
778 goi.isconfigure = !strcmp(cmd_name, "configure");
779 if (goi.argc < 2 + goi.isconfigure) {
780 Jim_WrongNumArgs(goi.interp, 0, NULL,
781 "<tap_name> <attribute> ...");
782 return JIM_ERR;
783 }
784
785 struct jtag_tap *t;
786
787 Jim_Obj *o;
788 Jim_GetOpt_Obj(&goi, &o);
789 t = jtag_tap_by_jim_obj(goi.interp, o);
790 if (t == NULL)
791 return JIM_ERR;
792
793 return jtag_tap_configure_cmd(&goi, t);
794 }
795
796 static int jim_jtag_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
797 {
798 Jim_GetOptInfo goi;
799 Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
800 if (goi.argc != 0) {
801 Jim_WrongNumArgs(goi.interp, 1, goi.argv, "Too many parameters");
802 return JIM_ERR;
803 }
804 Jim_SetResult(goi.interp, Jim_NewListObj(goi.interp, NULL, 0));
805 struct jtag_tap *tap;
806
807 for (tap = jtag_all_taps(); tap; tap = tap->next_tap) {
808 Jim_ListAppendElement(goi.interp,
809 Jim_GetResult(goi.interp),
810 Jim_NewStringObj(goi.interp,
811 tap->dotted_name, -1));
812 }
813 return JIM_OK;
814 }
815
816 COMMAND_HANDLER(handle_jtag_init_command)
817 {
818 if (CMD_ARGC != 0)
819 return ERROR_COMMAND_SYNTAX_ERROR;
820
821 static bool jtag_initialized;
822 if (jtag_initialized) {
823 LOG_INFO("'jtag init' has already been called");
824 return ERROR_OK;
825 }
826 jtag_initialized = true;
827
828 LOG_DEBUG("Initializing jtag devices...");
829 return jtag_init(CMD_CTX);
830 }
831
832 static const struct command_registration jtag_subcommand_handlers[] = {
833 {
834 .name = "init",
835 .mode = COMMAND_ANY,
836 .handler = handle_jtag_init_command,
837 .help = "initialize jtag scan chain",
838 .usage = ""
839 },
840 {
841 .name = "arp_init",
842 .mode = COMMAND_ANY,
843 .jim_handler = jim_jtag_arp_init,
844 .help = "Validates JTAG scan chain against the list of "
845 "declared TAPs using just the four standard JTAG "
846 "signals.",
847 },
848 {
849 .name = "arp_init-reset",
850 .mode = COMMAND_ANY,
851 .jim_handler = jim_jtag_arp_init_reset,
852 .help = "Uses TRST and SRST to try resetting everything on "
853 "the JTAG scan chain, then performs 'jtag arp_init'."
854 },
855 {
856 .name = "newtap",
857 .mode = COMMAND_CONFIG,
858 .jim_handler = jim_jtag_newtap,
859 .help = "Create a new TAP instance named basename.tap_type, "
860 "and appends it to the scan chain.",
861 .usage = "basename tap_type '-irlen' count "
862 "['-enable'|'-disable'] "
863 "['-expected_id' number] "
864 "['-ignore-version'] "
865 "['-ircapture' number] "
866 "['-mask' number] ",
867 },
868 {
869 .name = "tapisenabled",
870 .mode = COMMAND_EXEC,
871 .jim_handler = jim_jtag_tap_enabler,
872 .help = "Returns a Tcl boolean (0/1) indicating whether "
873 "the TAP is enabled (1) or not (0).",
874 .usage = "tap_name",
875 },
876 {
877 .name = "tapenable",
878 .mode = COMMAND_EXEC,
879 .jim_handler = jim_jtag_tap_enabler,
880 .help = "Try to enable the specified TAP using the "
881 "'tap-enable' TAP event.",
882 .usage = "tap_name",
883 },
884 {
885 .name = "tapdisable",
886 .mode = COMMAND_EXEC,
887 .jim_handler = jim_jtag_tap_enabler,
888 .help = "Try to disable the specified TAP using the "
889 "'tap-disable' TAP event.",
890 .usage = "tap_name",
891 },
892 {
893 .name = "configure",
894 .mode = COMMAND_EXEC,
895 .jim_handler = jim_jtag_configure,
896 .help = "Provide a Tcl handler for the specified "
897 "TAP event.",
898 .usage = "tap_name '-event' event_name handler",
899 },
900 {
901 .name = "cget",
902 .mode = COMMAND_EXEC,
903 .jim_handler = jim_jtag_configure,
904 .help = "Return any Tcl handler for the specified "
905 "TAP event.",
906 .usage = "tap_name '-event' event_name",
907 },
908 {
909 .name = "names",
910 .mode = COMMAND_ANY,
911 .jim_handler = jim_jtag_names,
912 .help = "Returns list of all JTAG tap names.",
913 },
914 {
915 .chain = jtag_command_handlers_to_move,
916 },
917 COMMAND_REGISTRATION_DONE
918 };
919
920 void jtag_notify_event(enum jtag_event event)
921 {
922 struct jtag_tap *tap;
923
924 for (tap = jtag_all_taps(); tap; tap = tap->next_tap)
925 jtag_tap_handle_event(tap, event);
926 }
927
928
929 COMMAND_HANDLER(handle_scan_chain_command)
930 {
931 struct jtag_tap *tap;
932 char expected_id[12];
933
934 tap = jtag_all_taps();
935 command_print(CMD_CTX,
936 " TapName Enabled IdCode Expected IrLen IrCap IrMask");
937 command_print(CMD_CTX,
938 "-- ------------------- -------- ---------- ---------- ----- ----- ------");
939
940 while (tap) {
941 uint32_t expected, expected_mask, ii;
942
943 snprintf(expected_id, sizeof expected_id, "0x%08x",
944 (unsigned)((tap->expected_ids_cnt > 0)
945 ? tap->expected_ids[0]
946 : 0));
947 if (tap->ignore_version)
948 expected_id[2] = '*';
949
950 expected = buf_get_u32(tap->expected, 0, tap->ir_length);
951 expected_mask = buf_get_u32(tap->expected_mask, 0, tap->ir_length);
952
953 command_print(CMD_CTX,
954 "%2d %-18s %c 0x%08x %s %5d 0x%02x 0x%02x",
955 tap->abs_chain_position,
956 tap->dotted_name,
957 tap->enabled ? 'Y' : 'n',
958 (unsigned int)(tap->idcode),
959 expected_id,
960 (unsigned int)(tap->ir_length),
961 (unsigned int)(expected),
962 (unsigned int)(expected_mask));
963
964 for (ii = 1; ii < tap->expected_ids_cnt; ii++) {
965 snprintf(expected_id, sizeof expected_id, "0x%08x",
966 (unsigned) tap->expected_ids[ii]);
967 if (tap->ignore_version)
968 expected_id[2] = '*';
969
970 command_print(CMD_CTX,
971 " %s",
972 expected_id);
973 }
974
975 tap = tap->next_tap;
976 }
977
978 return ERROR_OK;
979 }
980
981 COMMAND_HANDLER(handle_jtag_ntrst_delay_command)
982 {
983 if (CMD_ARGC > 1)
984 return ERROR_COMMAND_SYNTAX_ERROR;
985 if (CMD_ARGC == 1) {
986 unsigned delay;
987 COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
988
989 jtag_set_ntrst_delay(delay);
990 }
991 command_print(CMD_CTX, "jtag_ntrst_delay: %u", jtag_get_ntrst_delay());
992 return ERROR_OK;
993 }
994
995 COMMAND_HANDLER(handle_jtag_ntrst_assert_width_command)
996 {
997 if (CMD_ARGC > 1)
998 return ERROR_COMMAND_SYNTAX_ERROR;
999 if (CMD_ARGC == 1) {
1000 unsigned delay;
1001 COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
1002
1003 jtag_set_ntrst_assert_width(delay);
1004 }
1005 command_print(CMD_CTX, "jtag_ntrst_assert_width: %u", jtag_get_ntrst_assert_width());
1006 return ERROR_OK;
1007 }
1008
1009 COMMAND_HANDLER(handle_jtag_rclk_command)
1010 {
1011 if (CMD_ARGC > 1)
1012 return ERROR_COMMAND_SYNTAX_ERROR;
1013
1014 int retval = ERROR_OK;
1015 if (CMD_ARGC == 1) {
1016 unsigned khz = 0;
1017 COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], khz);
1018
1019 retval = jtag_config_rclk(khz);
1020 if (ERROR_OK != retval)
1021 return retval;
1022 }
1023
1024 int cur_khz = jtag_get_speed_khz();
1025 retval = jtag_get_speed_readable(&cur_khz);
1026 if (ERROR_OK != retval)
1027 return retval;
1028
1029 if (cur_khz)
1030 command_print(CMD_CTX, "RCLK not supported - fallback to %d kHz", cur_khz);
1031 else
1032 command_print(CMD_CTX, "RCLK - adaptive");
1033
1034 return retval;
1035 }
1036
1037 COMMAND_HANDLER(handle_jtag_reset_command)
1038 {
1039 if (CMD_ARGC != 2)
1040 return ERROR_COMMAND_SYNTAX_ERROR;
1041
1042 int trst = -1;
1043 if (CMD_ARGV[0][0] == '1')
1044 trst = 1;
1045 else if (CMD_ARGV[0][0] == '0')
1046 trst = 0;
1047 else
1048 return ERROR_COMMAND_SYNTAX_ERROR;
1049
1050 int srst = -1;
1051 if (CMD_ARGV[1][0] == '1')
1052 srst = 1;
1053 else if (CMD_ARGV[1][0] == '0')
1054 srst = 0;
1055 else
1056 return ERROR_COMMAND_SYNTAX_ERROR;
1057
1058 if (adapter_init(CMD_CTX) != ERROR_OK)
1059 return ERROR_JTAG_INIT_FAILED;
1060
1061 jtag_add_reset(trst, srst);
1062 return jtag_execute_queue();
1063 }
1064
1065 COMMAND_HANDLER(handle_runtest_command)
1066 {
1067 if (CMD_ARGC != 1)
1068 return ERROR_COMMAND_SYNTAX_ERROR;
1069
1070 unsigned num_clocks;
1071 COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num_clocks);
1072
1073 jtag_add_runtest(num_clocks, TAP_IDLE);
1074 return jtag_execute_queue();
1075 }
1076
1077 /*
1078 * For "irscan" or "drscan" commands, the "end" (really, "next") state
1079 * should be stable ... and *NOT* a shift state, otherwise free-running
1080 * jtag clocks could change the values latched by the update state.
1081 * Not surprisingly, this is the same constraint as SVF; the "irscan"
1082 * and "drscan" commands are a write-only subset of what SVF provides.
1083 */
1084
1085 COMMAND_HANDLER(handle_irscan_command)
1086 {
1087 int i;
1088 struct scan_field *fields;
1089 struct jtag_tap *tap = NULL;
1090 tap_state_t endstate;
1091
1092 if ((CMD_ARGC < 2) || (CMD_ARGC % 2))
1093 return ERROR_COMMAND_SYNTAX_ERROR;
1094
1095 /* optional "-endstate" "statename" at the end of the arguments,
1096 * so that e.g. IRPAUSE can let us load the data register before
1097 * entering RUN/IDLE to execute the instruction we load here.
1098 */
1099 endstate = TAP_IDLE;
1100
1101 if (CMD_ARGC >= 4) {
1102 /* have at least one pair of numbers.
1103 * is last pair the magic text? */
1104 if (strcmp("-endstate", CMD_ARGV[CMD_ARGC - 2]) == 0) {
1105 endstate = tap_state_by_name(CMD_ARGV[CMD_ARGC - 1]);
1106 if (endstate == TAP_INVALID)
1107 return ERROR_COMMAND_SYNTAX_ERROR;
1108 if (!scan_is_safe(endstate))
1109 LOG_WARNING("unstable irscan endstate \"%s\"",
1110 CMD_ARGV[CMD_ARGC - 1]);
1111 CMD_ARGC -= 2;
1112 }
1113 }
1114
1115 int num_fields = CMD_ARGC / 2;
1116 if (num_fields > 1) {
1117 /* we really should be looking at plain_ir_scan if we want
1118 * anything more fancy.
1119 */
1120 LOG_ERROR("Specify a single value for tap");
1121 return ERROR_COMMAND_SYNTAX_ERROR;
1122 }
1123
1124 fields = calloc(num_fields, sizeof(*fields));
1125
1126 int retval;
1127 for (i = 0; i < num_fields; i++) {
1128 tap = jtag_tap_by_string(CMD_ARGV[i*2]);
1129 if (tap == NULL) {
1130 free(fields);
1131 command_print(CMD_CTX, "Tap: %s unknown", CMD_ARGV[i*2]);
1132
1133 return ERROR_FAIL;
1134 }
1135 int field_size = tap->ir_length;
1136 fields[i].num_bits = field_size;
1137 uint8_t *v = malloc(DIV_ROUND_UP(field_size, 8));
1138
1139 uint64_t value;
1140 retval = parse_u64(CMD_ARGV[i * 2 + 1], &value);
1141 if (ERROR_OK != retval)
1142 goto error_return;
1143 buf_set_u64(v, 0, field_size, value);
1144 fields[i].out_value = v;
1145 fields[i].in_value = NULL;
1146 }
1147
1148 /* did we have an endstate? */
1149 jtag_add_ir_scan(tap, fields, endstate);
1150
1151 retval = jtag_execute_queue();
1152
1153 error_return:
1154 for (i = 0; i < num_fields; i++) {
1155 if (NULL != fields[i].out_value)
1156 free((void *)fields[i].out_value);
1157 }
1158
1159 free(fields);
1160
1161 return retval;
1162 }
1163
1164 COMMAND_HANDLER(handle_verify_ircapture_command)
1165 {
1166 if (CMD_ARGC > 1)
1167 return ERROR_COMMAND_SYNTAX_ERROR;
1168
1169 if (CMD_ARGC == 1) {
1170 bool enable;
1171 COMMAND_PARSE_ENABLE(CMD_ARGV[0], enable);
1172 jtag_set_verify_capture_ir(enable);
1173 }
1174
1175 const char *status = jtag_will_verify_capture_ir() ? "enabled" : "disabled";
1176 command_print(CMD_CTX, "verify Capture-IR is %s", status);
1177
1178 return ERROR_OK;
1179 }
1180
1181 COMMAND_HANDLER(handle_verify_jtag_command)
1182 {
1183 if (CMD_ARGC > 1)
1184 return ERROR_COMMAND_SYNTAX_ERROR;
1185
1186 if (CMD_ARGC == 1) {
1187 bool enable;
1188 COMMAND_PARSE_ENABLE(CMD_ARGV[0], enable);
1189 jtag_set_verify(enable);
1190 }
1191
1192 const char *status = jtag_will_verify() ? "enabled" : "disabled";
1193 command_print(CMD_CTX, "verify jtag capture is %s", status);
1194
1195 return ERROR_OK;
1196 }
1197
1198 COMMAND_HANDLER(handle_tms_sequence_command)
1199 {
1200 if (CMD_ARGC > 1)
1201 return ERROR_COMMAND_SYNTAX_ERROR;
1202
1203 if (CMD_ARGC == 1) {
1204 bool use_new_table;
1205 if (strcmp(CMD_ARGV[0], "short") == 0)
1206 use_new_table = true;
1207 else if (strcmp(CMD_ARGV[0], "long") == 0)
1208 use_new_table = false;
1209 else
1210 return ERROR_COMMAND_SYNTAX_ERROR;
1211
1212 tap_use_new_tms_table(use_new_table);
1213 }
1214
1215 command_print(CMD_CTX, "tms sequence is %s",
1216 tap_uses_new_tms_table() ? "short" : "long");
1217
1218 return ERROR_OK;
1219 }
1220
1221 COMMAND_HANDLER(handle_jtag_flush_queue_sleep)
1222 {
1223 if (CMD_ARGC != 1)
1224 return ERROR_COMMAND_SYNTAX_ERROR;
1225
1226 int sleep_ms;
1227 COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], sleep_ms);
1228
1229 jtag_set_flush_queue_sleep(sleep_ms);
1230
1231 return ERROR_OK;
1232 }
1233
1234 COMMAND_HANDLER(handle_wait_srst_deassert)
1235 {
1236 if (CMD_ARGC != 1)
1237 return ERROR_COMMAND_SYNTAX_ERROR;
1238
1239 int timeout_ms;
1240 COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], timeout_ms);
1241 if ((timeout_ms <= 0) || (timeout_ms > 100000)) {
1242 LOG_ERROR("Timeout must be an integer between 0 and 100000");
1243 return ERROR_FAIL;
1244 }
1245
1246 LOG_USER("Waiting for srst assert + deassert for at most %dms", timeout_ms);
1247 int asserted_yet;
1248 long long then = timeval_ms();
1249 while (jtag_srst_asserted(&asserted_yet) == ERROR_OK) {
1250 if ((timeval_ms() - then) > timeout_ms) {
1251 LOG_ERROR("Timed out");
1252 return ERROR_FAIL;
1253 }
1254 if (asserted_yet)
1255 break;
1256 }
1257 while (jtag_srst_asserted(&asserted_yet) == ERROR_OK) {
1258 if ((timeval_ms() - then) > timeout_ms) {
1259 LOG_ERROR("Timed out");
1260 return ERROR_FAIL;
1261 }
1262 if (!asserted_yet)
1263 break;
1264 }
1265
1266 return ERROR_OK;
1267 }
1268
1269 static const struct command_registration jtag_command_handlers[] = {
1270
1271 {
1272 .name = "jtag_flush_queue_sleep",
1273 .handler = handle_jtag_flush_queue_sleep,
1274 .mode = COMMAND_ANY,
1275 .help = "For debug purposes(simulate long delays of interface) "
1276 "to test performance or change in behavior. Default 0ms.",
1277 .usage = "[sleep in ms]",
1278 },
1279 {
1280 .name = "jtag_rclk",
1281 .handler = handle_jtag_rclk_command,
1282 .mode = COMMAND_ANY,
1283 .help = "With an argument, change to to use adaptive clocking "
1284 "if possible; else to use the fallback speed. "
1285 "With or without argument, display current setting.",
1286 .usage = "[fallback_speed_khz]",
1287 },
1288 {
1289 .name = "jtag_ntrst_delay",
1290 .handler = handle_jtag_ntrst_delay_command,
1291 .mode = COMMAND_ANY,
1292 .help = "delay after deasserting trst in ms",
1293 .usage = "[milliseconds]",
1294 },
1295 {
1296 .name = "jtag_ntrst_assert_width",
1297 .handler = handle_jtag_ntrst_assert_width_command,
1298 .mode = COMMAND_ANY,
1299 .help = "delay after asserting trst in ms",
1300 .usage = "[milliseconds]",
1301 },
1302 {
1303 .name = "scan_chain",
1304 .handler = handle_scan_chain_command,
1305 .mode = COMMAND_ANY,
1306 .help = "print current scan chain configuration",
1307 .usage = ""
1308 },
1309 {
1310 .name = "jtag_reset",
1311 .handler = handle_jtag_reset_command,
1312 .mode = COMMAND_EXEC,
1313 .help = "Set reset line values. Value '1' is active, "
1314 "value '0' is inactive.",
1315 .usage = "trst_active srst_active",
1316 },
1317 {
1318 .name = "runtest",
1319 .handler = handle_runtest_command,
1320 .mode = COMMAND_EXEC,
1321 .help = "Move to Run-Test/Idle, and issue TCK for num_cycles.",
1322 .usage = "num_cycles"
1323 },
1324 {
1325 .name = "irscan",
1326 .handler = handle_irscan_command,
1327 .mode = COMMAND_EXEC,
1328 .help = "Execute Instruction Register (DR) scan. The "
1329 "specified opcodes are put into each TAP's IR, "
1330 "and other TAPs are put in BYPASS.",
1331 .usage = "[tap_name instruction]* ['-endstate' state_name]",
1332 },
1333 {
1334 .name = "verify_ircapture",
1335 .handler = handle_verify_ircapture_command,
1336 .mode = COMMAND_ANY,
1337 .help = "Display or assign flag controlling whether to "
1338 "verify values captured during Capture-IR.",
1339 .usage = "['enable'|'disable']",
1340 },
1341 {
1342 .name = "verify_jtag",
1343 .handler = handle_verify_jtag_command,
1344 .mode = COMMAND_ANY,
1345 .help = "Display or assign flag controlling whether to "
1346 "verify values captured during IR and DR scans.",
1347 .usage = "['enable'|'disable']",
1348 },
1349 {
1350 .name = "tms_sequence",
1351 .handler = handle_tms_sequence_command,
1352 .mode = COMMAND_ANY,
1353 .help = "Display or change what style TMS sequences to use "
1354 "for JTAG state transitions: short (default) or "
1355 "long. Only for working around JTAG bugs.",
1356 /* Specifically for working around DRIVER bugs... */
1357 .usage = "['short'|'long']",
1358 },
1359 {
1360 .name = "wait_srst_deassert",
1361 .handler = handle_wait_srst_deassert,
1362 .mode = COMMAND_ANY,
1363 .help = "Wait for an SRST deassert. "
1364 "Useful for cases where you need something to happen within ms "
1365 "of an srst deassert. Timeout in ms ",
1366 .usage = "ms",
1367 },
1368 {
1369 .name = "jtag",
1370 .mode = COMMAND_ANY,
1371 .help = "perform jtag tap actions",
1372 .usage = "",
1373
1374 .chain = jtag_subcommand_handlers,
1375 },
1376 {
1377 .chain = jtag_command_handlers_to_move,
1378 },
1379 COMMAND_REGISTRATION_DONE
1380 };
1381
1382 int jtag_register_commands(struct command_context *cmd_ctx)
1383 {
1384 return register_commands(cmd_ctx, NULL, jtag_command_handlers);
1385 }

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)