David Brownell <david-b@pacbell.net>:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 16 Jun 2009 00:23:00 +0000 (00:23 +0000)
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 16 Jun 2009 00:23:00 +0000 (00:23 +0000)
Doc update:  say "jtag newtap ... -disable" records the
state after exiting the RESET state, matching the only
implementation we're working with so far (TI ICEpick-C).

Matching code updates.  Now we can be sure that the
"enabled" flag value is correct after JTAG resets.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2246 b42882b7-edfa-0310-969c-e2dbd0fdcd60

doc/openocd.texi
src/jtag/core.c
src/jtag/jtag.h
src/jtag/tcl.c

index 304fc62acf425514632881b98dc4263167c93fa3..7f73a4c33ff34f424be38c13a724c7128aecbb48 100644 (file)
@@ -2314,8 +2314,9 @@ A TAP may also provide optional @var{configparams}:
 
 @itemize @bullet
 @item @code{-disable} (or @code{-enable})
-@*Use the @code{-disable} paramater to flag a TAP which is not
-linked in to the scan chain when it is declared.
+@*Use the @code{-disable} parameter to flag a TAP which is not
+linked in to the scan chain after a reset using either TRST
+or the JTAG state machine's @sc{reset} state.
 You may use @code{-enable} to highlight the default state
 (the TAP is linked in).
 @xref{Enabling and Disabling TAPs}.
@@ -5079,7 +5080,7 @@ and @command{irscan} commands are:
 @end itemize
 
 Note that only six of those states are fully ``stable'' in the
-face of TMS fixed (usually low)
+face of TMS fixed (low except for @sc{reset})
 and a free-running JTAG clock.  For all the
 others, the next TCK transition changes to a new state.
 
index 347196c0da9be47e747ec836f3a7476f09d4f830..0cec11ad35134abc429c282b70aff583c42066de 100644 (file)
@@ -792,6 +792,8 @@ static int jtag_reset_callback(enum jtag_event event, void *priv)
 
        if (event == JTAG_TRST_ASSERTED)
        {
+               tap->enabled = !tap->disabled_after_reset;
+
                buf_set_ones(tap->cur_instr, tap->ir_length);
                tap->bypass = 1;
        }
index 34a099b8ec593535304381bba24f1b3756eea098..956343eea4a6099c85fa2180532f3dcee344b2a2 100644 (file)
@@ -151,8 +151,10 @@ struct jtag_tap_s
        const char* tapname;
        const char* dotted_name;
        int abs_chain_position;
-       /// Is this TAP enabled?
-       int enabled;
+       /// Is this TAP disabled after JTAG reset?
+       bool disabled_after_reset;
+       /// Is this TAP currently enabled?
+       bool enabled;
        int ir_length; /**< size of instruction register */
        u32 ir_capture_value;
        u8* expected; /**< Capture-IR expected value */
index fc113a398cb63cadfed93419de2ec47db484105c..8a7e38c3f91bb9ffa24b212aa69a94efb29784af 100644 (file)
@@ -359,9 +359,6 @@ static int jim_newtap_cmd( Jim_GetOptInfo *goi )
        LOG_DEBUG("Creating New Tap, Chip: %s, Tap: %s, Dotted: %s, %d params",
                          pTap->chip, pTap->tapname, pTap->dotted_name, goi->argc);
 
-       /* default is enabled */
-       pTap->enabled = 1;
-
        /* deal with options */
 #define NTREQ_IRLEN      1
 #define NTREQ_IRCAPTURE  2
@@ -379,10 +376,10 @@ static int jim_newtap_cmd( Jim_GetOptInfo *goi )
                LOG_DEBUG("Processing option: %s", n->name );
                switch( n->value ){
                case NTAP_OPT_ENABLED:
-                       pTap->enabled = 1;
+                       pTap->disabled_after_reset = false;
                        break;
                case NTAP_OPT_DISABLED:
-                       pTap->enabled = 0;
+                       pTap->disabled_after_reset = true;
                        break;
                case NTAP_OPT_EXPECTED_ID:
                {
@@ -446,6 +443,9 @@ static int jim_newtap_cmd( Jim_GetOptInfo *goi )
                } /* switch(n->value) */
        } /* while( goi->argc ) */
 
+       /* default is enabled-after-reset */
+       pTap->enabled = !pTap->disabled_after_reset;
+
        /* Did all the required option bits get cleared? */
        if (0 == reqbits)
        {