X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Ftarget%2Ftarget.h;h=9382720b9693ef880fc04d9f1c415eb3e40a237b;hp=21b94eea8a583fd5f84d8c8159a60542ab180bf8;hb=a09a75653dbe7ad99da6349285ab6622b80fdc15;hpb=4516eebabac0df24f00f40ff97ff570fdd39b2db diff --git a/src/target/target.h b/src/target/target.h index 21b94eea8a..9382720b96 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; @@ -129,7 +131,6 @@ struct target { int target_number; /* DO NOT USE! field to be removed in 2010 */ struct jtag_tap *tap; /* where on the jtag chain is this */ int32_t coreid; /* which device on the TAP? */ - char *variant; /* what variant of this chip is it? */ /** * Indicates whether this target has been examined. @@ -265,6 +266,8 @@ enum target_event { TARGET_EVENT_GDB_FLASH_ERASE_END, TARGET_EVENT_GDB_FLASH_WRITE_START, TARGET_EVENT_GDB_FLASH_WRITE_END, + + TARGET_EVENT_TRACE_CONFIG, }; struct target_event_action { @@ -283,10 +286,17 @@ 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; int periodic; + bool removed; struct timeval when; void *priv; struct target_timer_callback *next; @@ -304,6 +314,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 @@ -321,6 +340,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 @@ -328,7 +348,7 @@ int target_call_event_callbacks(struct target *target, enum target_event event); */ int target_register_timer_callback(int (*callback)(void *priv), int time_ms, int periodic, void *priv); - +int target_unregister_timer_callback(int (*callback)(void *priv), void *priv); int target_call_timer_callbacks(void); /** * Invoke this to ensure that e.g. polling timer callbacks happen before @@ -474,7 +494,7 @@ int target_wait_algorithm(struct target *target, * */ int target_run_flash_async_algorithm(struct target *target, - uint8_t *buffer, uint32_t count, int block_size, + 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, @@ -566,6 +586,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 @@ -591,6 +617,11 @@ int target_free_working_area(struct target *target, struct working_area *area); void target_free_all_working_areas(struct target *target); uint32_t target_get_working_area_avail(struct target *target); +/** + * Free all the resources allocated by targets and the target layer + */ +void target_quit(void); + extern struct target *all_targets; uint64_t target_buffer_get_u64(struct target *target, const uint8_t *buffer);