Commit Graph

883 Commits

Author SHA1 Message Date
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
Zachary T Welch
5f6d8ecf8c runtest_command_t -> struct runtest_command
Remove misleading typedef from struct runtest_command.
2009-11-13 11:58:05 -08:00
Zachary T Welch
c07f0600ff pathmove_command_t -> struct pathmove_command
Remove misleading typedef from struct pathmove_command.
2009-11-13 11:58:05 -08:00
Zachary T Welch
af3f4a0bbe statemove_command_t -> struct statemove_command
Remove misleading typedef from struct statemove_command.
2009-11-13 11:58:05 -08:00
Zachary T Welch
e11c5a3b42 cmd_queue_page_t -> struct cmd_queue_page
Remove misleading typedef from struct cmd_queue_page.
2009-11-13 11:58:05 -08:00
Zachary T Welch
2ddeec9db5 scan_command_t -> struct scan_command
Remove misleading typedef on struct scan_command.
2009-11-13 11:58:05 -08:00
Zachary T Welch
4a29f8e21d more vsllink typedef cleanup
Remove useless typedef for struct insert_insignification_operation.
2009-11-13 11:58:05 -08:00
Zachary T Welch
7c0ba75eae vsllink_jtag_t -> struct vsllink
Remove misleading typedef and redundant suffix.
2009-11-13 11:58:05 -08:00
Zachary T Welch
ffc77b61dd presto_t -> struct presto
Remove useless typedef.
2009-11-13 11:58:05 -08:00
Zachary T Welch
a3f1c87eb7 ft2232_device_t -> struct ft2232_device
Remove misleading typedef from ft2232_device; it was barely used.
2009-11-13 11:58:05 -08:00
Zachary T Welch
4bc155398e jlink_jtag_t -> struct jlink
Remove misleading typedef and redundant suffix.
2009-11-13 11:58:05 -08:00
Zachary T Welch
9036fdd589 cable_t -> struct cable
Remove useless typedef and redundant suffix from parport struct cable.
2009-11-13 11:58:05 -08:00
Zachary T Welch
e1c26950c0 pending_scan_result_t -> struct pending_scan_result
Remove misleading typedef from struct struct pending_scan_result.
Future patches need to remove these duplicated types and code.
2009-11-13 11:58:04 -08:00
Zachary T Welch
8bbb279c28 armjtagew_jtag_t -> struct armjtagew
Remove useless typedef and redundant suffix from struct armjtatew_jtag.
2009-11-13 11:58:04 -08:00
Zachary T Welch
5874d5f2ea use struct jtag_tap_event_action
Remove useless typedef and redundant suffix from jtag_tap_event_action.
2009-11-13 11:58:04 -08:00
Zachary T Welch
363d72a484 jtag_event_callback_t -> struct jtag_event_callback
Remove useless typedef and redundant suffix from jtag_event_callback.
Add documentation for the structure.
2009-11-13 11:58:04 -08:00
Zachary T Welch
9f535f9af7 jtag_interface_t -> struct jtag_interface
Remove useless typedef and redundant suffix from struct jtag_interface.
2009-11-13 11:58:04 -08:00
Zachary T Welch
bee796b5b0 bitbang_interface_t -> struct bitbang_interface
Removes another useless typedef and suffix.
2009-11-13 11:58:04 -08:00
Zachary T Welch
c20b779b89 bitq_interface_t -> struct biq_interface
Remove useless typedef and redundant suffix.
2009-11-13 11:58:04 -08:00
Zachary T Welch
ff3150922b encapsulate bitq_state structure
Move the bitq_state structure from the header to source file, as it
is used internally.

