2003-01-08 Marcel Telka <marcel@telka.sk>

* include/Makefile.am: Removed ctrl.h, added cable.h.
	* include/ctrl.h: Removed obsolete file.
	* include/cable.h: Added common declarations for JTAG cable drivers.
	* src/detect.c: Replaced ctrl.h include with cable.h (JTAG cable driver support).
	* src/discovery.c: Ditto.
	* src/tap/tap.c: Ditto.
	* src/help.c: Added help for new command 'cable'.
	* src/jtag.c: Added support for JTAG cable drivers, added new command 'cable'.
	* src/tap/Makefile.am: Removed ctrl.c, added cable/ea253.c, updated includes.
	* src/tap/ctrl.c: Removed obsolete file.
	* src/tap/state.c: Changed default TRST state to 1.
	* src/tap/cable/ea253.c: Added driver for EA253 JTAG cable.


git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@294 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Marcel Telka 22 years ago
parent d278440273
commit dfd76356a2

@ -1,3 +1,18 @@
2003-01-08 Marcel Telka <marcel@telka.sk>
* include/Makefile.am: Removed ctrl.h, added cable.h.
* include/ctrl.h: Removed obsolete file.
* include/cable.h: Added common declarations for JTAG cable drivers.
* src/detect.c: Replaced ctrl.h include with cable.h (JTAG cable driver support).
* src/discovery.c: Ditto.
* src/tap/tap.c: Ditto.
* src/help.c: Added help for new command 'cable'.
* src/jtag.c: Added support for JTAG cable drivers, added new command 'cable'.
* src/tap/Makefile.am: Removed ctrl.c, added cable/ea253.c, updated includes.
* src/tap/ctrl.c: Removed obsolete file.
* src/tap/state.c: Changed default TRST state to 1.
* src/tap/cable/ea253.c: Added driver for EA253 JTAG cable.
2003-01-06 Marcel Telka <marcel@telka.sk>
* src/discovery.c (discovery): Fixed memory leaks, added out of memory test,

@ -3,6 +3,7 @@ Changes since 0.1:
* Completed JTAG declarations for Xilinx XCR3128XL-CS144.
* Fixed crash if flash memory is not detected.
* Added new 'discovery' command for discovery unknown JTAG chains.
* Added JTAG cable driver support and new 'cable' command.
jtag-0.1 (2002-11-25):

@ -35,7 +35,8 @@ Supported hardware
------------------
JTAG adapters:
- various parallel port JTAG adapters
- various parallel port JTAG adapters/cables (for complete list see
'help cable' command)
JTAG-aware parts (chips):
- Atmel ATmega128 (partial support)
@ -76,12 +77,10 @@ Build & installation instructions
1. Download and install required software (see previous section).
2. Download and unpack jtag sources.
3. Setup your parallel cable configuration in src/tap/ctrl.c file.
Please set correct TCK, TDI, TMS, TRST, TDO and 'port' values in the file.
4. Run ./configure script. Use optional --with-include parameter.
3. Run ./configure script. Use optional --with-include parameter.
See `./configure --help` for more info.
5. Run `make`.
6. Run `make install`.
4. Run `make`.
5. Run `make install`.
Running JTAG tools
@ -98,7 +97,15 @@ jtag>
This is "jtag command prompt". Type "help" and press <Enter> for initial help
about available commands. To exit JTAG Tools type "quit" and press <Enter>.
===> First task: Detect parts on the JTAG chain.
===> First task: Select JTAG cable and parallel port address.
Type "help cable" for list of supported JTAG cables.
Type "cable" command with arguments. Exmaple:
jtag> cable parallel 0x378 EA253
Initilizing cable EA253 on parallel port at 0x378
===> Second task: Detect parts on the JTAG chain.
Type "detect" at the jtag command prompt:
jtag> detect
@ -121,7 +128,7 @@ doesn't work, or your JTAG-aware chip doesn't support JTAG ID detection
"detect" command is required before all other commands.
===> Second task: Print current JTAG chain status.
===> Third task: Print current JTAG chain status.
Type "print" at the jtag command prompt. Here is an output example:
@ -131,7 +138,7 @@ jtag> print
0 Intel PXA250 C0 BYPASS BR
jtag>
===> Third task: Sample device pin status.
===> Fourth task: Sample device pin status.
jtag> instruction 0 SAMPLE/PRELOAD
jtag> shift ir
@ -151,7 +158,7 @@ jtag>
Note: BSR is "Boundary Scan Register"
===> Fourth task: Burn flash connected to the part.
===> Fifth task: Burn flash connected to the part.
jtag> flashmem 0 brux.b
0x00000000

@ -1 +1,4 @@
jtag-0.1
--------
Thanks to Holger Schurig for suggestion about readmem functionality and his feedback.

@ -23,7 +23,7 @@
noinst_HEADERS = \
bsbit.h \
ctrl.h \
cable.h \
data_register.h \
instruction.h \
part.h \

