From 29ded645bc109e7490e18deb8135b9fbb049a98b Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Tue, 27 Aug 2002 19:58:08 +0000 Subject: [PATCH] Added part_set_instruction(), parts_shift_instructions() and parts_shift_data_regsiters(). git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@126 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- include/jtag/part.h | 3 +++ jtag/src/part/part.c | 52 +++++++++++++++++++++++++++++++++++++------- 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/include/jtag/part.h b/include/jtag/part.h index 8eb6092c..9062e21d 100644 --- a/include/jtag/part.h +++ b/include/jtag/part.h @@ -49,6 +49,7 @@ 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_set_instruction( part *p, const char *iname ); 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 ); @@ -65,5 +66,7 @@ parts *parts_alloc( void ); void parts_free( parts *ps ); int parts_add_part( parts *ps, part *p ); void parts_set_instruction( parts *ps, const char *iname ); +void parts_shift_instructions( parts *ps ); +void parts_shift_data_registers( parts *ps ); #endif /* JTAG_PART_H */ diff --git a/jtag/src/part/part.c b/jtag/src/part/part.c index c41a0f00..be9e4ae2 100644 --- a/jtag/src/part/part.c +++ b/jtag/src/part/part.c @@ -121,6 +121,12 @@ part_find_data_register( part *p, const char *drname ) return dr; } +void part_set_instruction( part *p, const char *iname ) +{ + if (p) + p->active_instruction = part_find_instruction( p, iname ); +} + void part_shift_instruction( part *p, int exit ) { @@ -266,17 +272,47 @@ parts_add_part( parts *ps, part *p ) void parts_set_instruction( parts *ps, const char *iname ) { - int j; + int i; + + for (i = 0; i < ps->len; i++) + ps->parts[i]->active_instruction = part_find_instruction( ps->parts[i], iname ); +} + +void +parts_shift_instructions( parts *ps ) +{ + int i; + + if (!ps) + return; tap_capture_ir(); - for (j = 0; j < ps->len; j++) { - instruction *i = part_find_instruction( ps->parts[j], iname ); - if (!i) { - printf( "Instruction '%s' not found\n", iname ); - return; + for (i = 0; i < ps->len; i++) { + if (!ps->parts[i]->active_instruction) { + printf( "%s(%s:%d) Part without active instruction\n", __FUNCTION__, __FILE__, __LINE__ ); + continue; + } + tap_shift_register( ps->parts[i]->active_instruction->value, NULL, (i + 1) == ps->len ); + } +} + +void +parts_shift_data_registers( parts *ps ) +{ + int i; + + if (!ps) + return; + + tap_capture_dr(); + + for (i = 0; i < ps->len; i++) { + if (!ps->parts[i]->active_instruction) { + printf( "%s(%s:%d) Part without active instruction\n", __FUNCTION__, __FILE__, __LINE__ ); + continue; } - ps->parts[j]->active_instruction = i; - tap_shift_register( i->value, NULL, (j + 1) == ps->len ); + tap_shift_register( ps->parts[i]->active_instruction->data_register->in, + ps->parts[i]->active_instruction->data_register->out, (i + 1) == ps->len ); } }