contrib/firmware: add new adapter ANGIE's firmware/bitstream code
[openocd.git] / contrib / firmware / angie / c / src / jtag.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2
3 /****************************************************************************
4 File : jtag.c *
5 Contents : Jtag handling functions code for NanoXplore *
6 USB-JTAG ANGIE adapter hardware. *
7 Based on openULINK project code by: Martin Schmoelzer. *
8 Copyright 2023, Ahmed Errached BOUDJELIDA, NanoXplore SAS. *
9 <aboudjelida@nanoxplore.com> *
10 <ahmederrachedbjld@gmail.com> *
11 *****************************************************************************/
12
13 #include "jtag.h"
14 #include "io.h"
15 #include "msgtypes.h"
16 #include "reg_ezusb.h"
17 #include <stdbool.h>
18 #include <serial.h>
19 #include <stdio.h>
20
21 /** Delay value for SCAN_IN operations with less than maximum TCK frequency */
22 uint8_t delay_scan_in;
23
24 /** Delay value for SCAN_OUT operations with less than maximum TCK frequency */
25 uint8_t delay_scan_out;
26
27 /** Delay value for SCAN_IO operations with less than maximum TCK frequency */
28 uint8_t delay_scan_io;
29
30 /** Delay value for CLOCK_TCK operations with less than maximum frequency */
31 uint8_t delay_tck;
32
33 /** Delay value for CLOCK_TMS operations with less than maximum frequency */
34 uint8_t delay_tms;
35
36 /**
37 * Perform JTAG SCAN-IN operation at maximum TCK frequency.
38 *
39 * Dummy data is shifted into the JTAG chain via TDI, TDO data is sampled and
40 * stored in the EP2 IN buffer.
41 *
42 * Maximum achievable TCK frequency is 182 kHz for ANGIE clocked at 24 MHz.
43 *
44 * @param out_offset offset in EP1OUTBUF where payload data starts
45 * @param in_offset
46 */
47 void jtag_scan_in(uint8_t out_offset, uint8_t in_offset)
48 {
49 uint8_t scan_size_bytes, bits_last_byte;
50 uint8_t tms_count_start, tms_count_end;
51 uint8_t tms_sequence_start, tms_sequence_end;
52 uint8_t tdo_data, i, j;
53
54 uint8_t outb_buffer;
55
56 /* Get parameters from EP1OUTBUF */
57 scan_size_bytes = EP1OUTBUF[out_offset];
58 bits_last_byte = EP1OUTBUF[out_offset + 1];
59 tms_count_start = (EP1OUTBUF[out_offset + 2] >> 4) & 0x0F;
60 tms_count_end = EP1OUTBUF[out_offset + 2] & 0x0F;
61 tms_sequence_start = EP1OUTBUF[out_offset + 3];
62 tms_sequence_end = EP1OUTBUF[out_offset + 4];
63
64 if (tms_count_start > 0)
65 jtag_clock_tms(tms_count_start, tms_sequence_start);
66
67 outb_buffer = IOB & ~(bmbit1 | bmbit2 | bmbit3);
68
69 /* Shift all bytes except the last byte */
70 for (i = 0; i < scan_size_bytes - 1; i++) {
71 tdo_data = 0;
72
73 for (j = 0; j < 8; j++) {
74 IOB = outb_buffer; /* TCK changes here */
75 tdo_data = tdo_data >> 1;
76 IOB = (outb_buffer | bmbit2);
77
78 if (PIN_TDO)
79 tdo_data |= 0x80;
80 }
81
82 /* Copy TDO data to EP1INBUF */
83 EP1INBUF[i + in_offset] = tdo_data;
84 }
85 tdo_data = 0;
86
87 /* Shift the last byte */
88 for (j = 0; j < bits_last_byte; j++) {
89 /* Assert TMS signal if requested and this is the last bit */
90 if (j == (bits_last_byte - 1) && tms_count_end > 0) {
91 outb_buffer |= bmbit1;
92 tms_count_end--;
93 tms_sequence_end = tms_sequence_end >> 1;
94 }
95
96 IOB = outb_buffer; /* TCK changes here */
97 tdo_data = tdo_data >> 1;
98 IOB = (outb_buffer | bmbit2);
99
100 if (PIN_TDO)
101 tdo_data |= 0x80;
102 }
103 tdo_data = tdo_data >> (8 - bits_last_byte);
104
105 /* Copy TDO data to EP1INBUF */
106 EP1INBUF[i + in_offset] = tdo_data;
107
108 /* Move to correct end state */
109 if (tms_count_end > 0)
110 jtag_clock_tms(tms_count_end, tms_sequence_end);
111 }
112
113
114 /**
115 * Perform JTAG SCAN-IN operation at variable TCK frequency.
116 *
117 * Dummy data is shifted into the JTAG chain via TDI, TDO data is sampled and
118 * stored in the EP2 IN buffer.
119 *
120 * Maximum achievable TCK frequency is 113 kHz for ANGIE clocked at 24 MHz.
121 *
122 * @param out_offset offset in EP1OUTBUF where payload data starts
123 * @param in_offset
124 */
125 void jtag_slow_scan_in(uint8_t out_offset, uint8_t in_offset)
126 {
127 uint8_t scan_size_bytes, bits_last_byte;
128 uint8_t tms_count_start, tms_count_end;
129 uint8_t tms_sequence_start, tms_sequence_end;
130 uint8_t tdo_data, i, j, k;
131 uint8_t outb_buffer;
132
133 /* Get parameters from EP1OUTBUF */
134 scan_size_bytes = EP1OUTBUF[out_offset];
135 bits_last_byte = EP1OUTBUF[out_offset + 1];
136 tms_count_start = (EP1OUTBUF[out_offset + 2] >> 4) & 0x0F;
137 tms_count_end = EP1OUTBUF[out_offset + 2] & 0x0F;
138 tms_sequence_start = EP1OUTBUF[out_offset + 3];
139 tms_sequence_end = EP1OUTBUF[out_offset + 4];
140
141 if (tms_count_start > 0)
142 jtag_slow_clock_tms(tms_count_start, tms_sequence_start);
143
144 outb_buffer = IOB & ~(bmbit3 | bmbit2 | bmbit1);
145
146 /* Shift all bytes except the last byte */
147 for (i = 0; i < scan_size_bytes - 1; i++) {
148 tdo_data = 0;
149
150 for (j = 0; j < 8; j++) {
151 IOB = outb_buffer; /* TCK changes here */
152 for (k = 0; k < delay_scan_in; k++)
153 ;
154 tdo_data = tdo_data >> 1;
155
156 IOB = (outb_buffer | bmbit2);
157 for (k = 0; k < delay_scan_in; k++)
158 ;
159
160 if (PIN_TDO)
161 tdo_data |= 0x80;
162 }
163
164 /* Copy TDO data to EP1INBUF */
165 EP1INBUF[i + in_offset] = tdo_data;
166 }
167
168 tdo_data = 0;
169
170 /* Shift the last byte */
171 for (j = 0; j < bits_last_byte; j++) {
172 /* Assert TMS signal if requested and this is the last bit */
173 if (j == (bits_last_byte - 1) && tms_count_end > 0) {
174 outb_buffer |= bmbit1;
175 tms_count_end--;
176 tms_sequence_end = tms_sequence_end >> 1;
177 }
178
179 IOB = outb_buffer; /* TCK changes here */
180 for (k = 0; k < delay_scan_in; k++)
181 ;
182 tdo_data = tdo_data >> 1;
183
184 IOB = (outb_buffer | bmbit2);
185 for (k = 0; k < delay_scan_in; k++)
186 ;
187
188 if (PIN_TDO)
189 tdo_data |= 0x80;
190 }
191 tdo_data = tdo_data >> (8 - bits_last_byte);
192
193 /* Copy TDO data to EP1INBUF */
194 EP1INBUF[i + in_offset] = tdo_data;
195
196 /* Move to correct end state */
197 if (tms_count_end > 0)
198 jtag_slow_clock_tms(tms_count_end, tms_sequence_end);
199 }
200
201
202 /**
203 * Perform JTAG SCAN-OUT operation at maximum TCK frequency.
204 *
205 * Data stored in EP2 OUT buffer is shifted into the JTAG chain via TDI, TDO
206 * data is not sampled.
207 * The TAP-FSM state is always left in the PAUSE-DR/PAUSE-IR state.
208 *
209 * Maximum achievable TCK frequency is 142 kHz for ANGIE clocked at 24 MHz.
210 *
211 * @param out_offset offset in EP1OUTBUF where payload data starts
212 */
213 void jtag_scan_out(uint8_t out_offset)
214 {
215 uint8_t scan_size_bytes, bits_last_byte;
216 uint8_t tms_count_start, tms_count_end;
217 uint8_t tms_sequence_start, tms_sequence_end;
218 uint8_t tdi_data, i, j;
219 uint8_t outb_buffer;
220
221 /* Get parameters from EP1OUTBUF */
222 scan_size_bytes = EP1OUTBUF[out_offset];
223 bits_last_byte = EP1OUTBUF[out_offset + 1];
224 tms_count_start = (EP1OUTBUF[out_offset + 2] >> 4) & 0x0F;
225 tms_count_end = EP1OUTBUF[out_offset + 2] & 0x0F;
226 tms_sequence_start = EP1OUTBUF[out_offset + 3];
227 tms_sequence_end = EP1OUTBUF[out_offset + 4];
228
229 if (tms_count_start > 0)
230 jtag_clock_tms(tms_count_start, tms_sequence_start);
231 outb_buffer = IOB & ~(bmbit2 | bmbit1);
232
233 /* Shift all bytes except the last byte */
234 for (i = 0; i < scan_size_bytes - 1; i++) {
235 tdi_data = EP1OUTBUF[i + out_offset + 5];
236
237 for (j = 0; j < 8; j++) {
238 if (tdi_data & 0x01)
239 outb_buffer |= bmbit3;
240 else
241 outb_buffer &= ~bmbit3;
242
243 IOB = outb_buffer; /* TDI and TCK change here */
244 tdi_data = tdi_data >> 1;
245 IOB = (outb_buffer | bmbit2);
246 }
247 }
248 tdi_data = EP1OUTBUF[i + out_offset + 5];
249
250 /* Shift the last byte */
251 for (j = 0; j < bits_last_byte; j++) {
252 if (tdi_data & 0x01)
253 outb_buffer |= bmbit3;
254 else
255 outb_buffer &= ~bmbit3;
256
257 /* Assert TMS signal if requested and this is the last bit */
258 if (j == (bits_last_byte - 1) && tms_count_end > 0) {
259 outb_buffer |= bmbit1;
260 tms_count_end--;
261 tms_sequence_end = tms_sequence_end >> 1;
262 }
263 IOB = outb_buffer; /* TDI and TCK change here */
264 tdi_data = tdi_data >> 1;
265 IOB = (outb_buffer | bmbit2);
266 }
267
268 /* Move to correct end state */
269 if (tms_count_end > 0)
270 jtag_clock_tms(tms_count_end, tms_sequence_end);
271 }
272
273 /**
274 * Perform JTAG SCAN-OUT operation at maximum TCK frequency.
275 *
276 * Data stored in EP2 OUT buffer is shifted into the JTAG chain via TDI, TDO
277 * data is not sampled.
278 * The TAP-FSM state is always left in the PAUSE-DR/PAUSE-IR state.
279 *
280 * Maximum achievable TCK frequency is 97 kHz for ANGIE clocked at 24 MHz.
281 *
282 * @param out_offset offset in EP1OUTBUF where payload data starts
283 */
284 void jtag_slow_scan_out(uint8_t out_offset)
285 {
286 uint8_t scan_size_bytes, bits_last_byte;
287 uint8_t tms_count_start, tms_count_end;
288 uint8_t tms_sequence_start, tms_sequence_end;
289 uint8_t tdi_data, i, j, k;
290 uint8_t outb_buffer;
291
292 /* Get parameters from EP1OUTBUF */
293 scan_size_bytes = EP1OUTBUF[out_offset];
294 bits_last_byte = EP1OUTBUF[out_offset + 1];
295 tms_count_start = (EP1OUTBUF[out_offset + 2] >> 4) & 0x0F;
296 tms_count_end = EP1OUTBUF[out_offset + 2] & 0x0F;
297 tms_sequence_start = EP1OUTBUF[out_offset + 3];
298 tms_sequence_end = EP1OUTBUF[out_offset + 4];
299
300 if (tms_count_start > 0)
301 jtag_slow_clock_tms(tms_count_start, tms_sequence_start);
302 outb_buffer = IOB & ~(bmbit2 | bmbit1);
303
304 /* Shift all bytes except the last byte */
305 for (i = 0; i < scan_size_bytes - 1; i++) {
306 tdi_data = EP1OUTBUF[i + out_offset + 5];
307
308 for (j = 0; j < 8; j++) {
309 if (tdi_data & 0x01)
310 outb_buffer |= bmbit3;
311 else
312 outb_buffer &= ~bmbit3;
313 IOB = outb_buffer; /* TDI and TCK change here */
314 for (k = 0; k < delay_scan_out; k++)
315 ;
316 tdi_data = tdi_data >> 1;
317 IOB = (outb_buffer | bmbit2);
318 for (k = 0; k < delay_scan_out; k++)
319 ;
320 }
321 }
322 tdi_data = EP1OUTBUF[i + out_offset + 5];
323
324 /* Shift the last byte */
325 for (j = 0; j < bits_last_byte; j++) {
326 if (tdi_data & 0x01)
327 outb_buffer |= bmbit3;
328 else
329 outb_buffer &= ~bmbit3;
330
331 /* Assert TMS signal if requested and this is the last bit */
332 if (j == (bits_last_byte - 1) && tms_count_end > 0) {
333 outb_buffer |= bmbit1;
334 tms_count_end--;
335 tms_sequence_end = tms_sequence_end >> 1;
336 }
337 IOB = outb_buffer; /* TDI and TCK change here */
338 for (k = 0; k < delay_scan_out; k++)
339 ;
340 tdi_data = tdi_data >> 1;
341 IOB = (outb_buffer | bmbit2);
342 for (k = 0; k < delay_scan_out; k++)
343 ;
344 }
345
346 /* Move to correct end state */
347 if (tms_count_end > 0)
348 jtag_slow_clock_tms(tms_count_end, tms_sequence_end);
349 }
350
351
352 /**
353 * Perform bidirectional JTAG SCAN operation at maximum TCK frequency.
354 *
355 * Data stored in EP2 OUT buffer is shifted into the JTAG chain via TDI, TDO
356 * data is sampled and stored in the EP2 IN buffer.
357 * The TAP-FSM state is always left in the PAUSE-DR/PAUSE-IR state.
358 *
359 * Maximum achievable TCK frequency is 100 kHz for ANGIE clocked at 24 MHz.
360 *
361 * @param out_offset offset in EP1OUTBUF where payload data starts
362 * @param in_offset
363 */
364 int it;
365 void jtag_scan_io(uint8_t out_offset, uint8_t in_offset)
366 {
367 uint8_t scan_size_bytes, bits_last_byte;
368 uint8_t tms_count_start, tms_count_end;
369 uint8_t tms_sequence_start, tms_sequence_end;
370 uint8_t tdi_data, tdo_data, i, j;
371 uint8_t outb_buffer;
372
373 it++;
374 /* Get parameters from EP1OUTBUF */
375 scan_size_bytes = EP1OUTBUF[out_offset];
376 bits_last_byte = EP1OUTBUF[out_offset + 1];
377 tms_count_start = (EP1OUTBUF[out_offset + 2] >> 4) & 0x0F;
378 tms_count_end = EP1OUTBUF[out_offset + 2] & 0x0F;
379 tms_sequence_start = EP1OUTBUF[out_offset + 3];
380 tms_sequence_end = EP1OUTBUF[out_offset + 4];
381
382 if (tms_count_start > 0)
383 jtag_clock_tms(tms_count_start, tms_sequence_start);
384 outb_buffer = IOB & ~(bmbit2 | bmbit1);
385
386 /* Shift all bytes except the last byte */
387 for (i = 0; i < scan_size_bytes - 1; i++) {
388 tdi_data = EP1OUTBUF[i + out_offset + 5];
389 tdo_data = 0;
390 for (j = 0; j < 8; j++) {
391 if (tdi_data & 0x01)
392 outb_buffer |= bmbit3;
393 else
394 outb_buffer &= ~bmbit3;
395 IOB = outb_buffer; /* TDI and TCK change here */
396 tdi_data = tdi_data >> 1;
397 IOB = (outb_buffer | bmbit2);
398 tdo_data = tdo_data >> 1;
399 if (PIN_TDO)
400 tdo_data |= 0x80;
401 }
402
403 /* Copy TDO data to EP1INBUF */
404 EP1INBUF[i + in_offset] = tdo_data;
405 }
406 tdi_data = EP1OUTBUF[i + out_offset + 5];
407 tdo_data = 0;
408
409 /* Shift the last byte */
410 for (j = 0; j < bits_last_byte; j++) {
411 if (tdi_data & 0x01)
412 outb_buffer |= bmbit3;
413 else
414 outb_buffer &= ~bmbit3;
415
416 /* Assert TMS signal if requested and this is the last bit */
417 if (j == (bits_last_byte - 1) && tms_count_end > 0) {
418 outb_buffer |= bmbit1;
419 tms_count_end--;
420 tms_sequence_end = tms_sequence_end >> 1;
421 }
422 IOB = outb_buffer; /* TDI and TCK change here */
423 tdi_data = tdi_data >> 1;
424 IOB = (outb_buffer | bmbit2);
425 tdo_data = tdo_data >> 1;
426 if (PIN_TDO)
427 tdo_data |= 0x80;
428 }
429 tdo_data = tdo_data >> (8 - bits_last_byte);
430
431 /* Copy TDO data to EP1INBUF */
432 EP1INBUF[i + in_offset] = tdo_data;
433
434 /* Move to correct end state */
435 if (tms_count_end > 0)
436 jtag_clock_tms(tms_count_end, tms_sequence_end);
437 }
438
439 /**
440 * Perform bidirectional JTAG SCAN operation at maximum TCK frequency.
441 *
442 * Data stored in EP2 OUT buffer is shifted into the JTAG chain via TDI, TDO
443 * data is sampled and stored in the EP2 IN buffer.
444 * The TAP-FSM state is always left in the PAUSE-DR/PAUSE-IR state.
445 *
446 * Maximum achievable TCK frequency is 78 kHz for ANGIE clocked at 24 MHz.
447 *
448 * @param out_offset offset in EP1OUTBUF where payload data starts
449 * @param in_offset
450 */
451 void jtag_slow_scan_io(uint8_t out_offset, uint8_t in_offset)
452 {
453 uint8_t scan_size_bytes, bits_last_byte;
454 uint8_t tms_count_start, tms_count_end;
455 uint8_t tms_sequence_start, tms_sequence_end;
456 uint8_t tdi_data, tdo_data, i, j, k;
457 uint8_t outb_buffer;
458
459 /* Get parameters from EP1OUTBUF */
460 scan_size_bytes = EP1OUTBUF[out_offset];
461 bits_last_byte = EP1OUTBUF[out_offset + 1];
462 tms_count_start = (EP1OUTBUF[out_offset + 2] >> 4) & 0x0F;
463 tms_count_end = EP1OUTBUF[out_offset + 2] & 0x0F;
464 tms_sequence_start = EP1OUTBUF[out_offset + 3];
465 tms_sequence_end = EP1OUTBUF[out_offset + 4];
466
467 if (tms_count_start > 0)
468 jtag_slow_clock_tms(tms_count_start, tms_sequence_start);
469 outb_buffer = IOB & ~(bmbit2 | bmbit1);
470
471 /* Shift all bytes except the last byte */
472 for (i = 0; i < scan_size_bytes - 1; i++) {
473 tdi_data = EP1OUTBUF[i + out_offset + 5];
474 tdo_data = 0;
475 for (j = 0; j < 8; j++) {
476 if (tdi_data & 0x01)
477 outb_buffer |= bmbit3;
478 else
479 outb_buffer &= ~bmbit3;
480 IOB = outb_buffer; /* TDI and TCK change here */
481 for (k = 0; k < delay_scan_io; k++)
482 ;
483 tdi_data = tdi_data >> 1;
484 IOB = (outb_buffer | bmbit2);
485 for (k = 0; k < delay_scan_io; k++)
486 ;
487 tdo_data = tdo_data >> 1;
488 if (PIN_TDO)
489 tdo_data |= 0x80;
490 }
491
492 /* Copy TDO data to EP1INBUF */
493 EP1INBUF[i + in_offset] = tdo_data;
494 }
495 tdi_data = EP1OUTBUF[i + out_offset + 5];
496 tdo_data = 0;
497
498 /* Shift the last byte */
499 for (j = 0; j < bits_last_byte; j++) {
500 if (tdi_data & 0x01)
501 outb_buffer |= bmbit3;
502 else
503 outb_buffer &= ~bmbit3;
504
505 /* Assert TMS signal if requested and this is the last bit */
506 if (j == (bits_last_byte - 1) && tms_count_end > 0) {
507 outb_buffer |= bmbit1;
508 tms_count_end--;
509 tms_sequence_end = tms_sequence_end >> 1;
510 }
511 IOB = outb_buffer; /* TDI and TCK change here */
512 for (k = 0; k < delay_scan_io; k++)
513 ;
514 tdi_data = tdi_data >> 1;
515 IOB = (outb_buffer | bmbit2);
516 for (k = 0; k < delay_scan_io; k++)
517 ;
518 tdo_data = tdo_data >> 1;
519 if (PIN_TDO)
520 tdo_data |= 0x80;
521 }
522 tdo_data = tdo_data >> (8 - bits_last_byte);
523
524 /* Copy TDO data to EP1INBUF */
525 EP1INBUF[i + in_offset] = tdo_data;
526
527 /* Move to correct end state */
528 if (tms_count_end > 0)
529 jtag_slow_clock_tms(tms_count_end, tms_sequence_end);
530 }
531
532 /**
533 * Generate TCK clock cycles.
534 *
535 * Maximum achievable TCK frequency is 375 kHz for ANGIE clocked at 24 MHz.
536 *
537 * @param count number of TCK clock cycles to generate.
538 */
539 void jtag_clock_tck(uint16_t count)
540 {
541 uint16_t i;
542 uint8_t outb_buffer = IOB & ~(bmbit2);
543
544 for (i = 0; i < count; i++) {
545 IOB = outb_buffer;
546 IOB = outb_buffer | bmbit2;
547 }
548 }
549
550 /**
551 * Generate TCK clock cycles at variable frequency.
552 *
553 * Maximum achievable TCK frequency is 166.6 kHz for ANGIE clocked at 24 MHz.
554 *
555 * @param count number of TCK clock cycles to generate.
556 */
557 void jtag_slow_clock_tck(uint16_t count)
558 {
559 uint16_t i;
560 uint8_t j;
561 uint8_t outb_buffer = IOB & ~(bmbit2);
562
563 for (i = 0; i < count; i++) {
564 IOB = outb_buffer;
565 for (j = 0; j < delay_tck; j++)
566 ;
567 IOB = outb_buffer | bmbit2;
568 for (j = 0; j < delay_tck; j++)
569 ;
570 }
571 }
572
573 /**
574 * Perform TAP FSM state transitions at maximum TCK frequency.
575 *
576 * Maximum achievable TCK frequency is 176 kHz for ANGIE clocked at 24 MHz.
577 *
578 * @param count the number of state transitions to perform.
579 * @param sequence the TMS pin levels for each state transition, starting with
580 * the least-significant bit.
581 */
582 void jtag_clock_tms(uint8_t count, uint8_t sequence)
583 {
584 uint8_t outb_buffer = IOB & ~(bmbit2);
585 uint8_t i;
586
587 for (i = 0; i < count; i++) {
588 /* Set TMS pin according to sequence parameter */
589 if (sequence & 0x1)
590 outb_buffer |= bmbit1;
591 else
592 outb_buffer &= ~bmbit1;
593 IOB = outb_buffer;
594 sequence = sequence >> 1;
595 IOB = outb_buffer | bmbit2;
596 }
597 }
598
599 /**
600 * Perform TAP-FSM state transitions at less than maximum TCK frequency.
601 *
602 * Maximum achievable TCK frequency is 117 kHz for ANGIE clocked at 24 MHz.
603 *
604 * @param count the number of state transitions to perform.
605 * @param sequence the TMS pin levels for each state transition, starting with
606 * the least-significant bit.
607 */
608 void jtag_slow_clock_tms(uint8_t count, uint8_t sequence)
609 {
610 uint8_t outb_buffer = IOB & ~(bmbit2);
611 uint8_t i, j;
612
613 for (i = 0; i < count; i++) {
614 /* Set TMS pin according to sequence parameter */
615 if (sequence & 0x1)
616 outb_buffer |= bmbit1;
617 else
618 outb_buffer &= ~bmbit1;
619 IOB = outb_buffer;
620 for (j = 0; j < delay_tms; j++)
621 ;
622 sequence = sequence >> 1;
623 IOB = outb_buffer | bmbit2;
624 for (j = 0; j < delay_tms; j++)
625 ;
626 }
627 }
628
629 uint16_t jtag_get_signals(void)
630 {
631 uint8_t input_signal_state, output_signal_state;
632 input_signal_state = 0;
633 output_signal_state = 0;
634
635 /* Get states of input pins */
636 if (PIN_TDO)
637 input_signal_state |= SIGNAL_TDO;
638
639 /* Get states of output pins */
640 output_signal_state = IOB & MASK_PORTB_DIRECTION_OUT;
641
642 return ((uint16_t)input_signal_state << 8) | ((uint16_t)output_signal_state);
643 }
644
645 /**
646 * Set state of JTAG output signals.
647 *
648 * @param low signals which should be de-asserted.
649 * @param high signals which should be asserted.
650 */
651 void jtag_set_signals(uint8_t low, uint8_t high)
652 {
653 IOB &= ~(low & MASK_PORTB_DIRECTION_OUT);
654 IOB |= (high & MASK_PORTB_DIRECTION_OUT);
655 }
656
657 /**
658 * Configure TCK delay parameters.
659 *
660 * @param scan_in number of delay cycles in scan_in operations.
661 * @param scan_out number of delay cycles in scan_out operations.
662 * @param scan_io number of delay cycles in scan_io operations.
663 * @param tck number of delay cycles in clock_tck operations.
664 * @param tms number of delay cycles in clock_tms operations.
665 */
666 void jtag_configure_tck_delay(uint8_t scan_in, uint8_t scan_out,
667 uint8_t scan_io, uint8_t tck, uint8_t tms)
668 {
669 delay_scan_in = scan_in;
670 delay_scan_out = scan_out;
671 delay_scan_io = scan_io;
672 delay_tck = tck;
673 delay_tms = tms;
674 }

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)