Commit Graph

883 Commits

Author SHA1 Message Date
Catalin Patulea
84dbf8ab5a Driver for USB-JTAG, Altera USB-Blaster and compatibles
The 10-pin JTAG layout used with these adapters is used by
a variety of platforms including AVR.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-26 15:05:06 -08:00
Antonio Borneo
f9d203d1e6 PARPORT code cleanup:
Align elements in array.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2009-12-26 10:19:57 +01:00
David Brownell
2c3e413d49 JTAG: shrink "scan_chain" output
Tweak the "scan_chain" output by removing column separators.  Also
remove the "current instruction" state ... which changes constantly.

Now its style resembles the "targets" output, and can even fit on
one line in standard terminals and in the PDF docs.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-16 14:19:44 -08:00
David Brownell
af79925eb1 jtag: add '-ignore-version' option
Add a "-ignore-version" to "jtag newtap" which makes the IDCODE
comparison logic optionally ignore version differences.

Update the "scan_chain" command to illustrate this by showing
the "*" character instead of the (ignored) version nibble.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-14 15:55:51 -08:00
Spencer Oliver
6b9c14e908 build: fix cygwin build warnings
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2009-12-11 10:26:14 +00:00
Øyvind Harboe
134df4b701 zy1000: revc FPGA now works
remove kludge code.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-12-10 13:52:07 +01:00
David Brownell
910dd664ce Comment and doxygen fixes
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-09 10:25:52 -08:00
Rafael Campos Las Heras
733ced125a Fix compilation error with gcc 4.4.1
Signed-off-by: Rafael Campos Las Heras <methril@gmail.com>
2009-12-08 22:58:23 +01:00
Øyvind Harboe
96d2b61c04 zy1000: some background info on the zy1000 file.
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-12-08 10:40:47 +01:00
Øyvind Harboe
97de520bc0 minidriver: fix inline capability of minidriver
Low latency low CPU processing power systems(embedded)
will benefit greatly from being able to inline certain
jtag_add_xxx() fn's. The trick is that this has to be
done in such a way as to allow implementing an OpenOCD
API with a shared library(eventually) on a PC hosted
OpenOCD.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-12-08 10:29:58 +01:00
Øyvind Harboe
eb1bc657ae build: add build/src to include path
This allows including generated include files.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-12-08 10:16:10 +01:00
David Brownell
dd9d1a3459 misc code review updates
More updates from the code review by Steve Grubb <sgrubb@redhat.com>.
The Jim float-comparision bug just gets a comment not a fix, though.

Cc: Steve Grubb <sgrubb@redhat.com>.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-05 14:40:06 -08:00
Zachary T Welch
79a73a786e separate Jim from jtag/core.c
After previous efforts, only one Jim routine remained in jtag/core.c,
and moving it to jtag/tcl.c painlessly finishes separating these layers.
The headers need separating, but the implementation is clean.
2009-12-04 03:34:32 -08:00
Zachary T Welch
eae56d27c3 allow 'jtag init' to be run in any mode
Help alleviate further potential problems with interactive startup.
2009-12-04 03:29:15 -08:00
Øyvind Harboe
24551b7b92 zy1000: FPGA revC wip
The bug in revC register memory access is pretty much
cornered now.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-12-04 08:21:25 +01:00
Zachary T Welch
822c06d9e3 remove tertiary include paths
With all #include directives converted, we only need to have the
top-level src/ directory in the search path.
2009-12-03 04:24:50 -08:00
Zachary T Welch
f7bd1e8f3a change #include "../hello.h" to "hello.h"
Before we can -I the top-level src/ directory alone, references to
"hello.h" must be updated.  This is an internal header, so it does
not need angle brackets.
2009-12-03 04:24:50 -08:00
Zachary T Welch
1650ab3a22 change #include "embeddedice.h" to <target/embeddedice.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "embeddedice.h"

the following form should be used.

	#include <target/embeddedice.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
2641fd9576 change #include "minidriver.h" to <jtag/minidriver.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "minidriver.h"

the following form should be used.

	#include <jtag/minidriver.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:40 -08:00
Zachary T Welch
cb4a475f6c change #include "jtag.h" to <jtag/jtag.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "jtag.h"

the following form should be used.

	#include <jtag/jtag.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:33 -08:00
Zachary T Welch
165fb9309d change #include "interface.h" to <jtag/interface.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "interface.h"

