+// SPDX-License-Identifier: GPL-2.0-or-later
+
/***************************************************************************
* Copyright (C) 2016 by Matthias Welwarsky *
* *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * *
***************************************************************************/
#ifdef HAVE_CONFIG_H
static LIST_HEAD(all_dap);
-extern const struct dap_ops swd_dap_ops;
-extern const struct dap_ops jtag_dp_ops;
extern struct adapter_driver *adapter_driver;
/* DAP command support */
{
struct arm_dap_object *obj;
int retval;
+ bool pre_connect = true;
LOG_DEBUG("Initializing all DAPs ...");
is_adiv6(dap) ? "ADIv6" : "ADIv5");
}
+ if (pre_connect && dap->ops->pre_connect_init) {
+ retval = dap->ops->pre_connect_init(dap);
+ if (retval != ERROR_OK)
+ return retval;
+
+ pre_connect = false;
+ }
+
retval = dap->ops->connect(dap);
if (retval != ERROR_OK)
return retval;
return dap_create(&goi);
}
-static int jim_dap_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+COMMAND_HANDLER(handle_dap_names)
{
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
struct arm_dap_object *obj;
+ list_for_each_entry(obj, &all_dap, lh)
+ command_print(CMD, "%s", obj->name);
- if (argc != 1) {
- Jim_WrongNumArgs(interp, 1, argv, "Too many parameters");
- return JIM_ERR;
- }
- Jim_SetResult(interp, Jim_NewListObj(interp, NULL, 0));
- list_for_each_entry(obj, &all_dap, lh) {
- Jim_ListAppendElement(interp, Jim_GetResult(interp),
- Jim_NewStringObj(interp, obj->name, -1));
- }
- return JIM_OK;
+ return ERROR_OK;
}
COMMAND_HANDLER(handle_dap_init)
{
.name = "names",
.mode = COMMAND_ANY,
- .jim_handler = jim_dap_names,
+ .handler = handle_dap_names,
.usage = "",
.help = "Lists all registered DAP instances by name",
},