flash/nor/at91samd: Use 32-bit register writes for ST-Link compat
[fw/openocd] / src / target / target_type.h
index d6b6086b3c59467305a9db5ae444f71402c1f9f2..947080381c172812b2751d65141c6be63882cbf1 100644 (file)
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
 /***************************************************************************
  *   Copyright (C) 2005 by Dominic Rath                                    *
  *   Dominic.Rath@gmx.de                                                   *
@@ -7,19 +9,6 @@
  *                                                                         *
  *   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
@@ -242,6 +231,17 @@ struct target_type {
        /**
         * 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);
@@ -286,6 +286,15 @@ struct target_type {
         */
        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,