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

* include/cable.h: Unified and simplified cable driver handling, added driver name
		and driver description into driver interface structure.
	* src/help.c (help): Ditto.
	* src/jtag.c (main): Ditto.
	* src/tap/Makefile.am: Ditto.
	* src/tap/cable.c: Ditto.
	* src/tap/cable/dlc5.c: Ditto.
	* src/tap/cable/ea253.c: Ditto.
	* src/tap/cable/ei012.c: Ditto.


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

@ -1,3 +1,15 @@
2003-01-08 Marcel Telka <marcel@telka.sk>
* include/cable.h: Unified and simplified cable driver handling, added driver name
and driver description into driver interface structure.
* src/help.c (help): Ditto.
* src/jtag.c (main): Ditto.
* src/tap/Makefile.am: Ditto.
* src/tap/cable.c: Ditto.
* src/tap/cable/dlc5.c: Ditto.
* src/tap/cable/ea253.c: Ditto.
* src/tap/cable/ei012.c: Ditto.
2003-01-08 Marcel Telka <marcel@telka.sk>
* include/cable.h: Added cable driver for ETC EI012 JTAG Cable.

@ -29,6 +29,8 @@
#include <stdint.h>
typedef struct {
const char *name;
const char *description;
int (*init)( unsigned int );
void (*done)( void );
void (*clock)( int, int );
@ -41,8 +43,6 @@ extern cable_driver_t *cable;
#define tap_get_tdo cable->get_tdo
#define tap_set_trst cable->set_trst
extern cable_driver_t ea253_cable_driver;
extern cable_driver_t dlc5_cable_driver;
extern cable_driver_t ei012_cable_driver;
extern cable_driver_t *cable_drivers[];
#endif /* CABLE_H */

@ -29,6 +29,8 @@
#include <stdio.h>
#include <string.h>
#include "cable.h"
void
help( const char *cmd )
{
@ -62,7 +64,9 @@ 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)
else if (strcmp( cmd, "cable" ) == 0) {
int i;
printf(
"Usage: cable parallel PORTADDR CABLE\n"
"Select JTAG cable connected to parallel port.\n"
@ -72,11 +76,11 @@ help( const char *cmd )
"\n"
"List of supported cables:\n"
"none No cable connected\n"
"DLC5 Xilinx DLC5 JTAG Parallel Cable III\n"
"EA253 ETC EA253 JTAG Cable\n"
"EI012 ETC EI012 JTAG Cable\n"
);
else if (strcmp( cmd, "detect" ) == 0)
for (i = 0; cable_drivers[i]; i++)
printf( "%-11s%s\n", cable_drivers[i]->name, cable_drivers[i]->description );
} else if (strcmp( cmd, "detect" ) == 0)
printf(
"Usage: detect\n"
"Detect parts on the JTAG chain.\n"

@ -101,6 +101,7 @@ main( void )
}
if (strcmp( t, "cable" ) == 0) {
int i;
unsigned int port;
t = get_token( NULL );
@ -137,33 +138,30 @@ main( void )
if (strcmp( t, "none" ) == 0) {
printf( "Changed cable to 'none'\n" );
cable = NULL;
} else if (strcmp( t, "DLC5" ) == 0) {
cable = &dlc5_cable_driver;
if (!cable->init( port ))
cable = NULL;
} else if (strcmp( t, "EA253" ) == 0) {
cable = &ea253_cable_driver;
if (!cable->init( port ))
cable = NULL;
} else if (strcmp( t, "EI012" ) == 0) {
cable = &ei012_cable_driver;
if (!cable->init( port ))
cable = NULL;
} else {
printf( "Unknown cable: %s\n", t );
continue;
}
for (i = 0; cable_drivers[i]; i++)
if (strcmp( t, cable_drivers[i]->name ) == 0)
break;
if (cable) {
cable->set_trst( 0 );
cable->set_trst( 1 );
if (!cable_drivers[i]) {
printf( "Unknown cable: %s\n", t );
continue;
}
tap_reset();
cable = cable_drivers[i];
printf( "Initilizing %s on parallel port at 0x%x\n", cable->description, port );
if (!cable->init( port )) {
printf( "Error: Cable driver initialization failed!\n" );
cable = NULL;
continue;
}
cable->set_trst( 0 );
cable->set_trst( 1 );
tap_reset();
continue;
}

@ -27,6 +27,7 @@ libtap_a_SOURCES = \
tap.c \
register.c \
state.c \
cable.c \
cable/dlc5.c \
cable/ea253.c \
cable/ei012.c

@ -0,0 +1,36 @@
/*
* $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.
*
*/
#include "cable.h"
extern cable_driver_t dlc5_cable_driver;
extern cable_driver_t ea253_cable_driver;
extern cable_driver_t ei012_cable_driver;
cable_driver_t *cable_drivers[] = {
&dlc5_cable_driver,
&ea253_cable_driver,
&ei012_cable_driver,
NULL /* last must be NULL */
};

@ -27,7 +27,6 @@
*
*/
#include <stdio.h>
#include <sys/io.h>
#include "cable.h"
@ -60,13 +59,7 @@ dlc5_init( unsigned int aport )
{
tap_state_init();
port = aport;
printf( "Initilizing Xilinx DLC5 JTAG Parallel Cable III on parallel port at 0x%x\n", port );
if (ioperm( port, 2, 1 )) {
printf( "Error: Initialization failed!\n" );
return 0;
}
return 1;
return !ioperm( port, 2, 1 );
}
static void
@ -102,6 +95,8 @@ dlc5_set_trst( int new_trst )
}
cable_driver_t dlc5_cable_driver = {
"DLC5",
"Xilinx DLC5 JTAG Parallel Cable III",
dlc5_init,
dlc5_done,
dlc5_clock,

@ -23,7 +23,6 @@
*
*/
#include <stdio.h>
#include <sys/io.h>
#include "cable.h"
@ -53,11 +52,8 @@ ea253_init( unsigned int aport )
{
tap_state_init();
port = aport;
printf( "Initilizing cable EA253 on parallel port at 0x%x\n", port );
if (ioperm( port, 2, 1 )) {
printf( "Error: Initialization failed!\n" );
if (ioperm( port, 2, 1 ))
return 0;
}
tap_state_set_trst( (inb( port ) >> TRST) & 1 );
return 1;
@ -100,6 +96,8 @@ ea253_set_trst( int new_trst )
}
cable_driver_t ea253_cable_driver = {
"EA253",
"ETC EA253 JTAG Cable",
ea253_init,
ea253_done,
ea253_clock,

@ -53,11 +53,8 @@ ei012_init( unsigned int aport )
{
tap_state_init();
port = aport;
printf( "Initilizing ETC EI012 JTAG Cable on parallel port at 0x%x\n", port );
if (ioperm( port, 2, 1 )) {
printf( "Error: Initialization failed!\n" );
if (ioperm( port, 2, 1 ))
return 0;
}
tap_state_set_trst( (inb( port ) >> TRST) & 1 );
return 1;
@ -100,6 +97,8 @@ ei012_set_trst( int new_trst )
}
cable_driver_t ei012_cable_driver = {
"EI012",
"ETC EI012 JTAG Cable",
ei012_init,
ei012_done,
ei012_clock,

Loading…
Cancel
Save