ARMv7-M: make DAP commands verify target is an ARMv7-M
[openocd.git] / src / target / arm_jtag.c
1 /***************************************************************************
2 * Copyright (C) 2005 by Dominic Rath *
3 * Dominic.Rath@gmx.de *
4 * *
5 * Copyright (C) 2007,2008 Øyvind Harboe *
6 * oyvind.harboe@zylin.com *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the *
20 * Free Software Foundation, Inc., *
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22 ***************************************************************************/
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
26
27 #include "arm_jtag.h"
28
29
30 #if 0
31 #define _ARM_JTAG_SCAN_N_CHECK_
32 #endif
33
34 int arm_jtag_set_instr_inner(struct arm_jtag *jtag_info, uint32_t new_instr, void *no_verify_capture)
35 {
36 struct jtag_tap *tap;
37 tap = jtag_info->tap;
38 struct scan_field field;
39 uint8_t t[4];
40
41 field.tap = tap;
42 field.num_bits = tap->ir_length;
43 field.out_value = t;
44 buf_set_u32(field.out_value, 0, field.num_bits, new_instr);
45 field.in_value = NULL;
46
47 if (no_verify_capture == NULL)
48 {
49 jtag_add_ir_scan(1, &field, jtag_get_end_state());
50 } else
51 {
52 /* FIX!!!! this is a kludge!!! arm926ejs.c should reimplement this arm_jtag_set_instr to
53 * have special verification code.
54 */
55 jtag_add_ir_scan_noverify(1, &field, jtag_get_end_state());
56 }
57
58 return ERROR_OK;
59 }
60
61 int arm_jtag_scann_inner(struct arm_jtag *jtag_info, uint32_t new_scan_chain)
62 {
63 int retval = ERROR_OK;
64 uint32_t values[1];
65 int num_bits[1];
66
67 values[0]=new_scan_chain;
68 num_bits[0]=jtag_info->scann_size;
69
70 if ((retval = arm_jtag_set_instr(jtag_info, jtag_info->scann_instr, NULL)) != ERROR_OK)
71 {
72 return retval;
73 }
74
75 jtag_add_dr_out(jtag_info->tap,
76 1,
77 num_bits,
78 values,
79 jtag_get_end_state());
80
81 jtag_info->cur_scan_chain = new_scan_chain;
82
83 return retval;
84 }
85
86 int arm_jtag_reset_callback(enum jtag_event event, void *priv)
87 {
88 struct arm_jtag *jtag_info = priv;
89
90 if (event == JTAG_TRST_ASSERTED)
91 {
92 jtag_info->cur_scan_chain = 0;
93 }
94
95 return ERROR_OK;
96 }
97
98 int arm_jtag_setup_connection(struct arm_jtag *jtag_info)
99 {
100 jtag_info->scann_instr = 0x2;
101 jtag_info->cur_scan_chain = 0;
102 jtag_info->intest_instr = 0xc;
103
104 return jtag_register_event_callback(arm_jtag_reset_callback, jtag_info);
105 }

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)