Also removes its silly typedef.
2009-11-13 11:58:04 -08:00
Zachary T Welch
d0809ac060 scan_field_t -> struct scan_field
Remove useless structure typedef.
2009-11-13 11:58:04 -08:00
Zachary T Welch
42ef503d37 jtag_tap_t -> struct jtag_tap
Search and destroy the jtag_tap_t typedef.  This also cleans up a
layering violation, removing the declaration from types.h.
2009-11-13 11:58:04 -08:00
Zachary T Welch
d22270e0ed command_handler_t: make argc unsigned
The number of command arguments will always be 0 or more, so use
the right type in handlers.  This has a cascading effect up through
the layers, but the new COMMAND_HANDLER macros prevented total chaos.
2009-11-13 10:55:27 -08:00
Zachary T Welch
a585bdf726 add CMD_NAME macro for command handlers
By introducing the CMD_NAME macro, this parameter may be integrated
as args[-1] in command.[ch], without touching any other call sites.
2009-11-13 10:55:00 -08:00
Zachary T Welch
5b6df55a1e use CALL_COMMAND_HANDLER instead of direct calls
By using CALL_COMMAND_HANDLER, parameters can be reordered, added, or
even removed in inherited signatures, without requiring revisiting
all of the various call sites.
2009-11-13 10:51:46 -08:00
Zachary T Welch
63a26b421b use COMMAND_HELPER for command helper functions
Define the numerous helpers that inherit command handler parameters
using the COMMAND_HELPER macro.
2009-11-13 10:51:45 -08:00
Zachary T Welch
cfc4d5c6b7 use COMMAND_HANDLER macro to define all commands 2009-11-13 10:51:45 -08:00
Jonas Horberg
de735d375b parport: add support for the jtag_khz command.
Add the khz and speed_div functions to the parport interface driver.
Add the parport_toggling_time function that tells the parport driver
how long (in nanoseconds) it takes for the hardware to toggle TCK.

[dbrownell@users.sourceforge.net: tweak doc for clarity, mention
multimeter, and whitespace fixes]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-12 12:39:37 -08:00
Zachary T Welch
5e1b500b17 fix 'jtag interface' behavior
Without this patch, running "openocd -c 'jtag interface'" segfaults.
Now, it returns the string "undefined" when the interface is unset.
2009-11-11 14:04:06 -08:00
Zachary T Welch
8d6dcb9d39 jtag: remove useless declarations
Contrary to my previous assessment, some opportunities to remove forward
declarations were overlooked.  Remove them by moving the definitions
of the command registration and interface structure to the end of files.
2009-11-09 21:39:28 -08:00
David Brownell
d70d9634bf finish removing deprecated/obsolete commands
It's been about a year since these were deprecated and, in most
cases, removed.  There's no point in carrying that documentation,
or backwards compatibility for "jtag_device" and "jtag_speed",
around forever.  (Or a few remnants of obsolete code...)

Removed a few obsolete uses of "jtag_speed":

 - The Calao stuff hasn't worked since July 2008.  (Those Atmel
   targets need to work with a 32KHz core clock after reset until
   board-specific init-reset code sets up the PLL and enables a
   faster JTAg clock.)
 - Parport speed controls don't actually work (tops out at about
   1 MHz on typical HW).
 - In general, speed controls need to live in board.cfg files (or
   sometimes target.cfg files), not interface.cfg ...

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-09 13:16:32 -08:00
Zachary T Welch
5e9d18f027 src/jtag: remove 'extern' and wrap headers.
Removes the 'extern' keyword from function declarations.
Wraps long prototypes to fit into 80 columns.

Fixes documentation for jtag_tap_s::{,has}idcode fields.
2009-11-09 09:44:33 -08:00
Zachary T Welch
2b1bd97508 Fix vsllink bulk out endpoint parsing. 2009-11-07 13:36:47 -08:00
Zachary T Welch
b7b561aae8 Improve jtag command argument parsing. 2009-11-05 18:03:18 -08:00
David Brownell
2d9863e121 ft2232: cleanup
Previous patch somehow made GCC lose some of its cookies;
work around, zero-init that struct.

Clean up code from the previous patch.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-04 21:41:08 -08:00
Krzysztof Kajstura
2970696e89 JTAG: support KT-LINK adapter
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-04 21:20:44 -08:00
Dimitar Dimitrov
e901cee72f FT2232: increase read retry counts
This change is necessary to debug AT91SAM9260 on my PC with a
FT2232H dongle.

Signed-off-by: Dimitar Dimitrov <dinuxbg@gmail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-01 19:56:51 -08:00
Oleg Seiljus
993fe4ab63 Signalyzer: H2 and H4 support
This patch includes partial support for these new JTAG adapters.
More complete support will require updates to the libftdi code,
for EEPROM access.

