diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 42ae408b..66d0303b 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,10 @@ +2004-08-15 Marcel Telka + + * include/jtag.h (detect_parts): Changed return type. + * src/detect.c (detect_parts): Changed return value to return number of detected parts. + * src/cmd/detect.c (cmd_detect_run): Added reset of the chain->parts to NULL before + detect_parts() call. Ignored detect_parts() return value. + 2004-08-13 Marcel Telka * src/jtag.c: Added missing locale.h include (patch 986414, Martin Buck). diff --git a/jtag/include/jtag.h b/jtag/include/jtag.h index a5c38996..6ea57404 100644 --- a/jtag/include/jtag.h +++ b/jtag/include/jtag.h @@ -40,7 +40,7 @@ extern int big_endian; int jtag_parse_file( const char *filename ); -parts_t *detect_parts( chain_t *chain, char *db_path ); +int detect_parts( chain_t *chain, char *db_path ); int detect_register_size( chain_t *chain ); void discovery( chain_t *chain ); diff --git a/jtag/src/cmd/detect.c b/jtag/src/cmd/detect.c index 879c0067..f949e154 100644 --- a/jtag/src/cmd/detect.c +++ b/jtag/src/cmd/detect.c @@ -44,7 +44,8 @@ cmd_detect_run( char *params[] ) buses_free(); parts_free( chain->parts ); - chain->parts = detect_parts( chain, JTAG_DATA_DIR ); + chain->parts = NULL; + detect_parts( chain, JTAG_DATA_DIR ); if (!chain->parts) return 1; if (!chain->parts->len) { diff --git a/jtag/src/detect.c b/jtag/src/detect.c index c4f19e57..7e69eeb5 100644 --- a/jtag/src/detect.c +++ b/jtag/src/detect.c @@ -160,7 +160,7 @@ find_record( char *filename, tap_register *key, struct id_record *idr ) return r; } -parts_t * +int detect_parts( chain_t *chain, char *db_path ) { int irlen; @@ -184,7 +184,7 @@ detect_parts( chain_t *chain, char *db_path ) tap_capture_ir( chain ); irlen = detect_register_size( chain ); if (irlen < 1) - return NULL; + return 0; printf( _("IR length: %d\n"), irlen ); @@ -192,7 +192,7 @@ detect_parts( chain_t *chain, char *db_path ) ir = register_fill( register_alloc( irlen ), 1 ); if (ir == NULL) { printf( _("out of memory\n") ); - return NULL; + return 0; } tap_shift_register( chain, ir, NULL, 1 ); @@ -203,7 +203,7 @@ detect_parts( chain_t *chain, char *db_path ) chlen = detect_register_size( chain ); if (chlen < 1) { printf( _("Unable to detect JTAG chain length\n") ); - return NULL; + return 0; } printf( _("Chain length: %d\n"), chlen ); @@ -221,7 +221,7 @@ detect_parts( chain_t *chain, char *db_path ) register_free( br ); register_free( id ); parts_free( ps ); - return NULL; + return 0; } chain->parts = ps; chain->active_part = 0; @@ -361,5 +361,5 @@ detect_parts( chain_t *chain, char *db_path ) register_free( br ); register_free( id ); - return ps; + return ps->len; }