X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Ftarget%2Ftarget.h;h=d46571e7b7f96193991766166a11e469fc461cb2;hp=0552b8f9b2c51cb66f68282c9531db5b1177602f;hb=1d0cf0df37a4e831ca3121ba8987d5848cad3e42;hpb=c50047bb418da6a4ed735ca87acee04e7fd2dbe7 diff --git a/src/target/target.h b/src/target/target.h index 0552b8f9b2..d46571e7b7 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -33,6 +33,8 @@ #ifndef TARGET_H #define TARGET_H +#include + struct reg; struct trace; struct command_context; @@ -282,6 +284,12 @@ struct target_event_callback { struct target_event_callback *next; }; +struct target_reset_callback { + struct list_head list; + void *priv; + int (*callback)(struct target *target, enum target_reset_mode reset_mode, void *priv); +}; + struct target_timer_callback { int (*callback)(void *priv); int time_ms; @@ -303,6 +311,15 @@ int target_unregister_event_callback( enum target_event event, void *priv), void *priv); +int target_register_reset_callback( + int (*callback)(struct target *target, + enum target_reset_mode reset_mode, void *priv), + void *priv); +int target_unregister_reset_callback( + int (*callback)(struct target *target, + enum target_reset_mode reset_mode, void *priv), + void *priv); + /* Poll the status of the target, detect any error conditions and report them. * * Also note that this fn will clear such error conditions, so a subsequent @@ -320,6 +337,7 @@ int target_resume(struct target *target, int current, uint32_t address, int handle_breakpoints, int debug_execution); int target_halt(struct target *target); int target_call_event_callbacks(struct target *target, enum target_event event); +int target_call_reset_callbacks(struct target *target, enum target_reset_mode reset_mode); /** * The period is very approximate, the callback can happen much more often @@ -565,6 +583,12 @@ int target_gdb_fileio_end(struct target *target, int retcode, int fileio_errno, /** Return the *name* of this targets current state */ const char *target_state_name(struct target *target); +/** Return the *name* of a target event enumeration value */ +const char *target_event_name(enum target_event event); + +/** Return the *name* of a target reset reason enumeration value */ +const char *target_reset_mode_name(enum target_reset_mode reset_mode); + /* DANGER!!!!! * * if "area" passed in to target_alloc_working_area() points to a memory