[ 1873260 ] Command 'reset' does not reset internal states

next round to fix this one


git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1302 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Arnim Läuger 17 years ago
parent 0214115402
commit 3c9dae4961

@ -1,3 +1,10 @@
2008-07-14 Arnim Laeuger <arniml@users.sourceforge.net>
* include/chain.h, include/tap.h, src/cmd/reset.c, src/tap/detect.c,
src/tap/chain.c, src/tap/tap.c, src/bus/fjmem.c, src/bus/avr32.c:
[ 1873260 ] Command 'reset' does not reset internal states
next round to fix this one
2008-07-10 Arnim Laeuger <arniml@users.sourceforge.net>
* src/tap/usbconn/libftd2xx.c (usbconn_ftd2xx_open): perform device reset

@ -40,6 +40,7 @@ typedef struct chain_t chain_t;
struct chain_t {
int state;
parts_t *parts;
int total_instr_len;
int active_part;
cable_t *cable;
bsdl_globs_t bsdl;

@ -29,6 +29,7 @@
#include "chain.h"
void tap_reset( chain_t *chain );
void tap_reset_bypass( chain_t *chain );
void tap_capture_dr( chain_t *chain );
void tap_capture_ir( chain_t *chain );
void tap_defer_shift_register( chain_t *chain, const tap_register *in, tap_register *out, int exit );

@ -39,8 +39,7 @@
#include "buses.h"
#include "generic_bus.h"
#include "data_register.h"
void jtag_reset (chain_t * chain);
#include "tap.h"
typedef struct {
unsigned int mode;
@ -271,7 +270,7 @@ nexus_access_start (bus_t * bus)
static void
nexus_access_end (bus_t * bus)
{
jtag_reset (CHAIN);
tap_reset_bypass (CHAIN);
}
static void

@ -114,7 +114,7 @@ fjmem_detect_reg_len( chain_t *chain, part_t *part, char *opcode, int len )
-> they're in BYPASS mode now */
chain_set_trst( chain, 0 );
chain_set_trst( chain, 1 );
tap_reset( chain );
tap_reset_bypass( chain );
/* flood all BYPASS registers with 0 for the following detection */
register_fill( dr->in, 0);

@ -28,11 +28,10 @@
#include <string.h>
#include "jtag.h"
#include "tap.h"
#include "cmd.h"
void jtag_reset( chain_t *chain );
static int
cmd_reset_run( chain_t *chain, char *params[] )
{
@ -42,7 +41,7 @@ cmd_reset_run( chain_t *chain, char *params[] )
if (!cmd_test_cable( chain ))
return 1;
jtag_reset( chain );
tap_reset_bypass( chain );
return 1;
}

@ -42,6 +42,7 @@ chain_alloc( void )
chain->cable = NULL;
chain->parts = NULL;
chain->total_instr_len = 0;
chain->active_part = 0;
BSDL_GLOBS_INIT(chain->bsdl);
tap_state_init( chain );

@ -203,6 +203,7 @@ detect_parts( chain_t *chain, const char *db_path )
return 0;
printf( _("IR length: %d\n"), irlen );
chain->total_instr_len = irlen;
/* Allocate IR */
ir = register_fill( register_alloc( irlen ), 1 );
@ -211,7 +212,7 @@ detect_parts( chain_t *chain, const char *db_path )
return 0;
}
tap_shift_register( chain, ir, NULL, 1 );
tap_shift_register( chain, ir, NULL, EXITMODE_IDLE );
register_free( ir );
/* Detect chain length */
@ -253,10 +254,10 @@ detect_parts( chain_t *chain, const char *db_path )
struct id_record idr;
char *p;
tap_shift_register( chain, one, br, 0 );
tap_shift_register( chain, one, br, EXITMODE_SHIFT );
if (register_compare( one, br ) == 0) {
/* part with id */
tap_shift_register( chain, ones, id, 0 );
tap_shift_register( chain, ones, id, EXITMODE_SHIFT );
register_shift_left( id, 1 );
id->data[0] = 1;
did = id;
@ -374,13 +375,13 @@ detect_parts( chain_t *chain, const char *db_path )
}
for (i = 0; i < 32; i++) {
tap_shift_register( chain, one, br, 0 );
tap_shift_register( chain, one, br, EXITMODE_SHIFT );
if (register_compare( one, br ) != 0) {
printf( _("Error: Unable to detect JTAG chain end!\n") );
break;
}
}
tap_shift_register( chain, one, NULL, 1 );
tap_shift_register( chain, one, NULL, EXITMODE_IDLE );
register_free( one );
register_free( ones );
@ -460,5 +461,8 @@ int manual_add(chain_t *chain, int instr_len)
return 0;
}
/* update total instruction register length of chain */
chain->total_instr_len += instr_len;
return chain->parts->len;
}

@ -36,10 +36,30 @@ tap_reset( chain_t *chain )
{
tap_state_reset( chain );
chain_defer_clock( chain, 1, 0, 5 ); /* Test-Logic-Reset */
chain_defer_clock( chain, 0, 0, 1 ); /* Run-Test/Idle */
chain_clock( chain, 1, 0, 5 ); /* Test-Logic-Reset */
chain_clock( chain, 0, 0, 1 ); /* Run-Test/Idle */
}
parts_set_instruction( chain->parts, "BYPASS" );
void
tap_reset_bypass( chain_t *chain )
{
tap_reset( chain );
/* set all parts in the chain to BYPASS instruction if the total
instruction register length of the chain is already known */
if (chain->total_instr_len > 0) {
tap_register *ir = register_fill( register_alloc( chain->total_instr_len ), 1 );
if (!ir) {
printf( _("out of memory\n") );
return;
}
tap_capture_ir( chain );
tap_shift_register( chain, ir, NULL, EXITMODE_IDLE );
register_free( ir );
parts_set_instruction( chain->parts, "BYPASS" );
}
}
void

Loading…
Cancel
Save