summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2009-11-27 18:50:20 -0800
committerDavid Brownell <dbrownell@users.sourceforge.net>2009-11-27 18:50:20 -0800
commit4e56a2303b3f68bb647d8bb640a830f7f21ea231 (patch)
tree87df3a19a84c9fa5b591043e2451db68e26550cd /src
parent4d2750e571b6a3f700cd95542a4bb5c7949e476c (diff)
downloadopenocd_libswd-4e56a2303b3f68bb647d8bb640a830f7f21ea231.tar.gz
openocd_libswd-4e56a2303b3f68bb647d8bb640a830f7f21ea231.tar.bz2
openocd_libswd-4e56a2303b3f68bb647d8bb640a830f7f21ea231.tar.xz
openocd_libswd-4e56a2303b3f68bb647d8bb640a830f7f21ea231.zip
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>
Diffstat (limited to 'src')
-rw-r--r--src/target/target.c19
-rw-r--r--src/target/target.h5
2 files changed, 21 insertions, 3 deletions
diff --git a/src/target/target.c b/src/target/target.c
index 3de9f2c6..a2bd8868 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -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,
diff --git a/src/target/target.h b/src/target/target.h
index 15003c65..55e9088a 100644
--- a/src/target/target.h
+++ b/src/target/target.h
@@ -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
{