11 * Name of the target. Do @b not access this field directly, use
12 * target_get_name() instead.
17 * Indicates whether this target has been examined.
19 * Do @b not access this field directly, use target_was_examined()
20 * target_set_examined(), and target_reset_examined().
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
);
30 /* target request support */
31 int (*target_request_data
)(struct target_s
*target
, u32 size
, u8
*buffer
);
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
);
38 /* target reset control. assert reset can be invoked when OpenOCD and
39 * the target is out of sync.
41 * A typical example is that the target was power cycled while OpenOCD
42 * thought the target was halted or running.
44 * assert_reset() can therefore make no assumptions whatsoever about the
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.
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
);
59 * Target register access for GDB. Do @b not call this function
60 * directly, use target_get_gdb_reg_list() instead.
62 * Danger! this function will succeed even if the target is running
63 * and return a register list with dummy values.
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
69 int (*get_gdb_reg_list
)(struct target_s
*target
, struct reg_s
**reg_list
[], int *reg_list_size
);
71 /* target memory access
72 * size: 1 = byte (8bit), 2 = half-word (16bit), 4 = word (32bit)
73 * count: number of items of <size>
75 int (*read_memory_imp
)(struct target_s
*target
, u32 address
, u32 size
, u32 count
, u8
*buffer
);
77 * Target memory read callback. Do @b not call this function
78 * directly, use target_read_memory() instead.
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
);
83 * Target memory write callback. Do @b not call this function
84 * directly, use target_write_memory() instead.
86 int (*write_memory
)(struct target_s
*target
, u32 address
, u32 size
, u32 count
, u8
*buffer
);
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.
93 int (*bulk_write_memory
)(struct target_s
*target
, u32 address
, u32 count
, u8
*buffer
);
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
);
99 * target break-/watchpoint control
100 * rw: 0 = write, 1 = read, 2 = access
102 * Target must be halted while this is invoked as this
103 * will actually set up breakpoints on target.
105 * The breakpoint hardware will be set up upon adding the first breakpoint.
107 * Upon GDB connection all breakpoints/watchpoints are cleared.
109 int (*add_breakpoint
)(struct target_s
*target
, breakpoint_t
*breakpoint
);
111 /* remove breakpoint. hw will only be updated if the target is currently halted.
112 * However, this method can be invoked on unresponsive targets.
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.
119 int (*remove_watchpoint
)(struct target_s
*target
, watchpoint_t
*watchpoint
);
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
);
124 * Target algorithm support. Do @b not call this method directly,
125 * use target_run_algorithm() instead.
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
);
129 int (*register_commands
)(struct command_context_s
*cmd_ctx
);
131 /* called when target is created */
132 int (*target_create
)( struct target_s
*target
, Jim_Interp
*interp
);
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
);
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
);
143 /* invoked after JTAG chain has been examined & validated. During
144 * this stage the target is examined and any additional setup is
147 * invoked every time after the jtag chain has been validated/examined
149 int (*examine
)(struct target_s
*target
);
150 /* Set up structures for target.
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
155 int (*init_target
)(struct command_context_s
*cmd_ctx
, struct target_s
*target
);
158 int (*virt2phys
)(struct target_s
*target
, u32 address
, u32
*physical
);
159 int (*mmu
)(struct target_s
*target
, int *enabled
);
163 #endif // TARGET_TYPE_H