the following form should be used.

	#include <jtag/interface.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:52 -08:00
Zachary T Welch
c9e448222c change #include "commands.h" to <jtag/commands.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "commands.h"

the following form should be used.

	#include <jtag/commands.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:52 -08:00
Zachary T Welch
df0e90ec8c change #include "types.h" to <helper/types.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "types.h"

the following form should be used.

	#include <helper/types.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:52 -08:00
Zachary T Welch
6512e5e36b change #include "time_support.h" to <helper/time_support.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "time_support.h"

the following form should be used.

	#include <helper/time_support.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:52 -08:00
Zachary T Welch
c79cca04be change #include "log.h" to <helper/log.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "log.h"

the following form should be used.

	#include <helper/log.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:52 -08:00
Zachary T Welch
264d24495d change #include "command.h" to <helper/command.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "command.h"

the following form should be used.

	#include <helper/command.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:48 -08:00
Zachary T Welch
d1bc4375e9 change #include "binarybuffer.h" to <helper/binarybuffer.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "binarybuffer.h"

the following form should be used.

	#include <helper/binarybuffer.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:17 -08:00
Zachary T Welch
896ac8d4ef allow #include directives to use module name
Includes the src directory in the search path, so header files may be
migrated from:

  #include "foo.h"

to
  #include <module/foo.h>

which is more conducive for installation.
2009-12-03 01:54:15 -08:00
Zachary T Welch
879a04cc6b remove #if HAVE_JTAG_INTERFACE_H from minidriver.h
Adds two "minidriver_imp.h" files, so the right one is allowed to be
"#included" by the Makefile logic.
2009-12-02 23:27:09 -08:00
Zachary T Welch
865efd828a move jtag drivers to src/jtag/drivers
Moves JTAG interface drivers to src/jtag/drivers/,
Adds src/jtag/drivers/Makefile.am.
Builds libocdjtagdrivers.la.

Flattens the rlink driver files into the drivers/ directory, adding
the 'rlink_' prefix or '.rlink' suffix as appropriate.
2009-12-02 23:27:09 -08:00
Zachary T Welch
ac1887c703 jtag: factor init into 'jtag init'
Adds 'jtag init' command handler, which can be called as part of a
fine-grained 'init' process.
2009-12-02 13:26:22 -08:00
Øyvind Harboe
445da543d8 zy1000: keep up with latest changes to command handling
Keep up with Jim Tcl interpreter creation cleanup.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-12-01 09:53:23 +01:00
Zachary T Welch
7b2906de24 do not extern 'interp' from command.c
Adds 'interp' field to command_context, chasing the few remaining
references to the global variable outside of the command module.
2009-11-30 16:29:34 -08:00
Zachary T Welch
e1ee270265 jtag: avoid using interp global variable
Adds 'interp' field to jtag_tap_event_action structure to avoid
using the global variable of same name.
2009-11-30 16:29:34 -08:00
Øyvind Harboe
2264270fe4 zy1000: keep up with changes to command structure
Add missing COMMAND_REGISTRATION_DONE.

For now the command syntax for zy1000 needs to be compatible
across 0.3/0.4, the world outside OpenOCD interfaces to
zy1000 using the old syntax. Post 0.4 release(0.4.1 even)
I'll switch to subcommand scheme.

Switch to subcommands post 0.3 lifecycle.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-30 08:54:52 +01:00
Zachary T Welch
f8a62fb9c6 split jim_newtap_cmd into pieces
Moves the ID and IR-related option parsing to static helpers, removing
two levels of indent.
2009-11-28 13:00:39 -08:00
Zachary T Welch
7124be8247 improve jtag_tap_configure
Splits bulk of the jtag_tap_configure into jtag_tap_configure_event,
removing three or four levels of indentation in the process.
The resulting code was stylistically improved in other ways, but it
should be functionally identical.
2009-11-28 13:00:39 -08:00
Zachary T Welch
4ff5eda576 improve jtag_tap_handle_event indentation
Use 'continue' to reduce identation levels and superfluous logic.
2009-11-28 13:00:39 -08:00
Zachary T Welch
0377e5b54d begin moving JTAG jim handlers/helpers
Moves the tertiary jim handlers and required static helpers to the top
of tcl.c, defining them in a new registration array that is chained in
both the top-level context and under the jtag command.  The top-level
commands can be removed at some point in the future to reduce clutter.
2009-11-28 13:00:39 -08:00
Zachary T Welch
c4992c6d86 split jim_jtag_command into multiple handlers
Explodes the 'jtag' into separate command handlers, which are easier
to understand and extend.  Makes the code much easier to understand,
though further simplifications are possible.  This patch tries to
minimize the noise when viewed with 'git diff -w'.

