diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/jtag/core.c | 2 | ||||
-rw-r--r-- | src/jtag/jtag.h | 13 | ||||
-rw-r--r-- | src/jtag/tcl.c | 8 | ||||
-rw-r--r-- | src/target/target.c | 18 |
4 files changed, 31 insertions, 10 deletions
diff --git a/src/jtag/core.c b/src/jtag/core.c index 0cec11ad..a8d65f1e 100644 --- a/src/jtag/core.c +++ b/src/jtag/core.c @@ -61,6 +61,8 @@ static int jtag_error = ERROR_OK; static const char *jtag_event_strings[] = { [JTAG_TRST_ASSERTED] = "JTAG controller reset (RESET or TRST)", + [JTAG_TAP_EVENT_ENABLE] = "TAP enabled", + [JTAG_TAP_EVENT_DISABLE] = "TAP disabled", }; static int jtag_trst = 0; diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h index 956343ee..cddceef4 100644 --- a/src/jtag/jtag.h +++ b/src/jtag/jtag.h @@ -201,19 +201,18 @@ extern unsigned jtag_tap_count(void); * - SRST pulls TRST * - TRST asserted * - **/ + * TAP activation/deactivation is currently implemented outside the core + * using scripted code that understands the specific router type. + */ enum jtag_event { - JTAG_TRST_ASSERTED -}; - -enum jtag_tap_event { + JTAG_TRST_ASSERTED, JTAG_TAP_EVENT_ENABLE, - JTAG_TAP_EVENT_DISABLE + JTAG_TAP_EVENT_DISABLE, }; struct jtag_tap_event_action_s { - enum jtag_tap_event event; + enum jtag_event event; Jim_Obj* body; jtag_tap_event_action_t* next; }; diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index aa55809f..ec74a9e1 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -256,7 +256,7 @@ static int jtag_tap_configure_cmd( Jim_GetOptInfo *goi, jtag_tap_t * tap) jteap = tap->event_action; /* replace existing? */ while (jteap) { - if (jteap->event == (enum jtag_tap_event)n->value) { + if (jteap->event == (enum jtag_event)n->value) { break; } jteap = jteap->next; @@ -460,7 +460,7 @@ static int jim_newtap_cmd( Jim_GetOptInfo *goi ) return JIM_ERR; } -static void jtag_tap_handle_event( jtag_tap_t * tap, enum jtag_tap_event e) +static void jtag_tap_handle_event(jtag_tap_t *tap, enum jtag_event e) { jtag_tap_event_action_t * jteap; int done; @@ -594,6 +594,8 @@ static int jim_jtag_command( Jim_Interp *interp, int argc, Jim_Obj *const *argv * - scan chain length grew by one (this) * - IDs and IR lengths are as expected */ + + jtag_call_event_callbacks(JTAG_TAP_EVENT_ENABLE); break; case JTAG_CMD_TAPDISABLE: if (!t->enabled) @@ -606,6 +608,8 @@ static int jim_jtag_command( Jim_Interp *interp, int argc, Jim_Obj *const *argv * - scan chain length shrank by one (this) * - IDs and IR lengths are as expected */ + + jtag_call_event_callbacks(JTAG_TAP_EVENT_DISABLE); break; } e = t->enabled; 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; } |