target: groundwork for "reset-assert" event
This defines a "reset-assert" event and a supporting utility routine, and documents both how targets should implement it and how config scripts should use it. Core-specific updates are needed to make this work. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
This commit is contained in:
@@ -147,6 +147,7 @@ static const Jim_Nvp nvp_target_event[] = {
|
||||
{ .value = TARGET_EVENT_RESET_START, .name = "reset-start" },
|
||||
|
||||
{ .value = TARGET_EVENT_RESET_ASSERT_PRE, .name = "reset-assert-pre" },
|
||||
{ .value = TARGET_EVENT_RESET_ASSERT, .name = "reset-assert" },
|
||||
{ .value = TARGET_EVENT_RESET_ASSERT_POST, .name = "reset-assert-post" },
|
||||
{ .value = TARGET_EVENT_RESET_DEASSERT_PRE, .name = "reset-deassert-pre" },
|
||||
{ .value = TARGET_EVENT_RESET_DEASSERT_POST, .name = "reset-deassert-post" },
|
||||
@@ -154,8 +155,8 @@ static const Jim_Nvp nvp_target_event[] = {
|
||||
{ .value = TARGET_EVENT_RESET_HALT_POST, .name = "reset-halt-post" },
|
||||
{ .value = TARGET_EVENT_RESET_WAIT_PRE, .name = "reset-wait-pre" },
|
||||
{ .value = TARGET_EVENT_RESET_WAIT_POST, .name = "reset-wait-post" },
|
||||
{ .value = TARGET_EVENT_RESET_INIT , .name = "reset-init" },
|
||||
{ .value = TARGET_EVENT_RESET_END, .name = "reset-end" },
|
||||
{ .value = TARGET_EVENT_RESET_INIT, .name = "reset-init" },
|
||||
{ .value = TARGET_EVENT_RESET_END, .name = "reset-end" },
|
||||
|
||||
{ .value = TARGET_EVENT_EXAMINE_START, .name = "examine-start" },
|
||||
{ .value = TARGET_EVENT_EXAMINE_END, .name = "examine-end" },
|
||||
@@ -3523,6 +3524,20 @@ void target_handle_event(struct target *target, enum target_event e)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true only if the target has a handler for the specified event.
|
||||
*/
|
||||
bool target_has_event_action(struct target *target, enum target_event event)
|
||||
{
|
||||
struct target_event_action *teap;
|
||||
|
||||
for (teap = target->event_action; teap != NULL; teap = teap->next) {
|
||||
if (teap->event == event)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
enum target_cfg_param {
|
||||
TCFG_TYPE,
|
||||
TCFG_EVENT,
|
||||
|
||||
@@ -196,6 +196,7 @@ enum target_event
|
||||
|
||||
TARGET_EVENT_RESET_START,
|
||||
TARGET_EVENT_RESET_ASSERT_PRE,
|
||||
TARGET_EVENT_RESET_ASSERT, /* C code uses this instead of SRST */
|
||||
TARGET_EVENT_RESET_ASSERT_POST,
|
||||
TARGET_EVENT_RESET_DEASSERT_PRE,
|
||||
TARGET_EVENT_RESET_DEASSERT_POST,
|
||||
@@ -226,7 +227,9 @@ struct target_event_action {
|
||||
struct Jim_Obj *body;
|
||||
int has_percent;
|
||||
struct target_event_action *next;
|
||||
};
|
||||
};
|
||||
|
||||
bool target_has_event_action(struct target *target, enum target_event event);
|
||||
|
||||
struct target_event_callback
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user