target/target: call event handlers around examine when polling resumes
The target might be using Tcl examine-start and examine-end handlers, they need to be called when the target gets reexamined after polling succeeds again. Change-Id: I371380c6f3c427ec7a0206d73426f6589f18a9bd Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2536 Tested-by: jenkins Reviewed-by: Stian Skjelstad <stian@nixia.no>
This commit is contained in:
parent
889b246d93
commit
ebe9b7a661
|
@ -685,7 +685,15 @@ static int default_check_reset(struct target *target)
|
||||||
|
|
||||||
int target_examine_one(struct target *target)
|
int target_examine_one(struct target *target)
|
||||||
{
|
{
|
||||||
return target->type->examine(target);
|
target_call_event_callbacks(target, TARGET_EVENT_EXAMINE_START);
|
||||||
|
|
||||||
|
int retval = target->type->examine(target);
|
||||||
|
if (retval != ERROR_OK)
|
||||||
|
return retval;
|
||||||
|
|
||||||
|
target_call_event_callbacks(target, TARGET_EVENT_EXAMINE_END);
|
||||||
|
|
||||||
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int jtag_enable_callback(enum jtag_event event, void *priv)
|
static int jtag_enable_callback(enum jtag_event event, void *priv)
|
||||||
|
@ -697,15 +705,7 @@ static int jtag_enable_callback(enum jtag_event event, void *priv)
|
||||||
|
|
||||||
jtag_unregister_event_callback(jtag_enable_callback, target);
|
jtag_unregister_event_callback(jtag_enable_callback, target);
|
||||||
|
|
||||||
target_call_event_callbacks(target, TARGET_EVENT_EXAMINE_START);
|
return target_examine_one(target);
|
||||||
|
|
||||||
int retval = target_examine_one(target);
|
|
||||||
if (retval != ERROR_OK)
|
|
||||||
return retval;
|
|
||||||
|
|
||||||
target_call_event_callbacks(target, TARGET_EVENT_EXAMINE_END);
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Targets that correctly implement init + examine, i.e.
|
/* Targets that correctly implement init + examine, i.e.
|
||||||
|
@ -726,13 +726,9 @@ int target_examine(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
target_call_event_callbacks(target, TARGET_EVENT_EXAMINE_START);
|
|
||||||
|
|
||||||
retval = target_examine_one(target);
|
retval = target_examine_one(target);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
target_call_event_callbacks(target, TARGET_EVENT_EXAMINE_END);
|
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue