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-d4ac073336b7master
parent
1d44678038
commit
daa49cf9bc
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* $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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CHAIN_H
|
||||
#define CHAIN_H
|
||||
|
||||
#include "cable.h"
|
||||
#include "part.h"
|
||||
|
||||
typedef struct {
|
||||
int state;
|
||||
parts_t *parts;
|
||||
cable_t *cable;
|
||||
} chain_t;
|
||||
|
||||
chain_t *chain_alloc( void );
|
||||
void chain_free( chain_t *chain );
|
||||
int chain_connect( chain_t *chain, cable_t *cable, unsigned int port );
|
||||
void chain_clock( chain_t *chain, int tms, int tdi );
|
||||
int chain_set_trst( chain_t *chain, int trst );
|
||||
int chain_get_trst( chain_t *chain );
|
||||
void chain_shift_instructions( chain_t *chain );
|
||||
void chain_shift_data_registers( chain_t *chain );
|
||||
|
||||
typedef struct {
|
||||
chain_t **chains;
|
||||
int size; /* allocated chains array size */
|
||||
} chains_t;
|
||||
|
||||
#endif /* CHAIN_H */
|
@ -0,0 +1,155 @@
|
||||
/*
|
||||
* $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 "gettext.h"
|
||||
#define _(s) gettext(s)
|
||||
#define N_(s) gettext_noop(s)
|
||||
#define P_(s,p,n) ngettext(s,p,n)
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "chain.h"
|
||||
#include "state.h"
|
||||
#include "tap.h"
|
||||
|
||||
chain_t *
|
||||
chain_alloc( void )
|
||||
{
|
||||
chain_t *chain = malloc( sizeof (chain_t) );
|
||||
if (!chain)
|
||||
return NULL;
|
||||
|
||||
chain->cable = NULL;
|
||||
chain->parts = NULL;
|
||||
tap_state_init( chain );
|
||||
|
||||
return chain;
|
||||
}
|
||||
|
||||
void
|
||||
chain_free( chain_t *chain )
|
||||
{
|
||||
if (!chain)
|
||||
return;
|
||||
|
||||
if (chain->cable) {
|
||||
chain->cable->set_trst( 0 );
|
||||
chain->cable->set_trst( 1 );
|
||||
tap_reset( chain );
|
||||
chain->cable->done();
|
||||
}
|
||||
tap_state_done( chain );
|
||||
/* cable_free( chain->cable ); */
|
||||
parts_free( chain->parts );
|
||||
free( chain );
|
||||
}
|
||||
|
||||
int
|
||||
chain_connect( chain_t *chain, cable_t *cable, unsigned int port )
|
||||
{
|
||||
if (chain->cable) {
|
||||
tap_state_done( chain );
|
||||
chain->cable->done();
|
||||
chain->cable = NULL;
|
||||
}
|
||||
if (!cable || !cable->init( port ))
|
||||
return -1;
|
||||
|
||||
chain->cable = cable;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
chain_clock( chain_t *chain, int tms, int tdi )
|
||||
{
|
||||
if (!chain || !chain->cable)
|
||||
return;
|
||||
|
||||
chain->cable->clock( tms, tdi );
|
||||
tap_state_clock( chain, tms );
|
||||
}
|
||||
|
||||
int
|
||||
chain_set_trst( chain_t *chain, int trst )
|
||||
{
|
||||
int old_trst = chain->cable->get_trst();
|
||||
trst = chain->cable->set_trst( trst );
|
||||
tap_state_set_trst( chain, old_trst, trst );
|
||||
return trst;
|
||||
}
|
||||
|
||||
int
|
||||
chain_get_trst( chain_t *chain )
|
||||
{
|
||||
return chain->cable->get_trst();
|
||||
}
|
||||
|
||||
void
|
||||
chain_shift_instructions( chain_t *chain )
|
||||
{
|
||||
int i;
|
||||
parts_t *ps;
|
||||
|
||||
if (!chain || !chain->parts)
|
||||
return;
|
||||
|
||||
ps = chain->parts;
|
||||
|
||||
tap_capture_ir( chain );
|
||||
|
||||
for (i = 0; i < ps->len; i++) {
|
||||
if (!ps->parts[i]->active_instruction) {
|
||||
printf( _("%s(%d) Part without active instruction\n"), __FILE__, __LINE__ );
|
||||
continue;
|
||||
}
|
||||
tap_shift_register( chain, ps->parts[i]->active_instruction->value, NULL, (i + 1) == ps->len );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
chain_shift_data_registers( chain_t *chain )
|
||||
{
|
||||
int i;
|
||||
parts_t *ps;
|
||||
|
||||
if (!chain || !chain->parts)
|
||||
return;
|
||||
|
||||
ps = chain->parts;
|
||||
|
||||
tap_capture_dr( chain );
|
||||
|
||||
for (i = 0; i < ps->len; i++) {
|
||||
if (!ps->parts[i]->active_instruction) {
|
||||
printf( _("%s(%d) Part without active instruction\n"), __FILE__, __LINE__ );
|
||||
continue;
|
||||
}
|
||||
tap_shift_register( chain, ps->parts[i]->active_instruction->data_register->in,
|
||||
ps->parts[i]->active_instruction->data_register->out, (i + 1) == ps->len );
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue