This is an automated email from Gerrit. "zapb <d...@zapb.de>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/8350
-- gerrit commit 753c70601179f91f04dd86375f7bd559331c3e86 Author: Marc Schink <d...@zapb.de> Date: Wed Jun 12 22:08:48 2024 +0200 Drop parallel port adapters Parallel port adapters are deprected for at least one release and can be dropped now. Change-Id: I78a2922ac5b7a404f9d9f29273df0549c3980660 Signed-off-by: Marc Schink <d...@zapb.de> diff --git a/README b/README index 7d3f10def0..1ff4b46a59 100644 --- a/README +++ b/README @@ -261,13 +261,6 @@ file. It probably belongs somewhere in /etc/udev/rules.d, but consult your operating system documentation to be sure. Do not forget to add yourself to the "plugdev" group. -For parallel port adapters on GNU/Linux and FreeBSD please change your -"ppdev" (parport* or ppi*) device node permissions accordingly. - -For parport adapters on Windows you need to run install_giveio.bat -(it's also possible to use "ioperm" with Cygwin instead) to give -ordinary users permissions for accessing the "LPT" registers directly. - Compiling OpenOCD ----------------- @@ -310,18 +303,6 @@ For a more or less complete script that does all this for you, see contrib/cross-build.sh -Parallel Port Dongles ---------------------- - -If you want to access the parallel port using the PPDEV interface you -have to specify both --enable-parport AND --enable-parport-ppdev, since -the later option is an option to the parport driver. - -The same is true for the --enable-parport-giveio option, you have to -use both the --enable-parport AND the --enable-parport-giveio option -if you want to use giveio instead of ioperm parallel port access -method. - ========================== Obtaining OpenOCD From GIT diff --git a/configure.ac b/configure.ac index e003a293b2..097af17814 100644 --- a/configure.ac +++ b/configure.ac @@ -269,20 +269,6 @@ AC_ARG_ADAPTERS([ AC_ARG_ADAPTERS([DUMMY_ADAPTER],[no]) -AC_ARG_ENABLE([parport], - AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]), - [build_parport=$enableval], [build_parport=no]) - -AC_ARG_ENABLE([parport_ppdev], - AS_HELP_STRING([--disable-parport-ppdev], - [Disable use of ppdev (/dev/parportN) for parport (for x86 only)]), - [parport_use_ppdev=$enableval], [parport_use_ppdev=yes]) - -AC_ARG_ENABLE([parport_giveio], - AS_HELP_STRING([--enable-parport-giveio], - [Enable use of giveio for parport (for CygWin only)]), - [parport_use_giveio=$enableval], [parport_use_giveio=]) - AC_ARG_ENABLE([jtag_vpi], AS_HELP_STRING([--enable-jtag_vpi], [Enable building support for JTAG VPI]), [build_jtag_vpi=$enableval], [build_jtag_vpi=no]) @@ -295,10 +281,6 @@ AC_ARG_ENABLE([jtag_dpi], AS_HELP_STRING([--enable-jtag_dpi], [Enable building support for JTAG DPI]), [build_jtag_dpi=$enableval], [build_jtag_dpi=no]) -AC_ARG_ENABLE([amtjtagaccel], - AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]), - [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no]) - AS_CASE(["${host_cpu}"], [arm*|aarch64], [ AC_ARG_ENABLE([bcm2835gpio], @@ -332,10 +314,6 @@ AS_CASE(["${host_cpu}"], build_at91rm9200=no ]) -AC_ARG_ENABLE([gw16012], - AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]), - [build_gw16012=$enableval], [build_gw16012=no]) - AC_ARG_ENABLE([sysfsgpio], AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]), [build_sysfsgpio=$enableval], [build_sysfsgpio=no]) @@ -388,45 +366,21 @@ AC_ARG_ENABLE([remote-bitbang], AS_HELP_STRING([--enable-remote-bitbang], [Enable building support for the Remote Bitbang driver]), [build_remote_bitbang=$enableval], [build_remote_bitbang=no]) -AS_CASE(["${host_cpu}"], - [i?86|x86*], [], - [ - AS_IF([test "x$parport_use_ppdev" = "xno"], [ - AC_MSG_WARN([--disable-parport-ppdev is not supported by the host CPU]) - ]) - parport_use_ppdev=yes -]) - AS_CASE([$host], [*-cygwin*], [ is_win32=yes - parport_use_ppdev=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[return __MINGW32__;]])], [is_mingw=yes],[is_mingw=no]) AS_IF([test "x$is_mingw" = "xyes"], [ - AS_IF([test "x$parport_use_giveio" = "xno"], [ - AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts]) - ]) - parport_use_giveio=yes is_cygwin=no ], [ is_cygwin=yes - # sys/io.h needed under cygwin for parport access - AS_IF([test "x$build_parport" = "xyes"], [ - AC_CHECK_HEADERS([sys/io.h],[],AC_MSG_ERROR([Please install the cygwin ioperm package])) - ]) ]) ], [*-mingw* | *-msys*], [ is_mingw=yes is_win32=yes - parport_use_ppdev=no - - AS_IF([test "x$parport_use_giveio" = "xno"], [ - AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts]) - ]) - parport_use_giveio=yes AS_IF([test "x$enable_buspirate" = "xyes"], [ AC_MSG_ERROR([buspirate currently not supported by MinGW32 hosts]) @@ -439,17 +393,6 @@ AS_CASE([$host], ], [*darwin*], [ is_darwin=yes - - AS_IF([test "x$parport_use_giveio" = "xyes"], [ - AC_MSG_WARN([--enable-parport-giveio cannot be used by Darwin hosts]) - ]) - parport_use_giveio=no - ], - [ - AS_IF([test "x$parport_use_giveio" = "xyes"], [ - AC_MSG_WARN([--enable-parport-giveio cannot be used by ]$host[ hosts]) - ]) - parport_use_giveio=no ]) AS_IF([test "x$is_cygwin" = "xyes"], [ @@ -476,13 +419,6 @@ AS_IF([test "x$is_darwin" = "xyes"], [ AC_DEFINE([IS_DARWIN], [0], [0 if not building for Darwin.]) ]) -AS_IF([test "x$build_parport" = "xyes"], [ - build_bitbang=yes - AC_DEFINE([BUILD_PARPORT], [1], [1 if you want parport.]) -], [ - AC_DEFINE([BUILD_PARPORT], [0], [0 if you don't want parport.]) -]) - AS_IF([test "x$build_rshim" = "xyes"], [ AC_DEFINE([BUILD_RSHIM], [1], [1 if you want to debug BlueField SoC via rshim.]) ], [ @@ -534,18 +470,6 @@ AS_IF([test "x$build_am335xgpio" = "xyes"], [ AC_DEFINE([BUILD_AM335XGPIO], [0], [0 if you don't want am335xgpio.]) ]) -AS_IF([test "x$parport_use_ppdev" = "xyes"], [ - AC_DEFINE([PARPORT_USE_PPDEV], [1], [1 if you want parport to use ppdev.]) -], [ - AC_DEFINE([PARPORT_USE_PPDEV], [0], [0 if you don't want parport to use ppdev.]) -]) - -AS_IF([test "x$parport_use_giveio" = "xyes"], [ - AC_DEFINE([PARPORT_USE_GIVEIO], [1], [1 if you want parport to use giveio.]) -], [ - AC_DEFINE([PARPORT_USE_GIVEIO], [0], [0 if you don't want parport to use giveio.]) -]) - AS_IF([test "x$build_jtag_vpi" = "xyes"], [ AC_DEFINE([BUILD_JTAG_VPI], [1], [1 if you want JTAG VPI.]) ], [ @@ -565,18 +489,6 @@ AS_IF([test "x$build_jtag_dpi" = "xyes"], [ ]) -AS_IF([test "x$build_amtjtagaccel" = "xyes"], [ - AC_DEFINE([BUILD_AMTJTAGACCEL], [1], [1 if you want the Amontec JTAG-Accelerator driver.]) -], [ - AC_DEFINE([BUILD_AMTJTAGACCEL], [0], [0 if you don't want the Amontec JTAG-Accelerator driver.]) -]) - -AS_IF([test "x$build_gw16012" = "xyes"], [ - AC_DEFINE([BUILD_GW16012], [1], [1 if you want the Gateworks GW16012 driver.]) -], [ - AC_DEFINE([BUILD_GW16012], [0], [0 if you don't want the Gateworks GW16012 driver.]) -]) - AS_IF([test "x$enable_buspirate" != "xno"], [ AC_DEFINE([BUILD_BUSPIRATE], [1], [1 if you want the Buspirate JTAG driver.]) ], [ @@ -748,8 +660,6 @@ AS_IF([test "x$enable_esp_usb_jtag" != "xno"], [ ]) AM_CONDITIONAL([RELEASE], [test "x$build_release" = "xyes"]) -AM_CONDITIONAL([PARPORT], [test "x$build_parport" = "xyes"]) -AM_CONDITIONAL([GIVEIO], [test "x$parport_use_giveio" = "xyes"]) AM_CONDITIONAL([EP93XX], [test "x$build_ep93xx" = "xyes"]) AM_CONDITIONAL([AT91RM9200], [test "x$build_at91rm9200" = "xyes"]) AM_CONDITIONAL([BCM2835GPIO], [test "x$build_bcm2835gpio" = "xyes"]) @@ -760,8 +670,6 @@ AM_CONDITIONAL([JTAG_VPI], [test "x$build_jtag_vpi" = "xyes"]) AM_CONDITIONAL([VDEBUG], [test "x$build_vdebug" = "xyes"]) AM_CONDITIONAL([JTAG_DPI], [test "x$build_jtag_dpi" = "xyes"]) AM_CONDITIONAL([USB_BLASTER_DRIVER], [test "x$enable_usb_blaster" != "xno" -o "x$enable_usb_blaster_2" != "xno"]) -AM_CONDITIONAL([AMTJTAGACCEL], [test "x$build_amtjtagaccel" = "xyes"]) -AM_CONDITIONAL([GW16012], [test "x$build_gw16012" = "xyes"]) AM_CONDITIONAL([REMOTE_BITBANG], [test "x$build_remote_bitbang" = "xyes"]) AM_CONDITIONAL([BUSPIRATE], [test "x$enable_buspirate" != "xno"]) AM_CONDITIONAL([SYSFSGPIO], [test "x$build_sysfsgpio" = "xyes"]) @@ -848,12 +756,6 @@ AS_IF([test "x$enable_jlink" != "xno"], [ ]]) ) -AS_IF([test "x$build_parport" = "xyes" || test "x$build_amtjtagaccel" = "xyes" || test "x$build_gw16012" = "xyes"], [ - echo - echo - AC_MSG_WARN([Parallel port adapters are deprecated and support will be removed in the next release!]) -]) - echo echo echo OpenOCD configuration summary diff --git a/doc/manual/release.txt b/doc/manual/release.txt index d1a6c62507..00f45de2bd 100644 --- a/doc/manual/release.txt +++ b/doc/manual/release.txt @@ -334,7 +334,7 @@ git tag -m "The openocd-${PACKAGE_VERSION} release." "${PACKAGE_TAG}" configuring its contents, using them to build a copy of OpenOCD, and verifying that the result prints the correct release version in its startup banner. (For example, - "configure --enable-parport" + "configure --enable-ftdi" then "make" and run "src/openocd -v" as a sanity check.) -# Run <code>make docs</code> to create the documentation which will be published. diff --git a/doc/openocd.texi b/doc/openocd.texi index d487bfdde0..88763e54eb 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -527,56 +527,6 @@ debuggers to ARM Cortex based targets @url{http://www.keil.com/support/man/docs/ @* Link: @url{https://software-dl.ti.com/ccs/esd/documents/xdsdebugprobes/emu_xds_software_package_download.html#xds110-support-utilities} @end itemize -@section IBM PC Parallel Printer Port Based - -The two well-known ``JTAG Parallel Ports'' cables are the Xilinx DLC5 -and the Macraigor Wiggler. There are many clones and variations of -these on the market. - -Note that parallel ports are becoming much less common, so if you -have the choice you should probably avoid these adapters in favor -of USB-based ones. - -@itemize @bullet - -@item @b{Wiggler} - There are many clones of this. -@* Link: @url{http://www.macraigor.com/wiggler.htm} - -@item @b{DLC5} - From XILINX - There are many clones of this -@* Link: Search the web for: ``XILINX DLC5'' - it is no longer -produced, PDF schematics are easily found and it is easy to make. - -@item @b{Amontec - JTAG Accelerator} -@* Link: @url{http://www.amontec.com/jtag_accelerator.shtml} - -@item @b{Wiggler2} -@* Link: @url{http://www.ccac.rwth-aachen.de/~michaels/index.php/hardware/armjtag} - -@item @b{Wiggler_ntrst_inverted} -@* Yet another variation - See the source code, src/jtag/parport.c - -@item @b{old_amt_wiggler} -@* Unknown - probably not on the market today - -@item @b{arm-jtag} -@* Link: Most likely @url{http://www.olimex.com/dev/arm-jtag.html} [another wiggler clone] - -@item @b{chameleon} -@* Link: @url{http://www.amontec.com/chameleon.shtml} - -@item @b{Triton} -@* Unknown. - -@item @b{Lattice} -@* ispDownload from Lattice Semiconductor -@url{http://www.latticesemi.com/lit/docs/@/devtools/dlcable.pdf} - -@item @b{flashlink} -@* From STMicroelectronics; -@* Link: @url{http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATA_BRIEF/DM00039500.pdf} - -@end itemize - @section Other... @itemize @bullet @@ -1036,8 +986,8 @@ will help support users of any board using that chip. @item You may need to write some C code. -It may be as simple as supporting a new FT2232 or parport -based adapter; a bit more involved, like a NAND or NOR flash +It may be as simple as supporting a new FT2232 based adapter; +a bit more involved, like a NAND or NOR flash controller driver; or a big piece of work like supporting a new chip architecture. @end itemize @@ -2501,24 +2451,6 @@ Each of the interface drivers listed here must be explicitly enabled when OpenOCD is configured, in order to be made available at run time. -@deffn {Interface Driver} {amt_jtagaccel} -@b{Note: Parallel port adapters are deprecated and support will be removed in the next release!} - -Amontec Chameleon in its JTAG Accelerator configuration, -connected to a PC's EPP mode parallel port. -This defines some driver-specific commands: - -@deffn {Config Command} {parport port} number -Specifies either the address of the I/O port (default: 0x378 for LPT1) or -the number of the @file{/dev/parport} device. -@end deffn - -@deffn {Config Command} {rtck} [@option{enable}|@option{disable}] -Displays status of RTCK option. -Optionally sets that option first. -@end deffn -@end deffn - @deffn {Interface Driver} {angie} This is the NanoXplore's ANGIE USB-JTAG Adapter. @end deffn @@ -2922,20 +2854,6 @@ image. To be used with USB-Blaster II only. @end deffn -@deffn {Interface Driver} {gw16012} -@b{Note: Parallel port adapters are deprecated and support will be removed in the next release!} - -Gateworks GW16012 JTAG programmer. -This has one driver-specific command: - -@deffn {Config Command} {parport port} [port_number] -Display either the address of the I/O port -(default: 0x378 for LPT1) or the number of the @file{/dev/parport} device. -If a parameter is provided, first switch to use that port. -This is a write-once setting. -@end deffn -@end deffn - @deffn {Interface Driver} {jlink} SEGGER J-Link family of USB adapters. It currently supports JTAG and SWD transports. @@ -3070,107 +2988,6 @@ version, and target voltage. @end deffn @end deffn -@deffn {Interface Driver} {parport} -@b{Note: Parallel port adapters are deprecated and support will be removed in the next release!} - -Supports PC parallel port bit-banging cables: -Wigglers, PLD download cable, and more. -These interfaces have several commands, used to configure the driver -before initializing the JTAG scan chain: - -@deffn {Config Command} {parport cable} name -Set the layout of the parallel port cable used to connect to the target. -This is a write-once setting. -Currently valid cable @var{name} values include: - -@itemize @minus -@item @b{altium} Altium Universal JTAG cable. -@item @b{arm-jtag} Same as original wiggler except SRST and -TRST connections reversed and TRST is also inverted. -@item @b{chameleon} The Amontec Chameleon's CPLD when operated -in configuration mode. This is only used to -program the Chameleon itself, not a connected target. -@item @b{dlc5} The Xilinx Parallel cable III. -@item @b{flashlink} The ST Parallel cable. -@item @b{lattice} Lattice ispDOWNLOAD Cable -@item @b{old_amt_wiggler} The Wiggler configuration that comes with -some versions of -Amontec's Chameleon Programmer. The new version available from -the website uses the original Wiggler layout ('@var{wiggler}') -@item @b{triton} The parallel port adapter found on the -``Karo Triton 1 Development Board''. -This is also the layout used by the HollyGates design -(see @uref{http://www.lartmaker.nl/projects/jtag/}). -@item @b{wiggler} The original Wiggler layout, also supported by -several clones, such as the Olimex ARM-JTAG -@item @b{wiggler2} Same as original wiggler except an led is fitted on D5. -@item @b{wiggler_ntrst_inverted} Same as original wiggler except TRST is inverted. -@end itemize -@end deffn - -@deffn {Config Command} {parport port} [port_number] -Display either the address of the I/O port -(default: 0x378 for LPT1) or the number of the @file{/dev/parport} device. -If a parameter is provided, first switch to use that port. -This is a write-once setting. - -When using PPDEV to access the parallel port, use the number of the parallel port: -@option{parport port 0} (the default). If @option{parport port 0x378} is specified -you may encounter a problem. -@end deffn - -@deffn {Config Command} {parport toggling_time} [nanoseconds] -Displays how many nanoseconds the hardware needs to toggle TCK; -the parport driver uses this value to obey the -@command{adapter speed} configuration. -When the optional @var{nanoseconds} parameter is given, -that setting is changed before displaying the current value. - -The default setting should work reasonably well on commodity PC hardware. -However, you may want to calibrate for your specific hardware. -@quotation Tip -To measure the toggling time with a logic analyzer or a digital storage -oscilloscope, follow the procedure below: -@example -> parport toggling_time 1000 -> adapter speed 500 -@end example -This sets the maximum JTAG clock speed of the hardware, but -the actual speed probably deviates from the requested 500 kHz. -Now, measure the time between the two closest spaced TCK transitions. -You can use @command{runtest 1000} or something similar to generate a -large set of samples. -Update the setting to match your measurement: -@example -> parport toggling_time <measured nanoseconds> -@end example -Now the clock speed will be a better match for @command{adapter speed} -command given in OpenOCD scripts and event handlers. - -You can do something similar with many digital multimeters, but note -that you'll probably need to run the clock continuously for several -seconds before it decides what clock rate to show. Adjust the -toggling time up or down until the measured clock rate is a good -match with the rate you specified in the @command{adapter speed} command; -be conservative. -@end quotation -@end deffn - -@deffn {Config Command} {parport write_on_exit} (@option{on}|@option{off}) -This will configure the parallel driver to write a known -cable-specific value to the parallel interface on exiting OpenOCD. -@end deffn - -For example, the interface configuration file for a -classic ``Wiggler'' cable on LPT2 might look something like this: - -@example -adapter driver parport -parport port 0x278 -parport cable wiggler -@end example -@end deffn - @deffn {Interface Driver} {presto} ASIX PRESTO USB JTAG programmer. @end deffn diff --git a/src/jtag/drivers/Makefile.am b/src/jtag/drivers/Makefile.am index e404afe9f0..5ee2f02c62 100644 --- a/src/jtag/drivers/Makefile.am +++ b/src/jtag/drivers/Makefile.am @@ -64,9 +64,6 @@ endif if BITBANG DRIVERFILES += %D%/bitbang.c endif -if PARPORT -DRIVERFILES += %D%/parport.c -endif if DUMMY DRIVERFILES += %D%/dummy.c endif @@ -92,18 +89,12 @@ endif if FT232R DRIVERFILES += %D%/ft232r.c endif -if AMTJTAGACCEL -DRIVERFILES += %D%/amt_jtagaccel.c -endif if EP93XX DRIVERFILES += %D%/ep93xx.c endif if AT91RM9200 DRIVERFILES += %D%/at91rm9200.c endif -if GW16012 -DRIVERFILES += %D%/gw16012.c -endif if BITQ DRIVERFILES += %D%/bitq.c endif diff --git a/src/jtag/drivers/amt_jtagaccel.c b/src/jtag/drivers/amt_jtagaccel.c deleted file mode 100644 index 9b27c10f5f..0000000000 --- a/src/jtag/drivers/amt_jtagaccel.c +++ /dev/null @@ -1,592 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -/*************************************************************************** - * Copyright (C) 2005 by Dominic Rath * - * dominic.r...@gmx.de * - ***************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <jtag/adapter.h> -#include <jtag/interface.h> - -#if PARPORT_USE_PPDEV == 1 -#include <linux/parport.h> -#include <linux/ppdev.h> -#include <sys/ioctl.h> -#else /* not PARPORT_USE_PPDEV */ -#ifndef _WIN32 -#include <sys/io.h> -#endif -#endif - -#if PARPORT_USE_GIVEIO == 1 -#if IS_CYGWIN == 1 -#include <windows.h> -#endif -#endif - -/** - * @file - * Support the Amontec Chameleon POD with JTAG Accelerator support. - * This is a parallel port JTAG adapter with a CPLD between the - * parallel port and the JTAG connection. VHDL code running in the - * CPLD significantly accelerates JTAG operations compared to the - * bitbanging "Wiggler" style of most parallel port adapters. - */ - -/* configuration */ -static uint16_t amt_jtagaccel_port; - -/* interface variables - */ -static uint8_t aw_control_rst; -static uint8_t aw_control_fsm = 0x10; -static uint8_t aw_control_baudrate = 0x20; - -static int rtck_enabled; - -#if PARPORT_USE_PPDEV == 1 -static int device_handle; - -static const int addr_mode = IEEE1284_MODE_EPP | IEEE1284_ADDR; - -/* FIXME do something sane when these ioctl/read/write calls fail. */ - -#define AMT_AW(val) \ - do { \ - int __retval; \ - \ - __retval = ioctl(device_handle, PPSETMODE, &addr_mode); \ - assert(__retval >= 0); \ - __retval = write(device_handle, &val, 1); \ - assert(__retval >= 0); \ - } while (0) -#define AMT_AR(val) \ - do { \ - int __retval; \ - \ - __retval = ioctl(device_handle, PPSETMODE, &addr_mode); \ - assert(__retval >= 0); \ - __retval = read(device_handle, &val, 1); \ - assert(__retval >= 0); \ - } while (0) - -static const int data_mode = IEEE1284_MODE_EPP | IEEE1284_DATA; - -#define AMT_DW(val) \ - do { \ - int __retval; \ - \ - __retval = ioctl(device_handle, PPSETMODE, &data_mode); \ - assert(__retval >= 0); \ - __retval = write(device_handle, &val, 1); \ - assert(__retval >= 0); \ - } while (0) -#define AMT_DR(val) \ - do { \ - int __retval; \ - \ - __retval = ioctl(device_handle, PPSETMODE, &data_mode); \ - assert(__retval >= 0); \ - __retval = read(device_handle, &val, 1); \ - assert(__retval >= 0); \ - } while (0) - -#else - -#define AMT_AW(val) do { outb(val, amt_jtagaccel_port + 3); } while (0) -#define AMT_AR(val) do { val = inb(amt_jtagaccel_port + 3); } while (0) -#define AMT_DW(val) do { outb(val, amt_jtagaccel_port + 4); } while (0) -#define AMT_DR(val) do { val = inb(amt_jtagaccel_port + 4); } while (0) - -#endif /* PARPORT_USE_PPDEV */ - -/* tap_move[i][j]: tap movement command to go from state i to state j - * 0: Test-Logic-Reset - * 1: Run-Test/Idle - * 2: Shift-DR - * 3: Pause-DR - * 4: Shift-IR - * 5: Pause-IR - */ -static const uint8_t amt_jtagaccel_tap_move[6][6][2] = { - /* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */ - { {0x1f, 0x00}, {0x0f, 0x00}, {0x05, 0x00}, {0x0a, 0x00}, {0x06, 0x00}, {0x96, 0x00} }, /* RESET */ - { {0x1f, 0x00}, {0x00, 0x00}, {0x04, 0x00}, {0x05, 0x00}, {0x06, 0x00}, {0x0b, 0x00} }, /* IDLE */ - { {0x1f, 0x00}, {0x0d, 0x00}, {0x00, 0x00}, {0x01, 0x00}, {0x8f, 0x09}, {0x8f, 0x01} }, /* DRSHIFT */ - { {0x1f, 0x00}, {0x0c, 0x00}, {0x08, 0x00}, {0x00, 0x00}, {0x8f, 0x09}, {0x8f, 0x01} }, /* DRPAUSE */ - { {0x1f, 0x00}, {0x0d, 0x00}, {0x07, 0x00}, {0x97, 0x00}, {0x00, 0x00}, {0x01, 0x00} }, /* IRSHIFT */ - { {0x1f, 0x00}, {0x0c, 0x00}, {0x07, 0x00}, {0x97, 0x00}, {0x08, 0x00}, {0x00, 0x00} }, /* IRPAUSE */ -}; - -static void amt_jtagaccel_reset(int trst, int srst) -{ - if (trst == 1) - aw_control_rst |= 0x4; - else if (trst == 0) - aw_control_rst &= ~0x4; - - if (srst == 1) - aw_control_rst |= 0x1; - else if (srst == 0) - aw_control_rst &= ~0x1; - - AMT_AW(aw_control_rst); -} - -static int amt_jtagaccel_speed(int speed) -{ - aw_control_baudrate &= 0xf0; - aw_control_baudrate |= speed & 0x0f; - AMT_AW(aw_control_baudrate); - - return ERROR_OK; -} - -static void amt_jtagaccel_end_state(tap_state_t state) -{ - if (tap_is_state_stable(state)) - tap_set_end_state(state); - else { - LOG_ERROR("BUG: %i is not a valid end state", state); - exit(-1); - } -} - -static void amt_wait_scan_busy(void) -{ - int timeout = 4096; - uint8_t ar_status; - - AMT_AR(ar_status); - while (((ar_status) & 0x80) && (timeout-- > 0)) - AMT_AR(ar_status); - - if (ar_status & 0x80) { - LOG_ERROR( - "amt_jtagaccel timed out while waiting for end of scan, rtck was %s, last AR_STATUS: 0x%2.2x", - (rtck_enabled) ? "enabled" : "disabled", - ar_status); - exit(-1); - } -} - -static void amt_jtagaccel_state_move(void) -{ - uint8_t aw_scan_tms_5; - uint8_t tms_scan[2]; - - tap_state_t cur_state = tap_get_state(); - tap_state_t end_state = tap_get_end_state(); - - tms_scan[0] = amt_jtagaccel_tap_move[tap_move_ndx(cur_state)][tap_move_ndx(end_state)][0]; - tms_scan[1] = amt_jtagaccel_tap_move[tap_move_ndx(cur_state)][tap_move_ndx(end_state)][1]; - - aw_scan_tms_5 = 0x40 | (tms_scan[0] & 0x1f); - AMT_AW(aw_scan_tms_5); - int jtag_speed = 0; - int retval = adapter_get_speed(&jtag_speed); - assert(retval == ERROR_OK); - if (jtag_speed > 3 || rtck_enabled) - amt_wait_scan_busy(); - - if (tms_scan[0] & 0x80) { - aw_scan_tms_5 = 0x40 | (tms_scan[1] & 0x1f); - AMT_AW(aw_scan_tms_5); - if (jtag_speed > 3 || rtck_enabled) - amt_wait_scan_busy(); - } - - tap_set_state(end_state); -} - -static void amt_jtagaccel_runtest(int num_cycles) -{ - int i = 0; - uint8_t aw_scan_tms_5; - uint8_t aw_scan_tms_1to4; - - tap_state_t saved_end_state = tap_get_end_state(); - - /* only do a state_move when we're not already in IDLE */ - if (tap_get_state() != TAP_IDLE) { - amt_jtagaccel_end_state(TAP_IDLE); - amt_jtagaccel_state_move(); - } - - while (num_cycles - i >= 5) { - aw_scan_tms_5 = 0x40; - AMT_AW(aw_scan_tms_5); - i += 5; - } - - if (num_cycles - i > 0) { - aw_scan_tms_1to4 = 0x80 | ((num_cycles - i - 1) & 0x3) << 4; - AMT_AW(aw_scan_tms_1to4); - } - - amt_jtagaccel_end_state(saved_end_state); - if (tap_get_state() != tap_get_end_state()) - amt_jtagaccel_state_move(); -} - -static void amt_jtagaccel_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size) -{ - int bits_left = scan_size; - int bit_count = 0; - tap_state_t saved_end_state = tap_get_end_state(); - uint8_t aw_tdi_option; - uint8_t dw_tdi_scan; - uint8_t dr_tdo; - uint8_t aw_tms_scan; - uint8_t tms_scan[2]; - int jtag_speed_var; - int retval = adapter_get_speed(&jtag_speed_var); - assert(retval == ERROR_OK); - - if (ir_scan) - amt_jtagaccel_end_state(TAP_IRSHIFT); - else - amt_jtagaccel_end_state(TAP_DRSHIFT); - - /* Only move if we're not already there */ - if (tap_get_state() != tap_get_end_state()) - amt_jtagaccel_state_move(); - - amt_jtagaccel_end_state(saved_end_state); - - /* handle unaligned bits at the beginning */ - if ((scan_size - 1) % 8) { - aw_tdi_option = 0x30 | (((scan_size - 1) % 8) - 1); - AMT_AW(aw_tdi_option); - - dw_tdi_scan = buf_get_u32(buffer, bit_count, (scan_size - 1) % 8) & 0xff; - AMT_DW(dw_tdi_scan); - if (jtag_speed_var > 3 || rtck_enabled) - amt_wait_scan_busy(); - - if ((type == SCAN_IN) || (type == SCAN_IO)) { - AMT_DR(dr_tdo); - dr_tdo = dr_tdo >> (8 - ((scan_size - 1) % 8)); - buf_set_u32(buffer, bit_count, (scan_size - 1) % 8, dr_tdo); - } - - bit_count += (scan_size - 1) % 8; - bits_left -= (scan_size - 1) % 8; - } - - while (bits_left - 1 >= 8) { - dw_tdi_scan = buf_get_u32(buffer, bit_count, 8) & 0xff; - AMT_DW(dw_tdi_scan); - if (jtag_speed_var > 3 || rtck_enabled) - amt_wait_scan_busy(); - - if ((type == SCAN_IN) || (type == SCAN_IO)) { - AMT_DR(dr_tdo); - buf_set_u32(buffer, bit_count, 8, dr_tdo); - } - - bit_count += 8; - bits_left -= 8; - } - - tms_scan[0] = - amt_jtagaccel_tap_move[tap_move_ndx(tap_get_state())][tap_move_ndx(tap_get_end_state())][0]; - tms_scan[1] = - amt_jtagaccel_tap_move[tap_move_ndx(tap_get_state())][tap_move_ndx(tap_get_end_state())][1]; - aw_tms_scan = 0x40 | (tms_scan[0] & 0x1f) | (buf_get_u32(buffer, bit_count, 1) << 5); - AMT_AW(aw_tms_scan); - if (jtag_speed_var > 3 || rtck_enabled) - amt_wait_scan_busy(); - - if ((type == SCAN_IN) || (type == SCAN_IO)) { - AMT_DR(dr_tdo); - dr_tdo = dr_tdo >> 7; - buf_set_u32(buffer, bit_count, 1, dr_tdo); - } - - if (tms_scan[0] & 0x80) { - aw_tms_scan = 0x40 | (tms_scan[1] & 0x1f); - AMT_AW(aw_tms_scan); - if (jtag_speed_var > 3 || rtck_enabled) - amt_wait_scan_busy(); - } - tap_set_state(tap_get_end_state()); -} - -static int amt_jtagaccel_execute_queue(struct jtag_command *cmd_queue) -{ - struct jtag_command *cmd = cmd_queue; /* currently processed command */ - int scan_size; - enum scan_type type; - uint8_t *buffer; - int retval; - - /* return ERROR_OK, unless a jtag_read_buffer returns a failed check - * that wasn't handled by a caller-provided error handler - */ - retval = ERROR_OK; - - while (cmd) { - switch (cmd->type) { - case JTAG_RESET: - LOG_DEBUG_IO("reset trst: %i srst %i", - cmd->cmd.reset->trst, - cmd->cmd.reset->srst); - if (cmd->cmd.reset->trst == 1) - tap_set_state(TAP_RESET); - amt_jtagaccel_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst); - break; - case JTAG_RUNTEST: - LOG_DEBUG_IO("runtest %i cycles, end in %i", - cmd->cmd.runtest->num_cycles, - cmd->cmd.runtest->end_state); - amt_jtagaccel_end_state(cmd->cmd.runtest->end_state); - amt_jtagaccel_runtest(cmd->cmd.runtest->num_cycles); - break; - case JTAG_TLR_RESET: - LOG_DEBUG_IO("statemove end in %i", cmd->cmd.statemove->end_state); - amt_jtagaccel_end_state(cmd->cmd.statemove->end_state); - amt_jtagaccel_state_move(); - break; - case JTAG_SCAN: - LOG_DEBUG_IO("scan end in %i", cmd->cmd.scan->end_state); - amt_jtagaccel_end_state(cmd->cmd.scan->end_state); - scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer); - type = jtag_scan_type(cmd->cmd.scan); - amt_jtagaccel_scan(cmd->cmd.scan->ir_scan, type, buffer, scan_size); - if (jtag_read_buffer(buffer, cmd->cmd.scan) != ERROR_OK) - retval = ERROR_JTAG_QUEUE_FAILED; - free(buffer); - break; - case JTAG_SLEEP: - LOG_DEBUG_IO("sleep %" PRIu32, cmd->cmd.sleep->us); - jtag_sleep(cmd->cmd.sleep->us); - break; - default: - LOG_ERROR("BUG: unknown JTAG command type encountered"); - exit(-1); - } - cmd = cmd->next; - } - - return retval; -} - -#if PARPORT_USE_GIVEIO == 1 -int amt_jtagaccel_get_giveio_access(void) -{ - HANDLE h; - OSVERSIONINFO version; - - version.dwOSVersionInfoSize = sizeof(version); - if (!GetVersionEx(&version)) { - errno = EINVAL; - return -1; - } - if (version.dwPlatformId != VER_PLATFORM_WIN32_NT) - return 0; - - h = CreateFile("\\\\.\\giveio", - GENERIC_READ, - 0, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - if (h == INVALID_HANDLE_VALUE) { - errno = ENODEV; - return -1; - } - - CloseHandle(h); - - return 0; -} -#endif - -static int amt_jtagaccel_init(void) -{ -#if PARPORT_USE_PPDEV == 1 - char buffer[256]; - int i = 0; - uint8_t control_port; -#else - uint8_t status_port; -#endif - uint8_t ar_status; - - LOG_WARNING("Parallel port adapters are deprecated and support will be removed in the next release!"); - -#if PARPORT_USE_PPDEV == 1 - if (device_handle > 0) { - LOG_ERROR("device is already opened"); - return ERROR_JTAG_INIT_FAILED; - } - - snprintf(buffer, 256, "/dev/parport%d", amt_jtagaccel_port); - device_handle = open(buffer, O_RDWR); - - if (device_handle < 0) { - LOG_ERROR( - "cannot open device. check it exists and that user read and write rights are set"); - return ERROR_JTAG_INIT_FAILED; - } - - i = ioctl(device_handle, PPCLAIM); - if (i < 0) { - LOG_ERROR("cannot claim device"); - return ERROR_JTAG_INIT_FAILED; - } - - i = IEEE1284_MODE_EPP; - i = ioctl(device_handle, PPSETMODE, &i); - if (i < 0) { - LOG_ERROR(" cannot set compatible mode to device"); - return ERROR_JTAG_INIT_FAILED; - } - - control_port = 0x00; - i = ioctl(device_handle, PPWCONTROL, &control_port); - - control_port = 0x04; - i = ioctl(device_handle, PPWCONTROL, &control_port); - -#else - if (amt_jtagaccel_port == 0) { - amt_jtagaccel_port = 0x378; - LOG_WARNING("No parport port specified, using default '0x378' (LPT1)"); - } - -#if PARPORT_USE_GIVEIO == 1 - if (amt_jtagaccel_get_giveio_access() != 0) { -#else /* PARPORT_USE_GIVEIO */ - if (ioperm(amt_jtagaccel_port, 5, 1) != 0) { -#endif /* PARPORT_USE_GIVEIO */ - LOG_ERROR("missing privileges for direct i/o"); - return ERROR_JTAG_INIT_FAILED; - } - - /* prepare epp port - * clear timeout */ - status_port = inb(amt_jtagaccel_port + 1); - outb(status_port | 0x1, amt_jtagaccel_port + 1); - - /* reset epp port */ - outb(0x00, amt_jtagaccel_port + 2); - outb(0x04, amt_jtagaccel_port + 2); -#endif - - if (rtck_enabled) { - /* set RTCK enable bit */ - aw_control_fsm |= 0x02; - } - - /* enable JTAG port */ - aw_control_fsm |= 0x04; - AMT_AW(aw_control_fsm); - - enum reset_types jtag_reset_config = jtag_get_reset_config(); - if (jtag_reset_config & RESET_TRST_OPEN_DRAIN) - aw_control_rst &= ~0x8; - else - aw_control_rst |= 0x8; - - if (jtag_reset_config & RESET_SRST_PUSH_PULL) - aw_control_rst &= ~0x2; - else - aw_control_rst |= 0x2; - - amt_jtagaccel_reset(0, 0); - - /* read status register */ - AMT_AR(ar_status); - LOG_DEBUG("AR_STATUS: 0x%2.2x", ar_status); - - return ERROR_OK; -} - -static int amt_jtagaccel_quit(void) -{ - - return ERROR_OK; -} - -COMMAND_HANDLER(amt_jtagaccel_handle_parport_port_command) -{ - if (CMD_ARGC == 1) { - /* only if the port wasn't overwritten by cmdline */ - if (amt_jtagaccel_port == 0) { - uint16_t port; - COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], port); - amt_jtagaccel_port = port; - } else { - LOG_ERROR("The parport port was already configured!"); - return ERROR_FAIL; - } - } - - command_print(CMD, "parport port = %u", amt_jtagaccel_port); - - return ERROR_OK; -} - -COMMAND_HANDLER(amt_jtagaccel_handle_rtck_command) -{ - if (CMD_ARGC == 0) { - command_print(CMD, - "amt_jtagaccel RTCK feature %s", - (rtck_enabled) ? "enabled" : "disabled"); - return ERROR_OK; - } else { - if (strcmp(CMD_ARGV[0], "enabled") == 0) - rtck_enabled = 1; - else - rtck_enabled = 0; - } - - return ERROR_OK; -} - -static const struct command_registration amtjtagaccel_command_handlers[] = { - { - .name = "parport_port", - .handler = &amt_jtagaccel_handle_parport_port_command, - .mode = COMMAND_CONFIG, - .help = "configure or display the parallel port to use", - .usage = "[port_num]", - }, - { - /** - * @todo Remove this "rtck" command; just use the standard - * mechanism to enable/disable adaptive clocking. First - * implement the standard mechanism and deprecate "rtck"; - * after a year or so, it'll be safe to remove this. - */ - .name = "rtck", - .handler = &amt_jtagaccel_handle_rtck_command, - .mode = COMMAND_CONFIG, - .help = "configure or display RTCK support", - .usage = "[enable|disable]", - }, - COMMAND_REGISTRATION_DONE -}; - -static struct jtag_interface amt_jtagaccel_interface = { - .execute_queue = amt_jtagaccel_execute_queue, -}; - -struct adapter_driver amt_jtagaccel_adapter_driver = { - .name = "amt_jtagaccel", - .transports = jtag_only, - .commands = amtjtagaccel_command_handlers, - - .init = amt_jtagaccel_init, - .quit = amt_jtagaccel_quit, - .speed = amt_jtagaccel_speed, - - .jtag_ops = &amt_jtagaccel_interface, -}; diff --git a/src/jtag/drivers/gw16012.c b/src/jtag/drivers/gw16012.c deleted file mode 100644 index 597a8dd4d4..0000000000 --- a/src/jtag/drivers/gw16012.c +++ /dev/null @@ -1,527 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -/*************************************************************************** - * Copyright (C) 2006 by Dominic Rath * - * dominic.r...@gmx.de * - ***************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <jtag/interface.h> -#include <jtag/commands.h> - -#if 1 -#define _DEBUG_GW16012_IO_ -#endif - -/* system includes */ -/* -ino: 060521-1036 */ -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - -#include <machine/sysarch.h> -#include <machine/cpufunc.h> -#define ioperm(startport, length, enable) \ - 386_set_ioperm((startport), (length), (enable)) - -#else - -#endif /* __FreeBSD__, __FreeBSD_kernel__ */ - -#if PARPORT_USE_PPDEV == 1 -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -#include <dev/ppbus/ppi.h> -#include <dev/ppbus/ppbconf.h> -#define PPRSTATUS PPIGSTATUS -#define PPWDATA PPISDATA -#else -#include <linux/parport.h> -#include <linux/ppdev.h> -#endif -#include <fcntl.h> -#include <sys/ioctl.h> -#else /* not PARPORT_USE_PPDEV */ -#ifndef _WIN32 -#include <sys/io.h> -#endif -#endif - -#if PARPORT_USE_GIVEIO == 1 && IS_CYGWIN == 1 -#include <windows.h> -#endif - -/* configuration */ -static uint16_t gw16012_port; - -/* interface variables - */ -static uint8_t gw16012_msb; -static uint8_t gw16012_control_value; - -#if PARPORT_USE_PPDEV == 1 -static int device_handle; -#endif - -static void gw16012_data(uint8_t value) -{ - value = (value & 0x7f) | gw16012_msb; - gw16012_msb ^= 0x80; /* toggle MSB */ - -#ifdef _DEBUG_GW16012_IO_ - LOG_DEBUG("%2.2x", value); -#endif - - #if PARPORT_USE_PPDEV == 1 - ioctl(device_handle, PPWDATA, &value); - #else - #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - outb(gw16012_port, value); - #else - outb(value, gw16012_port); - #endif - #endif -} - -static void gw16012_control(uint8_t value) -{ - if (value != gw16012_control_value) { - gw16012_control_value = value; - -#ifdef _DEBUG_GW16012_IO_ - LOG_DEBUG("%2.2x", gw16012_control_value); -#endif - - #if PARPORT_USE_PPDEV == 1 - ioctl(device_handle, PPWCONTROL, &gw16012_control_value); - #else - #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - outb(gw16012_port + 2, gw16012_control_value); - #else - outb(gw16012_control_value, gw16012_port + 2); - #endif - #endif - } -} - -static void gw16012_input(uint8_t *value) -{ - #if PARPORT_USE_PPDEV == 1 - ioctl(device_handle, PPRSTATUS, value); - #else - *value = inb(gw16012_port + 1); - #endif - -#ifdef _DEBUG_GW16012_IO_ - LOG_DEBUG("%2.2x", *value); -#endif -} - -/* (1) assert or (0) deassert reset lines */ -static void gw16012_reset(int trst, int srst) -{ - LOG_DEBUG("trst: %i, srst: %i", trst, srst); - - if (trst == 0) - gw16012_control(0x0d); - else if (trst == 1) - gw16012_control(0x0c); - - if (srst == 0) - gw16012_control(0x0a); - else if (srst == 1) - gw16012_control(0x0b); -} - -static void gw16012_end_state(tap_state_t state) -{ - if (tap_is_state_stable(state)) - tap_set_end_state(state); - else { - LOG_ERROR("BUG: %i is not a valid end state", state); - exit(-1); - } -} - -static void gw16012_state_move(void) -{ - int i = 0, tms = 0; - uint8_t tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state()); - int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state()); - - gw16012_control(0x0); /* single-bit mode */ - - for (i = 0; i < tms_count; i++) { - tms = (tms_scan >> i) & 1; - gw16012_data(tms << 1); /* output next TMS bit */ - } - - tap_set_state(tap_get_end_state()); -} - -static void gw16012_path_move(struct pathmove_command *cmd) -{ - int num_states = cmd->num_states; - int state_count; - - state_count = 0; - while (num_states) { - gw16012_control(0x0); /* single-bit mode */ - if (tap_state_transition(tap_get_state(), false) == cmd->path[state_count]) - gw16012_data(0x0); /* TCK cycle with TMS low */ - else if (tap_state_transition(tap_get_state(), true) == cmd->path[state_count]) - gw16012_data(0x2); /* TCK cycle with TMS high */ - else { - LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", - tap_state_name(tap_get_state()), tap_state_name(cmd->path[state_count])); - exit(-1); - } - - tap_set_state(cmd->path[state_count]); - state_count++; - num_states--; - } - - tap_set_end_state(tap_get_state()); -} - -static void gw16012_runtest(int num_cycles) -{ - tap_state_t saved_end_state = tap_get_end_state(); - int i; - - /* only do a state_move when we're not already in IDLE */ - if (tap_get_state() != TAP_IDLE) { - gw16012_end_state(TAP_IDLE); - gw16012_state_move(); - } - - for (i = 0; i < num_cycles; i++) { - gw16012_control(0x0); /* single-bit mode */ - gw16012_data(0x0); /* TMS cycle with TMS low */ - } - - gw16012_end_state(saved_end_state); - if (tap_get_state() != tap_get_end_state()) - gw16012_state_move(); -} - -static void gw16012_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size) -{ - int bits_left = scan_size; - int bit_count = 0; - tap_state_t saved_end_state = tap_get_end_state(); - uint8_t scan_out, scan_in; - - /* only if we're not already in the correct Shift state */ - if (!((!ir_scan && (tap_get_state() == TAP_DRSHIFT)) || - (ir_scan && (tap_get_state() == TAP_IRSHIFT)))) { - if (ir_scan) - gw16012_end_state(TAP_IRSHIFT); - else - gw16012_end_state(TAP_DRSHIFT); - - gw16012_state_move(); - gw16012_end_state(saved_end_state); - } - - while (type == SCAN_OUT && ((bits_left - 1) > 7)) { - gw16012_control(0x2); /* seven-bit mode */ - scan_out = buf_get_u32(buffer, bit_count, 7); - gw16012_data(scan_out); - bit_count += 7; - bits_left -= 7; - } - - gw16012_control(0x0); /* single-bit mode */ - while (bits_left-- > 0) { - uint8_t tms = 0; - - scan_out = buf_get_u32(buffer, bit_count, 1); - - if (bits_left == 0) /* last bit */ { - if ((ir_scan && (tap_get_end_state() == TAP_IRSHIFT)) - || (!ir_scan && (tap_get_end_state() == TAP_DRSHIFT))) - tms = 0; - else - tms = 2; - } - - gw16012_data(scan_out | tms); - - if (type != SCAN_OUT) { - gw16012_input(&scan_in); - buf_set_u32(buffer, bit_count, 1, ((scan_in & 0x08) >> 3)); - } - - bit_count++; - } - - if (!((ir_scan && (tap_get_end_state() == TAP_IRSHIFT)) || - (!ir_scan && (tap_get_end_state() == TAP_DRSHIFT)))) { - gw16012_data(0x0); - if (ir_scan) - tap_set_state(TAP_IRPAUSE); - else - tap_set_state(TAP_DRPAUSE); - - if (tap_get_state() != tap_get_end_state()) - gw16012_state_move(); - } -} - -static int gw16012_execute_queue(struct jtag_command *cmd_queue) -{ - struct jtag_command *cmd = cmd_queue; /* currently processed command */ - int scan_size; - enum scan_type type; - uint8_t *buffer; - int retval; - - /* return ERROR_OK, unless a jtag_read_buffer returns a failed check - * that wasn't handled by a caller-provided error handler - */ - retval = ERROR_OK; - - while (cmd) { - switch (cmd->type) { - case JTAG_RESET: - LOG_DEBUG_IO("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst); - if (cmd->cmd.reset->trst == 1) - tap_set_state(TAP_RESET); - gw16012_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst); - break; - case JTAG_RUNTEST: - LOG_DEBUG_IO("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles, - cmd->cmd.runtest->end_state); - gw16012_end_state(cmd->cmd.runtest->end_state); - gw16012_runtest(cmd->cmd.runtest->num_cycles); - break; - case JTAG_TLR_RESET: - LOG_DEBUG_IO("statemove end in %i", cmd->cmd.statemove->end_state); - gw16012_end_state(cmd->cmd.statemove->end_state); - gw16012_state_move(); - break; - case JTAG_PATHMOVE: - LOG_DEBUG_IO("pathmove: %i states, end in %i", cmd->cmd.pathmove->num_states, - cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]); - gw16012_path_move(cmd->cmd.pathmove); - break; - case JTAG_SCAN: - gw16012_end_state(cmd->cmd.scan->end_state); - scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer); - type = jtag_scan_type(cmd->cmd.scan); - LOG_DEBUG_IO("%s scan (%i) %i bit end in %i", (cmd->cmd.scan->ir_scan) ? "ir" : "dr", - type, scan_size, cmd->cmd.scan->end_state); - gw16012_scan(cmd->cmd.scan->ir_scan, type, buffer, scan_size); - if (jtag_read_buffer(buffer, cmd->cmd.scan) != ERROR_OK) - retval = ERROR_JTAG_QUEUE_FAILED; - free(buffer); - break; - case JTAG_SLEEP: - LOG_DEBUG_IO("sleep %" PRIu32, cmd->cmd.sleep->us); - jtag_sleep(cmd->cmd.sleep->us); - break; - default: - LOG_ERROR("BUG: unknown JTAG command type encountered"); - exit(-1); - } - cmd = cmd->next; - } - - return retval; -} - -#if PARPORT_USE_GIVEIO == 1 -static int gw16012_get_giveio_access(void) -{ - HANDLE h; - OSVERSIONINFO version; - - version.dwOSVersionInfoSize = sizeof(version); - if (!GetVersionEx(&version)) { - errno = EINVAL; - return -1; - } - if (version.dwPlatformId != VER_PLATFORM_WIN32_NT) - return 0; - - h = CreateFile("\\\\.\\giveio", GENERIC_READ, 0, NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, NULL); - if (h == INVALID_HANDLE_VALUE) { - errno = ENODEV; - return -1; - } - - CloseHandle(h); - - return 0; -} -#endif - -#if PARPORT_USE_PPDEV == 1 - -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - -#define GW16012_PPDEV_NAME "ppi" - -static int gw16012_init_ioctls(void) -{ - int temp = 0; - temp = ioctl(device_handle, PPCLAIM); - if (temp < 0) { - LOG_ERROR("cannot claim device"); - return ERROR_JTAG_INIT_FAILED; - } - - temp = PARPORT_MODE_COMPAT; - temp = ioctl(device_handle, PPSETMODE, &temp); - if (temp < 0) { - LOG_ERROR(" cannot set compatible mode to device"); - return ERROR_JTAG_INIT_FAILED; - } - - temp = IEEE1284_MODE_COMPAT; - temp = ioctl(device_handle, PPNEGOT, &temp); - if (temp < 0) { - LOG_ERROR("cannot set compatible 1284 mode to device"); - return ERROR_JTAG_INIT_FAILED; - } - return ERROR_OK; -} -#else - -#define GW16012_PPDEV_NAME "parport" - -static int gw16012_init_ioctls(void) -{ - return ERROR_OK; -} - -#endif /* defined(__FreeBSD__) || defined(__FreeBSD_kernel__) */ - -static int gw16012_init_device(void) -{ - const char *device_name = GW16012_PPDEV_NAME; - char buffer[256]; - - if (device_handle > 0) { - LOG_ERROR("device is already opened"); - return ERROR_JTAG_INIT_FAILED; - } - - snprintf(buffer, 256, "/dev/%s%d", device_name, gw16012_port); - LOG_DEBUG("opening %s...", buffer); - - device_handle = open(buffer, O_WRONLY); - if (device_handle < 0) { - LOG_ERROR("cannot open device. check it exists and that user read and write rights are set"); - return ERROR_JTAG_INIT_FAILED; - } - - LOG_DEBUG("...open"); - - if (gw16012_init_ioctls() != ERROR_OK) - return ERROR_JTAG_INIT_FAILED; - - return ERROR_OK; -} - -#else /* PARPORT_USE_PPDEV */ - -static int gw16012_init_device(void) -{ - if (gw16012_port == 0) { - gw16012_port = 0x378; - LOG_WARNING("No gw16012 port specified, using default '0x378' (LPT1)"); - } - - LOG_DEBUG("requesting privileges for parallel port 0x%" PRIx16 "...", gw16012_port); -#if PARPORT_USE_GIVEIO == 1 - if (gw16012_get_giveio_access() != 0) { -#else /* PARPORT_USE_GIVEIO */ - if (ioperm(gw16012_port, 3, 1) != 0) { -#endif /* PARPORT_USE_GIVEIO */ - LOG_ERROR("missing privileges for direct i/o"); - return ERROR_JTAG_INIT_FAILED; - } - LOG_DEBUG("...privileges granted"); - - /* make sure parallel port is in right mode (clear tristate and interrupt */ -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - outb(gw16012_port + 2, 0x0); -#else - outb(0x0, gw16012_port + 2); -#endif - return ERROR_OK; -} - -#endif /* PARPORT_USE_PPDEV */ - -static int gw16012_init(void) -{ - uint8_t status_port; - - LOG_WARNING("Parallel port adapters are deprecated and support will be removed in the next release!"); - - if (gw16012_init_device() != ERROR_OK) - return ERROR_JTAG_INIT_FAILED; - - gw16012_input(&status_port); - gw16012_msb = (status_port & 0x80) ^ 0x80; - - gw16012_reset(0, 0); - - return ERROR_OK; -} - -static int gw16012_quit(void) -{ - - return ERROR_OK; -} - -COMMAND_HANDLER(gw16012_handle_parport_port_command) -{ - if (CMD_ARGC == 1) { - /* only if the port wasn't overwritten by cmdline */ - if (gw16012_port == 0) - COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], gw16012_port); - else { - LOG_ERROR("The parport port was already configured!"); - return ERROR_FAIL; - } - } - - command_print(CMD, "parport port = %u", gw16012_port); - - return ERROR_OK; -} - -static const struct command_registration gw16012_command_handlers[] = { - { - .name = "parport_port", - .handler = gw16012_handle_parport_port_command, - .mode = COMMAND_CONFIG, - .help = "Display the address of the I/O port (e.g. 0x378) " - "or the number of the '/dev/parport' device used. " - "If a parameter is provided, first change that port.", - .usage = "[port_number]", - }, - COMMAND_REGISTRATION_DONE -}; - -static struct jtag_interface gw16012_interface = { - .execute_queue = gw16012_execute_queue, -}; - -struct adapter_driver gw16012_adapter_driver = { - .name = "gw16012", - .transports = jtag_only, - .commands = gw16012_command_handlers, - - .init = gw16012_init, - .quit = gw16012_quit, - - .jtag_ops = &gw16012_interface, -}; diff --git a/src/jtag/drivers/parport.c b/src/jtag/drivers/parport.c deleted file mode 100644 index 746db1ef32..0000000000 --- a/src/jtag/drivers/parport.c +++ /dev/null @@ -1,538 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -/*************************************************************************** - * Copyright (C) 2005 by Dominic Rath * - * dominic.r...@gmx.de * - * * - * Copyright (C) 2008 by Spencer Oliver * - * s...@spen-soft.co.uk * - ***************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <jtag/adapter.h> -#include <jtag/interface.h> -#include "bitbang.h" - -/* -ino: 060521-1036 */ -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -#include <machine/sysarch.h> -#include <machine/cpufunc.h> -#define ioperm(startport, length, enable)\ - i386_set_ioperm((startport), (length), (enable)) -#endif /* __FreeBSD__ */ - -#if PARPORT_USE_PPDEV == 1 -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -#include <dev/ppbus/ppi.h> -#include <dev/ppbus/ppbconf.h> -#define PPRSTATUS PPIGSTATUS -#define PPWDATA PPISDATA -#else -#include <linux/parport.h> -#include <linux/ppdev.h> -#endif -#include <sys/ioctl.h> -#else /* not PARPORT_USE_PPDEV */ -#ifndef _WIN32 -#include <sys/io.h> -#endif -#endif - -#if PARPORT_USE_GIVEIO == 1 && IS_CYGWIN == 1 -#include <windows.h> -#endif - -/* parallel port cable description - */ -struct cable { - const char *name; - uint8_t TDO_MASK; /* status port bit containing current TDO value */ - uint8_t TRST_MASK; /* data port bit for TRST */ - uint8_t TMS_MASK; /* data port bit for TMS */ - uint8_t TCK_MASK; /* data port bit for TCK */ - uint8_t TDI_MASK; /* data port bit for TDI */ - uint8_t SRST_MASK; /* data port bit for SRST */ - uint8_t OUTPUT_INVERT; /* data port bits that should be inverted */ - uint8_t INPUT_INVERT; /* status port that should be inverted */ - uint8_t PORT_INIT; /* initialize data port with this value */ - uint8_t PORT_EXIT; /* de-initialize data port with this value */ - uint8_t LED_MASK; /* data port bit for LED */ -}; - -static const struct cable cables[] = { - /* name tdo trst tms tck tdi srst o_inv i_inv init exit led */ - { "wiggler", 0x80, 0x10, 0x02, 0x04, 0x08, 0x01, 0x01, 0x80, 0x80, 0x80, 0x00 }, - { "wiggler2", 0x80, 0x10, 0x02, 0x04, 0x08, 0x01, 0x01, 0x80, 0x80, 0x00, 0x20 }, - { "wiggler_ntrst_inverted", 0x80, 0x10, 0x02, 0x04, 0x08, 0x01, 0x11, 0x80, 0x80, 0x80, 0x00 }, - { "old_amt_wiggler", 0x80, 0x01, 0x02, 0x04, 0x08, 0x10, 0x11, 0x80, 0x80, 0x80, 0x00 }, - { "arm-jtag", 0x80, 0x01, 0x02, 0x04, 0x08, 0x10, 0x01, 0x80, 0x80, 0x80, 0x00 }, - { "chameleon", 0x80, 0x00, 0x04, 0x01, 0x02, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00 }, - { "dlc5", 0x10, 0x00, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00 }, - { "triton", 0x80, 0x08, 0x04, 0x01, 0x02, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00 }, - { "lattice", 0x40, 0x10, 0x04, 0x02, 0x01, 0x08, 0x00, 0x00, 0x18, 0x18, 0x00 }, - { "flashlink", 0x20, 0x10, 0x02, 0x01, 0x04, 0x20, 0x30, 0x20, 0x00, 0x00, 0x00 }, -/* Altium Universal JTAG cable. Set the cable to Xilinx Mode and wire to target as follows: - HARD TCK - Target TCK - HARD TMS - Target TMS - HARD TDI - Target TDI - HARD TDO - Target TDO - SOFT TCK - Target TRST - SOFT TDI - Target SRST -*/ - { "altium", 0x10, 0x20, 0x04, 0x02, 0x01, 0x80, 0x00, 0x00, 0x10, 0x00, 0x08 }, - { "aspo", 0x10, 0x01, 0x04, 0x08, 0x02, 0x10, 0x17, 0x00, 0x17, 0x17, 0x00 }, - { NULL, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } -}; - -/* configuration */ -static char *parport_cable; -static uint16_t parport_port; -static bool parport_exit; -static uint32_t parport_toggling_time_ns = 1000; -static int wait_states; - -/* interface variables - */ -static const struct cable *cable; -static uint8_t dataport_value; - -#if PARPORT_USE_PPDEV == 1 -static int device_handle; -#else -static unsigned long dataport; -static unsigned long statusport; -#endif - -static bb_value_t parport_read(void) -{ - int data = 0; - -#if PARPORT_USE_PPDEV == 1 - ioctl(device_handle, PPRSTATUS, &data); -#else - data = inb(statusport); -#endif - - if ((data ^ cable->INPUT_INVERT) & cable->TDO_MASK) - return BB_HIGH; - else - return BB_LOW; -} - -static inline void parport_write_data(void) -{ - uint8_t output; - output = dataport_value ^ cable->OUTPUT_INVERT; - -#if PARPORT_USE_PPDEV == 1 - ioctl(device_handle, PPWDATA, &output); -#else -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - outb(dataport, output); -#else - outb(output, dataport); -#endif -#endif -} - -static int parport_write(int tck, int tms, int tdi) -{ - int i = wait_states + 1; - - if (tck) - dataport_value |= cable->TCK_MASK; - else - dataport_value &= ~cable->TCK_MASK; - - if (tms) - dataport_value |= cable->TMS_MASK; - else - dataport_value &= ~cable->TMS_MASK; - - if (tdi) - dataport_value |= cable->TDI_MASK; - else - dataport_value &= ~cable->TDI_MASK; - - while (i-- > 0) - parport_write_data(); - - return ERROR_OK; -} - -/* (1) assert or (0) deassert reset lines */ -static int parport_reset(int trst, int srst) -{ - LOG_DEBUG("trst: %i, srst: %i", trst, srst); - - if (trst == 0) - dataport_value |= cable->TRST_MASK; - else if (trst == 1) - dataport_value &= ~cable->TRST_MASK; - - if (srst == 0) - dataport_value |= cable->SRST_MASK; - else if (srst == 1) - dataport_value &= ~cable->SRST_MASK; - - parport_write_data(); - - return ERROR_OK; -} - -/* turn LED on parport adapter on (1) or off (0) */ -static int parport_led(int on) -{ - if (on) - dataport_value |= cable->LED_MASK; - else - dataport_value &= ~cable->LED_MASK; - - parport_write_data(); - - return ERROR_OK; -} - -static int parport_speed(int speed) -{ - wait_states = speed; - return ERROR_OK; -} - -static int parport_khz(int khz, int *jtag_speed) -{ - if (khz == 0) { - LOG_DEBUG("RCLK not supported"); - return ERROR_FAIL; - } - - *jtag_speed = 499999 / (khz * parport_toggling_time_ns); - return ERROR_OK; -} - -static int parport_speed_div(int speed, int *khz) -{ - uint32_t denominator = (speed + 1) * parport_toggling_time_ns; - - *khz = (499999 + denominator) / denominator; - return ERROR_OK; -} - -#if PARPORT_USE_GIVEIO == 1 -static int parport_get_giveio_access(void) -{ - HANDLE h; - OSVERSIONINFO version; - - version.dwOSVersionInfoSize = sizeof(version); - if (!GetVersionEx(&version)) { - errno = EINVAL; - return -1; - } - if (version.dwPlatformId != VER_PLATFORM_WIN32_NT) - return 0; - - h = CreateFile("\\\\.\\giveio", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (h == INVALID_HANDLE_VALUE) { - errno = ENODEV; - return -1; - } - - CloseHandle(h); - - return 0; -} -#endif - -static struct bitbang_interface parport_bitbang = { - .read = &parport_read, - .write = &parport_write, - .blink = &parport_led, - }; - -static int parport_init(void) -{ - const struct cable *cur_cable; -#if PARPORT_USE_PPDEV == 1 - char buffer[256]; -#endif - LOG_WARNING("Parallel port adapters are deprecated and support will be removed in the next release!"); - - cur_cable = cables; - - if (!parport_cable) { - parport_cable = strdup("wiggler"); - LOG_WARNING("No parport cable specified, using default 'wiggler'"); - } - - while (cur_cable->name) { - if (strcmp(cur_cable->name, parport_cable) == 0) { - cable = cur_cable; - break; - } - cur_cable++; - } - - if (!cable) { - LOG_ERROR("No matching cable found for %s", parport_cable); - return ERROR_JTAG_INIT_FAILED; - } - - dataport_value = cable->PORT_INIT; - -#if PARPORT_USE_PPDEV == 1 - if (device_handle > 0) { - LOG_ERROR("device is already opened"); - return ERROR_JTAG_INIT_FAILED; - } - -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - LOG_DEBUG("opening /dev/ppi%d...", parport_port); - - snprintf(buffer, 256, "/dev/ppi%d", parport_port); - device_handle = open(buffer, O_WRONLY); -#else /* not __FreeBSD__, __FreeBSD_kernel__ */ - LOG_DEBUG("opening /dev/parport%d...", parport_port); - - snprintf(buffer, 256, "/dev/parport%d", parport_port); - device_handle = open(buffer, O_WRONLY); -#endif /* __FreeBSD__, __FreeBSD_kernel__ */ - - if (device_handle < 0) { - int err = errno; - LOG_ERROR("cannot open device. check it exists and that user read and write rights are set. errno=%d", err); - return ERROR_JTAG_INIT_FAILED; - } - - LOG_DEBUG("...open"); - -#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) - int i = ioctl(device_handle, PPCLAIM); - - if (i < 0) { - LOG_ERROR("cannot claim device"); - return ERROR_JTAG_INIT_FAILED; - } - - i = PARPORT_MODE_COMPAT; - i = ioctl(device_handle, PPSETMODE, &i); - if (i < 0) { - LOG_ERROR(" cannot set compatible mode to device"); - return ERROR_JTAG_INIT_FAILED; - } - - i = IEEE1284_MODE_COMPAT; - i = ioctl(device_handle, PPNEGOT, &i); - if (i < 0) { - LOG_ERROR("cannot set compatible 1284 mode to device"); - return ERROR_JTAG_INIT_FAILED; - } -#endif /* not __FreeBSD__, __FreeBSD_kernel__ */ - -#else /* not PARPORT_USE_PPDEV */ - if (parport_port == 0) { - parport_port = 0x378; - LOG_WARNING("No parport port specified, using default '0x378' (LPT1)"); - } - - dataport = parport_port; - statusport = parport_port + 1; - - LOG_DEBUG("requesting privileges for parallel port 0x%lx...", dataport); -#if PARPORT_USE_GIVEIO == 1 - if (parport_get_giveio_access() != 0) { -#else /* PARPORT_USE_GIVEIO */ - if (ioperm(dataport, 3, 1) != 0) { -#endif /* PARPORT_USE_GIVEIO */ - LOG_ERROR("missing privileges for direct i/o"); - return ERROR_JTAG_INIT_FAILED; - } - LOG_DEBUG("...privileges granted"); - - /* make sure parallel port is in right mode (clear tristate and interrupt */ - #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - outb(parport_port + 2, 0x0); - #else - outb(0x0, parport_port + 2); - #endif - -#endif /* PARPORT_USE_PPDEV */ - - if (parport_reset(0, 0) != ERROR_OK) - return ERROR_FAIL; - if (parport_write(0, 0, 0) != ERROR_OK) - return ERROR_FAIL; - if (parport_led(1) != ERROR_OK) - return ERROR_FAIL; - - bitbang_interface = &parport_bitbang; - - return ERROR_OK; -} - -static int parport_quit(void) -{ - if (parport_led(0) != ERROR_OK) - return ERROR_FAIL; - - if (parport_exit) { - dataport_value = cable->PORT_EXIT; - parport_write_data(); - } - - free(parport_cable); - parport_cable = NULL; - - return ERROR_OK; -} - -COMMAND_HANDLER(parport_handle_parport_port_command) -{ - if (CMD_ARGC == 1) { - /* only if the port wasn't overwritten by cmdline */ - if (parport_port == 0) - COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], parport_port); - else { - LOG_ERROR("The parport port was already configured!"); - return ERROR_FAIL; - } - } - - command_print(CMD, "parport port = 0x%" PRIx16 "", parport_port); - - return ERROR_OK; -} - -COMMAND_HANDLER(parport_handle_parport_cable_command) -{ - if (CMD_ARGC == 0) - return ERROR_OK; - - /* only if the cable name wasn't overwritten by cmdline */ - if (!parport_cable) { - /* REVISIT first verify that it's listed in cables[] ... */ - parport_cable = malloc(strlen(CMD_ARGV[0]) + sizeof(char)); - if (!parport_cable) { - LOG_ERROR("Out of memory"); - return ERROR_FAIL; - } - strcpy(parport_cable, CMD_ARGV[0]); - } - - /* REVISIT it's probably worth returning the current value ... */ - - return ERROR_OK; -} - -COMMAND_HANDLER(parport_handle_write_on_exit_command) -{ - if (CMD_ARGC != 1) - return ERROR_COMMAND_SYNTAX_ERROR; - - COMMAND_PARSE_ON_OFF(CMD_ARGV[0], parport_exit); - - return ERROR_OK; -} - -COMMAND_HANDLER(parport_handle_parport_toggling_time_command) -{ - if (CMD_ARGC == 1) { - uint32_t ns; - int retval = parse_u32(CMD_ARGV[0], &ns); - - if (retval != ERROR_OK) - return retval; - - if (ns == 0) { - LOG_ERROR("0 ns is not a valid parport toggling time"); - return ERROR_FAIL; - } - - parport_toggling_time_ns = ns; - retval = adapter_get_speed(&wait_states); - if (retval != ERROR_OK) { - /* if adapter_get_speed fails then the clock_mode - * has not been configured, this happens if parport_toggling_time is - * called before the adapter speed is set */ - LOG_INFO("no parport speed set - defaulting to zero wait states"); - wait_states = 0; - } - } - - command_print(CMD, "parport toggling time = %" PRIu32 " ns", - parport_toggling_time_ns); - - return ERROR_OK; -} - -static const struct command_registration parport_subcommand_handlers[] = { - { - .name = "port", - .handler = parport_handle_parport_port_command, - .mode = COMMAND_CONFIG, - .help = "Display the address of the I/O port (e.g. 0x378) " - "or the number of the '/dev/parport' device used. " - "If a parameter is provided, first change that port.", - .usage = "[port_number]", - }, - { - .name = "cable", - .handler = parport_handle_parport_cable_command, - .mode = COMMAND_CONFIG, - .help = "Set the layout of the parallel port cable " - "used to connect to the target.", - /* REVISIT there's no way to list layouts we know ... */ - .usage = "[layout]", - }, - { - .name = "write_on_exit", - .handler = parport_handle_write_on_exit_command, - .mode = COMMAND_CONFIG, - .help = "Configure the parallel driver to write " - "a known value to the parallel interface on exit.", - .usage = "('on'|'off')", - }, - { - .name = "toggling_time", - .handler = parport_handle_parport_toggling_time_command, - .mode = COMMAND_CONFIG, - .help = "Displays or assigns how many nanoseconds it " - "takes for the hardware to toggle TCK.", - .usage = "[nanoseconds]", - }, - COMMAND_REGISTRATION_DONE -}; - -static const struct command_registration parport_command_handlers[] = { - { - .name = "parport", - .mode = COMMAND_ANY, - .help = "perform parport management", - .chain = parport_subcommand_handlers, - .usage = "", - }, - COMMAND_REGISTRATION_DONE -}; - -static struct jtag_interface parport_interface = { - .supported = DEBUG_CAP_TMS_SEQ, - .execute_queue = bitbang_execute_queue, -}; - -struct adapter_driver parport_adapter_driver = { - .name = "parport", - .transports = jtag_only, - .commands = parport_command_handlers, - - .init = parport_init, - .quit = parport_quit, - .reset = parport_reset, - .speed = parport_speed, - .khz = parport_khz, - .speed_div = parport_speed_div, - - .jtag_ops = &parport_interface, -}; diff --git a/src/jtag/interface.h b/src/jtag/interface.h index 28c1458cb0..d05875e8b7 100644 --- a/src/jtag/interface.h +++ b/src/jtag/interface.h @@ -365,7 +365,6 @@ int adapter_config_trace(bool enabled, enum tpiu_pin_protocol pin_protocol, int adapter_poll_trace(uint8_t *buf, size_t *size); extern struct adapter_driver am335xgpio_adapter_driver; -extern struct adapter_driver amt_jtagaccel_adapter_driver; extern struct adapter_driver angie_adapter_driver; extern struct adapter_driver armjtagew_adapter_driver; extern struct adapter_driver at91rm9200_adapter_driver; @@ -378,7 +377,6 @@ extern struct adapter_driver ep93xx_adapter_driver; extern struct adapter_driver esp_usb_adapter_driver; extern struct adapter_driver ft232r_adapter_driver; extern struct adapter_driver ftdi_adapter_driver; -extern struct adapter_driver gw16012_adapter_driver; extern struct adapter_driver hl_adapter_driver; extern struct adapter_driver imx_gpio_adapter_driver; extern struct adapter_driver jlink_adapter_driver; @@ -389,7 +387,6 @@ extern struct adapter_driver linuxgpiod_adapter_driver; extern struct adapter_driver opendous_adapter_driver; extern struct adapter_driver openjtag_adapter_driver; extern struct adapter_driver osbdm_adapter_driver; -extern struct adapter_driver parport_adapter_driver; extern struct adapter_driver presto_adapter_driver; extern struct adapter_driver remote_bitbang_adapter_driver; extern struct adapter_driver rlink_adapter_driver; diff --git a/src/jtag/interfaces.c b/src/jtag/interfaces.c index c24ead8cd9..ca8e11a620 100644 --- a/src/jtag/interfaces.c +++ b/src/jtag/interfaces.c @@ -36,9 +36,6 @@ * drivers that were enabled by the @c configure script. */ struct adapter_driver *adapter_drivers[] = { -#if BUILD_PARPORT == 1 - &parport_adapter_driver, -#endif #if BUILD_DUMMY == 1 &dummy_adapter_driver, #endif @@ -63,18 +60,12 @@ struct adapter_driver *adapter_drivers[] = { #if BUILD_FT232R == 1 &ft232r_adapter_driver, #endif -#if BUILD_AMTJTAGACCEL == 1 - &amt_jtagaccel_adapter_driver, -#endif #if BUILD_EP93XX == 1 &ep93xx_adapter_driver, #endif #if BUILD_AT91RM9200 == 1 &at91rm9200_adapter_driver, #endif -#if BUILD_GW16012 == 1 - &gw16012_adapter_driver, -#endif #if BUILD_PRESTO &presto_adapter_driver, #endif diff --git a/src/jtag/startup.tcl b/src/jtag/startup.tcl index 41db38e4ac..c3b5665578 100644 --- a/src/jtag/startup.tcl +++ b/src/jtag/startup.tcl @@ -347,30 +347,6 @@ proc openjtag_variant args { eval openjtag variant $args } -lappend _telnet_autocomplete_skip parport_port -proc parport_port args { - echo "DEPRECATED! use 'parport port' not 'parport_port'" - eval parport port $args -} - -lappend _telnet_autocomplete_skip parport_cable -proc parport_cable args { - echo "DEPRECATED! use 'parport cable' not 'parport_cable'" - eval parport cable $args -} - -lappend _telnet_autocomplete_skip parport_write_on_exit -proc parport_write_on_exit args { - echo "DEPRECATED! use 'parport write_on_exit' not 'parport_write_on_exit'" - eval parport write_on_exit $args -} - -lappend _telnet_autocomplete_skip parport_toggling_time -proc parport_toggling_time args { - echo "DEPRECATED! use 'parport toggling_time' not 'parport_toggling_time'" - eval parport toggling_time $args -} - lappend _telnet_autocomplete_skip jtag_dpi_set_port proc jtag_dpi_set_port args { echo "DEPRECATED! use 'jtag_dpi set_port' not 'jtag_dpi_set_port'" diff --git a/tcl/interface/chameleon.cfg b/tcl/interface/chameleon.cfg deleted file mode 100644 index b73d129f02..0000000000 --- a/tcl/interface/chameleon.cfg +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later - -# -# Amontec Chameleon POD -# -# http://www.amontec.com/chameleon.shtml -# - -adapter driver parport -parport cable chameleon diff --git a/tcl/interface/flashlink.cfg b/tcl/interface/flashlink.cfg deleted file mode 100644 index d552c50a6b..0000000000 --- a/tcl/interface/flashlink.cfg +++ /dev/null @@ -1,18 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later - -# -# ST FlashLINK JTAG parallel cable -# -# http://www.st.com/internet/evalboard/product/94023.jsp -# http://www.st.com/stonline/products/literature/um/7889.pdf -# - -if { [info exists PARPORTADDR] } { - set _PARPORTADDR $PARPORTADDR -} else { - set _PARPORTADDR 0 -} - -adapter driver parport -parport port $_PARPORTADDR -parport cable flashlink diff --git a/tcl/interface/parport.cfg b/tcl/interface/parport.cfg deleted file mode 100644 index b9fceeb852..0000000000 --- a/tcl/interface/parport.cfg +++ /dev/null @@ -1,21 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later - -# -# Parallel port wiggler (many clones available) on port 0x378 -# -# Addresses: 0x378/LPT1 or 0x278/LPT2 ... -# - -if { [info exists PARPORTADDR] } { - set _PARPORTADDR $PARPORTADDR -} else { - if {$tcl_platform(platform) eq "windows"} { - set _PARPORTADDR 0x378 - } { - set _PARPORTADDR 0 - } -} - -adapter driver parport -parport port $_PARPORTADDR -parport cable wiggler diff --git a/tcl/interface/parport_dlc5.cfg b/tcl/interface/parport_dlc5.cfg deleted file mode 100644 index 24acea7a95..0000000000 --- a/tcl/interface/parport_dlc5.cfg +++ /dev/null @@ -1,17 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later - -# -# Xilinx Parallel Cable III 'DLC 5' (and various clones) -# -# http://www.xilinx.com/itp/xilinx4/data/docs/pac/appendixb.html -# - -if { [info exists PARPORTADDR] } { - set _PARPORTADDR $PARPORTADDR -} else { - set _PARPORTADDR 0 -} - -adapter driver parport -parport port $_PARPORTADDR -parport cable dlc5 --