From f017932912eb06329b0bddc2e898666672057227 Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Thu, 19 Jun 2003 11:09:37 +0000 Subject: [PATCH] 2003-06-19 Marcel Telka * include/jtag.h (discovery): Removed 'filename' parameter. * src/discovery.c (TEST_COUNT): Changed test repeat count from 5 to 1. (detect_register_size): Removed 'f' parameter. Removed output messages. (jtag_reset): Removed sleep() calls. (discovery): Removed 'filename' parameter. Removed support for output to file. Simplified output messages. * src/cmd/discovery.c (cmd_discovery_run): Removed FILENAME parameter. (cmd_discovery_help): Updated help text. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@489 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 11 +++++++++++ jtag/NEWS | 6 ++++-- jtag/include/jtag.h | 2 +- jtag/src/cmd/discovery.c | 12 +++++------- jtag/src/discovery.c | 36 +++++++++++------------------------- 5 files changed, 32 insertions(+), 35 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 3f5bf15f..260e2339 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,14 @@ +2003-06-19 Marcel Telka + + * include/jtag.h (discovery): Removed 'filename' parameter. + * src/discovery.c (TEST_COUNT): Changed test repeat count from 5 to 1. + (detect_register_size): Removed 'f' parameter. Removed output messages. + (jtag_reset): Removed sleep() calls. + (discovery): Removed 'filename' parameter. Removed support for output to file. Simplified output + messages. + * src/cmd/discovery.c (cmd_discovery_run): Removed FILENAME parameter. + (cmd_discovery_help): Updated help text. + 2003-06-18 Marcel Telka * src/discovery.c (discovery): Removed explicit JTAG chain length detection. Changed starting of the DR diff --git a/jtag/NEWS b/jtag/NEWS index 4a835c76..bd640623 100644 --- a/jtag/NEWS +++ b/jtag/NEWS @@ -7,8 +7,10 @@ See libbrux/NEWS for more news. * Fixed bugs in SH7727 bus driver (thanks to Rainer Dörken). * Added bus width detection using MD3 and MD4 signals in SH7727 bus driver (thanks to Rainer Dörken). - * Removed explicit JTAG chain length detection for 'discovery' command - (patch 753298, Matan Ziv-Av). + * Changes in 'discovery' command: + - removed explicit JTAG chain length detection (patch 753298, Matan Ziv-Av) + - simplified output messages + - removed support for report results to file * Minor bugs fixed. jtag-0.4 (2003-05-29): diff --git a/jtag/include/jtag.h b/jtag/include/jtag.h index 75b4df06..0214cf03 100644 --- a/jtag/include/jtag.h +++ b/jtag/include/jtag.h @@ -41,7 +41,7 @@ extern int big_endian; int jtag_parse_file( const char *filename ); parts_t *detect_parts( chain_t *chain, char *db_path ); -void discovery( chain_t *chain, const char *filename ); +void discovery( chain_t *chain ); void readmem( bus_t *bus, FILE *f, uint32_t addr, uint32_t len ); diff --git a/jtag/src/cmd/discovery.c b/jtag/src/cmd/discovery.c index 0b626884..4f0c3eda 100644 --- a/jtag/src/cmd/discovery.c +++ b/jtag/src/cmd/discovery.c @@ -33,13 +33,13 @@ static int cmd_discovery_run( char *params[] ) { - if (cmd_params( params ) != 2) + if (cmd_params( params ) != 1) return -1; if (!cmd_test_cable()) return 1; - discovery( chain, params[1] ); + discovery( chain ); return 1; } @@ -48,15 +48,13 @@ static void cmd_discovery_help( void ) { printf( _( - "Usage: %s FILENAME\n" + "Usage: %s\n" "Discovery unknown parts in the JTAG chain.\n" "\n" - "Detail output (report) is directed to the FILENAME.\n" "'%s' attempts to detect these parameters of an unknown JTAG\n" "chain:\n" - " 1. JTAG chain size (number of parts in the chain)\n" - " 2. IR (instruction register) length\n" - " 3. DR (data register) length for all possible instructions\n" + " 1. IR (instruction register) length\n" + " 2. DR (data register) length for all possible instructions\n" "\n" "Warning: This may be dangerous for some parts (especially, if the\n" "part doesn't have TRST signal).\n" diff --git a/jtag/src/discovery.c b/jtag/src/discovery.c index 6b48fc9d..2174639c 100644 --- a/jtag/src/discovery.c +++ b/jtag/src/discovery.c @@ -26,7 +26,6 @@ #include #include -#include #include "cable.h" #include "tap.h" @@ -36,11 +35,11 @@ #define DETECT_PATTERN_SIZE 8 #define MAX_REGISTER_LENGTH 1024 -#define TEST_COUNT 5 +#define TEST_COUNT 1 #define TEST_THRESHOLD 100 /* in % */ static int -detect_register_size( chain_t *chain, FILE *f ) +detect_register_size( chain_t *chain ) { int len; tap_register *rz; @@ -51,8 +50,6 @@ detect_register_size( chain_t *chain, FILE *f ) int p; int ok = 0; - fprintf( f, _("\tTesting register length: %d\n"), len ); - rz = register_fill( register_alloc( len ), 0 ); rout = register_alloc( DETECT_PATTERN_SIZE + len ); rpat = register_inc( register_fill( register_alloc( DETECT_PATTERN_SIZE + len ), 0 ) ); @@ -65,7 +62,6 @@ detect_register_size( chain_t *chain, FILE *f ) s = register_get_string( rpat ); while (*s) s++; - fprintf( f, _("\t\tPattern: %s, "), s - DETECT_PATTERN_SIZE ); for (i = 0; i < TEST_COUNT; i++) { tap_shift_register( chain, rz, NULL, 0 ); @@ -76,7 +72,6 @@ detect_register_size( chain_t *chain, FILE *f ) if (register_compare( rpat, rout ) == 0) ok++; } - fprintf( f, _("%d %%\n"), 100 * ok / TEST_COUNT ); if (100 * ok / TEST_COUNT < TEST_THRESHOLD) { ok = 0; break; @@ -100,36 +95,31 @@ static void jtag_reset( chain_t *chain ) { chain_set_trst( chain, 0 ); - sleep( 1 ); chain_set_trst( chain, 1 ); - sleep( 1 ); tap_reset( chain ); } void -discovery( chain_t *chain, const char *filename ) +discovery( chain_t *chain ) { int irlen; tap_register *ir; tap_register *irz; - FILE *f = NULL; /* detecting IR size */ jtag_reset( chain ); - printf( _("Detecting IR size...\n") ); - fprintf( f, _("Detecting IR size:\n") ); + printf( _("Detecting IR length ... ") ); + fflush( stdout ); tap_capture_ir( chain ); - irlen = detect_register_size( chain, f ); + irlen = detect_register_size( chain ); - printf( _("IR length is %d\n\n"), irlen ); - fprintf( f, _("IR length is %d\n\n"), irlen ); + printf( _("%d\n"), irlen ); if (irlen < 1) { printf( _("Error: Invalid IR length!\n") ); - fclose( f ); return; } @@ -140,7 +130,6 @@ discovery( chain_t *chain, const char *filename ) if (!ir || !irz) { register_free( ir ); register_free( irz ); - fclose( f ); printf( _("Error: Out of memory!\n") ); return; } @@ -153,14 +142,13 @@ discovery( chain_t *chain, const char *filename ) tap_capture_ir( chain ); tap_shift_register( chain, ir, NULL, 1 ); - printf( _("Detecting DR size for IR %s ...\n"), register_get_string( ir ) ); - fprintf( f, _("Detecting DR size for IR %s:\n"), register_get_string( ir ) ); + printf( _("Detecting DR length for IR %s ... "), register_get_string( ir ) ); + fflush( stdout ); tap_capture_dr( chain ); - rs = detect_register_size( chain, f ); + rs = detect_register_size( chain ); - printf( _("DR length for IR %s is %d\n\n"), register_get_string( ir ), rs ); - fprintf( f, _("DR length for IR %s is %d\n\n"), register_get_string( ir ), rs ); + printf( _("%d\n"), rs ); register_inc( ir ); if (register_compare( ir, irz ) == 0) @@ -168,6 +156,4 @@ discovery( chain_t *chain, const char *filename ) } register_free( ir ); register_free( irz ); - - fclose( f ); }