diff options
author | zwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-06-16 12:17:18 +0000 |
---|---|---|
committer | zwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-06-16 12:17:18 +0000 |
commit | a0c10dd29b84e7e9238fa6652c8f7cea3c14fc14 (patch) | |
tree | e5c8b858e909d9b299c364043b5dcf035d8341d7 /src/target | |
parent | 491083a248a24c4b7d246e8f2c73b8ba1542d233 (diff) | |
download | openocd_libswd-a0c10dd29b84e7e9238fa6652c8f7cea3c14fc14.tar.gz openocd_libswd-a0c10dd29b84e7e9238fa6652c8f7cea3c14fc14.tar.bz2 openocd_libswd-a0c10dd29b84e7e9238fa6652c8f7cea3c14fc14.tar.xz openocd_libswd-a0c10dd29b84e7e9238fa6652c8f7cea3c14fc14.zip |
David Brownell <david-b@pacbell.net>:
Extend the internal JTAG event handlers to cover enable/disable,
and use those events to make sure that targets get "examined" if
they were disabled when the scan chain was first set up:
- Remove "enum jtag_tap_event", merge with "enum jtag_event",
so C code can now listen for TAP enable/disable events.
- Report those events so they can trigger callbacks.
- During startup, make target_examine() register a handler to
catch ENABLE events for any then-disabled targets.
This fixes bugs like "can't halt target after enabling its TAP".
One class of unresolved bugs: if the target has an ETM hooked
up to an ETB, nothing activates the ETB. But starting up the
ETM without access to the ETB registers fails...
git-svn-id: svn://svn.berlios.de/openocd/trunk@2251 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/target')
-rw-r--r-- | src/target/target.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/target/target.c b/src/target/target.c index d0227247..32e46b27 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -478,6 +478,18 @@ int target_examine_one(struct target_s *target) return target->type->examine(target); } +static int jtag_enable_callback(enum jtag_event event, void *priv) +{ + target_t *target = priv; + + if (event != JTAG_TAP_EVENT_ENABLE || !target->tap->enabled) + return ERROR_OK; + + jtag_unregister_event_callback(jtag_enable_callback, target); + return target_examine_one(target); +} + + /* Targets that correctly implement init+examine, i.e. * no communication with target during init: * @@ -490,8 +502,12 @@ int target_examine(void) for (target = all_targets; target; target = target->next) { - if (!target->tap->enabled) + /* defer examination, but don't skip it */ + if (!target->tap->enabled) { + jtag_register_event_callback(jtag_enable_callback, + target); continue; + } if ((retval = target_examine_one(target)) != ERROR_OK) return retval; } |