Report if TDO seems to be stuck during detect_register_size (ie. "detect")

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1018 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Kolja Waschk 17 years ago
parent 5f104d447d
commit 4270565c9f

@ -37,6 +37,7 @@ tap_register *register_duplicate( const tap_register_t *tr );
void register_free( tap_register_t *tr );
tap_register *register_fill( tap_register_t *tr, int val );
const char *register_get_string( const tap_register_t *tr );
int register_all_bits_same_value( const tap_register_t *tr );
tap_register *register_init( tap_register_t *tr, const char *value );
int register_compare( const tap_register_t *tr, const tap_register_t *tr2 );
int register_match( const tap_register_t *tr, const char *expr );

@ -46,6 +46,9 @@ detect_register_size( chain_t *chain )
tap_register *rout;
tap_register *rpat;
/* This seems to be a good place to check if TDO changes at all */
int tdo, tdo_stuck = -2;
for (len = 1; len <= MAX_REGISTER_LENGTH; len++) {
int p;
int ok = 0;
@ -67,6 +70,10 @@ detect_register_size( chain_t *chain )
tap_shift_register( chain, rz, NULL, 0 );
tap_shift_register( chain, rpat, rout, 0 );
tdo = register_all_bits_same_value(rout);
if(tdo_stuck == -2) tdo_stuck = tdo;
if(tdo_stuck != tdo) tdo_stuck = -1;
register_shift_right( rout, len );
if (register_compare( rpat, rout ) == 0)
@ -88,6 +95,11 @@ detect_register_size( chain_t *chain )
return len;
}
if(tdo_stuck >= 0)
{
printf(_("Warning: TDO seems to be stuck at %d\n"), tdo_stuck);
}
return -1;
}

@ -102,6 +102,25 @@ register_get_string( const tap_register *tr )
return tr->string;
}
int
register_all_bits_same_value ( const tap_register *tr )
{
int i, value;
if (!tr) return -1;
if (tr->len < 0) return -1;
/* Return -1 if any of the bits in the register
* differs from the others; the value otherwise. */
value = tr->data[0] & 1;
for(i=1; i<tr->len; i++)
{
if((tr->data[i] & 1) != value) return -1;
}
return value;
}
tap_register *
register_init( tap_register *tr, const char *value )
{

Loading…
Cancel
Save