Gives these commands improved built-in help and usage information.
2009-11-28 13:00:39 -08:00
Øyvind Harboe
a0d983ab06 zy1000: keep up with new command registration stuff
jim and classic style commands are both supported.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-27 20:41:06 +01:00
Zachary T Welch
6ce3a299f3 update minidummy interface driver command handling
Changes the interface definition field reference from register_commands
to commands, which allows the module to compile.
2009-11-27 11:11:26 -08:00
Øyvind Harboe
bd3ef5ca3d minidummy: fix compilation error
during refactoring a search and replace error crept in

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-27 09:10:37 +01:00
Zachary T Welch
4946925bea use ARRAY_SIZE macro
Search and destroy lingering cases where the ARRAY_SIZE macro should
be used to convey more intrinsic meaning in the OpenOCD code.
2009-11-25 10:32:00 -08:00
Zachary T Welch
a93b404161 improve command handling examples
Removes hello and foo commands from top-level registration.  Instead,
the dummy interface driver and faux flash driver have been augmented
to register these commands as sub-commands.
2009-11-25 10:29:05 -08:00
Zachary T Welch
17a9dea53a add jim_handler to command_registration
Adding jim_handler field to command_registration allows removing the
register_jim helper.  All command registrations now go through the
register_command{,s}() functions.
2009-11-24 21:37:37 -08:00
Zachary T Welch
8d46720cda remove register_callbacks from jtag interface
Changes the jtag_interface->register_callbacks field to a list of
commands to be registered.  Changes callback to invocation of
register_commands() with that command registration list.  Removes all
JTAG interface driver register_command callback functions, which the
previous commits had converted into identical calls.
2009-11-24 21:37:33 -08:00
Zachary T Welch
fc2d9f8761 vsllink: use register_commands()
Use register_commands() with command registration array.
2009-11-24 21:37:33 -08:00
Zachary T Welch
355a673032 jtag: use register_commands()
Use register commands with command registration array.
2009-11-24 21:37:33 -08:00
Zachary T Welch
9a31d66b3f presto: use register_commands()
Use register_commands() with command registration array.
2009-11-24 21:37:33 -08:00
Zachary T Welch
339e08baa5 parport: use register_commands()
Use register_commands() with a command registration array.
2009-11-24 21:37:33 -08:00
Zachary T Welch
b1d034bf2f jlink: use register_commands()
Use register_commands() with command registration array.
2009-11-24 21:37:33 -08:00
Zachary T Welch
779bdbe797 gw16012: use register_commands()
Use register_commands() with command registration array.
2009-11-24 21:37:33 -08:00
Zachary T Welch
3ab599a7e4 ft2232: use register_commands()
Use register_commands() with a command registration array.
2009-11-24 21:37:33 -08:00
Zachary T Welch
30be874de8 at91rm9200: use register_commands()
Use register_commands() with command registration array.
---
This module was broken by previous changes, but no one has complained.
Are there still users for this modules?
2009-11-24 21:37:33 -08:00
Zachary T Welch
0af32bb938 arm-jtag-ew: use register_commands()
Uses register_commands() with command registration array.
2009-11-24 21:37:33 -08:00
Zachary T Welch
48429dcfad amt_jtagaccel: use register_commands()
Use register_commands() with command_registration array.
2009-11-24 21:37:33 -08:00
Zachary T Welch
833e7f5248 use COMMAND_REGISTER macro
Replaces direct calls to register_command() with a macro, to allow
its parameters to be changed and callers updated in phases.
2009-11-24 21:37:29 -08:00
Zachary T Welch
47cb10217a improve startup tcl scripts
Fix a couple of layering violations missed in the last round.
Add missing comment headers.
2009-11-24 21:37:29 -08:00
Zachary T Welch
96f0ab894a jlink: rewrite to use jtag_usb_open
Rewrite jlink_usb_open to use jtag_usb_open helper.
2009-11-24 07:30:20 -08:00
Zachary T Welch
31fc1586a0 jlink: remove superfluous indentation
Rewrite logic to remove indentation in jlink_usb_open, in prep
for further surgery.
2009-11-24 07:30:20 -08:00
Zachary T Welch
9a21ef7614 rlink: use jtag_usb_open helper
Rewrite rlink_init routine to use jtag_usb_open helper.  Eliminates
some spurious calls to exit().