@ -1,7 +1,8 @@
/*
* $Id$
*
* Copyright (C) 2002 ETC s.r.o.
* Cable driver interface
* 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
@ -18,22 +19,28 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by Marcel Telka <marcel@telka.sk>, 2002.
* Written by Marcel Telka <marcel@telka.sk>, 2003.
*
*/
#ifndef CTRL_H
#define CTRL_H
#ifndef CABLE_H
#define CABLE_H
/*
* low level tap functions, hardware dependent
*/
int tap_init( void );
void tap_done( void );
#include <stdint.h>
typedef struct {
int (*init)( unsigned int );
void (*done)( void );
void (*clock)( int, int );
int (*get_tdo)( void );
void (*set_trst)( int );
} cable_driver_t;
void tap_clock( int tms, int tdi );
int tap_get_tdo( void );
extern cable_driver_t *cable;
#define tap_clock cable->clock
#define tap_get_tdo cable->get_tdo
#define tap_set_trst cable->set_trst
void tap_set_trst( int new_trst );
extern cable_driver_t ea253_cable_driver;
#endif /* CTRL_H */
#endif /* CABLE_H */

@ -29,7 +29,7 @@
#include "register.h"
#include "tap.h"
#include "ctrl.h"
#include "cable.h"
#include "part.h"
#include "detect.h"

@ -30,7 +30,7 @@
#include <stdlib.h>
#include <unistd.h>
#include "ctrl.h"
#include "cable.h"
#include "tap.h"
#define DETECT_PATTERN_SIZE 8

