From 08e72f43354ebb344fb160318cdb567d40640994 Mon Sep 17 00:00:00 2001 From: Rutger Hofman Date: Fri, 1 May 2009 12:02:08 +0000 Subject: [PATCH] Move all include/* to include/urjtag/; start lifting command implementations into their library modules git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1539 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 8 ++ urjtag/Makefile.am | 2 +- urjtag/configure.ac | 2 +- urjtag/include/{ => urjtag}/Makefile.am | 1 + urjtag/include/urjtag/error.h | 92 +++++++++++++ urjtag/include/{ => urjtag}/jim/some_cpu.h | 0 urjtag/include/urjtag/types.h | 48 +++++++ urjtag/include/urjtag/urjtag.h | 58 ++++++++ urjtag/include/{ => urjtag}/usbconn/libftdx.h | 0 urjtag/include/{ => urjtag}/usbconn/libusb.h | 0 urjtag/src/bsdl/bsdl.c | 6 +- urjtag/src/bsdl/bsdl_sem.c | 4 +- urjtag/src/bsdl/bsdl_sysdep.h | 2 +- urjtag/src/bsdl/bsdl_types.h | 4 +- urjtag/src/bsdl/vhdl_bison.y | 2 + urjtag/src/bus/au1500.c | 11 +- urjtag/src/bus/avr32.c | 16 ++- urjtag/src/bus/bcm1250.c | 11 +- urjtag/src/bus/bf533_ezkit.c | 11 +- urjtag/src/bus/bf533_stamp.c | 11 +- urjtag/src/bus/bf537_stamp.c | 11 +- urjtag/src/bus/bf548_ezkit.c | 11 +- urjtag/src/bus/bf561_ezkit.c | 11 +- urjtag/src/bus/bscoach.c | 13 +- urjtag/src/bus/buses.c | 4 +- urjtag/src/bus/ejtag.c | 15 ++- urjtag/src/bus/ejtag_dma.c | 15 ++- urjtag/src/bus/fjmem.c | 16 ++- urjtag/src/bus/generic_bus.c | 4 +- urjtag/src/bus/generic_bus.h | 2 +- urjtag/src/bus/h7202.c | 11 +- urjtag/src/bus/ixp425.c | 11 +- urjtag/src/bus/jopcyc.c | 13 +- urjtag/src/bus/lh7a400.c | 11 +- urjtag/src/bus/mpc5200.c | 10 +- urjtag/src/bus/mpc824x.c | 10 +- urjtag/src/bus/ppc405ep.c | 11 +- urjtag/src/bus/ppc440gx_ebc8.c | 11 +- urjtag/src/bus/prototype.c | 11 +- urjtag/src/bus/pxa2x0.c | 12 +- urjtag/src/bus/pxa2x0_mc.h | 2 +- urjtag/src/bus/readmem.c | 13 +- urjtag/src/bus/s3c4510x.c | 13 +- urjtag/src/bus/sa1110.c | 11 +- urjtag/src/bus/sh7727.c | 11 +- urjtag/src/bus/sh7750r.c | 11 +- urjtag/src/bus/sh7751r.c | 11 +- urjtag/src/bus/sharc21065l.c | 10 +- urjtag/src/bus/slsup3.c | 10 +- urjtag/src/bus/tx4925.c | 11 +- urjtag/src/bus/writemem.c | 13 +- urjtag/src/bus/zefant-xs3.c | 13 +- urjtag/src/cmd/cmd_addpart.c | 8 +- urjtag/src/cmd/cmd_bit.c | 126 ++++++------------ urjtag/src/cmd/cmd_bsdl.c | 6 +- urjtag/src/cmd/cmd_bus.c | 5 +- urjtag/src/cmd/cmd_cable.c | 16 +-- urjtag/src/cmd/cmd_cmd.c | 5 +- urjtag/src/cmd/cmd_debug.c | 4 +- urjtag/src/cmd/cmd_detect.c | 9 +- urjtag/src/cmd/cmd_detectflash.c | 6 +- urjtag/src/cmd/cmd_discovery.c | 4 +- urjtag/src/cmd/cmd_dr.c | 12 +- urjtag/src/cmd/cmd_endian.c | 4 +- urjtag/src/cmd/cmd_eraseflash.c | 6 +- urjtag/src/cmd/cmd_flashmem.c | 6 +- urjtag/src/cmd/cmd_frequency.c | 6 +- urjtag/src/cmd/cmd_get.c | 8 +- urjtag/src/cmd/cmd_help.c | 2 +- urjtag/src/cmd/cmd_idcode.c | 4 +- urjtag/src/cmd/cmd_include.c | 6 +- urjtag/src/cmd/cmd_initbus.c | 7 +- urjtag/src/cmd/cmd_instruction.c | 41 +----- urjtag/src/cmd/cmd_jtag_data_dir.c | 2 +- urjtag/src/cmd/cmd_parse.c | 8 +- urjtag/src/cmd/cmd_part.c | 6 +- urjtag/src/cmd/cmd_peekpoke.c | 5 +- urjtag/src/cmd/cmd_pod.c | 6 +- urjtag/src/cmd/cmd_print.c | 12 +- urjtag/src/cmd/cmd_quit.c | 2 +- urjtag/src/cmd/cmd_readmem.c | 4 +- urjtag/src/cmd/cmd_register.c | 8 +- urjtag/src/cmd/cmd_reset.c | 6 +- urjtag/src/cmd/cmd_salias.c | 7 +- urjtag/src/cmd/cmd_scan.c | 12 +- urjtag/src/cmd/cmd_set.c | 8 +- urjtag/src/cmd/cmd_shell.c | 8 +- urjtag/src/cmd/cmd_shift.c | 6 +- urjtag/src/cmd/cmd_signal.c | 44 ++---- urjtag/src/cmd/cmd_svf.c | 5 +- urjtag/src/cmd/cmd_test.c | 8 +- urjtag/src/cmd/cmd_usleep.c | 4 +- urjtag/src/cmd/cmd_writemem.c | 4 +- urjtag/src/flash/amd.c | 6 +- urjtag/src/flash/amd_flash.c | 6 +- urjtag/src/flash/cfi.c | 6 +- urjtag/src/flash/detectflash.c | 4 +- urjtag/src/flash/flash.c | 10 +- urjtag/src/flash/intel.c | 6 +- urjtag/src/flash/intel.h | 2 +- urjtag/src/flash/jedec.c | 6 +- urjtag/src/flash/jedec.h | 4 +- urjtag/src/flash/jedec_exp.c | 8 +- urjtag/src/jim/intel_28f800b3.c | 3 +- urjtag/src/jim/some_cpu.c | 5 +- urjtag/src/jim/tap.c | 5 +- urjtag/src/jtag.c | 23 ++-- urjtag/src/lib/fclock.c | 4 +- urjtag/src/part/bsbit.c | 87 +++++++++++- urjtag/src/part/data_register.c | 3 +- urjtag/src/part/instruction.c | 3 +- urjtag/src/part/part.c | 71 +++++++++- urjtag/src/part/signal.c | 95 ++++++++++++- urjtag/src/svf/svf.c | 17 ++- urjtag/src/svf/svf.h | 2 +- urjtag/src/svf/svf_flex.l | 1 + urjtag/src/tap/cable.c | 4 +- urjtag/src/tap/cable/arcom.c | 6 +- urjtag/src/tap/cable/byteblaster.c | 6 +- urjtag/src/tap/cable/cmd_xfer.h | 2 +- urjtag/src/tap/cable/dlc5.c | 6 +- urjtag/src/tap/cable/ea253.c | 6 +- urjtag/src/tap/cable/ei012.c | 6 +- urjtag/src/tap/cable/ft2232.c | 15 ++- urjtag/src/tap/cable/generic.c | 10 +- urjtag/src/tap/cable/generic.h | 4 +- urjtag/src/tap/cable/generic_parport.c | 11 +- urjtag/src/tap/cable/generic_parport.h | 4 +- urjtag/src/tap/cable/generic_usbconn.c | 6 +- urjtag/src/tap/cable/generic_usbconn.h | 4 +- urjtag/src/tap/cable/jim.c | 10 +- urjtag/src/tap/cable/jlink.c | 10 +- urjtag/src/tap/cable/keithkoep.c | 6 +- urjtag/src/tap/cable/lattice.c | 6 +- urjtag/src/tap/cable/mpcbdm.c | 6 +- urjtag/src/tap/cable/triton.c | 6 +- urjtag/src/tap/cable/ts7800.c | 6 +- urjtag/src/tap/cable/usbblaster.c | 11 +- urjtag/src/tap/cable/vision_ep9307.c | 8 +- urjtag/src/tap/cable/wiggler.c | 9 +- urjtag/src/tap/cable/wiggler2.c | 6 +- urjtag/src/tap/cable/xpc.c | 10 +- urjtag/src/tap/chain.c | 69 +++++----- urjtag/src/tap/detect.c | 16 +-- urjtag/src/tap/discovery.c | 8 +- urjtag/src/tap/idcode.c | 8 +- urjtag/src/tap/parport.c | 2 +- urjtag/src/tap/parport/direct.c | 5 +- urjtag/src/tap/parport/ppdev.c | 5 +- urjtag/src/tap/parport/ppi.c | 4 +- urjtag/src/tap/register.c | 2 +- urjtag/src/tap/state.c | 4 +- urjtag/src/tap/tap.c | 15 ++- urjtag/src/tap/usbconn.c | 2 +- urjtag/src/tap/usbconn/libftd2xx.c | 6 +- urjtag/src/tap/usbconn/libftdi.c | 6 +- urjtag/src/tap/usbconn/libusb.c | 6 +- urjtag/sysdep.h | 2 +- 158 files changed, 1124 insertions(+), 684 deletions(-) rename urjtag/include/{ => urjtag}/Makefile.am (99%) create mode 100644 urjtag/include/urjtag/error.h rename urjtag/include/{ => urjtag}/jim/some_cpu.h (100%) create mode 100644 urjtag/include/urjtag/types.h create mode 100644 urjtag/include/urjtag/urjtag.h rename urjtag/include/{ => urjtag}/usbconn/libftdx.h (100%) rename urjtag/include/{ => urjtag}/usbconn/libusb.h (100%) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 1a9fb61d..8fa49ba8 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -1,3 +1,11 @@ +2009-04-23 Rutger Hofman + + Move all include/* to include/urjtag/* to lower collision chance on #include. + Start lifting commands from cmd/ into the library modules. Begun work on: + * src/cmd/cmd_bit.c + * src/cmd/cmd_instruction.c + * src/cmd/cmd_signal.c + 2009-04-24 Mike Frysinger * data/analog/bf518/bf518: Update with public BSDL file. diff --git a/urjtag/Makefile.am b/urjtag/Makefile.am index 8c93186e..0e009dd5 100644 --- a/urjtag/Makefile.am +++ b/urjtag/Makefile.am @@ -25,7 +25,7 @@ include $(top_srcdir)/Makefile.rules SUBDIRS = \ doc \ - include \ + include/urjtag \ data \ src \ po diff --git a/urjtag/configure.ac b/urjtag/configure.ac index 1f99039a..49f35932 100644 --- a/urjtag/configure.ac +++ b/urjtag/configure.ac @@ -60,7 +60,7 @@ AC_CONFIG_FILES( Makefile doc/Makefile data/Makefile - include/Makefile + include/urjtag/Makefile src/Makefile src/lib/Makefile src/tap/Makefile diff --git a/urjtag/include/Makefile.am b/urjtag/include/urjtag/Makefile.am similarity index 99% rename from urjtag/include/Makefile.am rename to urjtag/include/urjtag/Makefile.am index e2a8d8ba..b732bb35 100644 --- a/urjtag/include/Makefile.am +++ b/urjtag/include/urjtag/Makefile.am @@ -53,3 +53,4 @@ noinst_HEADERS = \ usbconn/libftdx.h \ usbconn/libusb.h \ xpcu.h + diff --git a/urjtag/include/urjtag/error.h b/urjtag/include/urjtag/error.h new file mode 100644 index 00000000..ef9df9d1 --- /dev/null +++ b/urjtag/include/urjtag/error.h @@ -0,0 +1,92 @@ +/* + * $Id: error.h 1519 2009-04-22 23:12:44Z rfhh $ + * + * Copyright (C) 2009, Rutger Hofman, VU Amsterdam + * + * 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. + * + */ + +#ifndef URJ_ERROR_H +#define URJ_ERROR_H + +#include + +/** + * Error types + */ +typedef enum urj_error { + URJ_ERROR_OK = 0, + URJ_ERROR_ALREADY, + URJ_ERROR_OUT_OF_MEMORY, + URJ_ERROR_NO_ACTIVE_PART, + URJ_ERROR_INVALID, + URJ_ERROR_NOTFOUND, +} urj_error_t; + +/** Max length of message string that can be recorded. */ +#define URJ_ERROR_MSG_LEN 256 + +/** + * Error state. + */ +typedef struct urj_error_state { + urj_error_t errnum; /**< error number */ + const char *file; /**< file where error is set */ + const char *function; /**< function --,,-- */ + int line; /**< line no --,,-- */ + char msg[URJ_ERROR_MSG_LEN]; /**< printf-style message */ +} urj_error_state_t; + +extern urj_error_state_t urj_error_state; + +/** + * Set error state. The macro interface allows for a stack of errors, where + * this macro would push an error. The implementation is free to maintain + * a stack of depth one. + * + * @param e urj_error_t value + * @param ... consists of a printf argument set. It needs to start with a + * const char *fmt, followed by arguments used by fmt. + */ +#define urj_error_set(e, ...) \ + do { \ + urj_error_state.errnum = e; \ + urj_error_state.file = __FILE__; \ + urj_error_state.function = __func__; \ + urj_error_state.line = __LINE__; \ + snprintf(urj_error_state.msg, sizeof urj_error_state.msg, __VA_ARGS__); \ + } while (0) + +/** + * The top of the error stack. The caller must not modify the returned struct. + */ +const urj_error_state_t *urj_error_get(void); +/** + * Pop the top off the error stack. + * @return #URJ_ERROR_OK if the bottom of the error stack is reached + */ +urj_error_t urj_error_get_reset(void); +/** + * The top of the error state in human-readable form. + * + * This function is not reentrant. + * + * @return a pointer to a static area. + */ +const char *urj_error_describe(void); + +#endif /* URJ_ERROR_H */ diff --git a/urjtag/include/jim/some_cpu.h b/urjtag/include/urjtag/jim/some_cpu.h similarity index 100% rename from urjtag/include/jim/some_cpu.h rename to urjtag/include/urjtag/jim/some_cpu.h diff --git a/urjtag/include/urjtag/types.h b/urjtag/include/urjtag/types.h new file mode 100644 index 00000000..425c2ba2 --- /dev/null +++ b/urjtag/include/urjtag/types.h @@ -0,0 +1,48 @@ +/* + * $Id: urjtag.h 1525 2009-04-23 15:56:49Z rfhh $ + * + * Global opaque types that had better be predefined + * Copyright (C) 2009, Rutger Hofman + * + * 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. + * + * Author: Rutger Hofman, VU Amsterdam + * + */ + +#ifndef URJ_URJ_TYPES_H +#define URJ_URJ_TYPES_H + +typedef struct urj_bus urj_bus_t; +typedef struct urj_bus_driver urj_bus_driver_t; +typedef struct urj_chain urj_chain_t; +typedef struct urj_cable urj_cable_t; +typedef struct urj_usbconn urj_usbconn_t; +typedef struct urj_parport urj_parport_t; +typedef struct urj_part urj_part_t; +typedef struct urj_parts urj_parts_t; +typedef struct urj_part_signal urj_part_signal_t; +typedef struct urj_part_salias urj_part_salias_t; +typedef struct urj_part_instruction urj_part_instruction_t; +typedef struct urj_data_register urj_data_register_t; +typedef struct urj_bsbit urj_bsbit_t; +typedef struct urj_tap_register urj_tap_register_t; + +#define URJ_STATUS_OK 0 +#define URJ_STATUS_FAIL 1 +#define URJ_STATUS_SYNTAX_ERROR (-1) + +#endif /* URJ_URJ_TYPES_H */ diff --git a/urjtag/include/urjtag/urjtag.h b/urjtag/include/urjtag/urjtag.h new file mode 100644 index 00000000..1046c551 --- /dev/null +++ b/urjtag/include/urjtag/urjtag.h @@ -0,0 +1,58 @@ +/* + * $Id: urjtag.h 1525 2009-04-23 15:56:49Z rfhh $ + * + * Public include file for the UrJTAG library. + * Copyright (C) 2009, Rutger Hofman + * + * 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. + * + * Author: Rutger Hofman, VU Amsterdam + * + */ + +#ifndef URJ_URJTAG_H +#define URJ_URJTAG_H + +#include "types.h" +#include "bitmask.h" +#include "bsbit.h" +#include "bsdl.h" +#include "bsdl_mode.h" +#include "bssignal.h" +#include "bus.h" +#include "bus_driver.h" +#include "cable.h" +#include "chain.h" +#include "cmd.h" +#include "data_register.h" +#include "fclock.h" +#include "flash.h" +#include "gettext.h" +#include "jim.h" +#include "jtag.h" +#include "parport.h" +#include "part.h" +#include "part_instruction.h" +#include "pod.h" +#include "svf.h" +#include "tap.h" +#include "tap_register.h" +#include "tap_state.h" +#include "urjtag.h" +#include "usbconn.h" +#include "xpcu.h" + +#endif /* URJ_URJTAG_H */ diff --git a/urjtag/include/usbconn/libftdx.h b/urjtag/include/urjtag/usbconn/libftdx.h similarity index 100% rename from urjtag/include/usbconn/libftdx.h rename to urjtag/include/urjtag/usbconn/libftdx.h diff --git a/urjtag/include/usbconn/libusb.h b/urjtag/include/urjtag/usbconn/libusb.h similarity index 100% rename from urjtag/include/usbconn/libusb.h rename to urjtag/include/urjtag/usbconn/libusb.h diff --git a/urjtag/src/bsdl/bsdl.c b/urjtag/src/bsdl/bsdl.c index b2f32af5..dce35cde 100644 --- a/urjtag/src/bsdl/bsdl.c +++ b/urjtag/src/bsdl/bsdl.c @@ -33,8 +33,10 @@ #include "sysdep.h" -#include "jtag.h" -#include "cmd.h" +#include +#include +#include +#include //#include "bsdl_local.h" #include "bsdl_types.h" diff --git a/urjtag/src/bsdl/bsdl_sem.c b/urjtag/src/bsdl/bsdl_sem.c index f91e5042..a8750b41 100644 --- a/urjtag/src/bsdl/bsdl_sem.c +++ b/urjtag/src/bsdl/bsdl_sem.c @@ -29,8 +29,8 @@ #include #include -#include -#include +#include +#include #include "bsdl_sysdep.h" diff --git a/urjtag/src/bsdl/bsdl_sysdep.h b/urjtag/src/bsdl/bsdl_sysdep.h index 4b62189a..9a5e7f7d 100644 --- a/urjtag/src/bsdl/bsdl_sysdep.h +++ b/urjtag/src/bsdl/bsdl_sysdep.h @@ -28,7 +28,7 @@ #include "bsdl_config.h" -#include "gettext.h" +#include #define _(s) gettext(s) #define N_(s) gettext_noop(s) #define P_(s,p,n) ngettext(s,p,n) diff --git a/urjtag/src/bsdl/bsdl_types.h b/urjtag/src/bsdl/bsdl_types.h index ef6a598a..48bd289d 100644 --- a/urjtag/src/bsdl/bsdl_types.h +++ b/urjtag/src/bsdl/bsdl_types.h @@ -25,8 +25,8 @@ #ifndef URJ_BSDL_TYPES_H #define URJ_BSDL_TYPES_H -#include -#include +#include +#include /* private data of the flex scanner handled internally in bsdl_flex.l as yyextra */ diff --git a/urjtag/src/bsdl/vhdl_bison.y b/urjtag/src/bsdl/vhdl_bison.y index e3a775cb..f3af3381 100644 --- a/urjtag/src/bsdl/vhdl_bison.y +++ b/urjtag/src/bsdl/vhdl_bison.y @@ -128,6 +128,8 @@ LEGAL NOTICES: #include #include +#include + #include "bsdl_sysdep.h" #include "bsdl_types.h" diff --git a/urjtag/src/bus/au1500.c b/urjtag/src/bus/au1500.c index d66aff20..b1ad47eb 100644 --- a/urjtag/src/bus/au1500.c +++ b/urjtag/src/bus/au1500.c @@ -33,11 +33,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/avr32.c b/urjtag/src/bus/avr32.c index 7dd367bf..e2f67ad0 100644 --- a/urjtag/src/bus/avr32.c +++ b/urjtag/src/bus/avr32.c @@ -31,15 +31,17 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" -#include "data_register.h" -#include "tap.h" typedef struct { diff --git a/urjtag/src/bus/bcm1250.c b/urjtag/src/bus/bcm1250.c index f4be376f..444eabe4 100644 --- a/urjtag/src/bus/bcm1250.c +++ b/urjtag/src/bus/bcm1250.c @@ -29,11 +29,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/bf533_ezkit.c b/urjtag/src/bus/bf533_ezkit.c index 84a2bd5f..6a889d38 100644 --- a/urjtag/src/bus/bf533_ezkit.c +++ b/urjtag/src/bus/bf533_ezkit.c @@ -29,11 +29,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/bf533_stamp.c b/urjtag/src/bus/bf533_stamp.c index 27c41584..f33c2243 100644 --- a/urjtag/src/bus/bf533_stamp.c +++ b/urjtag/src/bus/bf533_stamp.c @@ -29,11 +29,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/bf537_stamp.c b/urjtag/src/bus/bf537_stamp.c index ffa4cbce..c200deac 100644 --- a/urjtag/src/bus/bf537_stamp.c +++ b/urjtag/src/bus/bf537_stamp.c @@ -29,11 +29,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/bf548_ezkit.c b/urjtag/src/bus/bf548_ezkit.c index d8a96bb6..d1558a6a 100644 --- a/urjtag/src/bus/bf548_ezkit.c +++ b/urjtag/src/bus/bf548_ezkit.c @@ -28,11 +28,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/bf561_ezkit.c b/urjtag/src/bus/bf561_ezkit.c index 3241439e..b282170b 100644 --- a/urjtag/src/bus/bf561_ezkit.c +++ b/urjtag/src/bus/bf561_ezkit.c @@ -29,11 +29,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/bscoach.c b/urjtag/src/bus/bscoach.c index 22745c4d..d938b6ee 100644 --- a/urjtag/src/bus/bscoach.c +++ b/urjtag/src/bus/bscoach.c @@ -30,14 +30,15 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" -#include "tap_state.h" typedef struct diff --git a/urjtag/src/bus/buses.c b/urjtag/src/bus/buses.c index 1274c56a..579faa64 100644 --- a/urjtag/src/bus/buses.c +++ b/urjtag/src/bus/buses.c @@ -24,9 +24,11 @@ #include "sysdep.h" +#include #include -#include "bus.h" +#include + #include "buses.h" const urj_bus_driver_t *urj_bus_drivers[] = { diff --git a/urjtag/src/bus/ejtag.c b/urjtag/src/bus/ejtag.c index 5c3866a3..d8167ef1 100644 --- a/urjtag/src/bus/ejtag.c +++ b/urjtag/src/bus/ejtag.c @@ -33,14 +33,17 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" -#include "tap_state.h" typedef struct { diff --git a/urjtag/src/bus/ejtag_dma.c b/urjtag/src/bus/ejtag_dma.c index 2d2600fd..3bd91838 100644 --- a/urjtag/src/bus/ejtag_dma.c +++ b/urjtag/src/bus/ejtag_dma.c @@ -40,14 +40,17 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" -#include "tap_state.h" typedef struct { diff --git a/urjtag/src/bus/fjmem.c b/urjtag/src/bus/fjmem.c index 9a1bd704..37e99dd9 100644 --- a/urjtag/src/bus/fjmem.c +++ b/urjtag/src/bus/fjmem.c @@ -28,15 +28,17 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "jtag.h" +#include +#include +#include +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" -#include "cmd.h" -#include "tap.h" - #undef DEBUG diff --git a/urjtag/src/bus/generic_bus.c b/urjtag/src/bus/generic_bus.c index 262dd2e0..9d3ac0b2 100644 --- a/urjtag/src/bus/generic_bus.c +++ b/urjtag/src/bus/generic_bus.c @@ -26,7 +26,9 @@ #include -#include +#include +#include +#include #include "generic_bus.h" diff --git a/urjtag/src/bus/generic_bus.h b/urjtag/src/bus/generic_bus.h index 17f62c42..704a0e3d 100644 --- a/urjtag/src/bus/generic_bus.h +++ b/urjtag/src/bus/generic_bus.h @@ -25,7 +25,7 @@ #ifndef URJ_BUS_GENERIC_BUS_H #define URJ_BUS_GENERIC_BUS_H -#include "bus.h" +#include int urj_bus_generic_attach_sig (urj_part_t *part, urj_part_signal_t **sig, char *id); diff --git a/urjtag/src/bus/h7202.c b/urjtag/src/bus/h7202.c index fad77fd8..ee2dcc9d 100644 --- a/urjtag/src/bus/h7202.c +++ b/urjtag/src/bus/h7202.c @@ -29,11 +29,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/ixp425.c b/urjtag/src/bus/ixp425.c index 04942f30..637bba63 100644 --- a/urjtag/src/bus/ixp425.c +++ b/urjtag/src/bus/ixp425.c @@ -29,11 +29,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/jopcyc.c b/urjtag/src/bus/jopcyc.c index 89fa8f11..3e3d4d1d 100644 --- a/urjtag/src/bus/jopcyc.c +++ b/urjtag/src/bus/jopcyc.c @@ -60,14 +60,15 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" -#include "tap_state.h" #define RAM_ADDR_WIDTH 18 #define RAM_DATA_WIDTH 16 diff --git a/urjtag/src/bus/lh7a400.c b/urjtag/src/bus/lh7a400.c index 88e4b91d..fb80d73f 100644 --- a/urjtag/src/bus/lh7a400.c +++ b/urjtag/src/bus/lh7a400.c @@ -38,11 +38,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/mpc5200.c b/urjtag/src/bus/mpc5200.c index 482f9b6b..8bfa290d 100644 --- a/urjtag/src/bus/mpc5200.c +++ b/urjtag/src/bus/mpc5200.c @@ -33,10 +33,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/mpc824x.c b/urjtag/src/bus/mpc824x.c index 91578b87..fdf32bc6 100644 --- a/urjtag/src/bus/mpc824x.c +++ b/urjtag/src/bus/mpc824x.c @@ -33,10 +33,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/ppc405ep.c b/urjtag/src/bus/ppc405ep.c index 11f4975a..f7474f0f 100644 --- a/urjtag/src/bus/ppc405ep.c +++ b/urjtag/src/bus/ppc405ep.c @@ -26,11 +26,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/ppc440gx_ebc8.c b/urjtag/src/bus/ppc440gx_ebc8.c index ca707bba..3e38a2f9 100644 --- a/urjtag/src/bus/ppc440gx_ebc8.c +++ b/urjtag/src/bus/ppc440gx_ebc8.c @@ -25,11 +25,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/prototype.c b/urjtag/src/bus/prototype.c index 65a4dd5d..df9a6192 100644 --- a/urjtag/src/bus/prototype.c +++ b/urjtag/src/bus/prototype.c @@ -29,11 +29,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/pxa2x0.c b/urjtag/src/bus/pxa2x0.c index 3461ac3a..18d03517 100644 --- a/urjtag/src/bus/pxa2x0.c +++ b/urjtag/src/bus/pxa2x0.c @@ -36,13 +36,15 @@ #include #include -#include "part.h" -#include "bus.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" -#include "tap_state.h" #include "pxa2x0_mc.h" diff --git a/urjtag/src/bus/pxa2x0_mc.h b/urjtag/src/bus/pxa2x0_mc.h index cc324dbd..25e1e763 100644 --- a/urjtag/src/bus/pxa2x0_mc.h +++ b/urjtag/src/bus/pxa2x0_mc.h @@ -45,7 +45,7 @@ #ifndef PXA2X0_MC_H #define PXA2X0_MC_H -#include +#include #ifndef __ASSEMBLY__ #include diff --git a/urjtag/src/bus/readmem.c b/urjtag/src/bus/readmem.c index 3c52b74b..5802cbf8 100644 --- a/urjtag/src/bus/readmem.c +++ b/urjtag/src/bus/readmem.c @@ -32,15 +32,10 @@ #include #include -#ifdef UNUSED /* RFHH */ -#include -#include -#include -#endif - -#include "bus.h" -#include "flash.h" -#include "jtag.h" + +#include +#include +#include void urj_bus_readmem (urj_bus_t *bus, FILE * f, uint32_t addr, uint32_t len) diff --git a/urjtag/src/bus/s3c4510x.c b/urjtag/src/bus/s3c4510x.c index 410c0084..a0ca8dad 100644 --- a/urjtag/src/bus/s3c4510x.c +++ b/urjtag/src/bus/s3c4510x.c @@ -58,14 +58,15 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" -#include "tap_state.h" #ifndef DEBUG_LVL2 diff --git a/urjtag/src/bus/sa1110.c b/urjtag/src/bus/sa1110.c index 35063cc7..c4ab596a 100644 --- a/urjtag/src/bus/sa1110.c +++ b/urjtag/src/bus/sa1110.c @@ -32,11 +32,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/sh7727.c b/urjtag/src/bus/sh7727.c index c758a8af..232ae545 100644 --- a/urjtag/src/bus/sh7727.c +++ b/urjtag/src/bus/sh7727.c @@ -29,11 +29,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/sh7750r.c b/urjtag/src/bus/sh7750r.c index b46aa31a..2cf50983 100644 --- a/urjtag/src/bus/sh7750r.c +++ b/urjtag/src/bus/sh7750r.c @@ -29,11 +29,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/sh7751r.c b/urjtag/src/bus/sh7751r.c index f8877c10..e0516868 100644 --- a/urjtag/src/bus/sh7751r.c +++ b/urjtag/src/bus/sh7751r.c @@ -29,11 +29,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/sharc21065l.c b/urjtag/src/bus/sharc21065l.c index cc1e4c4d..87d795e1 100644 --- a/urjtag/src/bus/sharc21065l.c +++ b/urjtag/src/bus/sharc21065l.c @@ -33,10 +33,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/slsup3.c b/urjtag/src/bus/slsup3.c index 263cb85e..37d6c41f 100644 --- a/urjtag/src/bus/slsup3.c +++ b/urjtag/src/bus/slsup3.c @@ -32,10 +32,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/tx4925.c b/urjtag/src/bus/tx4925.c index bc50aff7..b64ef47f 100644 --- a/urjtag/src/bus/tx4925.c +++ b/urjtag/src/bus/tx4925.c @@ -30,11 +30,12 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" diff --git a/urjtag/src/bus/writemem.c b/urjtag/src/bus/writemem.c index 2ac3b6ac..e7cf288d 100644 --- a/urjtag/src/bus/writemem.c +++ b/urjtag/src/bus/writemem.c @@ -25,15 +25,10 @@ #include #include -#ifdef UNUSED /* RFHH */ -#include -#include -#include -#endif - -#include "bus.h" -#include "flash.h" -#include "jtag.h" + +#include +#include +#include void urj_bus_writemem (urj_bus_t *bus, FILE * f, uint32_t addr, uint32_t len) diff --git a/urjtag/src/bus/zefant-xs3.c b/urjtag/src/bus/zefant-xs3.c index 49429c7b..b1906b43 100644 --- a/urjtag/src/bus/zefant-xs3.c +++ b/urjtag/src/bus/zefant-xs3.c @@ -60,14 +60,15 @@ #include #include -#include "part.h" -#include "bus.h" -#include "chain.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include +#include +#include +#include + #include "buses.h" #include "generic_bus.h" -#include "tap_state.h" /* EEPROM commands */ #define EEPROM_CMD_WREN 0x06 diff --git a/urjtag/src/cmd/cmd_addpart.c b/urjtag/src/cmd/cmd_addpart.c index b30b85a3..056dd04f 100644 --- a/urjtag/src/cmd/cmd_addpart.c +++ b/urjtag/src/cmd/cmd_addpart.c @@ -25,11 +25,11 @@ #include #include -#include "jtag.h" -#include "chain.h" -#include "bus.h" +#include +#include +#include -#include "cmd.h" +#include static int cmd_addpart_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_bit.c b/urjtag/src/cmd/cmd_bit.c index cd77a6b2..5f81045f 100644 --- a/urjtag/src/cmd/cmd_bit.c +++ b/urjtag/src/cmd/cmd_bit.c @@ -28,9 +28,10 @@ #include #include -#include "jtag.h" +#include +#include -#include "cmd.h" +#include static void cmd_bit_print_params (char *params[], unsigned int parameters, char *command, @@ -50,13 +51,12 @@ cmd_bit_print_params (char *params[], unsigned int parameters, char *command, static int cmd_bit_run (urj_chain_t *chain, char *params[]) { - urj_part_t *part; - urj_data_register_t *bsr; unsigned int bit; int type; int safe; unsigned int control; unsigned int parameters = urj_cmd_params (params); + urj_bsbit_t *bsbit; char command[1024]; cmd_bit_print_params (params, parameters, command, sizeof command); @@ -75,28 +75,6 @@ cmd_bit_run (urj_chain_t *chain, char *params[]) return 1; } - if (!chain->parts) - { - printf (_("Run \"detect\" first.\n")); - return 1; - } - - if (chain->active_part >= chain->parts->len) - { - printf (_("%s: no active part\n"), "bit"); - return 1; - } - - part = chain->parts->parts[chain->active_part]; - bsr = urj_part_find_data_register (part, "BSR"); - if (bsr == NULL) - { - printf (_ - ("%s: missing Boundary Scan Register (BSR) for command '%s'\n"), - "bit", command); - return 1; - } - /* bit number */ if (urj_cmd_get_number (params[1], &bit)) { @@ -105,19 +83,6 @@ cmd_bit_run (urj_chain_t *chain, char *params[]) return -1; } - if (bit >= bsr->in->len) - { - printf (_("%s: invalid boundary bit number for command '%s'\n"), - "bit", command); - return 1; - } - if (part->bsbits[bit] != NULL) - { - printf (_("%s: duplicate bit declaration for command '%s'\n"), "bit", - command); - return 1; - } - /* bit type */ if (strlen (params[2]) != 1) { @@ -159,53 +124,50 @@ cmd_bit_run (urj_chain_t *chain, char *params[]) "bit", command); return -1; } - safe = (params[3][0] == '1'); - bsr->in->data[bit] = safe; - - /* allocate bsbit */ - part->bsbits[bit] = - urj_part_bsbit_alloc (bit, params[4], type, - urj_part_find_signal (part, params[4]), safe); - if (part->bsbits[bit] == NULL) - { - printf (_("%s: out of memory for command '%s'\n"), "bit", command); - return 1; - } /* test for control bit */ - if (urj_cmd_params (params) == 5) - return 1; - - /* control bit number */ - if (urj_cmd_get_number (params[5], &control)) - { - printf (_("%s: unable to get control bit number for command '%s'\n"), - "bit", command); - return -1; - } - if (control >= bsr->in->len) - { - printf (_("%s: invalid control bit number for command '%s'\n"), "bit", - command); - return 1; + if (urj_cmd_params (params) == 5) { + bsbit = urj_part_bsbit_alloc (chain, bit, params[4], type, safe); + if (bsbit == NULL) + { + return -1; + } + + } else { + int control_value; + int control_state; + + /* control bit number */ + if (urj_cmd_get_number (params[5], &control)) + { + printf (_("%s: unable to get control bit number for command '%s'\n"), + "bit", command); + return -1; + } + /* control value */ + if (strlen (params[6]) != 1) + { + printf (_("%s: invalid control value length for command '%s'\n"), + "bit", command); + return -1; + } + control_value = (params[6][0] == '1'); + + /* control state */ + if (strcasecmp (params[7], "Z")) + return -1; + + control_state = URJ_BSBIT_STATE_Z; + + bsbit = urj_part_bsbit_alloc_control (chain, bit, params[4], type, safe, + control, control_value, + control_state); + if (bsbit == NULL) + { + return -1; + } } - part->bsbits[bit]->control = control; - - /* control value */ - if (strlen (params[6]) != 1) - { - printf (_("%s: invalid control value length for command '%s'\n"), - "bit", command); - return -1; - } - part->bsbits[bit]->control_value = (params[6][0] == '1') ? 1 : 0; - - /* control state */ - if (strcasecmp (params[7], "Z")) - return -1; - - part->bsbits[bit]->control_state = URJ_BSBIT_STATE_Z; return 1; } diff --git a/urjtag/src/cmd/cmd_bsdl.c b/urjtag/src/cmd/cmd_bsdl.c index 107d4eb4..7bda2ae6 100644 --- a/urjtag/src/cmd/cmd_bsdl.c +++ b/urjtag/src/cmd/cmd_bsdl.c @@ -28,9 +28,9 @@ #include #include -#include "bsdl.h" -#include "chain.h" -#include "cmd.h" +#include +#include +#include static int cmd_bsdl_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_bus.c b/urjtag/src/cmd/cmd_bus.c index f2c567db..b46d5396 100644 --- a/urjtag/src/cmd/cmd_bus.c +++ b/urjtag/src/cmd/cmd_bus.c @@ -27,9 +27,10 @@ #include #include -#include "jtag.h" +#include +#include -#include "cmd.h" +#include static int cmd_bus_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_cable.c b/urjtag/src/cmd/cmd_cable.c index 696f0a28..b828bd48 100644 --- a/urjtag/src/cmd/cmd_cable.c +++ b/urjtag/src/cmd/cmd_cable.c @@ -28,14 +28,14 @@ #include #include -#include "parport.h" -#include "tap.h" -#include "cable.h" -#include "chain.h" -#include "jtag.h" -#include "bus.h" - -#include "cmd.h" +#include +#include +#include +#include +#include +#include + +#include static int cmd_cable_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_cmd.c b/urjtag/src/cmd/cmd_cmd.c index cfca4f15..1007cc80 100644 --- a/urjtag/src/cmd/cmd_cmd.c +++ b/urjtag/src/cmd/cmd_cmd.c @@ -27,9 +27,9 @@ #include #include -#include "jtag.h" +#include -#include "cmd.h" +#include extern urj_cmd_t urj_cmd_quit; extern urj_cmd_t urj_cmd_help; @@ -155,6 +155,7 @@ urj_cmd_run (urj_chain_t *chain, char *params[]) if (strcasecmp (urj_cmds[i]->name, params[0]) == 0) { int r; + run_cmd: r = urj_cmds[i]->run (chain, params); if (r < 0) diff --git a/urjtag/src/cmd/cmd_debug.c b/urjtag/src/cmd/cmd_debug.c index 5b656a0d..16bfcb4c 100644 --- a/urjtag/src/cmd/cmd_debug.c +++ b/urjtag/src/cmd/cmd_debug.c @@ -30,9 +30,9 @@ //#include //#include "part.h" //#include "bssignal.h" -#include "jtag.h" +#include -#include "cmd.h" +#include static int cmd_debug_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_detect.c b/urjtag/src/cmd/cmd_detect.c index 740101a6..e350077b 100644 --- a/urjtag/src/cmd/cmd_detect.c +++ b/urjtag/src/cmd/cmd_detect.c @@ -27,11 +27,12 @@ #include #include -#include "jtag.h" -#include "chain.h" -#include "bus.h" +#include +#include +#include +#include -#include "cmd.h" +#include static int cmd_detect_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_detectflash.c b/urjtag/src/cmd/cmd_detectflash.c index 277a343c..4eb71817 100644 --- a/urjtag/src/cmd/cmd_detectflash.c +++ b/urjtag/src/cmd/cmd_detectflash.c @@ -26,9 +26,9 @@ #include -#include -#include -#include +#include +#include +#include static int cmd_detectflash_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_discovery.c b/urjtag/src/cmd/cmd_discovery.c index a7fb79fe..92d0e44b 100644 --- a/urjtag/src/cmd/cmd_discovery.c +++ b/urjtag/src/cmd/cmd_discovery.c @@ -26,9 +26,9 @@ #include -#include "jtag.h" +#include -#include "cmd.h" +#include static int cmd_discovery_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_dr.c b/urjtag/src/cmd/cmd_dr.c index a8608375..ed781c2b 100644 --- a/urjtag/src/cmd/cmd_dr.c +++ b/urjtag/src/cmd/cmd_dr.c @@ -27,10 +27,14 @@ #include #include -#include "tap_register.h" -#include "jtag.h" - -#include "cmd.h" +#include +#include +#include +#include +#include +#include + +#include static int cmd_dr_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_endian.c b/urjtag/src/cmd/cmd_endian.c index 1bacd32f..c64606f9 100644 --- a/urjtag/src/cmd/cmd_endian.c +++ b/urjtag/src/cmd/cmd_endian.c @@ -27,9 +27,9 @@ #include #include -#include "jtag.h" +#include -#include "cmd.h" +#include static int cmd_endian_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_eraseflash.c b/urjtag/src/cmd/cmd_eraseflash.c index 175c2346..3f50153b 100644 --- a/urjtag/src/cmd/cmd_eraseflash.c +++ b/urjtag/src/cmd/cmd_eraseflash.c @@ -28,10 +28,10 @@ #include #include -#include "jtag.h" -#include "flash.h" +#include +#include -#include "cmd.h" +#include static int cmd_eraseflash_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_flashmem.c b/urjtag/src/cmd/cmd_flashmem.c index 59a54a07..dd72b441 100644 --- a/urjtag/src/cmd/cmd_flashmem.c +++ b/urjtag/src/cmd/cmd_flashmem.c @@ -28,10 +28,10 @@ #include #include -#include "jtag.h" -#include "flash.h" +#include +#include -#include "cmd.h" +#include static int cmd_flashmem_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_frequency.c b/urjtag/src/cmd/cmd_frequency.c index 76feaec6..58c48330 100644 --- a/urjtag/src/cmd/cmd_frequency.c +++ b/urjtag/src/cmd/cmd_frequency.c @@ -26,10 +26,10 @@ #include -#include "cable.h" -#include "jtag.h" +#include +#include -#include "cmd.h" +#include static int cmd_frequency_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_get.c b/urjtag/src/cmd/cmd_get.c index 51abe5d5..5229b4bc 100644 --- a/urjtag/src/cmd/cmd_get.c +++ b/urjtag/src/cmd/cmd_get.c @@ -27,11 +27,11 @@ #include #include -#include "part.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include -#include "cmd.h" +#include static int cmd_get_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_help.c b/urjtag/src/cmd/cmd_help.c index cebcc171..78f213d8 100644 --- a/urjtag/src/cmd/cmd_help.c +++ b/urjtag/src/cmd/cmd_help.c @@ -27,7 +27,7 @@ #include #include -#include +#include static int cmd_help_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_idcode.c b/urjtag/src/cmd/cmd_idcode.c index 2ee45256..fa08843e 100644 --- a/urjtag/src/cmd/cmd_idcode.c +++ b/urjtag/src/cmd/cmd_idcode.c @@ -25,9 +25,9 @@ #include -#include "jtag.h" +#include -#include "cmd.h" +#include static int cmd_idcode_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_include.c b/urjtag/src/cmd/cmd_include.c index 6bcddf95..113e7a9f 100644 --- a/urjtag/src/cmd/cmd_include.c +++ b/urjtag/src/cmd/cmd_include.c @@ -29,10 +29,10 @@ #include #include -#include "jtag.h" +#include -#include "cmd.h" -#include "bsdl.h" +#include +#include static int cmd_include_or_script_run (urj_chain_t *chain, int is_include, char *params[]) diff --git a/urjtag/src/cmd/cmd_initbus.c b/urjtag/src/cmd/cmd_initbus.c index 6d995980..a664dcd0 100644 --- a/urjtag/src/cmd/cmd_initbus.c +++ b/urjtag/src/cmd/cmd_initbus.c @@ -28,8 +28,11 @@ #include #include -#include "cmd.h" -#include "jtag.h" +#include +#include +#include +#include +#include static int cmd_initbus_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_instruction.c b/urjtag/src/cmd/cmd_instruction.c index 3a4328c9..6411334c 100644 --- a/urjtag/src/cmd/cmd_instruction.c +++ b/urjtag/src/cmd/cmd_instruction.c @@ -27,10 +27,10 @@ #include #include -#include "part.h" -#include "jtag.h" +#include +#include -#include "cmd.h" +#include static int cmd_instruction_run (urj_chain_t *chain, char *params[]) @@ -70,50 +70,19 @@ cmd_instruction_run (urj_chain_t *chain, char *params[]) if (strcasecmp (params[1], "length") != 0) return -1; - if (part->instructions != NULL) - { - printf (_("instruction length is already set and used\n")); - return 1; - } - if (urj_cmd_get_number (params[2], &len)) return -1; - part->instruction_length = len; - return 1; + return urj_part_instruction_length_set (part, len); } if (urj_cmd_params (params) == 4) { urj_part_instruction_t *i; - if (strlen (params[2]) != part->instruction_length) - { - printf (_("invalid instruction length\n")); - return 1; - } - - if (urj_part_find_instruction (part, params[1]) != NULL) - { - printf (_("Instruction '%s' already defined\n"), params[1]); - return 1; - } - - i = urj_part_instruction_alloc (params[1], part->instruction_length, - params[2]); + i = urj_part_instruction_define (part, params[1], params[2], params[3]); if (!i) { - printf (_("out of memory\n")); - return 1; - } - - i->next = part->instructions; - part->instructions = i; - - i->data_register = urj_part_find_data_register (part, params[3]); - if (i->data_register == NULL) - { - printf (_("unknown data register '%s'\n"), params[3]); return 1; } diff --git a/urjtag/src/cmd/cmd_jtag_data_dir.c b/urjtag/src/cmd/cmd_jtag_data_dir.c index 332eb702..a5e2be1e 100644 --- a/urjtag/src/cmd/cmd_jtag_data_dir.c +++ b/urjtag/src/cmd/cmd_jtag_data_dir.c @@ -6,7 +6,7 @@ */ #include -#include "jtag.h" +#include static const char *jtag_argv0; diff --git a/urjtag/src/cmd/cmd_parse.c b/urjtag/src/cmd/cmd_parse.c index f723c23b..2c3ca59c 100644 --- a/urjtag/src/cmd/cmd_parse.c +++ b/urjtag/src/cmd/cmd_parse.c @@ -31,9 +31,9 @@ #include #include -#include "chain.h" -#include "cmd.h" -#include "jtag.h" +#include +#include +#include #define MAXINPUTLINE 100 /* Maximum input line length */ @@ -54,7 +54,7 @@ urj_cmd_jtag_parse_line (urj_chain_t *chain, char *line) return 1; /* allocate as many chars as in the input line; this will be enough in all cases */ - sline = malloc ((l + 1) * sizeof (char)); + sline = malloc (l + 1); if (sline == NULL) { printf (_("Out of memory\n")); diff --git a/urjtag/src/cmd/cmd_part.c b/urjtag/src/cmd/cmd_part.c index a1bb8ce5..7d3439e1 100644 --- a/urjtag/src/cmd/cmd_part.c +++ b/urjtag/src/cmd/cmd_part.c @@ -28,9 +28,11 @@ #include #include -#include "jtag.h" +#include +#include +#include -#include "cmd.h" +#include static int cmd_part_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_peekpoke.c b/urjtag/src/cmd/cmd_peekpoke.c index 19697d72..c32a5633 100644 --- a/urjtag/src/cmd/cmd_peekpoke.c +++ b/urjtag/src/cmd/cmd_peekpoke.c @@ -27,9 +27,10 @@ #include #include -#include "jtag.h" +#include +#include -#include "cmd.h" +#include static int cmd_peek_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_pod.c b/urjtag/src/cmd/cmd_pod.c index e3031f60..89c36284 100644 --- a/urjtag/src/cmd/cmd_pod.c +++ b/urjtag/src/cmd/cmd_pod.c @@ -30,10 +30,10 @@ #include #include -#include "jtag.h" -#include +#include +#include -#include "cmd.h" +#include static int cmd_pod_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_print.c b/urjtag/src/cmd/cmd_print.c index 048ff69d..ba014b59 100644 --- a/urjtag/src/cmd/cmd_print.c +++ b/urjtag/src/cmd/cmd_print.c @@ -38,10 +38,16 @@ typedef char wchar_t; # define wcslen(str) strlen(str) #endif -#include "part.h" -#include "jtag.h" +#include +#include +#include +#include +#include +#include +#include +#include -#include "cmd.h" +#include static int cmd_print_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_quit.c b/urjtag/src/cmd/cmd_quit.c index 6e834acf..0d898867 100644 --- a/urjtag/src/cmd/cmd_quit.c +++ b/urjtag/src/cmd/cmd_quit.c @@ -26,7 +26,7 @@ #include -#include +#include static int cmd_quit_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_readmem.c b/urjtag/src/cmd/cmd_readmem.c index 6a08fc14..08a5d83e 100644 --- a/urjtag/src/cmd/cmd_readmem.c +++ b/urjtag/src/cmd/cmd_readmem.c @@ -27,9 +27,9 @@ #include #include -#include "jtag.h" +#include -#include "cmd.h" +#include static int cmd_readmem_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_register.c b/urjtag/src/cmd/cmd_register.c index 19d62422..1a788ae6 100644 --- a/urjtag/src/cmd/cmd_register.c +++ b/urjtag/src/cmd/cmd_register.c @@ -28,9 +28,13 @@ #include #include -#include "jtag.h" +#include +#include +#include +#include +#include -#include "cmd.h" +#include static int cmd_register_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_reset.c b/urjtag/src/cmd/cmd_reset.c index c6460b4d..9d4b30b1 100644 --- a/urjtag/src/cmd/cmd_reset.c +++ b/urjtag/src/cmd/cmd_reset.c @@ -27,10 +27,10 @@ #include #include -#include "jtag.h" -#include "tap.h" +#include +#include -#include "cmd.h" +#include static int cmd_reset_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_salias.c b/urjtag/src/cmd/cmd_salias.c index d9d05ef0..31164a4b 100644 --- a/urjtag/src/cmd/cmd_salias.c +++ b/urjtag/src/cmd/cmd_salias.c @@ -28,9 +28,12 @@ #include #include -#include "jtag.h" +#include "urjtag/chain.h" +#include "urjtag/part.h" +#include "urjtag/bssignal.h" +#include "urjtag/jtag.h" -#include "cmd.h" +#include "urjtag/cmd.h" static int cmd_salias_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_scan.c b/urjtag/src/cmd/cmd_scan.c index e9d3baf1..d4bbab77 100644 --- a/urjtag/src/cmd/cmd_scan.c +++ b/urjtag/src/cmd/cmd_scan.c @@ -28,9 +28,15 @@ #include #include -#include "jtag.h" - -#include "cmd.h" +#include +#include +#include +#include +#include +#include +#include + +#include static int cmd_scan_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_set.c b/urjtag/src/cmd/cmd_set.c index 52ca584e..8fb04deb 100644 --- a/urjtag/src/cmd/cmd_set.c +++ b/urjtag/src/cmd/cmd_set.c @@ -27,11 +27,11 @@ #include #include -#include "part.h" -#include "bssignal.h" -#include "jtag.h" +#include +#include +#include -#include "cmd.h" +#include static int cmd_set_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_shell.c b/urjtag/src/cmd/cmd_shell.c index 09ba7ca0..691b36b1 100644 --- a/urjtag/src/cmd/cmd_shell.c +++ b/urjtag/src/cmd/cmd_shell.c @@ -30,11 +30,11 @@ #include #include #include -//#include "part.h" -//#include "bssignal.h" -#include "jtag.h" +//#include +//#include +#include -#include "cmd.h" +#include static int cmd_shell_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_shift.c b/urjtag/src/cmd/cmd_shift.c index 0b387c68..deef99f1 100644 --- a/urjtag/src/cmd/cmd_shift.c +++ b/urjtag/src/cmd/cmd_shift.c @@ -27,10 +27,10 @@ #include #include -#include "chain.h" -#include "jtag.h" +#include +#include -#include "cmd.h" +#include static int cmd_shift_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_signal.c b/urjtag/src/cmd/cmd_signal.c index 1c0bc786..7bbedff5 100644 --- a/urjtag/src/cmd/cmd_signal.c +++ b/urjtag/src/cmd/cmd_signal.c @@ -28,9 +28,11 @@ #include #include -#include "jtag.h" +#include +#include +#include -#include "cmd.h" +#include static int cmd_signal_run (urj_chain_t *chain, char *params[]) @@ -42,37 +44,22 @@ cmd_signal_run (urj_chain_t *chain, char *params[]) if ((i = urj_cmd_params (params)) < 2) return -1; - if (!urj_cmd_test_cable (chain)) return 1; - if (!chain->parts) + part = urj_part_active_part (chain); + if (part == NULL) { - printf (_("Run \"detect\" first.\n")); return 1; } - if (chain->active_part >= chain->parts->len) - { - printf (_("%s: no active part\n"), "signal"); - return 1; - } - - part = chain->parts->parts[chain->active_part]; if ((s = urj_part_find_signal (part, params[1])) != NULL) { if (i == 3) { printf ("Defining pin for signal %s\n", s->name); - if (s->pin) - free (s->pin); /* erase old */ - - /* Allocate the space for the pin number & copy it */ - s->pin = malloc (strlen (params[2]) + 1); - strcpy (s->pin, params[2]); - - return 1; + return urj_part_signal_redefine_pin(chain, s, params[2]); } else { @@ -81,25 +68,18 @@ cmd_signal_run (urj_chain_t *chain, char *params[]) } } - s = urj_part_signal_alloc (params[1]); - if (i == 3) { /* Add pin number */ - /* Allocate the space for the pin number & copy it */ - s->pin = malloc (strlen (params[2]) + 1); - strcpy (s->pin, params[2]); - + s = urj_part_signal_define_pin(chain, params[1], params[2]); } - - if (!s) + else { - printf (_("out of memory\n")); + s = urj_part_signal_define(chain, params[1]); + } + if (s == NULL) { return 1; } - s->next = part->signals; - part->signals = s; - return 1; } diff --git a/urjtag/src/cmd/cmd_svf.c b/urjtag/src/cmd/cmd_svf.c index 599e052f..405f0fa3 100644 --- a/urjtag/src/cmd/cmd_svf.c +++ b/urjtag/src/cmd/cmd_svf.c @@ -25,12 +25,13 @@ #include "sysdep.h" +#include #include #include #include -#include -#include +#include +#include static int cmd_svf_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_test.c b/urjtag/src/cmd/cmd_test.c index 4008a8c7..cd449320 100644 --- a/urjtag/src/cmd/cmd_test.c +++ b/urjtag/src/cmd/cmd_test.c @@ -28,11 +28,11 @@ #include #include //#include -#include "part.h" -#include "bssignal.h" -#include "jtag.h" +#include "urjtag/part.h" +#include "urjtag/bssignal.h" +#include "urjtag/jtag.h" -#include "cmd.h" +#include "urjtag/cmd.h" static int cmd_test_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_usleep.c b/urjtag/src/cmd/cmd_usleep.c index 819e5d45..a12d7083 100644 --- a/urjtag/src/cmd/cmd_usleep.c +++ b/urjtag/src/cmd/cmd_usleep.c @@ -29,8 +29,8 @@ #include #include -#include "jtag.h" -#include "cmd.h" +#include +#include static int cmd_usleep_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/cmd/cmd_writemem.c b/urjtag/src/cmd/cmd_writemem.c index b781bbdd..42848c0c 100644 --- a/urjtag/src/cmd/cmd_writemem.c +++ b/urjtag/src/cmd/cmd_writemem.c @@ -25,9 +25,9 @@ #include #include -#include "jtag.h" +#include -#include "cmd.h" +#include static int cmd_writemem_run (urj_chain_t *chain, char *params[]) diff --git a/urjtag/src/flash/amd.c b/urjtag/src/flash/amd.c index e3605c3b..9f993ce8 100644 --- a/urjtag/src/flash/amd.c +++ b/urjtag/src/flash/amd.c @@ -38,12 +38,12 @@ #include #include #include -#include #include -#include -#include +#include +#include +#include "intel.h" #include "cfi.h" static int dbg = 0; diff --git a/urjtag/src/flash/amd_flash.c b/urjtag/src/flash/amd_flash.c index a0e360df..3f87eb21 100644 --- a/urjtag/src/flash/amd_flash.c +++ b/urjtag/src/flash/amd_flash.c @@ -34,9 +34,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include "jedec.h" #include "cfi.h" diff --git a/urjtag/src/flash/cfi.c b/urjtag/src/flash/cfi.c index 35def9cb..b60aad55 100644 --- a/urjtag/src/flash/cfi.c +++ b/urjtag/src/flash/cfi.c @@ -33,9 +33,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include "cfi.h" diff --git a/urjtag/src/flash/detectflash.c b/urjtag/src/flash/detectflash.c index 8fb12875..09c6f9ca 100644 --- a/urjtag/src/flash/detectflash.c +++ b/urjtag/src/flash/detectflash.c @@ -33,8 +33,8 @@ #include #include -#include -#include +#include +#include #include "jedec.h" #include "cfi.h" diff --git a/urjtag/src/flash/flash.c b/urjtag/src/flash/flash.c index e9694ec3..5c82ab3c 100644 --- a/urjtag/src/flash/flash.c +++ b/urjtag/src/flash/flash.c @@ -39,12 +39,12 @@ #include #include -#include -#include +#include "cfi.h" +#include "intel.h" -#include "bus.h" -#include "flash.h" -#include "jtag.h" +#include +#include +#include extern urj_flash_driver_t urj_flash_amd_32_flash_driver; extern urj_flash_driver_t urj_flash_amd_16_flash_driver; diff --git a/urjtag/src/flash/intel.c b/urjtag/src/flash/intel.c index 2dd7e663..e8dc8cc4 100644 --- a/urjtag/src/flash/intel.c +++ b/urjtag/src/flash/intel.c @@ -41,9 +41,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include "cfi.h" #include "intel.h" diff --git a/urjtag/src/flash/intel.h b/urjtag/src/flash/intel.h index fb194360..f5fcc9d4 100644 --- a/urjtag/src/flash/intel.h +++ b/urjtag/src/flash/intel.h @@ -40,7 +40,7 @@ #ifndef FLASH_INTEL_H #define FLASH_INTEL_H -#include +#include /* Intel CFI commands - see Table 4. in [1] and Table 3. in [2] */ diff --git a/urjtag/src/flash/jedec.c b/urjtag/src/flash/jedec.c index 4e71250b..8f21b132 100644 --- a/urjtag/src/flash/jedec.c +++ b/urjtag/src/flash/jedec.c @@ -28,9 +28,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include "cfi.h" #include "intel.h" diff --git a/urjtag/src/flash/jedec.h b/urjtag/src/flash/jedec.h index 1a4cb64b..32caa8c5 100644 --- a/urjtag/src/flash/jedec.h +++ b/urjtag/src/flash/jedec.h @@ -25,8 +25,8 @@ #ifndef URJ_FLASH_JEDEC_H #define URJ_FLASH_JEDEC_H -#include -#include +#include +#include int urj_flash_jedec_detect (urj_bus_t *bus, uint32_t adr, urj_flash_cfi_array_t **urj_flash_cfi_array); diff --git a/urjtag/src/flash/jedec_exp.c b/urjtag/src/flash/jedec_exp.c index c0438b9d..50cd55f1 100644 --- a/urjtag/src/flash/jedec_exp.c +++ b/urjtag/src/flash/jedec_exp.c @@ -28,10 +28,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include "jedec.h" #include "cfi.h" diff --git a/urjtag/src/jim/intel_28f800b3.c b/urjtag/src/jim/intel_28f800b3.c index fdfb1ed8..e43af2be 100644 --- a/urjtag/src/jim/intel_28f800b3.c +++ b/urjtag/src/jim/intel_28f800b3.c @@ -26,13 +26,14 @@ * Order Number 290580, Revision: 020, 18 Aug 2005. */ -#include #include #include #include #include #include +#include + #undef VERBOSE typedef enum diff --git a/urjtag/src/jim/some_cpu.c b/urjtag/src/jim/some_cpu.c index 4429a8fd..9db52edc 100644 --- a/urjtag/src/jim/some_cpu.c +++ b/urjtag/src/jim/some_cpu.c @@ -25,8 +25,9 @@ #include #include #include -#include -#include + +#include +#include #undef VERBOSE diff --git a/urjtag/src/jim/tap.c b/urjtag/src/jim/tap.c index cd80178c..697d2f8e 100644 --- a/urjtag/src/jim/tap.c +++ b/urjtag/src/jim/tap.c @@ -26,9 +26,10 @@ #include #include #include -#include -#include +#include + +#include #undef VERBOSE diff --git a/urjtag/src/jtag.c b/urjtag/src/jtag.c index ccf5cc90..c091d139 100644 --- a/urjtag/src/jtag.c +++ b/urjtag/src/jtag.c @@ -46,16 +46,17 @@ #include #endif /* ENABLE_NLS */ -#include "chain.h" -#include "bus.h" -#include "cmd.h" -#include "jtag.h" -#include "flash.h" +#include +#include +#include +#include +#include #ifndef HAVE_GETLINE ssize_t urj_lib_getline (char **lineptr, size_t *n, FILE * stream); #endif +urj_error_state_t urj_error_state; int urj_debug_mode = 0; int urj_big_endian = 0; static int urj_interactive = 0; @@ -404,17 +405,13 @@ main (int argc, char *const argv[]) printf ("\n"); printf (_(" -h, --help display this help and exit\n")); - printf (_ - (" -v, --version display version information and exit\n")); + printf (_(" -v, --version display version information and exit\n")); printf ("\n"); - printf (_ - (" -n, --norc disable reading ~/.jtag/rc on startup\n")); - printf (_ - (" -i, --interactive enter interactive mode after reading files\n")); + printf (_(" -n, --norc disable reading ~/.jtag/rc on startup\n")); + printf (_(" -i, --interactive enter interactive mode after reading files\n")); printf (_(" -q, --quiet Do not print help on startup\n")); printf ("\n"); - printf (_ - (" [FILE] file containing commands to execute\n")); + printf (_(" [FILE] file containing commands to execute\n")); printf ("\n"); printf (_(" Please report bugs at http://www.urjtag.org\n")); diff --git a/urjtag/src/lib/fclock.c b/urjtag/src/lib/fclock.c index dbe36560..5727402a 100644 --- a/urjtag/src/lib/fclock.c +++ b/urjtag/src/lib/fclock.c @@ -32,6 +32,8 @@ #include #include +#include + /* ------------------------------------------------------------------ */ #ifdef __APPLE__ @@ -39,8 +41,6 @@ #include #include -#include "fclock.h" - long double urj_lib_frealtime (void) { diff --git a/urjtag/src/part/bsbit.c b/urjtag/src/part/bsbit.c index e13650d5..82e1715a 100644 --- a/urjtag/src/part/bsbit.c +++ b/urjtag/src/part/bsbit.c @@ -22,35 +22,87 @@ * */ +#include "sysdep.h" + #include #include -#include "bsbit.h" +#include +#include +#include +#include +#include +#include urj_bsbit_t * -urj_part_bsbit_alloc (int bit, const char *name, int type, - urj_part_signal_t *signal, int safe) +urj_part_bsbit_alloc_control (urj_chain_t *chain, int bit, const char *name, + int type, int safe, + int ctrl_num, int ctrl_val, int ctrl_state) { - urj_bsbit_t *b = malloc (sizeof *b); + urj_bsbit_t *b; + urj_part_t *part; + urj_data_register_t *bsr; + urj_part_signal_t *signal; + + if (!chain->parts) + { + urj_error_set (URJ_ERROR_NO_ACTIVE_PART, _("Run \"detect\" first.\n")); + return NULL; + } + if (chain->active_part >= chain->parts->len) + { + urj_error_set (URJ_ERROR_NO_ACTIVE_PART, + _("%s: no active part\n"), "signal"); + return NULL; + } + + part = chain->parts->parts[chain->active_part]; + bsr = urj_part_find_data_register (part, "BSR"); + if (bsr == NULL) + { + urj_error_set(URJ_ERROR_NOTFOUND, + _("missing Boundary Scan Register (BSR)")); + return NULL; + } + + if (bit >= bsr->in->len) + { + urj_error_set(URJ_ERROR_INVALID, _("invalid boundary bit number")); + return NULL; + } + if (part->bsbits[bit] != NULL) + { + urj_error_set(URJ_ERROR_ALREADY, _("duplicate bit declaration")); + return NULL; + } + + signal = urj_part_find_signal (part, name); + + bsr->in->data[bit] = safe; + + b = malloc (sizeof *b); if (!b) + { + urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "malloc fails"); return NULL; + } b->name = strdup (name); if (!b->name) { free (b); + urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "strdup fails"); return NULL; } b->bit = bit; b->type = type; - b->signal = NULL; + b->signal = signal; b->safe = safe; b->control = -1; if (signal != NULL) { - b->signal = signal; switch (type) { case URJ_BSBIT_INPUT: @@ -66,6 +118,29 @@ urj_part_bsbit_alloc (int bit, const char *name, int type, } } + if (ctrl_num != -1) + { + if (ctrl_num >= bsr->in->len) + { + urj_error_set(URJ_ERROR_INVALID, _("invalid control bit number\n")); + return NULL; + } + part->bsbits[bit]->control = ctrl_num; + part->bsbits[bit]->control_value = ctrl_val; + part->bsbits[bit]->control_state = URJ_BSBIT_STATE_Z; + } + + return b; +} + +urj_bsbit_t * +urj_part_bsbit_alloc (urj_chain_t *chain, int bit, const char *name, int type, + int safe) +{ + urj_bsbit_t *b; + + b = urj_part_bsbit_alloc_control (chain, bit, name, type, safe, -1, -1, -1); + return b; } diff --git a/urjtag/src/part/data_register.c b/urjtag/src/part/data_register.c index 2fc5d04d..88309b4c 100644 --- a/urjtag/src/part/data_register.c +++ b/urjtag/src/part/data_register.c @@ -28,7 +28,8 @@ #include #include -#include "data_register.h" +#include +#include urj_data_register_t * urj_part_data_register_alloc (const char *name, int len) diff --git a/urjtag/src/part/instruction.c b/urjtag/src/part/instruction.c index 2ceed238..ef265c1f 100644 --- a/urjtag/src/part/instruction.c +++ b/urjtag/src/part/instruction.c @@ -28,7 +28,8 @@ #include #include -#include "part_instruction.h" +#include +#include urj_part_instruction_t * urj_part_instruction_alloc (const char *name, int len, const char *val) diff --git a/urjtag/src/part/part.c b/urjtag/src/part/part.c index 9e30bb94..7d11ce16 100644 --- a/urjtag/src/part/part.c +++ b/urjtag/src/part/part.c @@ -27,7 +27,13 @@ #include #include -#include "part.h" +#include +#include +#include +#include +#include +#include +#include /* part */ @@ -281,6 +287,69 @@ urj_part_print (urj_part_t *p) printf (format, p->manufacturer, p->part, p->stepping, instruction, dr); } + +int +urj_part_instruction_length_set (urj_part_t *part, int length) +{ + if (part->instructions != NULL) + { + urj_error_set (URJ_ERROR_ALREADY, + _("instruction length is already set and used\n")); + return URJ_STATUS_FAIL; + } + + part->instruction_length = length; + + return URJ_STATUS_OK; +} + + +urj_part_instruction_t * +urj_part_instruction_define (urj_part_t *part, const char *instruction, + const char *code, const char *data_register) +{ + urj_part_instruction_t *i; + urj_data_register_t *dr; + + if (strlen (code) != part->instruction_length) + { + urj_error_set (URJ_ERROR_INVALID, + _("invalid instruction length\n")); + return NULL; + } + + if (urj_part_find_instruction (part, instruction) != NULL) + { + urj_error_set (URJ_ERROR_ALREADY, + _("Instruction '%s' already defined\n"), instruction); + return NULL; + } + + dr = urj_part_find_data_register (part, data_register); + if (dr == NULL) + { + urj_error_set(URJ_ERROR_NOTFOUND, + _("unknown data register '%s'\n"), data_register); + return NULL; + } + + i = urj_part_instruction_alloc (instruction, part->instruction_length, + code); + if (!i) + { + /* retain error state */ + return NULL; + } + + i->next = part->instructions; + part->instructions = i; + + i->data_register = dr; + + return i; +} + + /* parts */ urj_parts_t * diff --git a/urjtag/src/part/signal.c b/urjtag/src/part/signal.c index cc36774a..3d40b8bb 100644 --- a/urjtag/src/part/signal.c +++ b/urjtag/src/part/signal.c @@ -25,19 +25,27 @@ #include #include -#include "bssignal.h" +#include "sysdep.h" + +#include +#include +#include urj_part_signal_t * urj_part_signal_alloc (const char *name) { urj_part_signal_t *s = malloc (sizeof *s); if (!s) + { + urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "malloc fails"); return NULL; + } s->name = strdup (name); if (!s->name) { free (s); + urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "malloc fails"); return NULL; } s->pin = NULL; /* djf hack pin number */ @@ -61,13 +69,18 @@ urj_part_salias_t * urj_part_salias_alloc (const char *name, const urj_part_signal_t *signal) { urj_part_salias_t *sa = malloc (sizeof *sa); + if (sa == NULL) + { + urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "malloc fails"); return NULL; + } sa->name = strdup (name); if (sa->name == NULL) { free (sa); + urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "malloc fails"); return NULL; } sa->next = NULL; @@ -84,3 +97,83 @@ urj_part_salias_free (urj_part_salias_t *salias) free (salias->name); free (salias); } + +urj_part_t * +urj_part_active_part(urj_chain_t *chain) +{ + if (!chain->parts) + { + urj_error_set (URJ_ERROR_NO_ACTIVE_PART, + _("Run \"detect\" first.\n")); + return NULL; + } + if (chain->active_part >= chain->parts->len) + { + urj_error_set (URJ_ERROR_NO_ACTIVE_PART, + _("%s: no active part\n"), "signal"); + return NULL; + } + + return chain->parts->parts[chain->active_part]; +} + +urj_part_signal_t * +urj_part_signal_define_pin (urj_chain_t *chain, const char *signal_name, + const char *pin_name) +{ + urj_part_t *part; + urj_part_signal_t *s; + + part = urj_part_active_part (chain); + + if (urj_part_find_signal (part, signal_name) != NULL) + { + urj_error_set (URJ_ERROR_ALREADY, + _("Signal '%s' already defined\n"), signal_name); + return NULL; + } + + s = urj_part_signal_alloc (signal_name); + if (!s) + return NULL; + + if (pin_name != NULL) + { /* Add pin number */ + /* Allocate the space for the pin number & copy it */ + s->pin = strdup (pin_name); + if (s->pin == NULL) + { + urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "strdup fails"); + return NULL; + } + } + + s->next = part->signals; + part->signals = s; + + return s; +} + +urj_part_signal_t * +urj_part_signal_define (urj_chain_t *chain, const char *signal_name) +{ + return urj_part_signal_define_pin(chain, signal_name, NULL); +} + +int +urj_part_signal_redefine_pin (urj_chain_t *chain, urj_part_signal_t *s, + const char *pin_name) +{ + /* @@@@ RFHH Check s != NULL */ + free(s->pin); + + /* Allocate the space for the pin number & copy it */ + s->pin = strdup (pin_name); + if (s->pin == NULL) + { + urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "strdup fails"); + return URJ_STATUS_FAIL; + } + + return URJ_STATUS_OK; +} diff --git a/urjtag/src/svf/svf.c b/urjtag/src/svf/svf.c index 64e7f6e4..1f7c0e1b 100644 --- a/urjtag/src/svf/svf.c +++ b/urjtag/src/svf/svf.c @@ -41,9 +41,13 @@ #include "sysdep.h" -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #if 0 #include /* two include files w/ the same name @@ -52,13 +56,16 @@ * RFHH */ #endif -#include +#include + +#include #include "svf.h" + #include "svf_bison.h" #ifdef __MINGW32__ -#include "fclock.h" +#include #endif diff --git a/urjtag/src/svf/svf.h b/urjtag/src/svf/svf.h index 0311ec73..e037f8f6 100644 --- a/urjtag/src/svf/svf.h +++ b/urjtag/src/svf/svf.h @@ -25,7 +25,7 @@ #include -#include "chain.h" +#include #define MAX_PATH_STATES 64 diff --git a/urjtag/src/svf/svf_flex.l b/urjtag/src/svf/svf_flex.l index 1c96a999..44d8f79e 100644 --- a/urjtag/src/svf/svf_flex.l +++ b/urjtag/src/svf/svf_flex.l @@ -41,6 +41,7 @@ #endif #include "svf.h" + #include "svf_bison.h" #define YY_EXTRA_TYPE urj_svf_scanner_extra_t * diff --git a/urjtag/src/tap/cable.c b/urjtag/src/tap/cable.c index b2ddfe17..f1e2d11d 100644 --- a/urjtag/src/tap/cable.c +++ b/urjtag/src/tap/cable.c @@ -34,8 +34,8 @@ #include #include -#include "jtag.h" -#include "cable.h" +#include +#include #undef VERBOSE diff --git a/urjtag/src/tap/cable/arcom.c b/urjtag/src/tap/cable/arcom.c index 5e18681b..c81d725f 100644 --- a/urjtag/src/tap/cable/arcom.c +++ b/urjtag/src/tap/cable/arcom.c @@ -25,9 +25,9 @@ #include "sysdep.h" -#include "cable.h" -#include "parport.h" -#include "chain.h" +#include +#include +#include #include "generic.h" #include "generic_parport.h" diff --git a/urjtag/src/tap/cable/byteblaster.c b/urjtag/src/tap/cable/byteblaster.c index 2bcd3f4f..d2f8e8d3 100644 --- a/urjtag/src/tap/cable/byteblaster.c +++ b/urjtag/src/tap/cable/byteblaster.c @@ -33,9 +33,9 @@ #include "sysdep.h" -#include "cable.h" -#include "parport.h" -#include "chain.h" +#include +#include +#include #include "generic.h" #include "generic_parport.h" diff --git a/urjtag/src/tap/cable/cmd_xfer.h b/urjtag/src/tap/cable/cmd_xfer.h index e0297b41..352e7a9c 100644 --- a/urjtag/src/tap/cable/cmd_xfer.h +++ b/urjtag/src/tap/cable/cmd_xfer.h @@ -27,7 +27,7 @@ #include "sysdep.h" -#include +#include /* description of a command the buffer can contain one or more commands if receive count diff --git a/urjtag/src/tap/cable/dlc5.c b/urjtag/src/tap/cable/dlc5.c index fe92f46a..9610eeb1 100644 --- a/urjtag/src/tap/cable/dlc5.c +++ b/urjtag/src/tap/cable/dlc5.c @@ -29,9 +29,9 @@ #include "sysdep.h" -#include "cable.h" -#include "parport.h" -#include "chain.h" +#include +#include +#include #include "generic.h" #include "generic_parport.h" diff --git a/urjtag/src/tap/cable/ea253.c b/urjtag/src/tap/cable/ea253.c index e22540a2..084cfbe9 100644 --- a/urjtag/src/tap/cable/ea253.c +++ b/urjtag/src/tap/cable/ea253.c @@ -25,9 +25,9 @@ #include "sysdep.h" -#include "cable.h" -#include "parport.h" -#include "chain.h" +#include +#include +#include #include "generic.h" #include "generic_parport.h" diff --git a/urjtag/src/tap/cable/ei012.c b/urjtag/src/tap/cable/ei012.c index aa560f31..327893d0 100644 --- a/urjtag/src/tap/cable/ei012.c +++ b/urjtag/src/tap/cable/ei012.c @@ -25,9 +25,9 @@ #include "sysdep.h" -#include "cable.h" -#include "parport.h" -#include "chain.h" +#include +#include +#include #include "generic.h" #include "generic_parport.h" diff --git a/urjtag/src/tap/cable/ft2232.c b/urjtag/src/tap/cable/ft2232.c index df4d2431..c9f08d40 100644 --- a/urjtag/src/tap/cable/ft2232.c +++ b/urjtag/src/tap/cable/ft2232.c @@ -24,20 +24,21 @@ * */ +#include "sysdep.h" + +#include #include #include -#include "sysdep.h" - -#include -#include -#include +#include +#include +#include #include "generic.h" #include "generic_usbconn.h" -#include "usbconn.h" -#include "usbconn/libftdx.h" +#include +#include #include "cmd_xfer.h" diff --git a/urjtag/src/tap/cable/generic.c b/urjtag/src/tap/cable/generic.c index 4de57e64..de75cdea 100644 --- a/urjtag/src/tap/cable/generic.c +++ b/urjtag/src/tap/cable/generic.c @@ -30,14 +30,14 @@ #include #include -#include "cable.h" -#include "parport.h" -#include "chain.h" -#include "fclock.h" +#include +#include +#include +#include #include "generic.h" -#include +#include #ifndef HAVE_FMAX diff --git a/urjtag/src/tap/cable/generic.h b/urjtag/src/tap/cable/generic.h index e1b79a69..d462c824 100644 --- a/urjtag/src/tap/cable/generic.h +++ b/urjtag/src/tap/cable/generic.h @@ -25,8 +25,8 @@ #ifndef URJ_TAP_CABLE_GENERIC_H #define URJ_TAP_CABLE_GENERIC_H -#include "cable.h" -#include "parport.h" +#include +#include typedef struct { diff --git a/urjtag/src/tap/cable/generic_parport.c b/urjtag/src/tap/cable/generic_parport.c index 1969b1c3..da057b06 100644 --- a/urjtag/src/tap/cable/generic_parport.c +++ b/urjtag/src/tap/cable/generic_parport.c @@ -28,14 +28,15 @@ #include #include -#include "cable.h" -#include "chain.h" -#include "parport.h" +#include +#include +#include + +#include + #include "generic.h" #include "generic_parport.h" -#include - #undef VERBOSE #ifdef VERBOSE diff --git a/urjtag/src/tap/cable/generic_parport.h b/urjtag/src/tap/cable/generic_parport.h index 6f25ef6c..e9273f5e 100644 --- a/urjtag/src/tap/cable/generic_parport.h +++ b/urjtag/src/tap/cable/generic_parport.h @@ -25,8 +25,8 @@ #ifndef URJ_TAP_CABLE_GENERIC_PARPORT_H #define URJ_TAP_CABLE_GENERIC_PARPORT_H -#include "cable.h" -#include "parport.h" +#include +#include int urj_tap_cable_generic_parport_connect (char *params[], urj_cable_t *cable); diff --git a/urjtag/src/tap/cable/generic_usbconn.c b/urjtag/src/tap/cable/generic_usbconn.c index 207b3c51..978b4708 100644 --- a/urjtag/src/tap/cable/generic_usbconn.c +++ b/urjtag/src/tap/cable/generic_usbconn.c @@ -28,12 +28,12 @@ #include #include -#include "cable.h" -#include "chain.h" +#include +#include #include "generic.h" #include "generic_usbconn.h" -#include +#include #undef VERBOSE diff --git a/urjtag/src/tap/cable/generic_usbconn.h b/urjtag/src/tap/cable/generic_usbconn.h index cd31a67c..30dc294b 100644 --- a/urjtag/src/tap/cable/generic_usbconn.h +++ b/urjtag/src/tap/cable/generic_usbconn.h @@ -25,8 +25,8 @@ #ifndef URJ_TAP_CABLE_GENERIC_USBCONN_H #define URJ_TAP_CABLE_GENERIC_USBCONN_H -#include "cable.h" -#include "usbconn.h" +#include +#include int urj_tap_cable_generic_usbconn_connect (char *params[], urj_cable_t *cable); diff --git a/urjtag/src/tap/cable/jim.c b/urjtag/src/tap/cable/jim.c index 7fae17f4..951b51b8 100644 --- a/urjtag/src/tap/cable/jim.c +++ b/urjtag/src/tap/cable/jim.c @@ -27,15 +27,15 @@ #include #include -#include "cable.h" -#include "parport.h" -#include "chain.h" +#include +#include +#include #include "generic.h" -#include +#include -#include +#include /* private parameters of this cable driver */ typedef struct diff --git a/urjtag/src/tap/cable/jlink.c b/urjtag/src/tap/cable/jlink.c index 778e1044..4e2d9fa7 100644 --- a/urjtag/src/tap/cable/jlink.c +++ b/urjtag/src/tap/cable/jlink.c @@ -32,18 +32,18 @@ #include "generic.h" #include "generic_usbconn.h" -#include "usbconn.h" -#include "usbconn/libusb.h" +#include +#include /* ---------------------------------------------------------------------- */ #include "sysdep.h" -#include "cable.h" -#include "chain.h" +#include +#include -#include "jtag.h" +#include #include #include diff --git a/urjtag/src/tap/cable/keithkoep.c b/urjtag/src/tap/cable/keithkoep.c index ce5df496..3ce232fc 100644 --- a/urjtag/src/tap/cable/keithkoep.c +++ b/urjtag/src/tap/cable/keithkoep.c @@ -28,9 +28,9 @@ #include "sysdep.h" -#include "cable.h" -#include "parport.h" -#include "chain.h" +#include +#include +#include #include "generic.h" #include "generic_parport.h" diff --git a/urjtag/src/tap/cable/lattice.c b/urjtag/src/tap/cable/lattice.c index b6c94f11..b0b164dd 100644 --- a/urjtag/src/tap/cable/lattice.c +++ b/urjtag/src/tap/cable/lattice.c @@ -25,9 +25,9 @@ #include "sysdep.h" -#include "cable.h" -#include "parport.h" -#include "chain.h" +#include +#include +#include #include "generic.h" #include "generic_parport.h" diff --git a/urjtag/src/tap/cable/mpcbdm.c b/urjtag/src/tap/cable/mpcbdm.c index af2478b1..d2e4b1e7 100644 --- a/urjtag/src/tap/cable/mpcbdm.c +++ b/urjtag/src/tap/cable/mpcbdm.c @@ -29,9 +29,9 @@ #include "sysdep.h" -#include "cable.h" -#include "parport.h" -#include "chain.h" +#include +#include +#include #include "generic.h" #include "generic_parport.h" diff --git a/urjtag/src/tap/cable/triton.c b/urjtag/src/tap/cable/triton.c index 7597a62c..108bcb8a 100644 --- a/urjtag/src/tap/cable/triton.c +++ b/urjtag/src/tap/cable/triton.c @@ -38,9 +38,9 @@ #include "sysdep.h" -#include "cable.h" -#include "parport.h" -#include "chain.h" +#include +#include +#include #include "generic.h" #include "generic_parport.h" diff --git a/urjtag/src/tap/cable/ts7800.c b/urjtag/src/tap/cable/ts7800.c index bad959c3..a3c2aebd 100644 --- a/urjtag/src/tap/cable/ts7800.c +++ b/urjtag/src/tap/cable/ts7800.c @@ -36,10 +36,10 @@ #include #include -#include "cable.h" -#include "chain.h" +#include +#include -#include "generic.h" +#include #include diff --git a/urjtag/src/tap/cable/usbblaster.c b/urjtag/src/tap/cable/usbblaster.c index 522ec57e..93d51356 100644 --- a/urjtag/src/tap/cable/usbblaster.c +++ b/urjtag/src/tap/cable/usbblaster.c @@ -25,18 +25,19 @@ #include "sysdep.h" +#include #include #include -#include "cable.h" -#include "chain.h" -#include "cmd.h" +#include +#include +#include #include "generic.h" #include "generic_usbconn.h" -#include "usbconn.h" -#include "usbconn/libftdx.h" +#include +#include #include "cmd_xfer.h" diff --git a/urjtag/src/tap/cable/vision_ep9307.c b/urjtag/src/tap/cable/vision_ep9307.c index f1deb73d..ca8f738e 100644 --- a/urjtag/src/tap/cable/vision_ep9307.c +++ b/urjtag/src/tap/cable/vision_ep9307.c @@ -34,12 +34,12 @@ #include #include -#include "cable.h" -#include "chain.h" +#include +#include -#include "generic.h" +#include -#include +#include #define SYSCON_BASE 0x80930000 #define SYSCON_DEVICE_CONFIG 0x80 diff --git a/urjtag/src/tap/cable/wiggler.c b/urjtag/src/tap/cable/wiggler.c index db3ac896..cce836d4 100644 --- a/urjtag/src/tap/cable/wiggler.c +++ b/urjtag/src/tap/cable/wiggler.c @@ -29,18 +29,19 @@ #include "sysdep.h" +#include #include #include #include -#include "cable.h" -#include "parport.h" -#include "chain.h" +#include +#include +#include #include "generic.h" #include "generic_parport.h" -#include +#include /* * Bit <-> pin mapping of an original Wiggler diff --git a/urjtag/src/tap/cable/wiggler2.c b/urjtag/src/tap/cable/wiggler2.c index 3b1b5171..ed011d60 100644 --- a/urjtag/src/tap/cable/wiggler2.c +++ b/urjtag/src/tap/cable/wiggler2.c @@ -36,9 +36,9 @@ #include "sysdep.h" -#include "cable.h" -#include "parport.h" -#include "chain.h" +#include +#include +#include #include "generic.h" #include "generic_parport.h" diff --git a/urjtag/src/tap/cable/xpc.c b/urjtag/src/tap/cable/xpc.c index cef3d43c..0e07d781 100644 --- a/urjtag/src/tap/cable/xpc.c +++ b/urjtag/src/tap/cable/xpc.c @@ -26,14 +26,16 @@ #include "sysdep.h" -#include "cable.h" -#include "chain.h" +#include + +#include +#include #include "generic.h" #include "generic_usbconn.h" -#include "usbconn.h" -#include "usbconn/libusb.h" +#include +#include #include #include diff --git a/urjtag/src/tap/chain.c b/urjtag/src/tap/chain.c index da7bc0c7..b75c1c1b 100644 --- a/urjtag/src/tap/chain.c +++ b/urjtag/src/tap/chain.c @@ -27,11 +27,16 @@ #include #include -#include "chain.h" -#include "tap_state.h" -#include "tap.h" +#include +#include +#include +#include +#include +#include -#include "bsdl.h" +#include + +#include urj_chain_t * urj_tap_chain_alloc (void) @@ -108,14 +113,16 @@ urj_tap_chain_set_trst (urj_chain_t *chain, int trst) int old_val = urj_tap_cable_set_signal (chain->cable, URJ_POD_CS_TRST, trst ? URJ_POD_CS_TRST : 0); int old_trst = (old_val & URJ_POD_CS_TRST) ? 1 : 0; + urj_tap_state_set_trst (chain, old_trst, trst); + return trst; } int urj_tap_chain_get_trst (urj_chain_t *chain) { - return (urj_tap_cable_get_signal (chain->cable, URJ_POD_CS_TRST)); + return urj_tap_cable_get_signal (chain->cable, URJ_POD_CS_TRST); } int @@ -125,14 +132,16 @@ urj_tap_chain_set_pod_signal (urj_chain_t *chain, int mask, int val) int old_trst = (old_val & URJ_POD_CS_TRST) ? 1 : 0; int new_trst = (((old_val & ~mask) | (val & mask)) & URJ_POD_CS_TRST) ? 1 : 0; + urj_tap_state_set_trst (chain, old_trst, new_trst); + return old_val; } int urj_tap_chain_get_pod_signal (urj_chain_t *chain, urj_pod_sigsel_t sig) { - return (urj_tap_cable_get_signal (chain->cable, sig)); + return urj_tap_cable_get_signal (chain->cable, sig); } void @@ -167,13 +176,10 @@ urj_tap_chain_shift_instructions_mode (urj_chain_t *chain, for (i = 0; i < ps->len; i++) { urj_tap_defer_shift_register (chain, - ps->parts[i]->active_instruction->value, - capture_output ? ps->parts[i]-> - active_instruction->out : NULL, - (i + 1) == - ps-> - len ? chain_exit : - URJ_CHAIN_EXITMODE_SHIFT); + ps->parts[i]->active_instruction->value, + capture_output ? ps->parts[i]->active_instruction->out + : NULL, + (i + 1) == ps->len ? chain_exit : URJ_CHAIN_EXITMODE_SHIFT); } if (capture_output) @@ -181,14 +187,10 @@ urj_tap_chain_shift_instructions_mode (urj_chain_t *chain, for (i = 0; i < ps->len; i++) { urj_tap_shift_register_output (chain, - ps->parts[i]->active_instruction-> - value, - ps->parts[i]->active_instruction-> - out, - (i + 1) == - ps-> - len ? chain_exit : - URJ_CHAIN_EXITMODE_SHIFT); + ps->parts[i]->active_instruction->value, + ps->parts[i]->active_instruction->out, + (i + 1) == ps->len ? chain_exit + : URJ_CHAIN_EXITMODE_SHIFT); } } else @@ -243,15 +245,11 @@ urj_tap_chain_shift_data_registers_mode (urj_chain_t *chain, for (i = 0; i < ps->len; i++) { urj_tap_defer_shift_register (chain, - ps->parts[i]->active_instruction-> - data_register->in, - capture_output ? ps->parts[i]-> - active_instruction->data_register-> - out : NULL, - (i + 1) == - ps-> - len ? chain_exit : - URJ_CHAIN_EXITMODE_SHIFT); + ps->parts[i]->active_instruction->data_register->in, + capture_output ? + ps->parts[i]->active_instruction->data_register->out + : NULL, + (i + 1) == ps->len ? chain_exit : URJ_CHAIN_EXITMODE_SHIFT); } if (capture_output) @@ -259,14 +257,9 @@ urj_tap_chain_shift_data_registers_mode (urj_chain_t *chain, for (i = 0; i < ps->len; i++) { urj_tap_shift_register_output (chain, - ps->parts[i]->active_instruction-> - data_register->in, - ps->parts[i]->active_instruction-> - data_register->out, - (i + 1) == - ps-> - len ? chain_exit : - URJ_CHAIN_EXITMODE_SHIFT); + ps->parts[i]->active_instruction->data_register->in, + ps->parts[i]->active_instruction->data_register->out, + (i + 1) == ps->len ? chain_exit : URJ_CHAIN_EXITMODE_SHIFT); } } else diff --git a/urjtag/src/tap/detect.c b/urjtag/src/tap/detect.c index f1ced9cd..9b6203cc 100644 --- a/urjtag/src/tap/detect.c +++ b/urjtag/src/tap/detect.c @@ -30,17 +30,17 @@ #include #include -#include +#include -#include +#include -#include "tap_register.h" -#include "tap.h" -#include "cable.h" -#include "part.h" -#include "chain.h" +#include +#include +#include +#include +#include -#include "jtag.h" +#include struct id_record { diff --git a/urjtag/src/tap/discovery.c b/urjtag/src/tap/discovery.c index 3bad98fb..64867f98 100644 --- a/urjtag/src/tap/discovery.c +++ b/urjtag/src/tap/discovery.c @@ -27,11 +27,11 @@ #include #include -#include "cable.h" -#include "tap.h" -#include "chain.h" +#include +#include +#include -#include "jtag.h" +#include #define DETECT_PATTERN_SIZE 8 #define MAX_REGISTER_LENGTH 1024 diff --git a/urjtag/src/tap/idcode.c b/urjtag/src/tap/idcode.c index 63f04673..1f424608 100644 --- a/urjtag/src/tap/idcode.c +++ b/urjtag/src/tap/idcode.c @@ -26,11 +26,11 @@ #include #include -#include "cable.h" -#include "tap.h" -#include "chain.h" +#include +#include +#include -#include "jtag.h" +#include void urj_tap_urj_tap_idcode (urj_chain_t *chain, unsigned int bytes) diff --git a/urjtag/src/tap/parport.c b/urjtag/src/tap/parport.c index 5c7c04ab..f2289332 100644 --- a/urjtag/src/tap/parport.c +++ b/urjtag/src/tap/parport.c @@ -24,7 +24,7 @@ #include "sysdep.h" -#include "parport.h" +#include extern urj_parport_driver_t urj_tap_parport_direct_parport_driver; extern urj_parport_driver_t urj_tap_parport_ppdev_parport_driver; diff --git a/urjtag/src/tap/parport/direct.c b/urjtag/src/tap/parport/direct.c index 2260014a..431a7d5d 100644 --- a/urjtag/src/tap/parport/direct.c +++ b/urjtag/src/tap/parport/direct.c @@ -28,11 +28,12 @@ #ifdef ENABLE_LOWLEVEL_DIRECT +#include #include #include -#include "parport.h" -#include "cable.h" +#include +#include #if defined(HAVE_INPOUTXX) diff --git a/urjtag/src/tap/parport/ppdev.c b/urjtag/src/tap/parport/ppdev.c index c3509a1a..071ff072 100644 --- a/urjtag/src/tap/parport/ppdev.c +++ b/urjtag/src/tap/parport/ppdev.c @@ -27,6 +27,7 @@ #ifdef ENABLE_LOWLEVEL_PPDEV +#include #include #ifdef HAVE_STROPTS_H #include @@ -39,8 +40,8 @@ #include #include -#include "parport.h" -#include "cable.h" +#include +#include urj_parport_driver_t urj_tap_parport_ppdev_parport_driver; diff --git a/urjtag/src/tap/parport/ppi.c b/urjtag/src/tap/parport/ppi.c index 806bb6c7..bac4475a 100644 --- a/urjtag/src/tap/parport/ppi.c +++ b/urjtag/src/tap/parport/ppi.c @@ -35,8 +35,8 @@ #include #include -#include "parport.h" -#include "cable.h" +#include +#include urj_parport_driver_t urj_tap_parport_ppi_parport_driver; diff --git a/urjtag/src/tap/register.c b/urjtag/src/tap/register.c index e906452e..b968ec44 100644 --- a/urjtag/src/tap/register.c +++ b/urjtag/src/tap/register.c @@ -25,7 +25,7 @@ #include #include -#include "tap_register.h" +#include urj_tap_register_t * urj_tap_register_alloc (int len) diff --git a/urjtag/src/tap/state.c b/urjtag/src/tap/state.c index 6d5303ad..59c36847 100644 --- a/urjtag/src/tap/state.c +++ b/urjtag/src/tap/state.c @@ -23,8 +23,8 @@ * */ -#include "tap_state.h" -#include "chain.h" +#include +#include int urj_tap_state (urj_chain_t *chain) diff --git a/urjtag/src/tap/tap.c b/urjtag/src/tap/tap.c index 5145509a..fbfda10c 100644 --- a/urjtag/src/tap/tap.c +++ b/urjtag/src/tap/tap.c @@ -26,10 +26,12 @@ #include -#include "tap_register.h" -#include "tap.h" -#include "tap_state.h" -#include "chain.h" +#include +#include +#include +#include +#include +#include void urj_tap_reset (urj_chain_t *chain) @@ -49,9 +51,8 @@ urj_tap_reset_bypass (urj_chain_t *chain) instruction register length of the chain is already known */ if (chain->total_instr_len > 0) { - urj_tap_register_t *ir = - urj_tap_register_fill (urj_tap_register_alloc - (chain->total_instr_len), 1); + urj_tap_register_t *ir = urj_tap_register_fill ( + urj_tap_register_alloc (chain->total_instr_len), 1); if (!ir) { printf (_("out of memory\n")); diff --git a/urjtag/src/tap/usbconn.c b/urjtag/src/tap/usbconn.c index db3ddfb9..9ccb5e06 100644 --- a/urjtag/src/tap/usbconn.c +++ b/urjtag/src/tap/usbconn.c @@ -26,7 +26,7 @@ #include -#include "usbconn.h" +#include #ifdef HAVE_LIBUSB extern urj_usbconn_driver_t urj_tap_usbconn_libusb_driver; diff --git a/urjtag/src/tap/usbconn/libftd2xx.c b/urjtag/src/tap/usbconn/libftd2xx.c index 526bfc6c..6be1edae 100644 --- a/urjtag/src/tap/usbconn/libftd2xx.c +++ b/urjtag/src/tap/usbconn/libftd2xx.c @@ -39,9 +39,9 @@ #include -#include "cable.h" -#include "usbconn.h" -#include "usbconn/libftdx.h" +#include +#include +#include /* enables debug output */ diff --git a/urjtag/src/tap/usbconn/libftdi.c b/urjtag/src/tap/usbconn/libftdi.c index 2ef6abec..7c0633f1 100644 --- a/urjtag/src/tap/usbconn/libftdi.c +++ b/urjtag/src/tap/usbconn/libftdi.c @@ -39,9 +39,9 @@ #include -#include "cable.h" -#include "usbconn.h" -#include "usbconn/libftdx.h" +#include +#include +#include typedef struct { diff --git a/urjtag/src/tap/usbconn/libusb.c b/urjtag/src/tap/usbconn/libusb.c index 614f5b39..71861c94 100644 --- a/urjtag/src/tap/usbconn/libusb.c +++ b/urjtag/src/tap/usbconn/libusb.c @@ -42,9 +42,9 @@ #include #include -#include "parport.h" -#include "cable.h" -#include "usbconn.h" +#include +#include +#include typedef struct { diff --git a/urjtag/sysdep.h b/urjtag/sysdep.h index 094f30e2..f7eefed6 100644 --- a/urjtag/sysdep.h +++ b/urjtag/sysdep.h @@ -29,7 +29,7 @@ #include "config.h" #endif -#include "gettext.h" +#include "urjtag/gettext.h" #define _(s) gettext(s) #define N_(s) gettext_noop(s) #define P_(s,p,n) ngettext(s,p,n)