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

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)