diff --git a/jtag/ChangeLog b/jtag/ChangeLog index bd34ff32..3fadb6e6 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,9 @@ +2003-04-01 Marcel Telka + + * src/tap/cable/keithkoep.c: New file. + * src/tap/Makefile.am (libtap_a_SOURCES): Added cable/keithkoep.c. + * src/tap/cable.c (cable_drivers): Added keithkoep_cable_driver. + 2003-03-19 Marcel Telka Version 0.3.1 released. diff --git a/jtag/NEWS b/jtag/NEWS index 2f99c72c..7b48c695 100644 --- a/jtag/NEWS +++ b/jtag/NEWS @@ -1,5 +1,7 @@ $Id$ + * Added driver for Keith & Koep JTAG Cable. + jtag-0.3.1 (2003-03-19): * Added support for Intel PXA255 A0 (thanks to Mike Sprauve). diff --git a/jtag/README b/jtag/README index a5256174..11f1acb4 100644 --- a/jtag/README +++ b/jtag/README @@ -40,6 +40,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 +- Keith & Koep JTAG Cable - Mpcbdm JTAG Cable - Macraigor Wiggler JTAG Cable diff --git a/jtag/src/tap/Makefile.am b/jtag/src/tap/Makefile.am index cfb57839..a9d0ff99 100644 --- a/jtag/src/tap/Makefile.am +++ b/jtag/src/tap/Makefile.am @@ -39,5 +39,6 @@ libtap_a_SOURCES = \ cable/dlc5.c \ cable/ea253.c \ cable/ei012.c \ + cable/keithkoep.c \ cable/mpcbdm.c \ cable/wiggler.c diff --git a/jtag/src/tap/cable.c b/jtag/src/tap/cable.c index 993a5114..8cd7837c 100644 --- a/jtag/src/tap/cable.c +++ b/jtag/src/tap/cable.c @@ -38,6 +38,7 @@ 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 keithkoep_cable_driver; extern cable_driver_t mpcbdm_cable_driver; extern cable_driver_t wiggler_cable_driver; @@ -49,6 +50,7 @@ cable_driver_t *cable_drivers[] = { &dlc5_cable_driver, &ea253_cable_driver, &ei012_cable_driver, + &keithkoep_cable_driver, &mpcbdm_cable_driver, &wiggler_cable_driver, NULL /* last must be NULL */ diff --git a/jtag/src/tap/cable/keithkoep.c b/jtag/src/tap/cable/keithkoep.c new file mode 100644 index 00000000..e4e0953c --- /dev/null +++ b/jtag/src/tap/cable/keithkoep.c @@ -0,0 +1,113 @@ +/* + * $Id$ + * + * Keith & Koep 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] ftp://www.keith-koep.com/pub/arm-tools/jtag/jtag05_sch.pdf + * + */ + +#include "cable.h" +#include "parport.h" +#include "chain.h" + +#include "generic.h" + + +/* + * data D[7:0] (pins 9:2) + */ +#define TDI 0 +#define TCK 1 +#define TMS 2 + +/* + * 7 - BUSY (pin 11) + * 6 - ACK (pin 10) + * 5 - PE (pin 12) + * 4 - SEL (pin 13) + * 3 - ERROR (pin 15) + */ +#define TDO 5 + +/* + * 0 - STROBE (pin 1) + * 1 - AUTOFD (pin 14) + * 2 - INIT (pin 16) + * 3 - SELIN (pin 17) + */ +#define TRST 0 + +static int +keithkoep_init( cable_t *cable ) +{ + if (parport_open( cable->port )) + return -1; + + parport_set_control( cable->port, 1 << TRST ); + PARAM_TRST(cable) = 1; + + return 0; +} + +static void +keithkoep_clock( cable_t *cable, int tms, int tdi ) +{ + tms = tms ? 1 : 0; + tdi = tdi ? 1 : 0; + + parport_set_data( cable->port, (0 << TCK) | (tms << TMS) | (tdi << TDI) ); + cable_wait(); + parport_set_data( cable->port, (1 << TCK) | (tms << TMS) | (tdi << TDI) ); + cable_wait(); +} + +static int +keithkoep_get_tdo( cable_t *cable ) +{ + parport_set_data( cable->port, 0 << TCK ); + cable_wait(); + return (parport_get_status( cable->port ) >> TDO) & 1; +} + +static int +keithkoep_set_trst( cable_t *cable, int trst ) +{ + PARAM_TRST(cable) = trst ? 1 : 0; + + parport_set_control( cable->port, PARAM_TRST(cable) << TRST ); + return PARAM_TRST(cable); +} + +cable_driver_t keithkoep_cable_driver = { + "KeithKoep", + "Keith & Koep JTAG cable", + generic_connect, + generic_disconnect, + generic_cable_free, + keithkoep_init, + generic_done, + keithkoep_clock, + keithkoep_get_tdo, + keithkoep_set_trst, + generic_get_trst +};