+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
/***************************************************************************
* Copyright (C) 2005 by Dominic Rath *
* Dominic.Rath@gmx.de *
* *
* Copyright (C) 2008 by Spencer Oliver *
* spen@spen-soft.co.uk *
- * *
- * 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, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifndef OPENOCD_TARGET_TARGET_TYPE_H
#define OPENOCD_TARGET_TARGET_TYPE_H
-#include <jim-nvp.h>
+#include <helper/jim-nvp.h>
struct target;
/**
* Free all the resources allocated by the target.
*
+ * WARNING: deinit_target is called unconditionally regardless the target has
+ * ever been examined/initialised or not.
+ * If a problem has prevented establishing JTAG/SWD/... communication
+ * or
+ * if the target was created with -defer-examine flag and has never been
+ * examined
+ * then it is not possible to communicate with the target.
+ *
+ * If you need to talk to the target during deinit, first check if
+ * target_was_examined()!
+ *
* @param target The target to deinit
*/
void (*deinit_target)(struct target *target);
*/
int (*gdb_fileio_end)(struct target *target, int retcode, int fileio_errno, bool ctrl_c);
+ /* Parse target-specific GDB query commands.
+ * The string pointer "response_p" is always assigned by the called function
+ * to a pointer to a NULL-terminated string, even when the function returns
+ * an error. The string memory is not freed by the caller, so this function
+ * must pay attention for possible memory leaks if the string memory is
+ * dynamically allocated.
+ */
+ int (*gdb_query_custom)(struct target *target, const char *packet, char **response_p);
+
/* do target profiling
*/
int (*profiling)(struct target *target, uint32_t *samples,