X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Ftarget%2Ftarget.h;h=b75317b38a21f04e5ffb0a929bef2ae3a575b965;hb=7de7bc80fcca79e72c45040dc0ff3467e4b10dea;hp=e6d6f2947d62754deaf1971019b56817625dbc18;hpb=fe20b12fbdfa4a8128b16852ca704c3b5a13c06c;p=openocd.git diff --git a/src/target/target.h b/src/target/target.h index e6d6f2947d..b75317b38a 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -78,7 +78,8 @@ enum target_debug_reason DBG_REASON_WATCHPOINT = 2, DBG_REASON_WPTANDBKPT = 3, DBG_REASON_SINGLESTEP = 4, - DBG_REASON_NOTHALTED = 5 + DBG_REASON_NOTHALTED = 5, + DBG_REASON_UNDEFINED = 6 }; extern char *target_debug_reason_strings[]; @@ -115,7 +116,7 @@ typedef struct target_type_s /* target request support */ int (*target_request_data)(struct target_s *target, u32 size, u8 *buffer); - /* target execution control */ + /* halt will log a warning, but return ERROR_OK if the target is already halted. */ int (*halt)(struct target_s *target); int (*resume)(struct target_s *target, int current, u32 address, int handle_breakpoints, int debug_execution); int (*step)(struct target_s *target, int current, u32 address, int handle_breakpoints); @@ -126,7 +127,15 @@ typedef struct target_type_s int (*soft_reset_halt)(struct target_s *target); int (*prepare_reset_halt)(struct target_s *target); - /* target register access for gdb */ + /* target register access for gdb. + * + * Danger! this function will succeed even if the target is running + * and return a register list with dummy values. + * + * The reason is that GDB connection will fail without a valid register + * list, however it is after GDB is connected that monitor commands can + * be run to properly initialize the target + */ int (*get_gdb_reg_list)(struct target_s *target, struct reg_s **reg_list[], int *reg_list_size); /* target memory access @@ -230,9 +239,16 @@ extern int target_register_event_callback(int (*callback)(struct target_s *targe extern int target_unregister_event_callback(int (*callback)(struct target_s *target, enum target_event event, void *priv), void *priv); extern int target_call_event_callbacks(target_t *target, enum target_event event); +/* The period is very approximate, the callback can happen much more often + * or much more rarely than specified + */ extern int target_register_timer_callback(int (*callback)(void *priv), int time_ms, int periodic, void *priv); extern int target_unregister_timer_callback(int (*callback)(void *priv), void *priv); -extern int target_call_timer_callbacks(); +extern int target_call_timer_callbacks_now(); +/* invoke this to ensure that e.g. polling timer callbacks happen before + * a syncrhonous command completes. + */ +extern int target_call_timer_callbacks_now_now(); extern target_t* get_current_target(struct command_context_s *cmd_ctx); extern int get_num_by_target(target_t *query_target); @@ -269,7 +285,6 @@ int target_arch_state(struct target_s *target); #define ERROR_TARGET_INVALID (-300) #define ERROR_TARGET_INIT_FAILED (-301) #define ERROR_TARGET_TIMEOUT (-302) -#define ERROR_TARGET_ALREADY_HALTED (-303) #define ERROR_TARGET_NOT_HALTED (-304) #define ERROR_TARGET_FAILURE (-305) #define ERROR_TARGET_UNALIGNED_ACCESS (-306)