From 07bd219715c0b5d913ae712fd262b2c3050cafbd Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Tue, 27 Aug 2002 17:52:02 +0000 Subject: [PATCH] Added part_shift_instruction() and part_shift_data_register(). Renamed data_register members (value -> in, oldval -> out). git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@125 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- include/jtag/data_register.h | 4 ++-- include/jtag/part.h | 2 ++ jtag/src/part/data_register.c | 14 +++++++------- jtag/src/part/parse.c | 6 +++--- jtag/src/part/part.c | 26 ++++++++++++++++++++++---- 5 files changed, 36 insertions(+), 16 deletions(-) diff --git a/include/jtag/data_register.h b/include/jtag/data_register.h index 5d9cb4d1..61fcf2c2 100644 --- a/include/jtag/data_register.h +++ b/include/jtag/data_register.h @@ -31,8 +31,8 @@ typedef struct data_register data_register; struct data_register { char *name; /* (public) register name */ - tap_register *value; /* (public) register value */ - tap_register *oldval; /* (private) temporary (old) register value */ + tap_register *in; /* (public) register value clocked in */ + tap_register *out; /* (public) register value clocked out */ data_register *next; }; diff --git a/include/jtag/part.h b/include/jtag/part.h index daac564e..8eb6092c 100644 --- a/include/jtag/part.h +++ b/include/jtag/part.h @@ -49,6 +49,8 @@ void part_free( part *p ); 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_shift_instruction( part *p, int exit ); +void part_shift_data_register( part *p, int exit ); void part_set_signal( part *p, const char *pname, int out, int val ); int part_get_signal( part *p, const char *pname ); diff --git a/jtag/src/part/data_register.c b/jtag/src/part/data_register.c index f7eb6a89..6824a3cb 100644 --- a/jtag/src/part/data_register.c +++ b/jtag/src/part/data_register.c @@ -45,11 +45,11 @@ data_register_alloc( const char *name, int len ) return NULL; } - dr->value = register_alloc( len ); - dr->oldval = register_alloc( len ); - if (!dr->value || !dr->oldval) { - free( dr->value ); - free( dr->oldval ); + dr->in = register_alloc( len ); + dr->out = register_alloc( len ); + if (!dr->in || !dr->out) { + free( dr->in ); + free( dr->out ); free( dr->name ); free( dr ); return NULL; @@ -67,7 +67,7 @@ data_register_free( data_register *dr ) return; free( dr->name ); - register_free( dr->value ); - register_free( dr->oldval ); + register_free( dr->in ); + register_free( dr->out ); free( dr ); } diff --git a/jtag/src/part/parse.c b/jtag/src/part/parse.c index 542d9d95..8459c2be 100644 --- a/jtag/src/part/parse.c +++ b/jtag/src/part/parse.c @@ -136,7 +136,7 @@ read_part( FILE *f, tap_register *idr ) /* Device Identification Register */ if (strcmp( dr->name, "DIR" ) == 0) - register_init( dr->value, register_get_string( idr ) ); + register_init( dr->out, register_get_string( idr ) ); continue; } @@ -220,7 +220,7 @@ read_part( FILE *f, tap_register *idr ) /* get bit number */ t = get_token( NULL ); bit = strtol( t, &t, 10 ); - if ((t && *t) || (bit < 0) || (bit >= bsr->value->len)) { + if ((t && *t) || (bit < 0) || (bit >= bsr->in->len)) { printf( "(%d) invalid boundary bit number\n", line ); continue; } @@ -260,7 +260,7 @@ read_part( FILE *f, tap_register *idr ) continue; } safe = (*t == '1') ? 1 : 0; - bsr->value->data[bit] = safe; + bsr->in->data[bit] = safe; /* get bit name */ t = get_token( NULL ); diff --git a/jtag/src/part/part.c b/jtag/src/part/part.c index f25465a4..c41a0f00 100644 --- a/jtag/src/part/part.c +++ b/jtag/src/part/part.c @@ -121,6 +121,24 @@ part_find_data_register( part *p, const char *drname ) return dr; } +void +part_shift_instruction( part *p, int exit ) +{ + if (!p || !p->active_instruction) + return; + + tap_shift_register( p->active_instruction->value, NULL, exit ); +} + +void +part_shift_data_register( part *p, int exit ) +{ + if (!p || !p->active_instruction || !p->active_instruction->data_register) + return; + + tap_shift_register( p->active_instruction->data_register->in, p->active_instruction->data_register->out, exit ); +} + void part_set_signal( part *p, const char *pname, int out, int val ) { @@ -153,18 +171,18 @@ part_set_signal( part *p, const char *pname, int out, int val ) printf( "signal %s cannot be set as output\n", pname ); return; } - bsr->value->data[s->output->bit] = val & 1; + bsr->in->data[s->output->bit] = val & 1; control = p->bsbits[s->output->bit]->control; if (control >= 0) - bsr->value->data[control] = p->bsbits[s->output->bit]->control_value ^ 1; + bsr->in->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) - bsr->value->data[s->output->control] = p->bsbits[s->output->control]->control_value; + bsr->in->data[s->output->control] = p->bsbits[s->output->control]->control_value; } } @@ -198,7 +216,7 @@ part_get_signal( part *p, const char *pname ) return -1; } - return bsr->value->data[s->input->bit]; + return bsr->out->data[s->input->bit]; } /* parts */