1 /***************************************************************************
2 * Copyright (C) 2011 by Mathias Kuester *
3 * Mathias Kuester <kesmtp@freenet.de> *
5 * Copyright (C) 2012 by Spencer Oliver *
6 * spen@spen-soft.co.uk *
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. *
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. *
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 ***************************************************************************/
28 /* project specific includes */
29 #include <jtag/interface.h>
31 #include <transport/transport.h>
32 #include <helper/time_support.h>
33 #include <target/target.h>
34 #include <jtag/hla/hla_tcl.h>
35 #include <jtag/hla/hla_transport.h>
36 #include <jtag/hla/hla_interface.h>
38 COMMAND_HANDLER(hl_transport_jtag_command
)
40 LOG_DEBUG("hl_transport_jtag_command");
45 COMMAND_HANDLER(hl_transport_reset_command
)
47 return hl_interface_init_reset();
50 static const struct command_registration
51 hl_transport_stlink_subcommand_handlers
[] = {
54 .mode
= COMMAND_CONFIG
,
55 .jim_handler
= jim_hl_newtap
,
56 .help
= "Create a new TAP instance named basename.tap_type, "
57 "and appends it to the scan chain.",
58 .usage
= "basename tap_type '-irlen' count "
59 "['-expected_id' number] ",
62 COMMAND_REGISTRATION_DONE
65 static const struct command_registration
66 hl_transport_jtag_subcommand_handlers
[] = {
70 .handler
= hl_transport_jtag_command
,
76 .handler
= hl_transport_jtag_command
,
80 .name
= "arp_init-reset",
82 .handler
= hl_transport_reset_command
,
86 .name
= "tapisenabled",
88 .jim_handler
= jim_jtag_tap_enabler
,
93 .jim_handler
= jim_jtag_tap_enabler
,
98 .handler
= hl_transport_jtag_command
,
103 .mode
= COMMAND_EXEC
,
104 .handler
= hl_transport_jtag_command
,
109 .mode
= COMMAND_EXEC
,
110 .jim_handler
= jim_jtag_configure
,
115 .handler
= hl_transport_jtag_command
,
119 COMMAND_REGISTRATION_DONE
122 static const struct command_registration stlink_transport_command_handlers
[] = {
127 .help
= "perform stlink actions",
129 .chain
= hl_transport_stlink_subcommand_handlers
,
135 .chain
= hl_transport_jtag_subcommand_handlers
,
137 COMMAND_REGISTRATION_DONE
140 static int hl_transport_register_commands(struct command_context
*cmd_ctx
)
142 return register_commands(cmd_ctx
, NULL
,
143 stlink_transport_command_handlers
);
146 static int hl_transport_init(struct command_context
*cmd_ctx
)
148 LOG_DEBUG("hl_transport_init");
149 struct target
*t
= get_current_target(cmd_ctx
);
150 struct transport
*transport
;
151 enum hl_transports tr
;
154 LOG_ERROR("no current target");
158 transport
= get_current_transport();
161 LOG_ERROR("no transport selected");
165 LOG_DEBUG("current transport %s", transport
->name
);
167 /* get selected transport as enum */
168 tr
= HL_TRANSPORT_UNKNOWN
;
170 if (strcmp(transport
->name
, "stlink_swd") == 0)
171 tr
= HL_TRANSPORT_SWD
;
172 else if (strcmp(transport
->name
, "stlink_jtag") == 0)
173 tr
= HL_TRANSPORT_JTAG
;
174 else if (strcmp(transport
->name
, "stlink_swim") == 0)
175 tr
= HL_TRANSPORT_SWIM
;
177 int retval
= hl_interface_open(tr
);
179 if (retval
!= ERROR_OK
)
182 return hl_interface_init_target(t
);
185 static int hl_transport_select(struct command_context
*ctx
)
187 LOG_DEBUG("hl_transport_select");
191 /* NOTE: interface init must already have been done.
192 * That works with only C code ... no Tcl glue required.
195 retval
= hl_transport_register_commands(ctx
);
197 if (retval
!= ERROR_OK
)
203 static struct transport hl_swd_transport
= {
204 .name
= "stlink_swd",
205 .select
= hl_transport_select
,
206 .init
= hl_transport_init
,
209 static struct transport hl_jtag_transport
= {
210 .name
= "stlink_jtag",
211 .select
= hl_transport_select
,
212 .init
= hl_transport_init
,
215 static struct transport hl_swim_transport
= {
216 .name
= "stlink_swim",
217 .select
= hl_transport_select
,
218 .init
= hl_transport_init
,
221 const char *hl_transports
[] = { "stlink_swd", "stlink_jtag", "stlink_swim", NULL
};
223 static void hl_constructor(void) __attribute__ ((constructor
));
224 static void hl_constructor(void)
226 transport_register(&hl_swd_transport
);
227 transport_register(&hl_jtag_transport
);
228 transport_register(&hl_swim_transport
);
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)