20 #ifndef OPENOCD_TARGET_TARGET_H
21 #define OPENOCD_TARGET_TARGET_H
369 size_t len, uint8_t *data,
void *
priv),
373 size_t len, uint8_t *data,
void *
priv),
390 int handle_breakpoints,
int debug_execution);
513 struct reg **reg_list[],
int *reg_list_size,
523 struct reg **reg_list[],
int *reg_list_size,
546 int num_mem_params,
struct mem_param *mem_params,
549 unsigned int timeout_ms,
void *
arch_info);
557 int num_mem_params,
struct mem_param *mem_params,
558 int num_reg_params,
struct reg_param *reg_params,
568 int num_mem_params,
struct mem_param *mem_params,
569 int num_reg_params,
struct reg_param *reg_params,
578 const uint8_t *
buffer, uint32_t
count,
int block_size,
579 int num_mem_params,
struct mem_param *mem_params,
580 int num_reg_params,
struct reg_param *reg_params,
581 uint32_t buffer_start, uint32_t buffer_size,
582 uint32_t entry_point, uint32_t exit_point,
591 int num_mem_params,
struct mem_param *mem_params,
592 int num_reg_params,
struct reg_param *reg_params,
593 uint32_t buffer_start, uint32_t buffer_size,
594 uint32_t entry_point, uint32_t exit_point,
661 uint8_t erased_value);
785 max_num_samples, uint32_t *num_samples, uint32_t seconds);
787 #define ERROR_TARGET_INVALID (-300)
788 #define ERROR_TARGET_INIT_FAILED (-301)
789 #define ERROR_TARGET_TIMEOUT (-302)
790 #define ERROR_TARGET_NOT_HALTED (-304)
791 #define ERROR_TARGET_FAILURE (-305)
792 #define ERROR_TARGET_UNALIGNED_ACCESS (-306)
793 #define ERROR_TARGET_DATA_ABORT (-307)
794 #define ERROR_TARGET_RESOURCE_NOT_AVAILABLE (-308)
795 #define ERROR_TARGET_TRANSLATION_FAULT (-309)
796 #define ERROR_TARGET_NOT_RUNNING (-310)
797 #define ERROR_TARGET_NOT_EXAMINED (-311)
798 #define ERROR_TARGET_DUPLICATE_BREAKPOINT (-312)
799 #define ERROR_TARGET_ALGO_EXIT (-313)
800 #define ERROR_TARGET_SIZE_NOT_SUPPORTED (-314)
801 #define ERROR_TARGET_PACKING_NOT_SUPPORTED (-315)
802 #define ERROR_TARGET_HALTED_DO_RESUME (-316)
806 #define TARGET_DEFAULT_POLLING_INTERVAL 100
static struct esp_usb_jtag * priv
size_t size
Size of the control block search area.
When run_command is called, a new instance will be created on the stack, filled with the proper value...
struct target_event_action * next
int(* callback)(struct target *target, enum target_event event, void *priv)
struct target_event_callback * next
int(* callback)(struct target *target, enum target_reset_mode reset_mode, void *priv)
int(* callback)(void *priv)
struct target_timer_callback * next
enum target_timer_type type
int(* callback)(struct target *target, size_t len, uint8_t *data, void *priv)
This holds methods shared between all instances of a given target type.
struct semihosting * semihosting
target_addr_t working_area
target_addr_t working_area_virt
struct gdb_service * gdb_service
uint32_t working_area_size
struct trace * trace_info
enum target_debug_reason debug_reason
enum target_endianness endianness
struct reg_cache * reg_cache
struct list_head * smp_targets
struct target_event_action * event_action
struct breakpoint * breakpoints
struct working_area * working_areas
struct gdb_fileio_info * fileio_info
struct debug_msg_receiver * dbgmsg
struct target_type * type
struct backoff_timer backoff
target_addr_t working_area_phys
struct watchpoint * watchpoints
bool working_area_phys_spec
bool running_alg
true if the target is currently running a downloaded "algorithm" instead of arbitrary user code.
bool working_area_virt_spec
bool smp_halt_event_postponed
bool examined
Indicates whether this target has been examined.
bool defer_examine
Should we defer examine to later.
struct working_area * next
struct working_area ** user
void target_buffer_get_u16_array(struct target *target, const uint8_t *buffer, uint32_t count, uint16_t *dstbuf)
void target_buffer_set_u24(struct target *target, uint8_t *buffer, uint32_t value)
int target_get_gdb_fileio_info(struct target *target, struct gdb_fileio_info *fileio_info)
Obtain file-I/O information from target for GDB to do syscall.
int target_add_watchpoint(struct target *target, struct watchpoint *watchpoint)
Add the watchpoint for target.
struct target * all_targets
int target_run_read_async_algorithm(struct target *target, uint8_t *buffer, uint32_t count, int block_size, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, uint32_t buffer_start, uint32_t buffer_size, uint32_t entry_point, uint32_t exit_point, void *arch_info)
This routine is a wrapper for asynchronous algorithms.
int target_write_phys_u32(struct target *target, target_addr_t address, uint32_t value)
uint64_t target_buffer_get_u64(struct target *target, const uint8_t *buffer)
int target_call_event_callbacks(struct target *target, enum target_event event)
struct target * get_target(const char *id)
void target_free_all_working_areas(struct target *target)
int target_unregister_reset_callback(int(*callback)(struct target *target, enum target_reset_mode reset_mode, void *priv), void *priv)
int target_write_phys_u64(struct target *target, target_addr_t address, uint64_t value)
int target_unregister_event_callback(int(*callback)(struct target *target, enum target_event event, void *priv), void *priv)
int target_hit_watchpoint(struct target *target, struct watchpoint **watchpoint)
Find out the just hit watchpoint for target.
int target_read_phys_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
int target_register_event_callback(int(*callback)(struct target *target, enum target_event event, void *priv), void *priv)
int target_write_phys_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
int target_halt(struct target *target)
int target_get_gdb_reg_list_noread(struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)
Obtain the registers for GDB, but don't read register values from the target.
static bool target_was_examined(const struct target *target)
bool target_supports_gdb_connection(const struct target *target)
Check if target allows GDB connections.
int target_arch_state(struct target *target)
void target_buffer_set_u16(struct target *target, uint8_t *buffer, uint16_t value)
int target_call_timer_callbacks_now(void)
Invoke this to ensure that e.g.
int target_remove_breakpoint(struct target *target, struct breakpoint *breakpoint)
Remove the breakpoint for target.
void target_buffer_set_u32(struct target *target, uint8_t *buffer, uint32_t value)
int target_register_commands(struct command_context *cmd_ctx)
int target_checksum_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t *crc)
int target_write_buffer(struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer)
int target_add_hybrid_breakpoint(struct target *target, struct breakpoint *breakpoint)
Add the ContextID & IVA breakpoint for target.
int target_write_u8(struct target *target, target_addr_t address, uint8_t value)
int target_add_breakpoint(struct target *target, struct breakpoint *breakpoint)
Add the breakpoint for target.
target_addr_t target_address_max(struct target *target)
Return the highest accessible address for this target.
int target_write_u16(struct target *target, target_addr_t address, uint16_t value)
int target_unregister_timer_callback(int(*callback)(void *priv), void *priv)
int target_gdb_fileio_end(struct target *target, int retcode, int fileio_errno, bool ctrl_c)
Pass GDB file-I/O response to target after finishing host syscall.
int target_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
int target_unregister_trace_callback(int(*callback)(struct target *target, size_t len, uint8_t *data, void *priv), void *priv)
int target_read_u8(struct target *target, target_addr_t address, uint8_t *value)
int target_blank_check_memory(struct target *target, struct target_memory_check_block *blocks, int num_blocks, uint8_t erased_value)
int target_run_algorithm(struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_param, target_addr_t entry_point, target_addr_t exit_point, unsigned int timeout_ms, void *arch_info)
Run an algorithm on the target given.
@ TARGET_TIMER_TYPE_PERIODIC
@ TARGET_TIMER_TYPE_ONESHOT
@ TARGET_EVENT_DEBUG_RESUMED
@ TARGET_EVENT_EXAMINE_START
@ TARGET_EVENT_RESET_START
@ TARGET_EVENT_SEMIHOSTING_USER_CMD_0X106
@ TARGET_EVENT_GDB_FLASH_WRITE_END
@ TARGET_EVENT_RESET_ASSERT_POST
@ TARGET_EVENT_RESET_DEASSERT_POST
@ TARGET_EVENT_SEMIHOSTING_USER_CMD_0X102
@ TARGET_EVENT_SEMIHOSTING_USER_CMD_0X107
@ TARGET_EVENT_SEMIHOSTING_USER_CMD_0X105
@ TARGET_EVENT_EXAMINE_FAIL
@ TARGET_EVENT_EXAMINE_END
@ TARGET_EVENT_SEMIHOSTING_USER_CMD_0X104
@ TARGET_EVENT_RESET_INIT
@ TARGET_EVENT_RESET_DEASSERT_PRE
@ TARGET_EVENT_GDB_FLASH_ERASE_START
@ TARGET_EVENT_SEMIHOSTING_USER_CMD_0X103
@ TARGET_EVENT_DEBUG_HALTED
@ TARGET_EVENT_RESET_ASSERT_PRE
@ TARGET_EVENT_RESET_ASSERT
@ TARGET_EVENT_GDB_FLASH_WRITE_START
@ TARGET_EVENT_RESUME_START
@ TARGET_EVENT_STEP_START
@ TARGET_EVENT_GDB_ATTACH
@ TARGET_EVENT_SEMIHOSTING_USER_CMD_0X100
@ TARGET_EVENT_SEMIHOSTING_USER_CMD_0X101
@ TARGET_EVENT_RESUME_END
@ TARGET_EVENT_GDB_FLASH_ERASE_END
@ TARGET_EVENT_GDB_DETACH
@ TARGET_EVENT_TRACE_CONFIG
static const char * target_name(const struct target *target)
Returns the instance-specific name of the specified target.
unsigned int target_address_bits(struct target *target)
Return the number of address bits this target supports.
int target_profiling_default(struct target *target, uint32_t *samples, uint32_t max_num_samples, uint32_t *num_samples, uint32_t seconds)
int target_write_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
Write count items of size bytes to the memory of target at the address given.
int target_get_gdb_reg_list(struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)
Obtain the registers for GDB.
int target_call_timer_callbacks(void)
int target_write_u64(struct target *target, target_addr_t address, uint64_t value)
struct target * get_current_target_or_null(struct command_context *cmd_ctx)
const char * target_debug_reason_str(enum target_debug_reason reason)
int target_call_reset_callbacks(struct target *target, enum target_reset_mode reset_mode)
uint32_t target_get_working_area_avail(struct target *target)
int target_alloc_working_area(struct target *target, uint32_t size, struct working_area **area)
bool get_target_reset_nag(void)
int target_step(struct target *target, int current, target_addr_t address, int handle_breakpoints)
Step the target.
unsigned int target_data_bits(struct target *target)
Return the number of data bits this target supports.
int target_remove_watchpoint(struct target *target, struct watchpoint *watchpoint)
Remove the watchpoint for target.
const char * target_event_name(enum target_event event)
Return the name of a target event enumeration value.
int target_write_u32(struct target *target, target_addr_t address, uint32_t value)
int target_examine_one(struct target *target)
Examine the specified target, letting it perform any Initialisation that requires JTAG access.
int target_poll(struct target *target)
int target_free_working_area(struct target *target, struct working_area *area)
Free a working area.
int target_alloc_working_area_try(struct target *target, uint32_t size, struct working_area **area)
int target_register_timer_callback(int(*callback)(void *priv), unsigned int time_ms, enum target_timer_type type, void *priv)
The period is very approximate, the callback can happen much more often or much more rarely than spec...
static void target_set_examined(struct target *target)
Sets the examined flag for the given target.
int target_read_u16(struct target *target, target_addr_t address, uint16_t *value)
int target_run_flash_async_algorithm(struct target *target, const uint8_t *buffer, uint32_t count, int block_size, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, uint32_t buffer_start, uint32_t buffer_size, uint32_t entry_point, uint32_t exit_point, void *arch_info)
This routine is a wrapper for asynchronous algorithms.
void target_buffer_set_u64(struct target *target, uint8_t *buffer, uint64_t value)
void target_buffer_set_u64_array(struct target *target, uint8_t *buffer, uint32_t count, const uint64_t *srcbuf)
int target_add_context_breakpoint(struct target *target, struct breakpoint *breakpoint)
Add the ContextID breakpoint for target.
int target_read_u32(struct target *target, target_addr_t address, uint32_t *value)
uint16_t target_buffer_get_u16(struct target *target, const uint8_t *buffer)
int target_read_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
Read count items of size bytes from the memory of target at the address given.
bool target_has_event_action(const struct target *target, enum target_event event)
Returns true only if the target has a handler for the specified event.
void target_buffer_get_u64_array(struct target *target, const uint8_t *buffer, uint32_t count, uint64_t *dstbuf)
const char * debug_reason_name(const struct target *t)
void target_buffer_set_u16_array(struct target *target, uint8_t *buffer, uint32_t count, const uint16_t *srcbuf)
int target_register_reset_callback(int(*callback)(struct target *target, enum target_reset_mode reset_mode, void *priv), void *priv)
uint32_t target_buffer_get_u24(struct target *target, const uint8_t *buffer)
void target_buffer_get_u32_array(struct target *target, const uint8_t *buffer, uint32_t count, uint32_t *dstbuf)
int64_t target_timer_next_event(void)
Returns when the next registered event will take place.
void target_handle_md_output(struct command_invocation *cmd, struct target *target, target_addr_t address, unsigned int size, unsigned int count, const uint8_t *buffer)
int target_write_phys_u16(struct target *target, target_addr_t address, uint16_t value)
void target_handle_event(struct target *t, enum target_event e)
const char * target_get_gdb_arch(const struct target *target)
Obtain the architecture for GDB.
int target_wait_algorithm(struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, target_addr_t exit_point, unsigned int timeout_ms, void *arch_info)
Wait for an algorithm on the target given.
int target_wait_state(struct target *target, enum target_state state, unsigned int ms)
const char * target_state_name(const struct target *target)
Return the name of this targets current state.
int target_register_trace_callback(int(*callback)(struct target *target, size_t len, uint8_t *data, void *priv), void *priv)
struct target * get_current_target(struct command_context *cmd_ctx)
void target_buffer_set_u32_array(struct target *target, uint8_t *buffer, uint32_t count, const uint32_t *srcbuf)
uint32_t target_buffer_get_u32(struct target *target, const uint8_t *buffer)
const char * target_type_name(const struct target *target)
Get the target type name.
int target_call_trace_callbacks(struct target *target, size_t len, uint8_t *data)
int target_start_algorithm(struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, target_addr_t entry_point, target_addr_t exit_point, void *arch_info)
Starts an algorithm in the background on the target given.
void target_quit(void)
Free all the resources allocated by targets and the target layer.
int target_write_phys_u8(struct target *target, target_addr_t address, uint8_t value)
int target_read_u64(struct target *target, target_addr_t address, uint64_t *value)
const char * target_reset_mode_name(enum target_reset_mode reset_mode)
Return the name of a target reset reason enumeration value.
int target_resume(struct target *target, int current, target_addr_t address, int handle_breakpoints, int debug_execution)
Make the target (re)start executing using its saved execution context (possibly with some modificatio...