Wraps a tremendously long line of comment to fit 80 columns too.
2009-11-24 07:30:20 -08:00
Zachary T Welch
ec5e484fd6 rlink: eliminate spurious indentation
Rework rlink_init to use less indentation.  Best viewed with diff -w.
2009-11-24 07:30:19 -08:00
Zachary T Welch
de9a182ca6 vsllink: rewrite to use jtag_usb_open
Rewrite vsllink_usb_open to use jtag_usb_open helper.

Eliminates spurious calls to exit().
2009-11-24 07:30:19 -08:00
Zachary T Welch
0f544f4310 usbprog: use jtag_usb_open
Rewrite usbprob_jtag_open to use jtag_usb_open helper.
2009-11-24 07:30:19 -08:00
Zachary T Welch
d836b079b4 arm-jtag-ew: use jtag_usb_open
Rewrite armjtagwe_usb_open to use jtag_usb_open.
2009-11-24 07:30:19 -08:00
Zachary T Welch
3a660e2293 add jtag/usb_common.[ch] files
Begins to consolidate code used by several USB JTAG interfaces.
This first patch provides the required build system changes and
a common jtag_usb_open routine, which will replace the guts for
probing the busses and devices for possible VID/PID matches.
The following patches convert each driver to use it.
2009-11-24 07:30:19 -08:00
Øyvind Harboe
808e53368c zy1000: fix breakage in command parsing code for power command
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-22 13:38:42 +01:00
Zachary T Welch
b58239e4c0 jtag: remove useless forward declarations
Removes some more useless forward declarations from a few JTAG drivers.
Moves interface and bit-bang structure defitions below their callbacks.
2009-11-21 10:20:56 -08:00
Zachary T Welch
c46c2d77e6 allow jtag interfaces to lack commands
Allow JTAG interface drivers to skip registering an register_commands
callback when it will just be empty.
2009-11-21 10:19:47 -08:00
Zachary T Welch
f382ebae10 fix zy1000 command handler
Rewrite ZY1000 power command handler to use new macros, simplify logic.

Remove unused port command handler declaration.
2009-11-18 15:51:07 -08:00
Zachary T Welch
410fab9ea8 use COMMAND_PARSE_ENABLE macro where appropriate
Updates all command parsing of simple "enable" and "disable" arguments.
A few case in the tree use a tri-state or extended arguments, which
cannot use this simple macro.

Simlifies the xscale icache/dcache command handler logic.
2009-11-18 15:51:07 -08:00
Zachary T Welch
75a37eb5b3 use COMMAND_PARSE_ON_OFF where appropriate
Updates all command parsing of "on" and "off" arguments.
2009-11-18 15:51:07 -08:00
Zachary T Welch
cb7dbc1af4 split startup.tcl file across modules
Moves definitions for each layer into their own file, eliminating
layering violations in the built-in TCL code.  Updates src/Makefile.am
rules to include all files in the final startup.tcl input file, and
others Makefile.am rules to distribute the new files in our packages.
2009-11-18 07:21:42 -08:00
Zachary T Welch
2861877b32 command_handler: change 'cmd_ctx' to CMD_CTX
Convert all command handler 'cmd_ctx' parameter usage with CMD_CTX.
2009-11-17 11:40:06 -08:00
Zachary T Welch
23402315ce command_handler: change 'args' to CMD_ARGV
This patch converts all instances of 'args' in COMMAND_HANDLER routines
to use CMD_ARGV macro.
2009-11-17 11:38:07 -08:00
Zachary T Welch
7bf1a86e47 command_handler: change to 'argc' to CMD_ARGC
This patch converts all instances of 'argc' in COMMAND_HANDLER routines
to use CMD_ARGC.
2009-11-17 11:38:06 -08:00
Øyvind Harboe
959b373f8c jtag_registers: Avalon bridge flushing tweaks
The code is now much more explicit. It flushes every
N writes. For now flush every time, but tinkering with
the bridge FIFO size and how often we flush clearly
points in the direction of the Avalon write FIFO full
being the culprit.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-17 15:39:05 +01:00
Øyvind Harboe
ca32f25638 zy1000: add version command to print FPGA version and timestamps
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-17 15:04:17 +01:00
Øyvind Harboe
83104648e6 zy1000: fix bug when running on non-arm CPU
Shifting by more than 32 is undefined for 32 bit integers according
to the C standard. Robust solution is conditional code.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-17 15:04:17 +01:00
Øyvind Harboe
b888b63fe9 zy1000: fix trivial syntax error introduced by latest refactorings
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-17 15:01:48 +01:00
David Brownell
7c393679c0 JTAG: fix autoprobe failure.
Fix bug noted by Øyvind: terminate the IR length autoscan when
the IR is too long, or otherwise broken.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-16 16:36:03 -08:00
David Brownell
a7c04a0e49 JTAG: no LOG_WARNING() for taps without IDCODE
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-16 15:18:55 -08:00
Zachary T Welch
dc1685ca25 move ARRAY_SIZE macro to types.h
The ARRAY_SIZE macro was defined in several target files, so move it
to types.h.