[dbrownell@users.sourceforge.net: fix whitespace, linelen, etc ]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-27 12:40:24 -07:00
David Brownell
1020569b9f ft2232: less noise with _DEBUG_JTAG_IO_
Don't log "Yes, I'm *still* in TAP_IDLE" every seven runtest clocks.
2009-10-26 23:10:40 -07:00
David Brownell
0b476c9f4c JTAG: "jtag newtap ..." cleanup
Get rid of needless variable, improve and shrink diagnostic.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-26 23:06:22 -07:00
David Brownell
6cb1d10cda JTAG: simple autoprobing
This patch adds basic autoprobing support for the JTAG scan chains
which cooperate.  To use, you can invoke OpenOCD with just:

 - interface spec: "-f interface/...cfg"
 - possibly with "-c 'reset_config ...'" for SRST/TRST
 - possibly with "-c 'jtag_khz ...'" for the JTAG clock

Then set up config files matching the reported TAPs.  It doesn't
declare targets ... just TAPs.  So facilities above the JTAG and
SVF/XSVF levels won't be available without a real config; this is
almost purely a way to generate diagnostics.

Autoprobe was successful with most boards I tested, except ones
incorporating C55x DSPs (which don't cooperate with this scheme
for IR length autodetection).  Here's what one multi-TAP chip
reported, with the "Warn:" prefixes removed:

 clock speed 500 kHz
 There are no enabled taps.  AUTO PROBING MIGHT NOT WORK!!
 AUTO auto0.tap - use "jtag newtap auto0 tap -expected-id 0x2b900f0f ..."
 AUTO auto1.tap - use "jtag newtap auto1 tap -expected-id 0x07926001 ..."
 AUTO auto2.tap - use "jtag newtap auto2 tap -expected-id 0x0b73b02f ..."
 AUTO auto0.tap - use "... -irlen 4"
 AUTO auto1.tap - use "... -irlen 4"
 AUTO auto2.tap - use "... -irlen 6"
 no gdb ports allocated as no target has been specified

The patch tweaks IR setup a bit, so we can represent TAPs with
undeclared IR length.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-26 00:36:03 -07:00
David Brownell
e98817c463 JTAG: jtag_tap_init() bugfixes
Stop allocating three bytes per IR bit, and cope somewhat better
with IR lengths over 32 bits.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-25 13:07:57 -07:00
David Brownell
79f71fad58 jtag: clean up TAP state name handling
Some cosmetic cleanup, and switch to a single table mapping
between state names and symbols (vs two routines which only
share that state with difficulty).

Get rid of TAP_NUM_STATES, and some related knowledge about
how TAP numbers are assigned.  Later on, this will help us
get rid of more such hardwired knowlege.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-23 01:02:22 -07:00
David Brownell
814183a5c4 SVF: clean up, mostly for TAP state name handling
- Use the name mappings all the other code uses:
    + name-to-state ... needed to add one special case
    + state-to-name
 - Improve various diagnostics:
    + don't complain about a "valid" state when the issue
      is actually that it must be "stable"
    + say which command was affected
 - Misc:
    + make more private data and code be static
    + use public DIM() not private dimof()
    + shorten the affected lines

