X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Ftarget%2Ftarget.h;h=4faf3119f6a02efb9fb864eabbb8e8e7674743d6;hb=0df5577282163e176e5092db0a85c205789c0242;hp=d46571e7b7f96193991766166a11e469fc461cb2;hpb=1d0cf0df37a4e831ca3121ba8987d5848cad3e42;p=fw%2Fopenocd diff --git a/src/target/target.h b/src/target/target.h index d46571e7b..4faf3119f 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -266,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 { @@ -290,10 +292,17 @@ struct target_reset_callback { int (*callback)(struct target *target, enum target_reset_mode reset_mode, void *priv); }; +struct target_trace_callback { + struct list_head list; + void *priv; + int (*callback)(struct target *target, size_t len, uint8_t *data, 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; @@ -320,6 +329,15 @@ int target_unregister_reset_callback( enum target_reset_mode reset_mode, void *priv), void *priv); +int target_register_trace_callback( + int (*callback)(struct target *target, + size_t len, uint8_t *data, void *priv), + void *priv); +int target_unregister_trace_callback( + int (*callback)(struct target *target, + size_t len, uint8_t *data, 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 @@ -338,6 +356,7 @@ int target_resume(struct target *target, int current, uint32_t address, 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); +int target_call_trace_callbacks(struct target *target, size_t len, uint8_t *data); /** * The period is very approximate, the callback can happen much more often @@ -353,6 +372,7 @@ int target_call_timer_callbacks(void); */ int target_call_timer_callbacks_now(void); +struct target *get_target_by_num(int num); struct target *get_current_target(struct command_context *cmd_ctx); struct target *get_target(const char *id); @@ -614,6 +634,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);