Add missing copyright header to target_type.h.
[openocd.git] / src / target / target_type.h
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 * Copyright (C) 2008 by Spencer Oliver *
9 * spen@spen-soft.co.uk *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * GNU General Public License for more details. *
20 * *
21 * You should have received a copy of the GNU General Public License *
22 * along with this program; if not, write to the *
23 * Free Software Foundation, Inc., *
24 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
25 ***************************************************************************/
26 #ifndef TARGET_TYPE_H
27 #define TARGET_TYPE_H
28
29 #include "types.h"
30
31 struct target_s;
32
33 struct target_type_s
34 {
35 /**
36 * Name of the target. Do @b not access this field directly, use
37 * target_get_name() instead.
38 */
39 char *name;
40
41 /**
42 * Indicates whether this target has been examined.
43 *
44 * Do @b not access this field directly, use target_was_examined()
45 * target_set_examined(), and target_reset_examined().
46 */
47 int examined;
48
49 /* poll current target status */
50 int (*poll)(struct target_s *target);
51 /* Invoked only from target_arch_state().
52 * Issue USER() w/architecture specific status. */
53 int (*arch_state)(struct target_s *target);
54
55 /* target request support */
56 int (*target_request_data)(struct target_s *target, uint32_t size, uint8_t *buffer);
57
58 /* halt will log a warning, but return ERROR_OK if the target is already halted. */
59 int (*halt)(struct target_s *target);
60 int (*resume)(struct target_s *target, int current, uint32_t address, int handle_breakpoints, int debug_execution);
61 int (*step)(struct target_s *target, int current, uint32_t address, int handle_breakpoints);
62
63 /* target reset control. assert reset can be invoked when OpenOCD and
64 * the target is out of sync.
65 *
66 * A typical example is that the target was power cycled while OpenOCD
67 * thought the target was halted or running.
68 *
69 * assert_reset() can therefore make no assumptions whatsoever about the
70 * state of the target
71 *
72 * Before assert_reset() for the target is invoked, a TRST/tms and
73 * chain validation is executed. TRST should not be asserted
74 * during target assert unless there is no way around it due to
75 * the way reset's are configured.
76 *
77 */
78 int (*assert_reset)(struct target_s *target);
79 int (*deassert_reset)(struct target_s *target);
80 int (*soft_reset_halt_imp)(struct target_s *target);
81 int (*soft_reset_halt)(struct target_s *target);
82
83 /**
84 * Target register access for GDB. Do @b not call this function
85 * directly, use target_get_gdb_reg_list() instead.
86 *
87 * Danger! this function will succeed even if the target is running
88 * and return a register list with dummy values.
89 *
90 * The reason is that GDB connection will fail without a valid register
91 * list, however it is after GDB is connected that monitor commands can
92 * be run to properly initialize the target
93 */
94 int (*get_gdb_reg_list)(struct target_s *target, struct reg_s **reg_list[], int *reg_list_size);
95
96 /* target memory access
97 * size: 1 = byte (8bit), 2 = half-word (16bit), 4 = word (32bit)
98 * count: number of items of <size>
99 */
100 int (*read_memory_imp)(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
101 /**
102 * Target memory read callback. Do @b not call this function
103 * directly, use target_read_memory() instead.
104 */
105 int (*read_memory)(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
106 int (*write_memory_imp)(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
107 /**
108 * Target memory write callback. Do @b not call this function
109 * directly, use target_write_memory() instead.
110 */
111 int (*write_memory)(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
112
113 /**
114 * Write target memory in multiples of 4 bytes, optimized for
115 * writing large quantities of data. Do @b not call this
116 * function directly, use target_bulk_write_memory() instead.
117 */
118 int (*bulk_write_memory)(struct target_s *target, uint32_t address, uint32_t count, uint8_t *buffer);
119
120 int (*checksum_memory)(struct target_s *target, uint32_t address, uint32_t count, uint32_t* checksum);
121 int (*blank_check_memory)(struct target_s *target, uint32_t address, uint32_t count, uint32_t* blank);
122
123 /*
124 * target break-/watchpoint control
125 * rw: 0 = write, 1 = read, 2 = access
126 *
127 * Target must be halted while this is invoked as this
128 * will actually set up breakpoints on target.
129 *
130 * The breakpoint hardware will be set up upon adding the first breakpoint.
131 *
132 * Upon GDB connection all breakpoints/watchpoints are cleared.
133 */
134 int (*add_breakpoint)(struct target_s *target, breakpoint_t *breakpoint);
135
136 /* remove breakpoint. hw will only be updated if the target is currently halted.
137 * However, this method can be invoked on unresponsive targets.
138 */
139 int (*remove_breakpoint)(struct target_s *target, breakpoint_t *breakpoint);
140 int (*add_watchpoint)(struct target_s *target, watchpoint_t *watchpoint);
141 /* remove watchpoint. hw will only be updated if the target is currently halted.
142 * However, this method can be invoked on unresponsive targets.
143 */
144 int (*remove_watchpoint)(struct target_s *target, watchpoint_t *watchpoint);
145
146 /* target algorithm support */
147 int (*run_algorithm_imp)(struct target_s *target, int num_mem_params, mem_param_t *mem_params, int num_reg_params, reg_param_t *reg_param, uint32_t entry_point, uint32_t exit_point, int timeout_ms, void *arch_info);
148 /**
149 * Target algorithm support. Do @b not call this method directly,
150 * use target_run_algorithm() instead.
151 */
152 int (*run_algorithm)(struct target_s *target, int num_mem_params, mem_param_t *mem_params, int num_reg_params, reg_param_t *reg_param, uint32_t entry_point, uint32_t exit_point, int timeout_ms, void *arch_info);
153
154 int (*register_commands)(struct command_context_s *cmd_ctx);
155
156 /* called when target is created */
157 int (*target_create)(struct target_s *target, Jim_Interp *interp);
158
159 /* called for various config parameters */
160 /* returns JIM_CONTINUE - if option not understood */
161 /* otherwise: JIM_OK, or JIM_ERR, */
162 int (*target_jim_configure)(struct target_s *target, Jim_GetOptInfo *goi);
163
164 /* target commands specifically handled by the target */
165 /* returns JIM_OK, or JIM_ERR, or JIM_CONTINUE - if option not understood */
166 int (*target_jim_commands)(struct target_s *target, Jim_GetOptInfo *goi);
167
168 /* invoked after JTAG chain has been examined & validated. During
169 * this stage the target is examined and any additional setup is
170 * performed.
171 *
172 * invoked every time after the jtag chain has been validated/examined
173 */
174 int (*examine)(struct target_s *target);
175 /* Set up structures for target.
176 *
177 * It is illegal to talk to the target at this stage as this fn is invoked
178 * before the JTAG chain has been examined/verified
179 * */
180 int (*init_target)(struct command_context_s *cmd_ctx, struct target_s *target);
181 int (*quit)(void);
182
183 int (*virt2phys)(struct target_s *target, uint32_t address, uint32_t *physical);
184 int (*mmu)(struct target_s *target, int *enabled);
185
186 };
187
188 #endif // TARGET_TYPE_H

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)