From 4152bbcbf53fc8faac8bf733759d3f9a8abe2bd4 Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Sat, 11 Jan 2003 23:12:22 +0000 Subject: [PATCH] 2003-01-11 Marcel Telka * src/tap/cable/bytebaster.c: Added support for Altera ByteBlaster family cables. * src/tap/cable.c: Ditto. * src/tap/Makefile.am: Ditto. * src/help.c (help): Increased space for cable short name. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@310 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 7 +++ jtag/NEWS | 2 + jtag/README | 1 + jtag/src/help.c | 4 +- jtag/src/tap/Makefile.am | 1 + jtag/src/tap/cable.c | 2 + jtag/src/tap/cable/byteblaster.c | 105 +++++++++++++++++++++++++++++++ 7 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 jtag/src/tap/cable/byteblaster.c diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 6eca6eea..bfafc005 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,10 @@ +2003-01-11 Marcel Telka + + * src/tap/cable/bytebaster.c: Added support for Altera ByteBlaster family cables. + * src/tap/cable.c: Ditto. + * src/tap/Makefile.am: Ditto. + * src/help.c (help): Increased space for cable short name. + 2003-01-11 Marcel Telka * src/tap/cable/wiggler.c: Added support for Macraigor Wiggler JTAG Cable (Stas Khirman). diff --git a/jtag/NEWS b/jtag/NEWS index 830650d3..3b5f41eb 100644 --- a/jtag/NEWS +++ b/jtag/NEWS @@ -2,6 +2,8 @@ $Id$ * Fixed compile error (bug 665923, thanks to Chris Ellec). * Added support for Macraigor Wiggler JTAG Cable (Stas Khirman). + * Added support for Altera ByteBlaster/ByteBlaster II/ByteBlasterMV + Parallel Port Download Cable. * Minor fixes. jtag-0.2 (2003-01-08): diff --git a/jtag/README b/jtag/README index a3add486..5531f93d 100644 --- a/jtag/README +++ b/jtag/README @@ -35,6 +35,7 @@ Supported hardware ------------------ JTAG adapters/cables (see 'help cable' command for more info): +- Altera ByteBlaster/ByteBlaster II/ByteBlasterMV Parallel Port Download Cable - Xilinx DLC5 JTAG Parallel Cable III - ETC EA253 JTAG Cable - ETC EI012 JTAG Cable diff --git a/jtag/src/help.c b/jtag/src/help.c index 551f4112..24aa09fe 100644 --- a/jtag/src/help.c +++ b/jtag/src/help.c @@ -75,11 +75,11 @@ help( const char *cmd ) "CABLE cable type\n" "\n" "List of supported cables:\n" - "none No cable connected\n" + "none No cable connected\n" ); for (i = 0; cable_drivers[i]; i++) - printf( "%-11s%s\n", cable_drivers[i]->name, cable_drivers[i]->description ); + printf( "%-14s%s\n", cable_drivers[i]->name, cable_drivers[i]->description ); } else if (strcmp( cmd, "detect" ) == 0) printf( "Usage: detect\n" diff --git a/jtag/src/tap/Makefile.am b/jtag/src/tap/Makefile.am index ae2214e0..5a52d6a3 100644 --- a/jtag/src/tap/Makefile.am +++ b/jtag/src/tap/Makefile.am @@ -28,6 +28,7 @@ libtap_a_SOURCES = \ register.c \ state.c \ cable.c \ + cable/byteblaster.c \ cable/dlc5.c \ cable/ea253.c \ cable/ei012.c \ diff --git a/jtag/src/tap/cable.c b/jtag/src/tap/cable.c index bb411cf9..c49236bd 100644 --- a/jtag/src/tap/cable.c +++ b/jtag/src/tap/cable.c @@ -26,12 +26,14 @@ #include "cable.h" +extern cable_driver_t byteblaster_cable_driver; extern cable_driver_t dlc5_cable_driver; extern cable_driver_t ea253_cable_driver; extern cable_driver_t ei012_cable_driver; extern cable_driver_t wiggler_cable_driver; cable_driver_t *cable_drivers[] = { + &byteblaster_cable_driver, &dlc5_cable_driver, &ea253_cable_driver, &ei012_cable_driver, diff --git a/jtag/src/tap/cable/byteblaster.c b/jtag/src/tap/cable/byteblaster.c new file mode 100644 index 00000000..efa2eabe --- /dev/null +++ b/jtag/src/tap/cable/byteblaster.c @@ -0,0 +1,105 @@ +/* + * $Id$ + * + * Altera ByteBlaster/ByteBlaster II/ByteBlasterMV Parallel Port Download Cable Driver + * 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 + * 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 , 2002, 2003. + * + * Documentation: + * [1] Altera Corporation, "ByteBlaster Parallel Port Download Cable Data Sheet", + * February 1998, ver. 2.01, Order Number: A-DS-BYTE-02.01 + * [2] Altera Corporation, "ByteBlasterMV Parallel Port Download Cable Data Sheet", + * July 2002, Version 3.3, Order Number: DS-BYTBLMV-3.3 + * [3] Altera Corporation, "ByteBlaster II Parallel Port Download Cable Data Sheet", + * December 2002, Version 1.0, Order Number: DS-BYTEBLSTRII-1.0 L01-08739-00 + * + */ + +#include + +#include "cable.h" +#include "state.h" + +/* + * data D[7:0] (pins 9:2) + */ +#define TDI 6 +#define TCK 0 +#define TMS 1 + +/* + * 7 - BUSY (pin 11) + * 6 - ACK (pin 10) + * 5 - PE (pin 12) + * 4 - SEL (pin 13) + * 3 - ERROR (pin 15) + */ +#define TDO 7 + +static unsigned int port; + +static int +byteblaster_init( unsigned int aport ) +{ + tap_state_init(); + port = aport; + return !ioperm( port, 2, 1 ); +} + +static void +byteblaster_done( void ) +{ + ioperm( port, 2, 0 ); + + tap_state_done(); +} + +static void +byteblaster_clock( int tms, int tdi ) +{ + tms &= 1; + tdi &= 1; + + outb( (0 << TCK) | (tms << TMS) | (tdi << TDI), port ); + outb( (1 << TCK) | (tms << TMS) | (tdi << TDI), port ); + + tap_state_clock( tms ); +} + +static int +byteblaster_get_tdo( void ) +{ + outb( 0 << TCK, port ); + return ((inb( port + 1 ) ^ 0x80) >> TDO) & 1; /* BUSY is inverted */ +} + +static void +byteblaster_set_trst( int new_trst ) +{ +} + +cable_driver_t byteblaster_cable_driver = { + "ByteBlaster", + "Altera ByteBlaster/ByteBlaster II/ByteBlasterMV Parallel Port Download Cable", + byteblaster_init, + byteblaster_done, + byteblaster_clock, + byteblaster_get_tdo, + byteblaster_set_trst +};