You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

229 lines
5.2 KiB
C

/*
* $Id$
*
* Copyright (C) 2003 ETC s.r.o.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by Marcel Telka <marcel@telka.sk>, 2003.
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "cable.h"
#include "tap.h"
2003-03-13 Marcel Telka <marcel@telka.sk> * include/chain.h: New file. * src/tap/chain.c: Ditto. * src/tap/Makefile.am (libtap_a_SOURCES): Added chain.c. * include/Makefile.am (noinst_HEADERS): Added chain.h. * src/jtag.c: Encapsulated parts, cable and TAP state into one object - chain. All relevant function parameters changed to `chain'. * src/tap/state.c: `trst' state moved to cable drivers. All cable drivers changed. * include/cable.h (cable_driver_t) <set_trst>: Changed return value from void to int. All cable drivers changed. (cable_driver_t) <get_trst>: New function. Implemented this function to all cable drivers. * include/part.h (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Funcions removed. * src/part/part.c (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Ditto. * src/tap/cable/arcom.c: Removed dependency on state.h. * src/tap/cable/byteblaster.c: Ditto. * src/tap/cable/dlc5.c: Ditto. * src/tap/cable/ea253.c: Ditto. * src/tap/cable/ei012.c: Ditto. * src/tap/cable/mpcbdm.c: Ditto. * src/tap/cable/wiggler.c: Ditto. * include/state.h (bit): Replaced with common.h include. (Unknown_State, Run_Test_Idle, Select_DR_Scan, Select_IR_Scan): Removed parentheses. * include/tap.h (write_command): Removed unused declaration. * src/detect.h: Removed file. * src/jtag.h: New file with common jtag function declarations. * src/Makefile.am (jtag_SOURCES): Removed detect.h, added jtag.h. * src/cfi.c: Added jtag.h include. Moved common function declarations to jtag.h file. * src/detect.c: Ditto. * src/discovery.c: Ditto. * src/flash.c: Ditto. * src/help.c: Ditto. * src/jtag.c: Ditto. * src/readmem.c: Ditto. * src/jtag.c (jtag_create_jtagdir, jtag_load_history, jtag_save_history, jtag_parse_line) (jtag_readline_loop, jtag_parse_file, jtag_parse_rc): Changed functions to `static'. * src/tap/tap.c: Added l10n support. * po/POTFILES.in: Added src/tap/chain.c and src/tap/tap.c. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@392 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
#include "chain.h"
#include "jtag.h"
#define DETECT_PATTERN_SIZE 8
#define MAX_REGISTER_LENGTH 1024
#define TEST_COUNT 5
#define TEST_THRESHOLD 100 /* in % */
static int
2003-03-13 Marcel Telka <marcel@telka.sk> * include/chain.h: New file. * src/tap/chain.c: Ditto. * src/tap/Makefile.am (libtap_a_SOURCES): Added chain.c. * include/Makefile.am (noinst_HEADERS): Added chain.h. * src/jtag.c: Encapsulated parts, cable and TAP state into one object - chain. All relevant function parameters changed to `chain'. * src/tap/state.c: `trst' state moved to cable drivers. All cable drivers changed. * include/cable.h (cable_driver_t) <set_trst>: Changed return value from void to int. All cable drivers changed. (cable_driver_t) <get_trst>: New function. Implemented this function to all cable drivers. * include/part.h (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Funcions removed. * src/part/part.c (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Ditto. * src/tap/cable/arcom.c: Removed dependency on state.h. * src/tap/cable/byteblaster.c: Ditto. * src/tap/cable/dlc5.c: Ditto. * src/tap/cable/ea253.c: Ditto. * src/tap/cable/ei012.c: Ditto. * src/tap/cable/mpcbdm.c: Ditto. * src/tap/cable/wiggler.c: Ditto. * include/state.h (bit): Replaced with common.h include. (Unknown_State, Run_Test_Idle, Select_DR_Scan, Select_IR_Scan): Removed parentheses. * include/tap.h (write_command): Removed unused declaration. * src/detect.h: Removed file. * src/jtag.h: New file with common jtag function declarations. * src/Makefile.am (jtag_SOURCES): Removed detect.h, added jtag.h. * src/cfi.c: Added jtag.h include. Moved common function declarations to jtag.h file. * src/detect.c: Ditto. * src/discovery.c: Ditto. * src/flash.c: Ditto. * src/help.c: Ditto. * src/jtag.c: Ditto. * src/readmem.c: Ditto. * src/jtag.c (jtag_create_jtagdir, jtag_load_history, jtag_save_history, jtag_parse_line) (jtag_readline_loop, jtag_parse_file, jtag_parse_rc): Changed functions to `static'. * src/tap/tap.c: Added l10n support. * po/POTFILES.in: Added src/tap/chain.c and src/tap/tap.c. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@392 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
detect_register_size( chain_t *chain, FILE *f )
{
int len;
tap_register *rz;
tap_register *rout;
tap_register *rpat;
for (len = 1; len <= MAX_REGISTER_LENGTH; len++) {
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 ) );
for (p = 1; p < (1 << DETECT_PATTERN_SIZE); p++) {
int i;
const char *s;
ok = 0;
s = register_get_string( rpat );
while (*s)
s++;
fprintf( f, "\t\tPattern: %s, ", s - DETECT_PATTERN_SIZE );
for (i = 0; i < TEST_COUNT; i++) {
2003-03-13 Marcel Telka <marcel@telka.sk> * include/chain.h: New file. * src/tap/chain.c: Ditto. * src/tap/Makefile.am (libtap_a_SOURCES): Added chain.c. * include/Makefile.am (noinst_HEADERS): Added chain.h. * src/jtag.c: Encapsulated parts, cable and TAP state into one object - chain. All relevant function parameters changed to `chain'. * src/tap/state.c: `trst' state moved to cable drivers. All cable drivers changed. * include/cable.h (cable_driver_t) <set_trst>: Changed return value from void to int. All cable drivers changed. (cable_driver_t) <get_trst>: New function. Implemented this function to all cable drivers. * include/part.h (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Funcions removed. * src/part/part.c (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Ditto. * src/tap/cable/arcom.c: Removed dependency on state.h. * src/tap/cable/byteblaster.c: Ditto. * src/tap/cable/dlc5.c: Ditto. * src/tap/cable/ea253.c: Ditto. * src/tap/cable/ei012.c: Ditto. * src/tap/cable/mpcbdm.c: Ditto. * src/tap/cable/wiggler.c: Ditto. * include/state.h (bit): Replaced with common.h include. (Unknown_State, Run_Test_Idle, Select_DR_Scan, Select_IR_Scan): Removed parentheses. * include/tap.h (write_command): Removed unused declaration. * src/detect.h: Removed file. * src/jtag.h: New file with common jtag function declarations. * src/Makefile.am (jtag_SOURCES): Removed detect.h, added jtag.h. * src/cfi.c: Added jtag.h include. Moved common function declarations to jtag.h file. * src/detect.c: Ditto. * src/discovery.c: Ditto. * src/flash.c: Ditto. * src/help.c: Ditto. * src/jtag.c: Ditto. * src/readmem.c: Ditto. * src/jtag.c (jtag_create_jtagdir, jtag_load_history, jtag_save_history, jtag_parse_line) (jtag_readline_loop, jtag_parse_file, jtag_parse_rc): Changed functions to `static'. * src/tap/tap.c: Added l10n support. * po/POTFILES.in: Added src/tap/chain.c and src/tap/tap.c. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@392 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
tap_shift_register( chain, rz, NULL, 0 );
tap_shift_register( chain, rpat, rout, 0 );
register_shift_right( rout, len );
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;
}
register_inc( rpat );
}
register_free( rz );
register_free( rout );
register_free( rpat );
if (ok)
return len;
}
return -1;
}
static void
2003-03-13 Marcel Telka <marcel@telka.sk> * include/chain.h: New file. * src/tap/chain.c: Ditto. * src/tap/Makefile.am (libtap_a_SOURCES): Added chain.c. * include/Makefile.am (noinst_HEADERS): Added chain.h. * src/jtag.c: Encapsulated parts, cable and TAP state into one object - chain. All relevant function parameters changed to `chain'. * src/tap/state.c: `trst' state moved to cable drivers. All cable drivers changed. * include/cable.h (cable_driver_t) <set_trst>: Changed return value from void to int. All cable drivers changed. (cable_driver_t) <get_trst>: New function. Implemented this function to all cable drivers. * include/part.h (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Funcions removed. * src/part/part.c (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Ditto. * src/tap/cable/arcom.c: Removed dependency on state.h. * src/tap/cable/byteblaster.c: Ditto. * src/tap/cable/dlc5.c: Ditto. * src/tap/cable/ea253.c: Ditto. * src/tap/cable/ei012.c: Ditto. * src/tap/cable/mpcbdm.c: Ditto. * src/tap/cable/wiggler.c: Ditto. * include/state.h (bit): Replaced with common.h include. (Unknown_State, Run_Test_Idle, Select_DR_Scan, Select_IR_Scan): Removed parentheses. * include/tap.h (write_command): Removed unused declaration. * src/detect.h: Removed file. * src/jtag.h: New file with common jtag function declarations. * src/Makefile.am (jtag_SOURCES): Removed detect.h, added jtag.h. * src/cfi.c: Added jtag.h include. Moved common function declarations to jtag.h file. * src/detect.c: Ditto. * src/discovery.c: Ditto. * src/flash.c: Ditto. * src/help.c: Ditto. * src/jtag.c: Ditto. * src/readmem.c: Ditto. * src/jtag.c (jtag_create_jtagdir, jtag_load_history, jtag_save_history, jtag_parse_line) (jtag_readline_loop, jtag_parse_file, jtag_parse_rc): Changed functions to `static'. * src/tap/tap.c: Added l10n support. * po/POTFILES.in: Added src/tap/chain.c and src/tap/tap.c. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@392 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
jtag_reset( chain_t *chain )
{
2003-03-13 Marcel Telka <marcel@telka.sk> * include/chain.h: New file. * src/tap/chain.c: Ditto. * src/tap/Makefile.am (libtap_a_SOURCES): Added chain.c. * include/Makefile.am (noinst_HEADERS): Added chain.h. * src/jtag.c: Encapsulated parts, cable and TAP state into one object - chain. All relevant function parameters changed to `chain'. * src/tap/state.c: `trst' state moved to cable drivers. All cable drivers changed. * include/cable.h (cable_driver_t) <set_trst>: Changed return value from void to int. All cable drivers changed. (cable_driver_t) <get_trst>: New function. Implemented this function to all cable drivers. * include/part.h (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Funcions removed. * src/part/part.c (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Ditto. * src/tap/cable/arcom.c: Removed dependency on state.h. * src/tap/cable/byteblaster.c: Ditto. * src/tap/cable/dlc5.c: Ditto. * src/tap/cable/ea253.c: Ditto. * src/tap/cable/ei012.c: Ditto. * src/tap/cable/mpcbdm.c: Ditto. * src/tap/cable/wiggler.c: Ditto. * include/state.h (bit): Replaced with common.h include. (Unknown_State, Run_Test_Idle, Select_DR_Scan, Select_IR_Scan): Removed parentheses. * include/tap.h (write_command): Removed unused declaration. * src/detect.h: Removed file. * src/jtag.h: New file with common jtag function declarations. * src/Makefile.am (jtag_SOURCES): Removed detect.h, added jtag.h. * src/cfi.c: Added jtag.h include. Moved common function declarations to jtag.h file. * src/detect.c: Ditto. * src/discovery.c: Ditto. * src/flash.c: Ditto. * src/help.c: Ditto. * src/jtag.c: Ditto. * src/readmem.c: Ditto. * src/jtag.c (jtag_create_jtagdir, jtag_load_history, jtag_save_history, jtag_parse_line) (jtag_readline_loop, jtag_parse_file, jtag_parse_rc): Changed functions to `static'. * src/tap/tap.c: Added l10n support. * po/POTFILES.in: Added src/tap/chain.c and src/tap/tap.c. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@392 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
chain_set_trst( chain, 0 );
sleep( 1 );
2003-03-13 Marcel Telka <marcel@telka.sk> * include/chain.h: New file. * src/tap/chain.c: Ditto. * src/tap/Makefile.am (libtap_a_SOURCES): Added chain.c. * include/Makefile.am (noinst_HEADERS): Added chain.h. * src/jtag.c: Encapsulated parts, cable and TAP state into one object - chain. All relevant function parameters changed to `chain'. * src/tap/state.c: `trst' state moved to cable drivers. All cable drivers changed. * include/cable.h (cable_driver_t) <set_trst>: Changed return value from void to int. All cable drivers changed. (cable_driver_t) <get_trst>: New function. Implemented this function to all cable drivers. * include/part.h (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Funcions removed. * src/part/part.c (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Ditto. * src/tap/cable/arcom.c: Removed dependency on state.h. * src/tap/cable/byteblaster.c: Ditto. * src/tap/cable/dlc5.c: Ditto. * src/tap/cable/ea253.c: Ditto. * src/tap/cable/ei012.c: Ditto. * src/tap/cable/mpcbdm.c: Ditto. * src/tap/cable/wiggler.c: Ditto. * include/state.h (bit): Replaced with common.h include. (Unknown_State, Run_Test_Idle, Select_DR_Scan, Select_IR_Scan): Removed parentheses. * include/tap.h (write_command): Removed unused declaration. * src/detect.h: Removed file. * src/jtag.h: New file with common jtag function declarations. * src/Makefile.am (jtag_SOURCES): Removed detect.h, added jtag.h. * src/cfi.c: Added jtag.h include. Moved common function declarations to jtag.h file. * src/detect.c: Ditto. * src/discovery.c: Ditto. * src/flash.c: Ditto. * src/help.c: Ditto. * src/jtag.c: Ditto. * src/readmem.c: Ditto. * src/jtag.c (jtag_create_jtagdir, jtag_load_history, jtag_save_history, jtag_parse_line) (jtag_readline_loop, jtag_parse_file, jtag_parse_rc): Changed functions to `static'. * src/tap/tap.c: Added l10n support. * po/POTFILES.in: Added src/tap/chain.c and src/tap/tap.c. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@392 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
chain_set_trst( chain, 1 );
sleep( 1 );
2003-03-13 Marcel Telka <marcel@telka.sk> * include/chain.h: New file. * src/tap/chain.c: Ditto. * src/tap/Makefile.am (libtap_a_SOURCES): Added chain.c. * include/Makefile.am (noinst_HEADERS): Added chain.h. * src/jtag.c: Encapsulated parts, cable and TAP state into one object - chain. All relevant function parameters changed to `chain'. * src/tap/state.c: `trst' state moved to cable drivers. All cable drivers changed. * include/cable.h (cable_driver_t) <set_trst>: Changed return value from void to int. All cable drivers changed. (cable_driver_t) <get_trst>: New function. Implemented this function to all cable drivers. * include/part.h (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Funcions removed. * src/part/part.c (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Ditto. * src/tap/cable/arcom.c: Removed dependency on state.h. * src/tap/cable/byteblaster.c: Ditto. * src/tap/cable/dlc5.c: Ditto. * src/tap/cable/ea253.c: Ditto. * src/tap/cable/ei012.c: Ditto. * src/tap/cable/mpcbdm.c: Ditto. * src/tap/cable/wiggler.c: Ditto. * include/state.h (bit): Replaced with common.h include. (Unknown_State, Run_Test_Idle, Select_DR_Scan, Select_IR_Scan): Removed parentheses. * include/tap.h (write_command): Removed unused declaration. * src/detect.h: Removed file. * src/jtag.h: New file with common jtag function declarations. * src/Makefile.am (jtag_SOURCES): Removed detect.h, added jtag.h. * src/cfi.c: Added jtag.h include. Moved common function declarations to jtag.h file. * src/detect.c: Ditto. * src/discovery.c: Ditto. * src/flash.c: Ditto. * src/help.c: Ditto. * src/jtag.c: Ditto. * src/readmem.c: Ditto. * src/jtag.c (jtag_create_jtagdir, jtag_load_history, jtag_save_history, jtag_parse_line) (jtag_readline_loop, jtag_parse_file, jtag_parse_rc): Changed functions to `static'. * src/tap/tap.c: Added l10n support. * po/POTFILES.in: Added src/tap/chain.c and src/tap/tap.c. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@392 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
tap_reset( chain );
}
#define MAX_CHAIN_LENGTH 128
void
2003-03-13 Marcel Telka <marcel@telka.sk> * include/chain.h: New file. * src/tap/chain.c: Ditto. * src/tap/Makefile.am (libtap_a_SOURCES): Added chain.c. * include/Makefile.am (noinst_HEADERS): Added chain.h. * src/jtag.c: Encapsulated parts, cable and TAP state into one object - chain. All relevant function parameters changed to `chain'. * src/tap/state.c: `trst' state moved to cable drivers. All cable drivers changed. * include/cable.h (cable_driver_t) <set_trst>: Changed return value from void to int. All cable drivers changed. (cable_driver_t) <get_trst>: New function. Implemented this function to all cable drivers. * include/part.h (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Funcions removed. * src/part/part.c (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Ditto. * src/tap/cable/arcom.c: Removed dependency on state.h. * src/tap/cable/byteblaster.c: Ditto. * src/tap/cable/dlc5.c: Ditto. * src/tap/cable/ea253.c: Ditto. * src/tap/cable/ei012.c: Ditto. * src/tap/cable/mpcbdm.c: Ditto. * src/tap/cable/wiggler.c: Ditto. * include/state.h (bit): Replaced with common.h include. (Unknown_State, Run_Test_Idle, Select_DR_Scan, Select_IR_Scan): Removed parentheses. * include/tap.h (write_command): Removed unused declaration. * src/detect.h: Removed file. * src/jtag.h: New file with common jtag function declarations. * src/Makefile.am (jtag_SOURCES): Removed detect.h, added jtag.h. * src/cfi.c: Added jtag.h include. Moved common function declarations to jtag.h file. * src/detect.c: Ditto. * src/discovery.c: Ditto. * src/flash.c: Ditto. * src/help.c: Ditto. * src/jtag.c: Ditto. * src/readmem.c: Ditto. * src/jtag.c (jtag_create_jtagdir, jtag_load_history, jtag_save_history, jtag_parse_line) (jtag_readline_loop, jtag_parse_file, jtag_parse_rc): Changed functions to `static'. * src/tap/tap.c: Added l10n support. * po/POTFILES.in: Added src/tap/chain.c and src/tap/tap.c. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@392 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
discovery( chain_t *chain, const char *filename )
{
int i;
int irlen;
tap_register *ir;
tap_register *irz;
FILE *f = NULL;
tap_register *id = register_alloc( 32 );
tap_register *zeros = register_fill( register_alloc( 32 ), 0 );
tap_register *ones = register_fill( register_alloc( 32 ), 1 );
if (id && zeros && ones) {
f = fopen( filename, "w" );
if (!f)
printf( "Error: Unable to create file '%s'.\n", filename );
} else
printf( "Error: Out of memory!\n" );
if (!id || !zeros || !ones || !f) {
register_free( id );
register_free( zeros );
register_free( ones );
return;
}
printf( "Detecting JTAG chain length:\n" );
fprintf( f, "Detecting JTAG chain length:\n" );
2003-03-13 Marcel Telka <marcel@telka.sk> * include/chain.h: New file. * src/tap/chain.c: Ditto. * src/tap/Makefile.am (libtap_a_SOURCES): Added chain.c. * include/Makefile.am (noinst_HEADERS): Added chain.h. * src/jtag.c: Encapsulated parts, cable and TAP state into one object - chain. All relevant function parameters changed to `chain'. * src/tap/state.c: `trst' state moved to cable drivers. All cable drivers changed. * include/cable.h (cable_driver_t) <set_trst>: Changed return value from void to int. All cable drivers changed. (cable_driver_t) <get_trst>: New function. Implemented this function to all cable drivers. * include/part.h (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Funcions removed. * src/part/part.c (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Ditto. * src/tap/cable/arcom.c: Removed dependency on state.h. * src/tap/cable/byteblaster.c: Ditto. * src/tap/cable/dlc5.c: Ditto. * src/tap/cable/ea253.c: Ditto. * src/tap/cable/ei012.c: Ditto. * src/tap/cable/mpcbdm.c: Ditto. * src/tap/cable/wiggler.c: Ditto. * include/state.h (bit): Replaced with common.h include. (Unknown_State, Run_Test_Idle, Select_DR_Scan, Select_IR_Scan): Removed parentheses. * include/tap.h (write_command): Removed unused declaration. * src/detect.h: Removed file. * src/jtag.h: New file with common jtag function declarations. * src/Makefile.am (jtag_SOURCES): Removed detect.h, added jtag.h. * src/cfi.c: Added jtag.h include. Moved common function declarations to jtag.h file. * src/detect.c: Ditto. * src/discovery.c: Ditto. * src/flash.c: Ditto. * src/help.c: Ditto. * src/jtag.c: Ditto. * src/readmem.c: Ditto. * src/jtag.c (jtag_create_jtagdir, jtag_load_history, jtag_save_history, jtag_parse_line) (jtag_readline_loop, jtag_parse_file, jtag_parse_rc): Changed functions to `static'. * src/tap/tap.c: Added l10n support. * po/POTFILES.in: Added src/tap/chain.c and src/tap/tap.c. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@392 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
jtag_reset( chain );
2003-03-13 Marcel Telka <marcel@telka.sk> * include/chain.h: New file. * src/tap/chain.c: Ditto. * src/tap/Makefile.am (libtap_a_SOURCES): Added chain.c. * include/Makefile.am (noinst_HEADERS): Added chain.h. * src/jtag.c: Encapsulated parts, cable and TAP state into one object - chain. All relevant function parameters changed to `chain'. * src/tap/state.c: `trst' state moved to cable drivers. All cable drivers changed. * include/cable.h (cable_driver_t) <set_trst>: Changed return value from void to int. All cable drivers changed. (cable_driver_t) <get_trst>: New function. Implemented this function to all cable drivers. * include/part.h (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Funcions removed. * src/part/part.c (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Ditto. * src/tap/cable/arcom.c: Removed dependency on state.h. * src/tap/cable/byteblaster.c: Ditto. * src/tap/cable/dlc5.c: Ditto. * src/tap/cable/ea253.c: Ditto. * src/tap/cable/ei012.c: Ditto. * src/tap/cable/mpcbdm.c: Ditto. * src/tap/cable/wiggler.c: Ditto. * include/state.h (bit): Replaced with common.h include. (Unknown_State, Run_Test_Idle, Select_DR_Scan, Select_IR_Scan): Removed parentheses. * include/tap.h (write_command): Removed unused declaration. * src/detect.h: Removed file. * src/jtag.h: New file with common jtag function declarations. * src/Makefile.am (jtag_SOURCES): Removed detect.h, added jtag.h. * src/cfi.c: Added jtag.h include. Moved common function declarations to jtag.h file. * src/detect.c: Ditto. * src/discovery.c: Ditto. * src/flash.c: Ditto. * src/help.c: Ditto. * src/jtag.c: Ditto. * src/readmem.c: Ditto. * src/jtag.c (jtag_create_jtagdir, jtag_load_history, jtag_save_history, jtag_parse_line) (jtag_readline_loop, jtag_parse_file, jtag_parse_rc): Changed functions to `static'. * src/tap/tap.c: Added l10n support. * po/POTFILES.in: Added src/tap/chain.c and src/tap/tap.c. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@392 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
tap_capture_dr( chain );
for (i = 0; i < MAX_CHAIN_LENGTH; i++) {
2003-03-13 Marcel Telka <marcel@telka.sk> * include/chain.h: New file. * src/tap/chain.c: Ditto. * src/tap/Makefile.am (libtap_a_SOURCES): Added chain.c. * include/Makefile.am (noinst_HEADERS): Added chain.h. * src/jtag.c: Encapsulated parts, cable and TAP state into one object - chain. All relevant function parameters changed to `chain'. * src/tap/state.c: `trst' state moved to cable drivers. All cable drivers changed. * include/cable.h (cable_driver_t) <set_trst>: Changed return value from void to int. All cable drivers changed. (cable_driver_t) <get_trst>: New function. Implemented this function to all cable drivers. * include/part.h (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Funcions removed. * src/part/part.c (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Ditto. * src/tap/cable/arcom.c: Removed dependency on state.h. * src/tap/cable/byteblaster.c: Ditto. * src/tap/cable/dlc5.c: Ditto. * src/tap/cable/ea253.c: Ditto. * src/tap/cable/ei012.c: Ditto. * src/tap/cable/mpcbdm.c: Ditto. * src/tap/cable/wiggler.c: Ditto. * include/state.h (bit): Replaced with common.h include. (Unknown_State, Run_Test_Idle, Select_DR_Scan, Select_IR_Scan): Removed parentheses. * include/tap.h (write_command): Removed unused declaration. * src/detect.h: Removed file. * src/jtag.h: New file with common jtag function declarations. * src/Makefile.am (jtag_SOURCES): Removed detect.h, added jtag.h. * src/cfi.c: Added jtag.h include. Moved common function declarations to jtag.h file. * src/detect.c: Ditto. * src/discovery.c: Ditto. * src/flash.c: Ditto. * src/help.c: Ditto. * src/jtag.c: Ditto. * src/readmem.c: Ditto. * src/jtag.c (jtag_create_jtagdir, jtag_load_history, jtag_save_history, jtag_parse_line) (jtag_readline_loop, jtag_parse_file, jtag_parse_rc): Changed functions to `static'. * src/tap/tap.c: Added l10n support. * po/POTFILES.in: Added src/tap/chain.c and src/tap/tap.c. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@392 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
tap_shift_register( chain, zeros, id, 0 );
if (!register_compare( id, zeros ))
break; /* end of chain */
if (!register_compare( ones, id )) {
printf( "bad JTAG connection (TDO is 1)\n" );
fprintf( f, "bad JTAG connection (TDO is 1)\n" );
break;
}
printf( "ID[%d]: %s\n", i, register_get_string( id ) );
fprintf( f, "ID[%d]: %s\n", i, register_get_string( id ) );
}
register_free( id );
register_free( zeros );
register_free( ones );
if (i == MAX_CHAIN_LENGTH) {
printf( "Warning: Maximum internal JTAG chain length exceeded!\n" );
fprintf( f, "Warning: Maximum internal JTAG chain length exceeded!\n" );
} else {
printf( "JTAG chain length is %d\n", i );
fprintf( f, "JTAG chain length is %d\n", i );
}
/* detecting IR size */
2003-03-13 Marcel Telka <marcel@telka.sk> * include/chain.h: New file. * src/tap/chain.c: Ditto. * src/tap/Makefile.am (libtap_a_SOURCES): Added chain.c. * include/Makefile.am (noinst_HEADERS): Added chain.h. * src/jtag.c: Encapsulated parts, cable and TAP state into one object - chain. All relevant function parameters changed to `chain'. * src/tap/state.c: `trst' state moved to cable drivers. All cable drivers changed. * include/cable.h (cable_driver_t) <set_trst>: Changed return value from void to int. All cable drivers changed. (cable_driver_t) <get_trst>: New function. Implemented this function to all cable drivers. * include/part.h (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Funcions removed. * src/part/part.c (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Ditto. * src/tap/cable/arcom.c: Removed dependency on state.h. * src/tap/cable/byteblaster.c: Ditto. * src/tap/cable/dlc5.c: Ditto. * src/tap/cable/ea253.c: Ditto. * src/tap/cable/ei012.c: Ditto. * src/tap/cable/mpcbdm.c: Ditto. * src/tap/cable/wiggler.c: Ditto. * include/state.h (bit): Replaced with common.h include. (Unknown_State, Run_Test_Idle, Select_DR_Scan, Select_IR_Scan): Removed parentheses. * include/tap.h (write_command): Removed unused declaration. * src/detect.h: Removed file. * src/jtag.h: New file with common jtag function declarations. * src/Makefile.am (jtag_SOURCES): Removed detect.h, added jtag.h. * src/cfi.c: Added jtag.h include. Moved common function declarations to jtag.h file. * src/detect.c: Ditto. * src/discovery.c: Ditto. * src/flash.c: Ditto. * src/help.c: Ditto. * src/jtag.c: Ditto. * src/readmem.c: Ditto. * src/jtag.c (jtag_create_jtagdir, jtag_load_history, jtag_save_history, jtag_parse_line) (jtag_readline_loop, jtag_parse_file, jtag_parse_rc): Changed functions to `static'. * src/tap/tap.c: Added l10n support. * po/POTFILES.in: Added src/tap/chain.c and src/tap/tap.c. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@392 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
jtag_reset( chain );
printf( "Detecting IR size...\n" );
fprintf( f, "Detecting IR size:\n" );
2003-03-13 Marcel Telka <marcel@telka.sk> * include/chain.h: New file. * src/tap/chain.c: Ditto. * src/tap/Makefile.am (libtap_a_SOURCES): Added chain.c. * include/Makefile.am (noinst_HEADERS): Added chain.h. * src/jtag.c: Encapsulated parts, cable and TAP state into one object - chain. All relevant function parameters changed to `chain'. * src/tap/state.c: `trst' state moved to cable drivers. All cable drivers changed. * include/cable.h (cable_driver_t) <set_trst>: Changed return value from void to int. All cable drivers changed. (cable_driver_t) <get_trst>: New function. Implemented this function to all cable drivers. * include/part.h (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Funcions removed. * src/part/part.c (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Ditto. * src/tap/cable/arcom.c: Removed dependency on state.h. * src/tap/cable/byteblaster.c: Ditto. * src/tap/cable/dlc5.c: Ditto. * src/tap/cable/ea253.c: Ditto. * src/tap/cable/ei012.c: Ditto. * src/tap/cable/mpcbdm.c: Ditto. * src/tap/cable/wiggler.c: Ditto. * include/state.h (bit): Replaced with common.h include. (Unknown_State, Run_Test_Idle, Select_DR_Scan, Select_IR_Scan): Removed parentheses. * include/tap.h (write_command): Removed unused declaration. * src/detect.h: Removed file. * src/jtag.h: New file with common jtag function declarations. * src/Makefile.am (jtag_SOURCES): Removed detect.h, added jtag.h. * src/cfi.c: Added jtag.h include. Moved common function declarations to jtag.h file. * src/detect.c: Ditto. * src/discovery.c: Ditto. * src/flash.c: Ditto. * src/help.c: Ditto. * src/jtag.c: Ditto. * src/readmem.c: Ditto. * src/jtag.c (jtag_create_jtagdir, jtag_load_history, jtag_save_history, jtag_parse_line) (jtag_readline_loop, jtag_parse_file, jtag_parse_rc): Changed functions to `static'. * src/tap/tap.c: Added l10n support. * po/POTFILES.in: Added src/tap/chain.c and src/tap/tap.c. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@392 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
tap_capture_ir( chain );
irlen = detect_register_size( chain, f );
printf( "IR length is %d\n\n", irlen );
fprintf( f, "IR length is %d\n\n", irlen );
if (irlen < 1) {
printf( "Error: Invalid IR length!\n" );
fclose( f );
return;
}
ir = register_fill( register_alloc( irlen ), 0 );
irz = register_duplicate( ir );
if (!ir || !irz) {
register_free( ir );
register_free( irz );
fclose( f );
printf( "Error: Out of memory!\n" );
return;
}
for (;;) {
int rs;
2003-03-13 Marcel Telka <marcel@telka.sk> * include/chain.h: New file. * src/tap/chain.c: Ditto. * src/tap/Makefile.am (libtap_a_SOURCES): Added chain.c. * include/Makefile.am (noinst_HEADERS): Added chain.h. * src/jtag.c: Encapsulated parts, cable and TAP state into one object - chain. All relevant function parameters changed to `chain'. * src/tap/state.c: `trst' state moved to cable drivers. All cable drivers changed. * include/cable.h (cable_driver_t) <set_trst>: Changed return value from void to int. All cable drivers changed. (cable_driver_t) <get_trst>: New function. Implemented this function to all cable drivers. * include/part.h (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Funcions removed. * src/part/part.c (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Ditto. * src/tap/cable/arcom.c: Removed dependency on state.h. * src/tap/cable/byteblaster.c: Ditto. * src/tap/cable/dlc5.c: Ditto. * src/tap/cable/ea253.c: Ditto. * src/tap/cable/ei012.c: Ditto. * src/tap/cable/mpcbdm.c: Ditto. * src/tap/cable/wiggler.c: Ditto. * include/state.h (bit): Replaced with common.h include. (Unknown_State, Run_Test_Idle, Select_DR_Scan, Select_IR_Scan): Removed parentheses. * include/tap.h (write_command): Removed unused declaration. * src/detect.h: Removed file. * src/jtag.h: New file with common jtag function declarations. * src/Makefile.am (jtag_SOURCES): Removed detect.h, added jtag.h. * src/cfi.c: Added jtag.h include. Moved common function declarations to jtag.h file. * src/detect.c: Ditto. * src/discovery.c: Ditto. * src/flash.c: Ditto. * src/help.c: Ditto. * src/jtag.c: Ditto. * src/readmem.c: Ditto. * src/jtag.c (jtag_create_jtagdir, jtag_load_history, jtag_save_history, jtag_parse_line) (jtag_readline_loop, jtag_parse_file, jtag_parse_rc): Changed functions to `static'. * src/tap/tap.c: Added l10n support. * po/POTFILES.in: Added src/tap/chain.c and src/tap/tap.c. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@392 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
jtag_reset( chain );
2003-03-13 Marcel Telka <marcel@telka.sk> * include/chain.h: New file. * src/tap/chain.c: Ditto. * src/tap/Makefile.am (libtap_a_SOURCES): Added chain.c. * include/Makefile.am (noinst_HEADERS): Added chain.h. * src/jtag.c: Encapsulated parts, cable and TAP state into one object - chain. All relevant function parameters changed to `chain'. * src/tap/state.c: `trst' state moved to cable drivers. All cable drivers changed. * include/cable.h (cable_driver_t) <set_trst>: Changed return value from void to int. All cable drivers changed. (cable_driver_t) <get_trst>: New function. Implemented this function to all cable drivers. * include/part.h (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Funcions removed. * src/part/part.c (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Ditto. * src/tap/cable/arcom.c: Removed dependency on state.h. * src/tap/cable/byteblaster.c: Ditto. * src/tap/cable/dlc5.c: Ditto. * src/tap/cable/ea253.c: Ditto. * src/tap/cable/ei012.c: Ditto. * src/tap/cable/mpcbdm.c: Ditto. * src/tap/cable/wiggler.c: Ditto. * include/state.h (bit): Replaced with common.h include. (Unknown_State, Run_Test_Idle, Select_DR_Scan, Select_IR_Scan): Removed parentheses. * include/tap.h (write_command): Removed unused declaration. * src/detect.h: Removed file. * src/jtag.h: New file with common jtag function declarations. * src/Makefile.am (jtag_SOURCES): Removed detect.h, added jtag.h. * src/cfi.c: Added jtag.h include. Moved common function declarations to jtag.h file. * src/detect.c: Ditto. * src/discovery.c: Ditto. * src/flash.c: Ditto. * src/help.c: Ditto. * src/jtag.c: Ditto. * src/readmem.c: Ditto. * src/jtag.c (jtag_create_jtagdir, jtag_load_history, jtag_save_history, jtag_parse_line) (jtag_readline_loop, jtag_parse_file, jtag_parse_rc): Changed functions to `static'. * src/tap/tap.c: Added l10n support. * po/POTFILES.in: Added src/tap/chain.c and src/tap/tap.c. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@392 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
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 ) );
2003-03-13 Marcel Telka <marcel@telka.sk> * include/chain.h: New file. * src/tap/chain.c: Ditto. * src/tap/Makefile.am (libtap_a_SOURCES): Added chain.c. * include/Makefile.am (noinst_HEADERS): Added chain.h. * src/jtag.c: Encapsulated parts, cable and TAP state into one object - chain. All relevant function parameters changed to `chain'. * src/tap/state.c: `trst' state moved to cable drivers. All cable drivers changed. * include/cable.h (cable_driver_t) <set_trst>: Changed return value from void to int. All cable drivers changed. (cable_driver_t) <get_trst>: New function. Implemented this function to all cable drivers. * include/part.h (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Funcions removed. * src/part/part.c (part_shift_instruction, part_shift_data_register) (parts_shift_instructions, parts_shift_data_registers): Ditto. * src/tap/cable/arcom.c: Removed dependency on state.h. * src/tap/cable/byteblaster.c: Ditto. * src/tap/cable/dlc5.c: Ditto. * src/tap/cable/ea253.c: Ditto. * src/tap/cable/ei012.c: Ditto. * src/tap/cable/mpcbdm.c: Ditto. * src/tap/cable/wiggler.c: Ditto. * include/state.h (bit): Replaced with common.h include. (Unknown_State, Run_Test_Idle, Select_DR_Scan, Select_IR_Scan): Removed parentheses. * include/tap.h (write_command): Removed unused declaration. * src/detect.h: Removed file. * src/jtag.h: New file with common jtag function declarations. * src/Makefile.am (jtag_SOURCES): Removed detect.h, added jtag.h. * src/cfi.c: Added jtag.h include. Moved common function declarations to jtag.h file. * src/detect.c: Ditto. * src/discovery.c: Ditto. * src/flash.c: Ditto. * src/help.c: Ditto. * src/jtag.c: Ditto. * src/readmem.c: Ditto. * src/jtag.c (jtag_create_jtagdir, jtag_load_history, jtag_save_history, jtag_parse_line) (jtag_readline_loop, jtag_parse_file, jtag_parse_rc): Changed functions to `static'. * src/tap/tap.c: Added l10n support. * po/POTFILES.in: Added src/tap/chain.c and src/tap/tap.c. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@392 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
22 years ago
tap_capture_dr( chain );
rs = detect_register_size( chain, f );
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 );
register_inc( ir );
if (register_compare( ir, irz ) == 0)
break;
}
register_free( ir );
register_free( irz );
fclose( f );
}