From 516caa46b06946820ad6548455080539d9591266 Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Fri, 20 Aug 2004 03:54:52 +0000 Subject: [PATCH] 2004-08-20 Marcel Telka * src/tap/Makefile.am (libtap_a_SOURCES): Added cable/lattice.c. * src/tap/cable.c (cable_drivers): Added lattice_cable_driver (patch 1012138, Jerome Debard). * src/tap/cable/lattice.c: New file (patch 1012138, Jerome Debard). git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@609 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 6 +++ jtag/NEWS | 1 + jtag/README | 1 + jtag/THANKS | 1 + jtag/src/tap/Makefile.am | 1 + jtag/src/tap/cable.c | 2 + jtag/src/tap/cable/lattice.c | 102 +++++++++++++++++++++++++++++++++++ 7 files changed, 114 insertions(+) create mode 100644 jtag/src/tap/cable/lattice.c diff --git a/jtag/ChangeLog b/jtag/ChangeLog index c771b6b4..ec34bf07 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,9 @@ +2004-08-20 Marcel Telka + + * src/tap/Makefile.am (libtap_a_SOURCES): Added cable/lattice.c. + * src/tap/cable.c (cable_drivers): Added lattice_cable_driver (patch 1012138, Jerome Debard). + * src/tap/cable/lattice.c: New file (patch 1012138, Jerome Debard). + 2004-08-19 Marcel Telka * src/bus/Makefile.am (libbus_a_SOURCES): Added tx4925.c (patch 972625, Andrew Dyer). diff --git a/jtag/NEWS b/jtag/NEWS index e60cdece..304565cf 100644 --- a/jtag/NEWS +++ b/jtag/NEWS @@ -14,6 +14,7 @@ See libbrux/NEWS for more news. - Motorola MPC824x - AMD Alchemy Solutions Au1500 (patch 853883, Zhang Wei) - Toshiba TX4925 (patch 972625, Andrew Dyer) + * Added support for Lattice Parallel Port JTAG Cable (patch 1012138, Jerome Debard). * Added new command 'salias'. * Explicit 'detectflash' command call is required before 'flashmem' command. * Fixed minor bugs (including bug 857039). diff --git a/jtag/README b/jtag/README index 226f353e..95ae221d 100644 --- a/jtag/README +++ b/jtag/README @@ -36,6 +36,7 @@ JTAG adapters/cables (see 'help cable' command for more info): - ETC EA253 JTAG Cable - ETC EI012 JTAG Cable - Keith & Koep JTAG Cable +- Lattice Parallel Port JTAG Cable - Mpcbdm JTAG Cable - Ka-Ro TRITON (PXA255/250) JTAG Cable - Macraigor Wiggler JTAG Cable diff --git a/jtag/THANKS b/jtag/THANKS index f00b89e4..02dcf0f6 100644 --- a/jtag/THANKS +++ b/jtag/THANKS @@ -6,6 +6,7 @@ Beregnyei Balazs Martin Buck Ian Campbell Alex (d18c7db) +Jerome Debard Rainer Dörken Andrew Dyer Chris Ellec diff --git a/jtag/src/tap/Makefile.am b/jtag/src/tap/Makefile.am index 4672e924..0fb0366e 100644 --- a/jtag/src/tap/Makefile.am +++ b/jtag/src/tap/Makefile.am @@ -42,6 +42,7 @@ libtap_a_SOURCES = \ cable/ea253.c \ cable/ei012.c \ cable/keithkoep.c \ + cable/lattice.c \ cable/mpcbdm.c \ cable/triton.c \ cable/wiggler.c diff --git a/jtag/src/tap/cable.c b/jtag/src/tap/cable.c index c121fa02..d84204b2 100644 --- a/jtag/src/tap/cable.c +++ b/jtag/src/tap/cable.c @@ -37,6 +37,7 @@ 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 lattice_cable_driver; extern cable_driver_t mpcbdm_cable_driver; extern cable_driver_t triton_cable_driver; extern cable_driver_t wiggler_cable_driver; @@ -50,6 +51,7 @@ cable_driver_t *cable_drivers[] = { &ea253_cable_driver, &ei012_cable_driver, &keithkoep_cable_driver, + &lattice_cable_driver, &mpcbdm_cable_driver, &triton_cable_driver, &wiggler_cable_driver, diff --git a/jtag/src/tap/cable/lattice.c b/jtag/src/tap/cable/lattice.c new file mode 100644 index 00000000..9dc5813d --- /dev/null +++ b/jtag/src/tap/cable/lattice.c @@ -0,0 +1,102 @@ +/* + * $Id$ + * + * Lattice 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. + * + */ + +#include "sysdep.h" + +#include "cable.h" +#include "parport.h" +#include "chain.h" + +#include "generic.h" + +/* + * 0 - STROBE (pin 1) + * 1 - AUTOFD (pin 14) + * 2 - INIT (pin 16) + * 3 - SELECT (pin 17) + * data D[7:0] (pins 9:2) + * 7 - BUSY (pin 11) + * 6 - ACK (pin 10) + * 5 - PE (pin 12) + * 4 - SEL (pin 13) + * 3 - ERROR (pin 15) + */ +#define TDI 0 +#define TCK 1 +#define TMS 2 +#define TRST 4 +#define TDO 6 + + +static int +lattice_init( cable_t *cable ) +{ + if (parport_open( cable->port )) + return -1; + + PARAM_TRST(cable) = 1; + + return 0; +} + +static void +lattice_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) | (1 << TRST) ); + cable_wait(); + parport_set_data( cable->port, (1 << TCK) | (tms << TMS) | (tdi << TDI) | (1 << TRST) ); + cable_wait(); +} + +static int +lattice_get_tdo( cable_t *cable ) +{ + parport_set_data( cable->port, (0 << TCK) | (1 << TRST) ); + cable_wait(); + return (parport_get_status( cable->port ) >> TDO) & 1; +} + +static int +lattice_set_trst( cable_t *cable, int trst ) +{ + return parport_set_data( cable->port, trst << TRST ); +} + +cable_driver_t lattice_cable_driver = { + "Lattice", + N_("Lattice Parallel Port JTAG Cable"), + generic_connect, + generic_disconnect, + generic_cable_free, + lattice_init, + generic_done, + lattice_clock, + lattice_get_tdo, + lattice_set_trst, + generic_get_trst +};