From 8815d81bfb0e53d01e878fc4b3787fcc79c93a83 Mon Sep 17 00:00:00 2001 From: Kolja Waschk Date: Tue, 6 Nov 2007 18:14:57 +0000 Subject: [PATCH] [ 986415 ] Allow interactive loading of DR git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@686 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/src/cmd/dr.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/jtag/src/cmd/dr.c b/jtag/src/cmd/dr.c index 077d1736..6dfa18f0 100644 --- a/jtag/src/cmd/dr.c +++ b/jtag/src/cmd/dr.c @@ -54,15 +54,6 @@ cmd_dr_run( char *params[] ) return 1; } - if (params[1]) { - if (strcasecmp( params[1], "in" ) == 0) - dir = 0; - else if (strcasecmp( params[1], "out" ) == 0) - dir = 1; - else - return -1; - } - if (chain->parts->parts[chain->active_part]->active_instruction == NULL) { printf( _("%s: part without active instruction\n"), "dr" ); return 1; @@ -72,6 +63,30 @@ cmd_dr_run( char *params[] ) return 1; } + if (params[1]) { + if (strcmp( params[1], "in" ) == 0) + dir = 0; + else if (strcmp( params[1], "out" ) == 0) + dir = 1; + else { + unsigned int bit; + if (strspn(params[1], "01") != strlen(params[1])) { + return -1; + } + + r = chain->parts->parts[chain->active_part]->active_instruction->data_register->in; + if (r->len != strlen(params[1])) { + printf( _("%s: register length mismatch\n"), "dr" ); + return 1; + } + for (bit = 0; params[1][bit]; bit++) { + r->data[r->len - 1 - bit] = (params[1][bit] == '1'); + } + + dir = 0; + } + } + if (dir) r = chain->parts->parts[chain->active_part]->active_instruction->data_register->out; else