jim-nvp: Make Jim_GetOpt_String const-correct
[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 uint32_t *p = realloc(pTap->expected_ids,
438 (pTap->expected_ids_cnt + 1) * sizeof(uint32_t));
439 if (!p) {
440 Jim_SetResultFormatted(goi->interp, "no memory");
441 return JIM_ERR;
442 }
443
444 pTap->expected_ids = p;
445 pTap->expected_ids[pTap->expected_ids_cnt++] = w;
446
447 return JIM_OK;
448 }
449
450 #define NTAP_OPT_IRLEN 0
451 #define NTAP_OPT_IRMASK 1
452 #define NTAP_OPT_IRCAPTURE 2
453 #define NTAP_OPT_ENABLED 3
454 #define NTAP_OPT_DISABLED 4
455 #define NTAP_OPT_EXPECTED_ID 5
456 #define NTAP_OPT_VERSION 6
457
458 static int jim_newtap_ir_param(Jim_Nvp *n, Jim_GetOptInfo *goi,
459 struct jtag_tap *pTap)
460 {
461 jim_wide w;
462 int e = Jim_GetOpt_Wide(goi, &w);
463 if (e != JIM_OK) {
464 Jim_SetResultFormatted(goi->interp,
465 "option: %s bad parameter", n->name);
466 return e;
467 }
468 switch (n->value) {
469 case NTAP_OPT_IRLEN:
470 if (w > (jim_wide) (8 * sizeof(pTap->ir_capture_value))) {
471 LOG_WARNING("%s: huge IR length %d",
472 pTap->dotted_name, (int) w);
473 }
474 pTap->ir_length = w;
475 break;
476 case NTAP_OPT_IRMASK:
477 if (is_bad_irval(pTap->ir_length, w)) {
478 LOG_ERROR("%s: IR mask %x too big",
479 pTap->dotted_name,
480 (int) w);
481 return JIM_ERR;
482 }
483 if ((w & 3) != 3)
484 LOG_WARNING("%s: nonstandard IR mask", pTap->dotted_name);
485 pTap->ir_capture_mask = w;
486 break;
487 case NTAP_OPT_IRCAPTURE:
488 if (is_bad_irval(pTap->ir_length, w)) {
489 LOG_ERROR("%s: IR capture %x too big",
490 pTap->dotted_name, (int) w);
491 return JIM_ERR;
492 }
493 if ((w & 3) != 1)
494 LOG_WARNING("%s: nonstandard IR value",
495 pTap->dotted_name);
496 pTap->ir_capture_value = w;
497 break;
498 default:
499 return JIM_ERR;
500 }
501 return JIM_OK;
502 }
503
504 static int jim_newtap_cmd(Jim_GetOptInfo *goi)
505 {
506 struct jtag_tap *pTap;
507 int x;
508 int e;
509 Jim_Nvp *n;
510 char *cp;
511 const Jim_Nvp opts[] = {
512 { .name = "-irlen", .value = NTAP_OPT_IRLEN },
513 { .name = "-irmask", .value = NTAP_OPT_IRMASK },
514 { .name = "-ircapture", .value = NTAP_OPT_IRCAPTURE },
515 { .name = "-enable", .value = NTAP_OPT_ENABLED },
516 { .name = "-disable", .value = NTAP_OPT_DISABLED },
517 { .name = "-expected-id", .value = NTAP_OPT_EXPECTED_ID },
518 { .name = "-ignore-version", .value = NTAP_OPT_VERSION },
519 { .name = NULL, .value = -1 },
520 };
521
522 pTap = calloc(1, sizeof(struct jtag_tap));
523 if (!pTap) {
524 Jim_SetResultFormatted(goi->interp, "no memory");
525 return JIM_ERR;
526 }
527
528 /*
529 * we expect CHIP + TAP + OPTIONS
530 * */
531 if (goi->argc < 3) {
532 Jim_SetResultFormatted(goi->interp, "Missing CHIP TAP OPTIONS ....");
533 free(pTap);
534 return JIM_ERR;
535 }
536
537 const char *tmp;
538 Jim_GetOpt_String(goi, &tmp, NULL);
539 pTap->chip = strdup(tmp);
540
541 Jim_GetOpt_String(goi, &tmp, NULL);
542 pTap->tapname = strdup(tmp);
543
544 /* name + dot + name + null */
545 x = strlen(pTap->chip) + 1 + strlen(pTap->tapname) + 1;
546 cp = malloc(x);
547 sprintf(cp, "%s.%s", pTap->chip, pTap->tapname);
548 pTap->dotted_name = cp;
549
550 LOG_DEBUG("Creating New Tap, Chip: %s, Tap: %s, Dotted: %s, %d params",
551 pTap->chip, pTap->tapname, pTap->dotted_name, goi->argc);
552
553 if (!transport_is_jtag()) {
554 /* SWD doesn't require any JTAG tap parameters */
555 pTap->enabled = true;
556 jtag_tap_init(pTap);
557 return JIM_OK;
558 }
559
560 /* IEEE specifies that the two LSBs of an IR scan are 01, so make
561 * that the default. The "-ircapture" and "-irmask" options are only
562 * needed to cope with nonstandard TAPs, or to specify more bits.
563 */
564 pTap->ir_capture_mask = 0x03;
565 pTap->ir_capture_value = 0x01;
566
567 while (goi->argc) {
568 e = Jim_GetOpt_Nvp(goi, opts, &n);
569 if (e != JIM_OK) {
570 Jim_GetOpt_NvpUnknown(goi, opts, 0);
571 free(cp);
572 free(pTap);
573 return e;
574 }
575 LOG_DEBUG("Processing option: %s", n->name);
576 switch (n->value) {
577 case NTAP_OPT_ENABLED:
578 pTap->disabled_after_reset = false;
579 break;
580 case NTAP_OPT_DISABLED:
581 pTap->disabled_after_reset = true;
582 break;
583 case NTAP_OPT_EXPECTED_ID:
584 e = jim_newtap_expected_id(n, goi, pTap);
585 if (JIM_OK != e) {
586 free(cp);
587 free(pTap);
588 return e;
589 }
590 break;
591 case NTAP_OPT_IRLEN:
592 case NTAP_OPT_IRMASK:
593 case NTAP_OPT_IRCAPTURE:
594 e = jim_newtap_ir_param(n, goi, pTap);
595 if (JIM_OK != e) {
596 free(cp);
597 free(pTap);
598 return e;
599 }
600 break;
601 case NTAP_OPT_VERSION:
602 pTap->ignore_version = true;
603 break;
604 } /* switch (n->value) */
605 } /* while (goi->argc) */
606
607 /* default is enabled-after-reset */
608 pTap->enabled = !pTap->disabled_after_reset;
609
610 /* Did all the required option bits get cleared? */
611 if (pTap->ir_length != 0) {
612 jtag_tap_init(pTap);
613 return JIM_OK;
614 }
615
616 Jim_SetResultFormatted(goi->interp,
617 "newtap: %s missing IR length",
618 pTap->dotted_name);
619 jtag_tap_free(pTap);
620 return JIM_ERR;
621 }
622
623 static void jtag_tap_handle_event(struct jtag_tap *tap, enum jtag_event e)
624 {
625 struct jtag_tap_event_action *jteap;
626
627 for (jteap = tap->event_action; jteap != NULL; jteap = jteap->next) {
628 if (jteap->event != e)
629 continue;
630
631 Jim_Nvp *nvp = Jim_Nvp_value2name_simple(nvp_jtag_tap_event, e);
632 LOG_DEBUG("JTAG tap: %s event: %d (%s)\n\taction: %s",
633 tap->dotted_name, e, nvp->name,
634 Jim_GetString(jteap->body, NULL));
635
636 if (Jim_EvalObj(jteap->interp, jteap->body) != JIM_OK) {
637 Jim_MakeErrorMessage(jteap->interp);
638 LOG_USER("%s", Jim_GetString(Jim_GetResult(jteap->interp), NULL));
639 continue;
640 }
641
642 switch (e) {
643 case JTAG_TAP_EVENT_ENABLE:
644 case JTAG_TAP_EVENT_DISABLE:
645 /* NOTE: we currently assume the handlers
646 * can't fail. Right here is where we should
647 * really be verifying the scan chains ...
648 */
649 tap->enabled = (e == JTAG_TAP_EVENT_ENABLE);
650 LOG_INFO("JTAG tap: %s %s", tap->dotted_name,
651 tap->enabled ? "enabled" : "disabled");
652 break;
653 default:
654 break;
655 }
656 }
657 }
658
659 static int jim_jtag_arp_init(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
660 {
661 Jim_GetOptInfo goi;
662 Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
663 if (goi.argc != 0) {
664 Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
665 return JIM_ERR;
666 }
667 struct command_context *context = current_command_context(interp);
668 int e = jtag_init_inner(context);
669 if (e != ERROR_OK) {
670 Jim_Obj *eObj = Jim_NewIntObj(goi.interp, e);
671 Jim_SetResultFormatted(goi.interp, "error: %#s", eObj);
672 Jim_FreeNewObj(goi.interp, eObj);
673 return JIM_ERR;
674 }
675 return JIM_OK;
676 }
677
678 static int jim_jtag_arp_init_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
679 {
680 int e = ERROR_OK;
681 Jim_GetOptInfo goi;
682 Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
683 if (goi.argc != 0) {
684 Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
685 return JIM_ERR;
686 }
687 struct command_context *context = current_command_context(interp);
688 if (transport_is_jtag())
689 e = jtag_init_reset(context);
690 else if (transport_is_swd())
691 e = swd_init_reset(context);
692
693 if (e != ERROR_OK) {
694 Jim_Obj *eObj = Jim_NewIntObj(goi.interp, e);
695 Jim_SetResultFormatted(goi.interp, "error: %#s", eObj);
696 Jim_FreeNewObj(goi.interp, eObj);
697 return JIM_ERR;
698 }
699 return JIM_OK;
700 }
701
702 int jim_jtag_newtap(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
703 {
704 Jim_GetOptInfo goi;
705 Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
706 return jim_newtap_cmd(&goi);
707 }
708
709 static bool jtag_tap_enable(struct jtag_tap *t)
710 {
711 if (t->enabled)
712 return false;
713 jtag_tap_handle_event(t, JTAG_TAP_EVENT_ENABLE);
714 if (!t->enabled)
715 return false;
716
717 /* FIXME add JTAG sanity checks, w/o TLR
718 * - scan chain length grew by one (this)
719 * - IDs and IR lengths are as expected
720 */
721 jtag_call_event_callbacks(JTAG_TAP_EVENT_ENABLE);
722 return true;
723 }
724 static bool jtag_tap_disable(struct jtag_tap *t)
725 {
726 if (!t->enabled)
727 return false;
728 jtag_tap_handle_event(t, JTAG_TAP_EVENT_DISABLE);
729 if (t->enabled)
730 return false;
731
732 /* FIXME add JTAG sanity checks, w/o TLR
733 * - scan chain length shrank by one (this)
734 * - IDs and IR lengths are as expected
735 */
736 jtag_call_event_callbacks(JTAG_TAP_EVENT_DISABLE);
737 return true;
738 }
739
740 int jim_jtag_tap_enabler(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
741 {
742 const char *cmd_name = Jim_GetString(argv[0], NULL);
743 Jim_GetOptInfo goi;
744 Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
745 if (goi.argc != 1) {
746 Jim_SetResultFormatted(goi.interp, "usage: %s <name>", cmd_name);
747 return JIM_ERR;
748 }
749
750 struct jtag_tap *t;
751
752 t = jtag_tap_by_jim_obj(goi.interp, goi.argv[0]);
753 if (t == NULL)
754 return JIM_ERR;
755
756 if (strcasecmp(cmd_name, "tapisenabled") == 0) {
757 /* do nothing, just return the value */
758 } else if (strcasecmp(cmd_name, "tapenable") == 0) {
759 if (!jtag_tap_enable(t)) {
760 LOG_WARNING("failed to enable tap %s", t->dotted_name);
761 return JIM_ERR;
762 }
763 } else if (strcasecmp(cmd_name, "tapdisable") == 0) {
764 if (!jtag_tap_disable(t)) {
765 LOG_WARNING("failed to disable tap %s", t->dotted_name);
766 return JIM_ERR;
767 }
768 } else {
769 LOG_ERROR("command '%s' unknown", cmd_name);
770 return JIM_ERR;
771 }
772 bool e = t->enabled;
773 Jim_SetResult(goi.interp, Jim_NewIntObj(goi.interp, e));
774 return JIM_OK;
775 }
776
777 int jim_jtag_configure(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
778 {
779 const char *cmd_name = Jim_GetString(argv[0], NULL);
780 Jim_GetOptInfo goi;
781 Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
782 goi.isconfigure = !strcmp(cmd_name, "configure");
783 if (goi.argc < 2 + goi.isconfigure) {
784 Jim_WrongNumArgs(goi.interp, 0, NULL,
785 "<tap_name> <attribute> ...");
786 return JIM_ERR;
787 }
788
789 struct jtag_tap *t;
790
791 Jim_Obj *o;
792 Jim_GetOpt_Obj(&goi, &o);
793 t = jtag_tap_by_jim_obj(goi.interp, o);
794 if (t == NULL)
795 return JIM_ERR;
796
797 return jtag_tap_configure_cmd(&goi, t);
798 }
799
800 static int jim_jtag_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
801 {
802 Jim_GetOptInfo goi;
803 Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
804 if (goi.argc != 0) {
805 Jim_WrongNumArgs(goi.interp, 1, goi.argv, "Too many parameters");
806 return JIM_ERR;
807 }
808 Jim_SetResult(goi.interp, Jim_NewListObj(goi.interp, NULL, 0));
809 struct jtag_tap *tap;
810
811 for (tap = jtag_all_taps(); tap; tap = tap->next_tap) {
812 Jim_ListAppendElement(goi.interp,
813 Jim_GetResult(goi.interp),
814 Jim_NewStringObj(goi.interp,
815 tap->dotted_name, -1));
816 }
817 return JIM_OK;
818 }
819
820 COMMAND_HANDLER(handle_jtag_init_command)
821 {
822 if (CMD_ARGC != 0)
823 return ERROR_COMMAND_SYNTAX_ERROR;
824
825 static bool jtag_initialized;
826 if (jtag_initialized) {
827 LOG_INFO("'jtag init' has already been called");
828 return ERROR_OK;
829 }
830 jtag_initialized = true;
831
832 LOG_DEBUG("Initializing jtag devices...");
833 return jtag_init(CMD_CTX);
834 }
835
836 static const struct command_registration jtag_subcommand_handlers[] = {
837 {
838 .name = "init",
839 .mode = COMMAND_ANY,
840 .handler = handle_jtag_init_command,
841 .help = "initialize jtag scan chain",
842 .usage = ""
843 },
844 {
845 .name = "arp_init",
846 .mode = COMMAND_ANY,
847 .jim_handler = jim_jtag_arp_init,
848 .help = "Validates JTAG scan chain against the list of "
849 "declared TAPs using just the four standard JTAG "
850 "signals.",
851 },
852 {
853 .name = "arp_init-reset",
854 .mode = COMMAND_ANY,
855 .jim_handler = jim_jtag_arp_init_reset,
856 .help = "Uses TRST and SRST to try resetting everything on "
857 "the JTAG scan chain, then performs 'jtag arp_init'."
858 },
859 {
860 .name = "newtap",
861 .mode = COMMAND_CONFIG,
862 .jim_handler = jim_jtag_newtap,
863 .help = "Create a new TAP instance named basename.tap_type, "
864 "and appends it to the scan chain.",
865 .usage = "basename tap_type '-irlen' count "
866 "['-enable'|'-disable'] "
867 "['-expected_id' number] "
868 "['-ignore-version'] "
869 "['-ircapture' number] "
870 "['-mask' number] ",
871 },
872 {
873 .name = "tapisenabled",
874 .mode = COMMAND_EXEC,
875 .jim_handler = jim_jtag_tap_enabler,
876 .help = "Returns a Tcl boolean (0/1) indicating whether "
877 "the TAP is enabled (1) or not (0).",
878 .usage = "tap_name",
879 },
880 {
881 .name = "tapenable",
882 .mode = COMMAND_EXEC,
883 .jim_handler = jim_jtag_tap_enabler,
884 .help = "Try to enable the specified TAP using the "
885 "'tap-enable' TAP event.",
886 .usage = "tap_name",
887 },
888 {
889 .name = "tapdisable",
890 .mode = COMMAND_EXEC,
891 .jim_handler = jim_jtag_tap_enabler,
892 .help = "Try to disable the specified TAP using the "
893 "'tap-disable' TAP event.",
894 .usage = "tap_name",
895 },
896 {
897 .name = "configure",
898 .mode = COMMAND_EXEC,
899 .jim_handler = jim_jtag_configure,
900 .help = "Provide a Tcl handler for the specified "
901 "TAP event.",
902 .usage = "tap_name '-event' event_name handler",
903 },
904 {
905 .name = "cget",
906 .mode = COMMAND_EXEC,
907 .jim_handler = jim_jtag_configure,
908 .help = "Return any Tcl handler for the specified "
909 "TAP event.",
910 .usage = "tap_name '-event' event_name",
911 },
912 {
913 .name = "names",
914 .mode = COMMAND_ANY,
915 .jim_handler = jim_jtag_names,
916 .help = "Returns list of all JTAG tap names.",
917 },
918 {
919 .chain = jtag_command_handlers_to_move,
920 },
921 COMMAND_REGISTRATION_DONE
922 };
923
924 void jtag_notify_event(enum jtag_event event)
925 {
926 struct jtag_tap *tap;
927
928 for (tap = jtag_all_taps(); tap; tap = tap->next_tap)
929 jtag_tap_handle_event(tap, event);
930 }
931
932
933 COMMAND_HANDLER(handle_scan_chain_command)
934 {
935 struct jtag_tap *tap;
936 char expected_id[12];
937
938 tap = jtag_all_taps();
939 command_print(CMD_CTX,
940 " TapName Enabled IdCode Expected IrLen IrCap IrMask");
941 command_print(CMD_CTX,
942 "-- ------------------- -------- ---------- ---------- ----- ----- ------");
943
944 while (tap) {
945 uint32_t expected, expected_mask, ii;
946
947 snprintf(expected_id, sizeof expected_id, "0x%08x",
948 (unsigned)((tap->expected_ids_cnt > 0)
949 ? tap->expected_ids[0]
950 : 0));
951 if (tap->ignore_version)
952 expected_id[2] = '*';
953
954 expected = buf_get_u32(tap->expected, 0, tap->ir_length);
955 expected_mask = buf_get_u32(tap->expected_mask, 0, tap->ir_length);
956
957 command_print(CMD_CTX,
958 "%2d %-18s %c 0x%08x %s %5d 0x%02x 0x%02x",
959 tap->abs_chain_position,
960 tap->dotted_name,
961 tap->enabled ? 'Y' : 'n',
962 (unsigned int)(tap->idcode),
963 expected_id,
964 (unsigned int)(tap->ir_length),
965 (unsigned int)(expected),
966 (unsigned int)(expected_mask));
967
968 for (ii = 1; ii < tap->expected_ids_cnt; ii++) {
969 snprintf(expected_id, sizeof expected_id, "0x%08x",
970 (unsigned) tap->expected_ids[ii]);
971 if (tap->ignore_version)
972 expected_id[2] = '*';
973
974 command_print(CMD_CTX,
975 " %s",
976 expected_id);
977 }
978
979 tap = tap->next_tap;
980 }
981
982 return ERROR_OK;
983 }
984
985 COMMAND_HANDLER(handle_jtag_ntrst_delay_command)
986 {
987 if (CMD_ARGC > 1)
988 return ERROR_COMMAND_SYNTAX_ERROR;
989 if (CMD_ARGC == 1) {
990 unsigned delay;
991 COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
992
993 jtag_set_ntrst_delay(delay);
994 }
995 command_print(CMD_CTX, "jtag_ntrst_delay: %u", jtag_get_ntrst_delay());
996 return ERROR_OK;
997 }
998
999 COMMAND_HANDLER(handle_jtag_ntrst_assert_width_command)
1000 {
1001 if (CMD_ARGC > 1)
1002 return ERROR_COMMAND_SYNTAX_ERROR;
1003 if (CMD_ARGC == 1) {
1004 unsigned delay;
1005 COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
1006
1007 jtag_set_ntrst_assert_width(delay);
1008 }
1009 command_print(CMD_CTX, "jtag_ntrst_assert_width: %u", jtag_get_ntrst_assert_width());
1010 return ERROR_OK;
1011 }
1012
1013 COMMAND_HANDLER(handle_jtag_rclk_command)
1014 {
1015 if (CMD_ARGC > 1)
1016 return ERROR_COMMAND_SYNTAX_ERROR;
1017
1018 int retval = ERROR_OK;
1019 if (CMD_ARGC == 1) {
1020 unsigned khz = 0;
1021 COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], khz);
1022
1023 retval = jtag_config_rclk(khz);
1024 if (ERROR_OK != retval)
1025 return retval;
1026 }
1027
1028 int cur_khz = jtag_get_speed_khz();
1029 retval = jtag_get_speed_readable(&cur_khz);
1030 if (ERROR_OK != retval)
1031 return retval;
1032
1033 if (cur_khz)
1034 command_print(CMD_CTX, "RCLK not supported - fallback to %d kHz", cur_khz);
1035 else
1036 command_print(CMD_CTX, "RCLK - adaptive");
1037
1038 return retval;
1039 }
1040
1041 COMMAND_HANDLER(handle_jtag_reset_command)
1042 {
1043 if (CMD_ARGC != 2)
1044 return ERROR_COMMAND_SYNTAX_ERROR;
1045
1046 int trst = -1;
1047 if (CMD_ARGV[0][0] == '1')
1048 trst = 1;
1049 else if (CMD_ARGV[0][0] == '0')
1050 trst = 0;
1051 else
1052 return ERROR_COMMAND_SYNTAX_ERROR;
1053
1054 int srst = -1;
1055 if (CMD_ARGV[1][0] == '1')
1056 srst = 1;
1057 else if (CMD_ARGV[1][0] == '0')
1058 srst = 0;
1059 else
1060 return ERROR_COMMAND_SYNTAX_ERROR;
1061
1062 if (adapter_init(CMD_CTX) != ERROR_OK)
1063 return ERROR_JTAG_INIT_FAILED;
1064
1065 jtag_add_reset(trst, srst);
1066 return jtag_execute_queue();
1067 }
1068
1069 COMMAND_HANDLER(handle_runtest_command)
1070 {
1071 if (CMD_ARGC != 1)
1072 return ERROR_COMMAND_SYNTAX_ERROR;
1073
1074 unsigned num_clocks;
1075 COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num_clocks);
1076
1077 jtag_add_runtest(num_clocks, TAP_IDLE);
1078 return jtag_execute_queue();
1079 }
1080
1081 /*
1082 * For "irscan" or "drscan" commands, the "end" (really, "next") state
1083 * should be stable ... and *NOT* a shift state, otherwise free-running
1084 * jtag clocks could change the values latched by the update state.
1085 * Not surprisingly, this is the same constraint as SVF; the "irscan"
1086 * and "drscan" commands are a write-only subset of what SVF provides.
1087 */
1088
1089 COMMAND_HANDLER(handle_irscan_command)
1090 {
1091 int i;
1092 struct scan_field *fields;
1093 struct jtag_tap *tap = NULL;
1094 tap_state_t endstate;
1095
1096 if ((CMD_ARGC < 2) || (CMD_ARGC % 2))
1097 return ERROR_COMMAND_SYNTAX_ERROR;
1098
1099 /* optional "-endstate" "statename" at the end of the arguments,
1100 * so that e.g. IRPAUSE can let us load the data register before
1101 * entering RUN/IDLE to execute the instruction we load here.
1102 */
1103 endstate = TAP_IDLE;
1104
1105 if (CMD_ARGC >= 4) {
1106 /* have at least one pair of numbers.
1107 * is last pair the magic text? */
1108 if (strcmp("-endstate", CMD_ARGV[CMD_ARGC - 2]) == 0) {
1109 endstate = tap_state_by_name(CMD_ARGV[CMD_ARGC - 1]);
1110 if (endstate == TAP_INVALID)
1111 return ERROR_COMMAND_SYNTAX_ERROR;
1112 if (!scan_is_safe(endstate))
1113 LOG_WARNING("unstable irscan endstate \"%s\"",
1114 CMD_ARGV[CMD_ARGC - 1]);
1115 CMD_ARGC -= 2;
1116 }
1117 }
1118
1119 int num_fields = CMD_ARGC / 2;
1120 if (num_fields > 1) {
1121 /* we really should be looking at plain_ir_scan if we want
1122 * anything more fancy.
1123 */
1124 LOG_ERROR("Specify a single value for tap");
1125 return ERROR_COMMAND_SYNTAX_ERROR;
1126 }
1127
1128 fields = calloc(num_fields, sizeof(*fields));
1129
1130 int retval;
1131 for (i = 0; i < num_fields; i++) {
1132 tap = jtag_tap_by_string(CMD_ARGV[i*2]);
1133 if (tap == NULL) {
1134 free(fields);
1135 command_print(CMD_CTX, "Tap: %s unknown", CMD_ARGV[i*2]);
1136
1137 return ERROR_FAIL;
1138 }
1139 int field_size = tap->ir_length;
1140 fields[i].num_bits = field_size;
1141 uint8_t *v = malloc(DIV_ROUND_UP(field_size, 8));
1142
1143 uint64_t value;
1144 retval = parse_u64(CMD_ARGV[i * 2 + 1], &value);
1145 if (ERROR_OK != retval)
1146 goto error_return;
1147 buf_set_u64(v, 0, field_size, value);
1148 fields[i].out_value = v;
1149 fields[i].in_value = NULL;
1150 }
1151
1152 /* did we have an endstate? */
1153 jtag_add_ir_scan(tap, fields, endstate);
1154
1155 retval = jtag_execute_queue();
1156
1157 error_return:
1158 for (i = 0; i < num_fields; i++) {
1159 if (NULL != fields[i].out_value)
1160 free((void *)fields[i].out_value);
1161 }
1162
1163 free(fields);
1164
1165 return retval;
1166 }
1167
1168 COMMAND_HANDLER(handle_verify_ircapture_command)
1169 {
1170 if (CMD_ARGC > 1)
1171 return ERROR_COMMAND_SYNTAX_ERROR;
1172
1173 if (CMD_ARGC == 1) {
1174 bool enable;
1175 COMMAND_PARSE_ENABLE(CMD_ARGV[0], enable);
1176 jtag_set_verify_capture_ir(enable);
1177 }
1178
1179 const char *status = jtag_will_verify_capture_ir() ? "enabled" : "disabled";
1180 command_print(CMD_CTX, "verify Capture-IR is %s", status);
1181
1182 return ERROR_OK;
1183 }
1184
1185 COMMAND_HANDLER(handle_verify_jtag_command)
1186 {
1187 if (CMD_ARGC > 1)
1188 return ERROR_COMMAND_SYNTAX_ERROR;
1189
1190 if (CMD_ARGC == 1) {
1191 bool enable;
1192 COMMAND_PARSE_ENABLE(CMD_ARGV[0], enable);
1193 jtag_set_verify(enable);
1194 }
1195
1196 const char *status = jtag_will_verify() ? "enabled" : "disabled";
1197 command_print(CMD_CTX, "verify jtag capture is %s", status);
1198
1199 return ERROR_OK;
1200 }
1201
1202 COMMAND_HANDLER(handle_tms_sequence_command)
1203 {
1204 if (CMD_ARGC > 1)
1205 return ERROR_COMMAND_SYNTAX_ERROR;
1206
1207 if (CMD_ARGC == 1) {
1208 bool use_new_table;
1209 if (strcmp(CMD_ARGV[0], "short") == 0)
1210 use_new_table = true;
1211 else if (strcmp(CMD_ARGV[0], "long") == 0)
1212 use_new_table = false;
1213 else
1214 return ERROR_COMMAND_SYNTAX_ERROR;
1215
1216 tap_use_new_tms_table(use_new_table);
1217 }
1218
1219 command_print(CMD_CTX, "tms sequence is %s",
1220 tap_uses_new_tms_table() ? "short" : "long");
1221
1222 return ERROR_OK;
1223 }
1224
1225 COMMAND_HANDLER(handle_jtag_flush_queue_sleep)
1226 {
1227 if (CMD_ARGC != 1)
1228 return ERROR_COMMAND_SYNTAX_ERROR;
1229
1230 int sleep_ms;
1231 COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], sleep_ms);
1232
1233 jtag_set_flush_queue_sleep(sleep_ms);
1234
1235 return ERROR_OK;
1236 }
1237
1238 COMMAND_HANDLER(handle_wait_srst_deassert)
1239 {
1240 if (CMD_ARGC != 1)
1241 return ERROR_COMMAND_SYNTAX_ERROR;
1242
1243 int timeout_ms;
1244 COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], timeout_ms);
1245 if ((timeout_ms <= 0) || (timeout_ms > 100000)) {
1246 LOG_ERROR("Timeout must be an integer between 0 and 100000");
1247 return ERROR_FAIL;
1248 }
1249
1250 LOG_USER("Waiting for srst assert + deassert for at most %dms", timeout_ms);
1251 int asserted_yet;
1252 long long then = timeval_ms();
1253 while (jtag_srst_asserted(&asserted_yet) == ERROR_OK) {
1254 if ((timeval_ms() - then) > timeout_ms) {
1255 LOG_ERROR("Timed out");
1256 return ERROR_FAIL;
1257 }
1258 if (asserted_yet)
1259 break;
1260 }
1261 while (jtag_srst_asserted(&asserted_yet) == ERROR_OK) {
1262 if ((timeval_ms() - then) > timeout_ms) {
1263 LOG_ERROR("Timed out");
1264 return ERROR_FAIL;
1265 }
1266 if (!asserted_yet)
1267 break;
1268 }
1269
1270 return ERROR_OK;
1271 }
1272
1273 static const struct command_registration jtag_command_handlers[] = {
1274
1275 {
1276 .name = "jtag_flush_queue_sleep",
1277 .handler = handle_jtag_flush_queue_sleep,
1278 .mode = COMMAND_ANY,
1279 .help = "For debug purposes(simulate long delays of interface) "
1280 "to test performance or change in behavior. Default 0ms.",
1281 .usage = "[sleep in ms]",
1282 },
1283 {
1284 .name = "jtag_rclk",
1285 .handler = handle_jtag_rclk_command,
1286 .mode = COMMAND_ANY,
1287 .help = "With an argument, change to to use adaptive clocking "
1288 "if possible; else to use the fallback speed. "
1289 "With or without argument, display current setting.",
1290 .usage = "[fallback_speed_khz]",
1291 },
1292 {
1293 .name = "jtag_ntrst_delay",
1294 .handler = handle_jtag_ntrst_delay_command,
1295 .mode = COMMAND_ANY,
1296 .help = "delay after deasserting trst in ms",
1297 .usage = "[milliseconds]",
1298 },
1299 {
1300 .name = "jtag_ntrst_assert_width",
1301 .handler = handle_jtag_ntrst_assert_width_command,
1302 .mode = COMMAND_ANY,
1303 .help = "delay after asserting trst in ms",
1304 .usage = "[milliseconds]",
1305 },
1306 {
1307 .name = "scan_chain",
1308 .handler = handle_scan_chain_command,
1309 .mode = COMMAND_ANY,
1310 .help = "print current scan chain configuration",
1311 .usage = ""
1312 },
1313 {
1314 .name = "jtag_reset",
1315 .handler = handle_jtag_reset_command,
1316 .mode = COMMAND_EXEC,
1317 .help = "Set reset line values. Value '1' is active, "
1318 "value '0' is inactive.",
1319 .usage = "trst_active srst_active",
1320 },
1321 {
1322 .name = "runtest",
1323 .handler = handle_runtest_command,
1324 .mode = COMMAND_EXEC,
1325 .help = "Move to Run-Test/Idle, and issue TCK for num_cycles.",
1326 .usage = "num_cycles"
1327 },
1328 {
1329 .name = "irscan",
1330 .handler = handle_irscan_command,
1331 .mode = COMMAND_EXEC,
1332 .help = "Execute Instruction Register (DR) scan. The "
1333 "specified opcodes are put into each TAP's IR, "
1334 "and other TAPs are put in BYPASS.",
1335 .usage = "[tap_name instruction]* ['-endstate' state_name]",
1336 },
1337 {
1338 .name = "verify_ircapture",
1339 .handler = handle_verify_ircapture_command,
1340 .mode = COMMAND_ANY,
1341 .help = "Display or assign flag controlling whether to "
1342 "verify values captured during Capture-IR.",
1343 .usage = "['enable'|'disable']",
1344 },
1345 {
1346 .name = "verify_jtag",
1347 .handler = handle_verify_jtag_command,
1348 .mode = COMMAND_ANY,
1349 .help = "Display or assign flag controlling whether to "
1350 "verify values captured during IR and DR scans.",
1351 .usage = "['enable'|'disable']",
1352 },
1353 {
1354 .name = "tms_sequence",
1355 .handler = handle_tms_sequence_command,
1356 .mode = COMMAND_ANY,
1357 .help = "Display or change what style TMS sequences to use "
1358 "for JTAG state transitions: short (default) or "
1359 "long. Only for working around JTAG bugs.",
1360 /* Specifically for working around DRIVER bugs... */
1361 .usage = "['short'|'long']",
1362 },
1363 {
1364 .name = "wait_srst_deassert",
1365 .handler = handle_wait_srst_deassert,
1366 .mode = COMMAND_ANY,
1367 .help = "Wait for an SRST deassert. "
1368 "Useful for cases where you need something to happen within ms "
1369 "of an srst deassert. Timeout in ms ",
1370 .usage = "ms",
1371 },
1372 {
1373 .name = "jtag",
1374 .mode = COMMAND_ANY,
1375 .help = "perform jtag tap actions",
1376 .usage = "",
1377
1378 .chain = jtag_subcommand_handlers,
1379 },
1380 {
1381 .chain = jtag_command_handlers_to_move,
1382 },
1383 COMMAND_REGISTRATION_DONE
1384 };
1385
1386 int jtag_register_commands(struct command_context *cmd_ctx)
1387 {
1388 return register_commands(cmd_ctx, NULL, jtag_command_handlers);
1389 }

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)