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