Re the mappings, this means we're more generous in inputs we
accept, since case won't matter.  Also our output diagnostics
will be a smidgeon more informative, saying "RUN/IDLE" not
just "IDLE" (emphasizing that there can be side effects).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-23 01:00:32 -07:00
David Brownell
7556a93aed XSVF: use svf_add_statemove()
XSVF improvements:

 - Layer parts of XSVF directly over SVF, calling svf_add_statemove()
   instead of expecting jtag_add_statemove() to conform to the SVF/XSVF
   requirements (which it doesn't).

   This should improve XSTATE handling a lot; it removes most users of
   jtag_add_statemove(), and the comments about how it should really do
   what svf_add_statemove() does.

 - Update XSTATE logic to be a closer match to the XSVF spec.  The main
   open issue here is (still) that this implementation doesn't know how
   to build and submit paths from single-state transitions ... but now
   it will report that error case.

 - Update the User's Guide to mention the two utility scripts for
   working with XSVF, and to mention the five extension opcodes.

Handling of state transition paths is, overall, still a mess.  I think
they should all be specified as paths not unlike SVF uses, and compiled
to the bitstrings later ... so that we can actually make sense of the
paths.  (And see the extra clocks, detours through RUN, etc.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-20 20:04:36 -07:00
Øyvind Harboe
a1609e5ad1 Removed unused interface_jtag_set_end_state and wrote down some notes on TCP/IP client/server scheme. 2009-10-20 15:54:53 +02:00
Øyvind Harboe
e4dba30b63 More svn to git version string fixes. 2009-10-20 09:46:23 +02:00
David Brownell
d243e641d3 jtag_add_statemove() always uses TLR to get to RESET
As decided a while back, this isn't a transition we want to chance.
Whenever someone wants to got to RESET, force it.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-19 22:50:51 -07:00
oyvind
89a8a37998 Switch from svn to git version string handling. 2009-10-19 15:08:52 +02:00
David Brownell
510db585fd portability updates
Based on some patches from <redirect.slash.nil@gmail.com>
for preliminary Win64 compilation.  More such updates are
needed, but they need work.  Compile tested on 64 and 32 bit
Linuxes, and Cygwin.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-14 20:04:33 -07:00
David Brownell
5535399a46 cosmetic cleanup in TMS tables
Cleanup comments and layout/whitespace in the TMS tables.
Table contents stayed the same (ignoring whitespace).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-13 10:55:24 -07:00
David Brownell
a0b1e05b53 printf format warning fixes
Observed on a Cygwin build.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-10 11:32:39 -07:00
David Brownell
bc13c12be9 add documentation about reset customization
We added two overridable procedures; document them, and the
two jtag arp_* operations they necessarily expose.

Update the comment about the jtag_init_reset() routine; it's
been obsolete for as long as it's had SRST support.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-09 12:52:42 -07:00
David Brownell
5b352c9e79 minor JTAG init messaging tweaks
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-08 23:51:50 -07:00
David Brownell
a8234af06c prevent abort via polling during jtag_reset
Observed:

  openocd: core.c:318: jtag_checks: Assertion `jtag_trst == 0' failed.

The issue was that nothing disabled background polling during calls
from the TCL shell to "jtag_reset 1 1".  Fix by moving the existing
poll-disable mechanism to the JTAG layer where it belongs, and then
augmenting it to always pay attention to TRST and SRST.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-08 11:14:00 -07:00
David Brownell
40c9668b70 Stop ignoring most scan chain validation errors
Among other things this causes startup errors to kick in the
fallback "reset harder" logic during server startup.  Comments
are also updated a bit, explaining what the various error paths
signify (in at least my observation).

There's one class of validation error that we can still plausibly
ignore:  when wrong IDCODE values are observed.

This change seems to have helped make an OMAP5912 behave much
more reliably.  There's still some post-reset flakiness, but
it's unrelated to scan verification.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-08 09:16:01 -07:00
dbrownell
cdc33b3808 Force sane SRST and TRST initialization
At least some FT2232 based adapters don't necessarily come up
in the expected state, with SRST and TRST disabled.  Since
other adapters could suffer the same problem, let's avoid
needing to patch every driver and just force *all* adapters
to initialize those values properly at server startup.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2824 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 19:02:21 +00:00
dbrownell
246ff4f601 Better fix for TAPs violating the JTAG spec for IR-Capture.
Instead of just assuming all IDCODE-deprived TAPs violate the
JTAG spec (they don't!), just require TAPs with such problems
to be declared with proper ircapture/irmask values.  Example,
with mask and value of zero.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2823 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 18:51:11 +00:00
dbrownell
7035b37e71 Remove much #ifdeffery around _DEBUG_JTAG_IO_ usage.
Have DEBUG_JTAG_IO() always trigger necessary warnings.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2822 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 17:30:51 +00:00
dbrownell
b83d79a42f Updates for "reset_config":
- revert to previous default: don't talk JTAG during SRST
 - add "srst_nogates" flag, the converse of "srst_gates_jtag"
 - with no args, display the current configuration

And update the User's Guide text with bullet lists to be a bit more clear.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2818 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 15:31:33 +00:00
oharboe
53dea2f952 Do not check ir capture if there is no IDCODE
git-svn-id: svn://svn.berlios.de/openocd/trunk@2812 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 11:03:01 +00:00
oharboe
e4cc19521b 1.55 snapshot
git-svn-id: svn://svn.berlios.de/openocd/trunk@2810 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 06:53:44 +00:00
oharboe
39b57471bf Introduced jtag_init and "jtag arp_init" to allow target scripts more control over how OpenOCD starts up and initializes the target.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2805 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-06 08:10:57 +00:00
dbrownell
7a57c31619 Improve jtag_validate_ircapture() diagnostics.
Bugfix the error message so it shows the disliked value, and add
a debug message showing each TAP's IR capture value, all N bits.

This just changes diagnostics ... it still ignores the parameters
given to us at TAP declaration time.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2801 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-05 08:23:33 +00:00
dbrownell
7c7467b34f Add a new JTAG "setup" event; use for better DaVinci ICEpick support.
The model is that this fires after scanchain verification, when it's
safe to call "jtag tapenable $TAPNAME".  So it will fire as part of
non-error paths of "init" and "reset" command processing.  However it
will *NOT* trigger during "jtag_reset" processing, which skips all
scan chain verification, or after verification errors.

ALSO:
 - switch DaVinci chips to use this new mechanism
 - log TAP activation/deactivation, since their IDCODEs aren't verified
 - unify "enum jtag_event" scripted event notifications
 - remove duplicative JTAG_TAP_EVENT_POST_RESET


git-svn-id: svn://svn.berlios.de/openocd/trunk@2800 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-05 08:20:28 +00:00
dbrownell
e4de4251fe Streamline Capture-IR validation code
- Don't issue needless JTAG resets ... only do them after
   errors. Normal exit now leaves every TAP in BYPASS.
   
 - Fix an unlikely memory leak on one fault path.

 - Remove the oddball limitation that invalid capture LSBs 
   trigger errors only for TAPs that support IDCODE.

Re the JTAG reset:  there are too many of them, and they can
(and do!) change system state.  So the needless ones should
get removed.  This one was especially pointless.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2777 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-29 19:28:08 +00:00
dbrownell
4297209ac9 Make "-expected-id 0" suppress warnings; not unlike it used to do.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2775 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-29 18:26:18 +00:00
oharboe
035b6ba84b reentry assert
git-svn-id: svn://svn.berlios.de/openocd/trunk@2770 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-29 14:23:42 +00:00
oharboe
c5949a03a7 added t/nsrst_assert_width commands
git-svn-id: svn://svn.berlios.de/openocd/trunk@2768 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-29 06:07:50 +00:00
oharboe
e3a0647558 if srst pulls trst, then set state to TAP_RESET.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2767 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-28 12:22:20 +00:00
dbrownell
817ea3f4e4 Update FT2232 driver so that it reliably enters TAP_RESET.
When the OpenOCD server starts up it records its state as TAP_RESET,
even though it could be anything.  Then when it starts to examine
the scan chain, it calls jtag_add_tlr() which sees it doesn't have
any work to do, and so it does nothing.  This can make the next
operations fail because they start from the wrong TAP state...

Instead of caring about the current recorded state, always enter
TAP_RESET by forcing five clocks with TMS high.

(NOTE:  it seems most other JTAG adapter drivers have this same bug.)


git-svn-id: svn://svn.berlios.de/openocd/trunk@2763 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-27 16:55:52 +00:00
dbrownell
2329ae9306 Diagnostics tweaks for jtag_examine_chain() failure paths.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2760 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-26 22:01:24 +00:00
dbrownell
f64e924ba9 Updates to the initial scanchain validation code:
- minor bug fixes
  - code cleanup
  - update comments
  - improve diagnostics
  - etc


git-svn-id: svn://svn.berlios.de/openocd/trunk@2759 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-26 19:18:42 +00:00
dbrownell
2e210ee48f Streamline Capture-IR handling and integrity test.
Change the handling of the "-ircapture" and "-irmask" parameters
to be slightly more sensible, given that the JTAG spec describes
what is required, and that we already require that conformance in
one place.  IR scan returns some bitstring with LSBs "01".

 - First, provide and use default values that satisfy the IEEE spec.
   Existing TAP configs will override the defaults, but those parms
   are no longer required.

 - Second, warn if any TAP gets set up to violate the JTAG spec.
   It's likely a bug, but maybe not; else this should be an error.
   Improve the related diagnostics to say which TAP is affected.

And associated minor fixes/cleanups to comments and diagnostics.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2758 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-26 19:08:34 +00:00
dbrownell
86a7d813a1 Remove annoying end-of-line whitespace from most src/*
files; omitted src/httpd


git-svn-id: svn://svn.berlios.de/openocd/trunk@2742 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-21 18:40:55 +00:00
dbrownell
d20103cd93 Update the jtag-examine_chain() logic to verify that there's no
garbage after the expected data (from the TAPs' BYPASS or IDCODE
registers).

NOTE that there was previously some code that looked like it was
trying to do this ... which didn't work, because it was looping
over the list of expected TAPs, and never checked *after* that
list completed!  That could hide some *nasty* reset issues...

Also replace a now-obsolete scanchain length test with one that
behaves correctly; and update reporting of unexpected IDCODEs.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2739 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-21 00:04:35 +00:00
dbrownell
0c4b119d3f Debug message updates:
- Shrink messaging during resets, primarily by getting rid of
   "nothing happened" noise that hides *useful* information.

 - Improve: the "no IDCODE" message by identifying which tap only
   supports BYPASS; and the TAP event strings.

Related minor code updates:

 - Remove two needless tests when examining the chain:  we know
   we have a TAP, and that all TAPs have names.

 - Clean up two loops, turning "while"s into "for"s which better
   show what's actually being done.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2736 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-20 07:55:11 +00:00
dbrownell
75581ffea6 Minor regression bugfix for the jtag_tap_handle_event() case
for disabling TAPs.  We don't actually know how to make any
JRCs which do that yet; but when we do, this will matter.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2735 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-20 07:46:22 +00:00
dbrownell
3e87fc20ab Style cleanup for the updated ft2232_add_pathmove().
Indentation, whitespace, line lengths.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2731 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-19 06:54:01 +00:00
dbrownell
2d3bcddf04 Minor behavior fixes for the two JTAG reset events (C/internal,
and Tcl/external):

 - Reorder so *both* paths (TCK/TMS or TRST) can enable TAPs with
   ICEpick ... first C code flags TAPs that got disabled, then call
   any Tcl code that might want to re-enable them.

 - Always call the C/internal handlers when JTAG operations can be
   issued; previously that wasn't done when TRST was used. 

Plus some small cleanups (whitespace, strings, better messaging
during debug and on some errors) to reset-related code.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2730 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-19 06:49:40 +00:00
oharboe
631b2ab244 remove unused externs
git-svn-id: svn://svn.berlios.de/openocd/trunk@2727 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-18 07:09:44 +00:00
dbrownell
e961bd14d9 Address codereview comment from Steve Grubb <sgrubb@redhat.com>:
avoid a duplicate test.

Plus other cleanup in the same code: be "static", sane line lengths
for source and diagnostics, and fix misleading variable names.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2725 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-17 19:20:18 +00:00
oharboe
84f51bf50c michal smulski <michal.smulski@ooma.com> fix regression in jtag_add_pathmove() which broke arm11 in r1825. Other uses of jtag_add_pathmove are svn + xsvf + xscale...
git-svn-id: svn://svn.berlios.de/openocd/trunk@2722 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-17 12:25:53 +00:00
oharboe
016e7ebbfa srst_gates_jtag option. at91sam9260 needs retesting, and possibly srst_gates_jtag added to reset_config. Could i.MX27 be a case where srst does not pull trst, but really srst gates jtag clock?
git-svn-id: svn://svn.berlios.de/openocd/trunk@2720 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-17 11:23:41 +00:00
oharboe
4f7761828c tap post reset event added. Allows omap3530 to send 100 runtest idle tickle's after a TAP_RESET.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2696 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-11 18:34:15 +00:00
oharboe
983f5a1ae9 - Fix bug-in-waiting when adding more than one TAP event type
- Infinite loop bugfix when running tap configure a second time


git-svn-id: svn://svn.berlios.de/openocd/trunk@2681 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-09 07:09:14 +00:00
oharboe
dce1cdc9fb David Brownell <david-b@pacbell.net> Fix segv in jtag_examine_chain(): exit loop on no-tap. Keep
"next iteration" step with the rest of the loop overhead.

Cleanup:  remove spurious whitespace, and an overlong line;
only assign "tap->hasidcode" once.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2631 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-26 19:06:56 +00:00
oharboe
0de530067f added missing check on jtag_execute
git-svn-id: svn://svn.berlios.de/openocd/trunk@2630 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-26 10:13:51 +00:00
oharboe
9a9ebfb924 reduce arm11 output noise
git-svn-id: svn://svn.berlios.de/openocd/trunk@2628 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-26 08:32:03 +00:00
oharboe
24f011ebb4 David Brownell <david-b@pacbell.net> More jtag_add_reset() cleanup:
Unify the handling of the req_srst parameter, and rip out a
large NOP branch and its associated FIXME.  (There didn't seem
to be anything that needs fixing; but that was unclear since
the constraints were scattered all over the place not unified.)

git-svn-id: svn://svn.berlios.de/openocd/trunk@2623 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 19:59:55 +00:00
oharboe
86b49612a6 David Brownell <david-b@pacbell.net> More jtag_add_reset() cleanup:
Unify the handling of the req_tlr_or_trst parameter.  Basically,
JTAG TMS+TCK ops ("TLR") is always used ... unless TRST is a safe
option in this system configuration.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2622 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 19:58:06 +00:00
oharboe
6f359fba68 David Brownell <david-b@pacbell.net> Some jtag_add_reset() cleanup:
- Track whether TRST and/or SRST actually change:

    * If they're not changing, don't ask the JTAG adapter to do anything!
      (JTAG TCK/TMS ops might still be used to enter TAP_RESET though.)
    * Don't change their recorded values until after the adapter says it
      did so ... so fault paths can't leave corrupt state.
    * Detect and report jtag_execute_queue() failure mode
    * Only emit messages saying what really changed; this includes adding
      an omitted "deasserted TRST" message.
    * Only apply delays after deasserting SRST/TRST if we *DID* deassert!

 - Messages say "TLR" not "RESET", to be less confusing; there are many
   kinds of reset.  (Though "TLR" isn't quite ideal either, since it's
   the name of the TAP state being entered by TMS+TCK or TRST; it's at
   least non-ambiguous in context.)

So the main effect is to do only the work this routine was told to do;
and to have debug messaging make more sense.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2621 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 19:55:32 +00:00
oharboe
bf5f21e39a Steve Grubb <sgrubb@redhat.com> fix various and sundry leaks
git-svn-id: svn://svn.berlios.de/openocd/trunk@2606 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-24 07:53:46 +00:00
oharboe
332c8d78d8 Jonas Horberg <jhorberg@sauer-danfoss.com>
The trunk is currently broken for interfaces without
the speed_div function (interface specific clock speed
value to kHz conversion). Example: parport.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2605 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-24 07:26:05 +00:00
ntfreak
ef30f22fd3 - remove enable-ft2232-highspeed configure option, high speed ftdi support is now detected during the configure stage
- warning now issued if high speed ftdi device found and openocd was built using an old driver

git-svn-id: svn://svn.berlios.de/openocd/trunk@2599 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-20 07:54:49 +00:00
ntfreak
c2f593bdc1 Jonas Horberg [jhorberg@sauer-danfoss.com]:
Fix small typo in ftd2xx type detection

git-svn-id: svn://svn.berlios.de/openocd/trunk@2597 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-19 08:39:06 +00:00
ntfreak
a634b5d52e Jonas Horberg [jhorberg@sauer-danfoss.com]
https://lists.berlios.de/pipermail/openocd-development/2009-August/009939.html

1. It can only be built with the FTD2XX driver. libftdi supports FT2232H/FT4232H 
since version 0.16 

2. A speed value of 0 is used as a RTCK request indicator. This clashes with the 
valid clock division value 0 that provide the highest fixed clock frequency. 

3. The ft2232_speed_div function return the maximum selectable frequency (30MHz) 
when RTCK is activated. It should return 0. 

4. The ft2232_khz function return ERROR_OK when RTCK is requested even for 
devices lacking RTCK support. It should return ERROR_FAIL so the upper driver layers 
can detect this and try to fallback to a fixed frequency. 

5. FT2232H/FT4232H have a backward compatibility function that divide the clock 
by 5 to get the same frequency range as FT2232D. There is no code that disable 
this functionality. I can not find anything about if this is enabled or disabled by default. 
I think it is safest to actively disable it. 


git-svn-id: svn://svn.berlios.de/openocd/trunk@2591 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-18 14:41:58 +00:00
ntfreak
bb5086b83e Jonas Horberg [jhorberg@sauer-danfoss.com]
Change jtag_rclk behaviour so it can be called before the interface init function

git-svn-id: svn://svn.berlios.de/openocd/trunk@2590 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-18 12:14:01 +00:00
ntfreak
720c39ba2f David Brownell <david-b@pacbell.net>:
Warn about anyone using "jtag_speed" commands; that command is obsolete, and will someday be removed.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2578 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-07 09:37:59 +00:00
ntfreak
d40fd9e0f4 Gary Carlson [gcarlson@carlson-minot.com]:
- revert patch from rev1507 as it was causing reset issues with arm9 cores

git-svn-id: svn://svn.berlios.de/openocd/trunk@2574 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-06 23:34:34 +00:00
oharboe
c7565cc381 Ferdinand Postema <ferdinand@postema.eu> fix cygwin warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@2559 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-23 07:04:21 +00:00