From: dbrownell at B. <dbr...@ma...> - 2009-09-19 08:49:42
|
Author: dbrownell Date: 2009-09-19 08:49:40 +0200 (Sat, 19 Sep 2009) New Revision: 2730 Modified: trunk/src/jtag/core.c trunk/src/target/target.c Log: Minor behavior fixes for the two JTAG reset events (C/internal, and Tcl/external): - Reorder so *both* paths (TCK/TMS or TRST) can enable TAPs with ICEpick ... first C code flags TAPs that got disabled, then call any Tcl code that might want to re-enable them. - Always call the C/internal handlers when JTAG operations can be issued; previously that wasn't done when TRST was used. Plus some small cleanups (whitespace, strings, better messaging during debug and on some errors) to reset-related code. Modified: trunk/src/jtag/core.c =================================================================== --- trunk/src/jtag/core.c 2009-09-19 06:42:50 UTC (rev 2729) +++ trunk/src/jtag/core.c 2009-09-19 06:49:40 UTC (rev 2730) @@ -446,7 +446,7 @@ tap_state_t state) { assert(state != TAP_RESET); - + jtag_prelude(state); int retval; @@ -458,7 +458,7 @@ tap_state_t state) { assert(state != TAP_RESET); - + jtag_prelude(state); int retval; @@ -471,7 +471,6 @@ tap_state_t end_state) { assert(end_state != TAP_RESET); - assert(end_state != TAP_INVALID); cmd_queue_cur_state = end_state; @@ -486,9 +485,9 @@ jtag_prelude(TAP_RESET); jtag_set_error(interface_jtag_add_tlr()); - jtag_notify_reset(); - + /* NOTE: order here matches TRST path in jtag_add_reset() */ jtag_call_event_callbacks(JTAG_TRST_ASSERTED); + jtag_notify_reset(); } void jtag_add_pathmove(int num_states, const tap_state_t *path) @@ -684,21 +683,19 @@ } else if (jtag_trst != new_trst) { jtag_trst = new_trst; if (jtag_trst) { - /* we just asserted nTRST, so we're now in TAP_RESET; - * inform possible listeners about this - * - * REVISIT asserting TRST is less significant than - * being in TAP_RESET ... both entries (TRST, TLR) - * should trigger a callback. - */ LOG_DEBUG("TRST line asserted"); tap_set_state(TAP_RESET); - jtag_call_event_callbacks(JTAG_TRST_ASSERTED); } else { LOG_DEBUG("TRST line released"); if (jtag_ntrst_delay) jtag_add_sleep(jtag_ntrst_delay * 1000); + /* We just asserted nTRST, so we're now in TAP_RESET. + * Inform possible listeners about this, now that + * JTAG instructions and data can be shifted. This + * sequence must match jtag_add_tlr(). + */ + jtag_call_event_callbacks(JTAG_TRST_ASSERTED); jtag_notify_reset(); } } @@ -823,7 +820,8 @@ { jtag_tap_t *tap = priv; - LOG_DEBUG("-"); + LOG_DEBUG("TAP %s event %s", tap->dotted_name, + jtag_event_strings[event]); if (event == JTAG_TRST_ASSERTED) { Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-09-19 06:42:50 UTC (rev 2729) +++ trunk/src/target/target.c 2009-09-19 06:49:40 UTC (rev 2730) @@ -4028,7 +4028,8 @@ break; case TS_CMD_RESET: if (goi.argc != 2) { - Jim_WrongNumArgs(interp, 2, argv, "t | f|assert | deassert BOOL"); + Jim_WrongNumArgs(interp, 2, argv, + "([tT]|[fF]|assert|deassert) BOOL"); return JIM_ERR; } e = Jim_GetOpt_Nvp(&goi, nvp_assert, &n); |