diff --git a/jtag/ChangeLog b/jtag/ChangeLog index ba942c74..6eca6eea 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,9 @@ +2003-01-11 Marcel Telka + + * src/tap/cable/wiggler.c: Added support for Macraigor Wiggler JTAG Cable (Stas Khirman). + * src/tap/cable.c: Ditto. + * src/tap/Makefile.am: Ditto. + 2003-01-10 Marcel Telka * src/tap/cable.c: Added missing stdlib.h include (bug 665923). Thanks to Chris Ellec. diff --git a/jtag/NEWS b/jtag/NEWS index 29a31bf3..830650d3 100644 --- a/jtag/NEWS +++ b/jtag/NEWS @@ -1,6 +1,7 @@ $Id$ * Fixed compile error (bug 665923, thanks to Chris Ellec). + * Added support for Macraigor Wiggler JTAG Cable (Stas Khirman). * Minor fixes. jtag-0.2 (2003-01-08): diff --git a/jtag/README b/jtag/README index 70faf728..a3add486 100644 --- a/jtag/README +++ b/jtag/README @@ -38,6 +38,7 @@ JTAG adapters/cables (see 'help cable' command for more info): - Xilinx DLC5 JTAG Parallel Cable III - ETC EA253 JTAG Cable - ETC EI012 JTAG Cable +- Macraigor Wiggler JTAG Cable JTAG-aware parts (chips): - Atmel ATmega128 (partial support) diff --git a/jtag/THANKS b/jtag/THANKS index 47f3613f..8e4110bd 100644 --- a/jtag/THANKS +++ b/jtag/THANKS @@ -1,6 +1,4 @@ $Id$ -jtag-0.1 --------- - -Thanks to Holger Schurig for suggestion about readmem functionality and his feedback. +Holger Schurig +Stas Khirman diff --git a/jtag/src/tap/Makefile.am b/jtag/src/tap/Makefile.am index 1b5ef1b2..ae2214e0 100644 --- a/jtag/src/tap/Makefile.am +++ b/jtag/src/tap/Makefile.am @@ -30,6 +30,7 @@ libtap_a_SOURCES = \ cable.c \ cable/dlc5.c \ cable/ea253.c \ - cable/ei012.c + cable/ei012.c \ + cable/wiggler.c INCLUDES = -I$(top_srcdir)/include $(OPENWINCE_INC) diff --git a/jtag/src/tap/cable.c b/jtag/src/tap/cable.c index 86638ec7..bb411cf9 100644 --- a/jtag/src/tap/cable.c +++ b/jtag/src/tap/cable.c @@ -29,10 +29,12 @@ 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[] = { &dlc5_cable_driver, &ea253_cable_driver, &ei012_cable_driver, + &wiggler_cable_driver, NULL /* last must be NULL */ }; diff --git a/jtag/src/tap/cable/wiggler.c b/jtag/src/tap/cable/wiggler.c new file mode 100644 index 00000000..3987d0cf --- /dev/null +++ b/jtag/src/tap/cable/wiggler.c @@ -0,0 +1,110 @@ +/* + * $Id$ + * + * Macraigor Wiggler JTAG 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] http://www.ocdemon.net/ + * [2] http://jtag-arm9.sourceforge.net/hardware.html + * + */ + +#include + +#include "cable.h" +#include "state.h" + +/* + * data D[7:0] (pins 9:2) + */ +#define TDI 3 +#define TCK 2 +#define TMS 1 +#define TRST 0 + +/* + * 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 +wiggler_init( unsigned int aport ) +{ + tap_state_init(); + port = aport; + if (ioperm( port, 2, 1 )) + return 0; + tap_state_set_trst( (inb( port ) >> TRST) & 1 ); + + return 1; +} + +static void +wiggler_done( void ) +{ + ioperm( port, 2, 0 ); + + tap_state_done(); +} + +static void +wiggler_clock( int tms, int tdi ) +{ + int trst = tap_state_get_trst(); + + tms &= 1; + tdi &= 1; + + outb( (trst << TRST) | (0 << TCK) | (tms << TMS) | (tdi << TDI), port ); + outb( (trst << TRST) | (1 << TCK) | (tms << TMS) | (tdi << TDI), port ); + + tap_state_clock( tms ); +} + +static int +wiggler_get_tdo( void ) +{ + outb( (tap_state_get_trst() << TRST) | (0 << TCK), port ); + return ((inb( port + 1 ) ^ 0x80) >> TDO) & 1; /* BUSY is inverted */ +} + +static void +wiggler_set_trst( int new_trst ) +{ + tap_state_set_trst( new_trst ); + outb( (new_trst & 1) << TRST, port ); +} + +cable_driver_t wiggler_cable_driver = { + "WIGGLER", + "Macraigor Wiggler JTAG Cable", + wiggler_init, + wiggler_done, + wiggler_clock, + wiggler_get_tdo, + wiggler_set_trst +};