This patch also removes two other identical macros: DIM (from jtag.h)
and asizeof (from arm11.h).
2009-11-16 09:58:11 -08:00
Zachary T Welch
0535a92456 remove TAP_SCAN_BYTES macro
Use DIV_ROUND_UP(n, 8) instead of TAP_SCAN_BYTES macro.
2009-11-16 09:58:11 -08:00
Zachary T Welch
a94748ec6d rename CEIL as DIV_ROUND_UP
Improves the name of this macro, moves it to types.h, and adds a block
of Doxygen comments to describe what it does.
2009-11-16 09:58:11 -08:00
Zachary T Welch
d7a0dfa4dc cleanup jtag minidrivers
Remove two vestigial externs from our JTAG minidriver source files.
Also, removes many extra blank lines from the minidummy driver.
2009-11-16 05:30:51 -08:00
Zachary T Welch
f30136603e arm-jtag-ew,jlink: switch to COMMAND_HANDLER
These drivers were overlooked during the recent upgrade.  Convert them,
moving their registration routines to eliminate their declarations.
2009-11-15 09:12:44 -08:00
Zachary T Welch
6731968873 rlink: fix overzealous sed
Fix an instance where my cleanup when awry.
2009-11-15 09:11:29 -08:00
Ferdinand Postema
ab3bdfb2cb compile with cygwin (32-bit)
Changed some printf format strings..

[dbrownell@users.sourceforge.net: shrink lines, fix indents]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-14 02:22:37 -08:00
Zachary T Welch
ef746e27c5 command_t -> struct command
Remove misleading typedef and redundant suffix from struct command.
2009-11-13 13:30:50 -08:00
Zachary T Welch
98723c4ecd command_context_t -> struct command_context
Remove misleading typedef and redundant suffix from struct command_context.
2009-11-13 13:25:47 -08:00
Zachary T Welch
d16968e24f remove rlink structure typedefs
Remove useless typedefs from the rlink driver.  Improve whitespace.
2009-11-13 12:19:39 -08:00
Zachary T Welch
0f1163e823 target_t -> struct target
Remove misleading typedef and redundant suffix from struct target.
2009-11-13 11:58:14 -08:00
Zachary T Welch
246068fd89 jtag_command_t -> struct jtag_command
Remove useless typedef from struct jtag_command.
2009-11-13 11:58:05 -08:00
Zachary T Welch
1053c32d9e jtag_command_container_t -> union jtag_command_container
Remove misleading typedef from union jtag_container.
2009-11-13 11:58:05 -08:00
Zachary T Welch
22b220ad7f sleep_command_t -> struct sleep_command
Remove misleading typedef from struct sleep_command.
2009-11-13 11:58:05 -08:00
Zachary T Welch
cf2e402d71 end_state_command_t -> struct end_state_command
Remove misleading typedef from struct end_state_command.
2009-11-13 11:58:05 -08:00
Zachary T Welch
8cc8c0544f reset_command_t -> struct reset_command
Remove misleading typedef from struct reset_command.
2009-11-13 11:58:05 -08:00
Zachary T Welch
2fecae46f6 stableclocks_command_t -> struct stableclocks_command
Remove misleading typedef from struct stableclocks_command.
2009-11-13 11:58:05 -08:00