Removed obsolete structure members from part (idr, bsr and prev_bsr).

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@123 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Marcel Telka 23 years ago
parent dc856be038
commit c01ba4b1a2

@ -42,14 +42,11 @@ struct part {
data_register *data_registers;
int boundary_length;
bsbit **bsbits;
tap_register *idr;
tap_register *bsr;
tap_register *prev_bsr;
};
part *part_alloc( void );
void part_free( part *p );
part *read_part( FILE *f, const tap_register *idr );
part *read_part( FILE *f, tap_register *idr );
instruction *part_find_instruction( part *p, const char *iname );
data_register *part_find_data_register( part *p, const char *drname );
void part_set_signal( part *p, const char *pname, int out, int val );

@ -39,7 +39,7 @@ get_token( char *buf )
}
part *
read_part( FILE *f, const tap_register *idr )
read_part( FILE *f, tap_register *idr )
{
int line = 0;
part *part;
@ -53,8 +53,6 @@ read_part( FILE *f, const tap_register *idr )
return NULL;
}
part->idr = register_duplicate( idr );
for (;;) {
char *t;
char buf[1024];
@ -122,6 +120,7 @@ read_part( FILE *f, const tap_register *idr )
dr->next = part->data_registers;
part->data_registers = dr;
/* Boundary Scan Register */
if (strcmp( dr->name, "BSR" ) == 0) {
int i;
@ -135,6 +134,10 @@ read_part( FILE *f, const tap_register *idr )
part->bsbits[i] = NULL;
}
/* Device Identification Register */
if (strcmp( dr->name, "DIR" ) == 0)
register_init( dr->value, register_get_string( idr ) );
continue;
}

@ -44,9 +44,6 @@ part_alloc( void )
p->data_registers = NULL;
p->boundary_length = 0;
p->bsbits = NULL;
p->idr = NULL;
p->bsr = NULL;
p->prev_bsr = NULL;
return p;
}
@ -73,6 +70,7 @@ part_free( part *p )
instruction_free( i );
}
/* data registers */
while (p->data_registers) {
data_register *dr = p->data_registers;
p->data_registers = dr->next;
@ -84,13 +82,6 @@ part_free( part *p )
bsbit_free( p->bsbits[i] );
free( p->bsbits );
/* idr */
register_free( p->idr );
/* bsr */
register_free( p->bsr );
register_free( p->prev_bsr );
free( p );
}
@ -133,8 +124,17 @@ part_find_data_register( part *p, const char *drname )
void
part_set_signal( part *p, const char *pname, int out, int val )
{
signal *s;
/* search for Boundary Scan Register */
data_register *bsr = part_find_data_register( p, "BSR" );
if (!bsr) {
printf( "%s(%s:%d) Boundary Scan Register (BSR) not found\n", __FUNCTION__, __FILE__, __LINE__ );
return;
}
/* search signal */
signal *s = p->signals;
s = p->signals;
while (s) {
if (strcmp( pname, s->name ) == 0)
break;
@ -153,26 +153,35 @@ part_set_signal( part *p, const char *pname, int out, int val )
printf( "signal %s cannot be set as output\n", pname );
return;
}
p->bsr->data[s->output->bit] = val & 1;
bsr->value->data[s->output->bit] = val & 1;
control = p->bsbits[s->output->bit]->control;
if (control >= 0)
p->bsr->data[control] = p->bsbits[s->output->bit]->control_value ^ 1;
bsr->value->data[control] = p->bsbits[s->output->bit]->control_value ^ 1;
} else {
if (!s->input) {
printf( "signal %s cannot be set as input\n", pname );
return;
}
if (s->output)
p->bsr->data[s->output->control] = p->bsbits[s->output->control]->control_value;
bsr->value->data[s->output->control] = p->bsbits[s->output->control]->control_value;
}
}
int
part_get_signal( part *p, const char *pname )
{
signal *s;
/* search for Boundary Scan Register */
data_register *bsr = part_find_data_register( p, "BSR" );
if (!bsr) {
printf( "%s(%s:%d) Boundary Scan Register (BSR) not found\n", __FUNCTION__, __FILE__, __LINE__ );
return -1;
}
/* search signal */
signal *s = p->signals;
s = p->signals;
while (s) {
if (strcmp( pname, s->name ) == 0)
break;
@ -189,7 +198,7 @@ part_get_signal( part *p, const char *pname )
return -1;
}
return p->prev_bsr->data[s->input->bit];
return bsr->value->data[s->input->bit];
}
/* parts */

Loading…
Cancel
Save