@ -38,6 +38,7 @@ help( const char *cmd )
"\n"
"quit exit from %s\n"
"help display this help\n"
"cable select JTAG cable\n"
"detect detect parts on the JTAG chain\n"
"discovery discovery unknown parts in the JTAG chain\n"
"print display JTAG chain list/status\n"
@ -61,6 +62,17 @@ help( const char *cmd )
"Usage: help [COMMAND]\n"
"Print short help for COMMAND, or list of available commands.\n"
);
else if (strcmp( cmd, "cable" ) == 0)
printf(
"Usage: cable parallel PORTADDR CABLE\n"
"Select JTAG cable connected to parallel port.\n"
"\n"
"PORTADDR parallel port address (e.g. 0x378)\n"
"CABLE cable type\n"
"\n"
"List of supported cables:\n"
"none, EA253\n"
);
else if (strcmp( cmd, "detect" ) == 0)
printf(
"Usage: detect\n"

@ -32,12 +32,14 @@
#include <readline/history.h>
#include "part.h"
#include "ctrl.h"
#include "cable.h"
#include "tap.h"
#include "detect.h"
#include "bus.h"
cable_driver_t *cable = NULL;
bus_driver_t *bus_driver = NULL;
static char *
@ -72,14 +74,6 @@ main( void )
printf( "Warning: %s may damage your hardware! Type \"quit\" for exit!\n\n", PACKAGE );
printf( "Type \"help\" for help.\n\n" );
if (!tap_init()) {
printf( "TAP initialization failed! Exiting.\n" );
return 1;
}
tap_set_trst( 0 );
tap_set_trst( 1 );
for (;;) {
char *t;
@ -106,7 +100,70 @@ main( void )
continue;
}
if (strcmp( t, "cable" ) == 0) {
unsigned int port;
t = get_token( NULL );
if (!t) {
printf( "Missing argument(s)\n" );
continue;
}
if (strcmp( t, "parallel" ) != 0) {
printf( "syntax error!\n" );
continue;
}
t = get_token( NULL );
if (!t) {
printf( "Missing argument(s)\n" );
continue;
}
if ((sscanf( t, "0x%x", &port ) != 1) && (sscanf( t, "%d", &port ) != 1)) {
printf( "syntax error\n" );
continue;
}
t = get_token( NULL );
if (!t) {
printf( "Missing argument(s)\n" );
continue;
}
if (get_token( NULL )) {
printf( "syntax error!\n" );
continue;
}
if (strcmp( t, "none" ) == 0) {
printf( "Changed cable to 'none'\n" );
cable = NULL;
} else if (strcmp( t, "EA253" ) == 0) {
cable = &ea253_cable_driver;
if (!cable->init( port )) {
cable = NULL;
}
} else {
printf( "Unknown cable: %s\n", t );
continue;
}
if (cable) {
cable->set_trst( 0 );
cable->set_trst( 1 );
tap_reset();
}
continue;
}
if (strcmp( t, "discovery" ) == 0) {
if (!cable) {
printf( "Error: Cable not configured. Use 'cable' command first!\n" );
continue;
}
t = get_token( NULL );
if (!t) {
printf( "discovery: missing filename\n" );
@ -121,9 +178,14 @@ main( void )
}
if (strcmp( t, "detect" ) == 0) {
if (!cable) {
printf( "Error: Cable not configured. Use 'cable' command first!\n" );
continue;
}
t = get_token( NULL );
if (ps)
parts_free( ps );
parts_free( ps );
ps = detect_parts( JTAG_DATA_DIR );
if (!ps->len)
continue;
@ -144,6 +206,11 @@ main( void )
int msbin = 0;
uint32_t addr = 0;
if (!cable) {
printf( "Error: Cable not configured. Use 'cable' command first!\n" );
continue;
}
if (!ps) {
printf( "Run \"detect\" first.\n" );
continue;
@ -192,6 +259,11 @@ main( void )
uint32_t addr = 0;
uint32_t len = 0;
if (!cable) {
printf( "Error: Cable not configured. Use 'cable' command first!\n" );
continue;
}
if (!ps) {
printf( "Run \"detect\" first.\n" );
continue;
@ -242,6 +314,11 @@ main( void )
}
if (strcmp( t, "detectflash" ) == 0) {
if (!cable) {
printf( "Error: Cable not configured. Use 'cable' command first!\n" );
continue;
}
if (!ps) {
printf( "Run \"detect\" first.\n" );
continue;
@ -252,6 +329,11 @@ main( void )
}
if (strcmp( t, "print" ) == 0) {
if (!cable) {
printf( "Error: Cable not configured. Use 'cable' command first!\n" );
continue;
}
parts_print( ps, 1 );
continue;
}
@ -259,6 +341,11 @@ main( void )
if (strcmp( t, "instruction" ) == 0) {
int n;
if (!cable) {
printf( "Error: Cable not configured. Use 'cable' command first!\n" );
continue;
}
if (!ps) {
printf( "Run \"detect\" first.\n" );
continue;
@ -293,6 +380,11 @@ main( void )
}
if (strcmp( t, "shift" ) == 0) {
if (!cable) {
printf( "Error: Cable not configured. Use 'cable' command first!\n" );
continue;
}
t = get_token( NULL );
if (t && (strcmp( t, "ir" ) == 0)) {
@ -312,6 +404,11 @@ main( void )
if (strcmp( t, "dr" ) == 0) {
int n;
if (!cable) {
printf( "Error: Cable not configured. Use 'cable' command first!\n" );
continue;
}
if (!ps) {
printf( "Run \"detect\" first.\n" );
continue;
@ -355,8 +452,14 @@ main( void )
free( line );
parts_free( ps );
tap_reset();
tap_done();
if (cable) {
cable->set_trst( 0 );
cable->set_trst( 1 );
tap_reset();
cable->done();
cable = NULL;
}
return 0;
}

@ -24,9 +24,9 @@
noinst_LIBRARIES = libtap.a
libtap_a_SOURCES = \
ctrl.c \
tap.c \
register.c \
state.c
state.c \
cable/ea253.c
INCLUDES = -I$(top_srcdir)/include
INCLUDES = -I$(top_srcdir)/include $(OPENWINCE_INC)

@ -1,7 +1,7 @@
/*
* $Id$
*
* Copyright (C) 2002 ETC s.r.o.
* Copyright (C) 2002, 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
@ -18,21 +18,21 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Written by Marcel Telka <marcel@telka.sk>, 2002.
* Written by Marcel Telka <marcel@telka.sk>, 2002, 2003.
*
*/
#include <stdio.h>
#include <sys/io.h>
#include "ctrl.h"
#include "cable.h"
#include "state.h"
/*
* data D[7:0] (pins 9:2)
*/
#define TCK 0
#define TDI 1
#define TDI 0
#define TCK 1
#define TMS 2
#define TRST 4
@ -43,15 +43,16 @@
* 4 - SEL (pin 13)
* 3 - ERROR (pin 15)
*/
#define TDO 7
#define TDO 4
static unsigned short int port = 0x378;
static unsigned int port;
int
tap_init( void )
static int
ea253_init( unsigned int aport )
{
tap_state_init();
printf( "Initilizing parallel TAP on port 0x%x\n", port );
port = aport;
printf( "Initilizing cable EA253 on parallel port at 0x%x\n", port );
if (ioperm( port, 2, 1 )) {
printf( "Error: Initialization failed!\n" );
return 0;
@ -61,16 +62,16 @@ tap_init( void )
return 1;
}
void
tap_done( void )
static void
ea253_done( void )
{
ioperm( port, 2, 0 );
tap_state_done();
}
void
tap_clock( int tms, int tdi )
static void
ea253_clock( int tms, int tdi )
{
int trst = tap_state_get_trst();
@ -83,16 +84,24 @@ tap_clock( int tms, int tdi )
tap_state_clock( tms );
}
int
tap_get_tdo( void )
static int
ea253_get_tdo( void )
{
outb( (tap_state_get_trst() << TRST) | (0 << TCK), port );
return ((inb( port + 1 ) ^ 0x80) >> TDO) & 1; /* BUSY is inverted */
}
void
tap_set_trst( int new_trst )
static void
ea253_set_trst( int new_trst )
{
tap_state_set_trst( new_trst );
outb( (new_trst & 1) << TRST, port );
}
cable_driver_t ea253_cable_driver = {
ea253_init,
ea253_done,
ea253_clock,
ea253_get_tdo,
ea253_set_trst
};

@ -26,7 +26,7 @@
#include "state.h"
static int state = Unknown_State;
static int trst = 0;
static int trst = 1;
int
tap_state( void )

@ -26,7 +26,7 @@
#include "register.h"
#include "tap.h"
#include "ctrl.h"
#include "cable.h"
#include "state.h"
void

Loading…
Cancel
Save