Commit Graph

52 Commits

Author SHA1 Message Date
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
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 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 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 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 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
oharboe 8b994145b8 Andreas Fritiofson <andreas.fritiofson@gmail.com> UTF8 fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2549 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-17 19:54:25 +00:00
zwelch f0fd28a66c David Brownell <david-b@pacbell.net>:
Warn when people (or scripts) use numeric identifiers for TAPs,
instead of dotted.name values.  We want this usage to go away,
so that for example adding more TAPs doesn't cause config scripts
to break because some sequence number changed.

It's been deprecated since late 2008, but putting a warning on
this should help us remove it (say, in June 2010) by helping to
phase out old (ab)usage in config scripts.

Other than in various config files, the only code expecting such
a number was the almost unused str9xpec driver.  This code was
changed to use the TAP it was passed, instead of making its own
dubious lookup and ignoring that TAP.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2415 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-29 20:03:59 +00:00
zwelch c97caebccd Remove whitespace at end of lines, step 2.
- Replace '\s*$' with ''.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2380 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:50:08 +00:00
zwelch c493543fc9 - Replace '){' with ') {'.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2378 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:49:06 +00:00
zwelch dc575dc5bf Remove whitespace that occurs before ')'.
- Replace '[ \t]*[)]' with ')'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2377 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:47:42 +00:00
zwelch f90d8fa45f Remove whitespace that occurs after '('.
- Replace '([ \t]*' with '('.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2376 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:46:23 +00:00
zwelch 84df52f9ea - Fixes '=' whitespace
- Replace ')\(=\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\(=\)(' with '\1 \2 ('.
- Replace '\(\w\)\(=\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2372 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:42:54 +00:00
zwelch 3813fda44a - Fixes '==' whitespace
- Replace ')\(==\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\(==\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2371 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:42:03 +00:00
zwelch 128a733428 - Fixes '&&' whitespace
- Replace ')\(&&\)(' with ') \1 ('.
- Replace '\(\w\)\(&&\)(' with '\1 \2 ('.
- Replace '\(\w\)\(&&\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2366 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:39:47 +00:00
zwelch 53d605e12c - Fixes '!=' whitespace
- Replace ')\(!=\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\(!=\)(' with '\1 \2 ('.
- Replace '\(\w\)\(!=\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2363 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:38:12 +00:00
zwelch 95d2a23724 - Replace 'for(' with 'for ('.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2360 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:37:21 +00:00
zwelch 50c086ffb9 - Replace 'while(' with 'while ('.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2358 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:36:11 +00:00
zwelch e43979e702 - Replace 'if(' with 'if ('.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2357 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:35:09 +00:00
duane 40d7e81c45 printf() warning fixes due to uint32_t change-over
git-svn-id: svn://svn.berlios.de/openocd/trunk@2293 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-19 23:15:58 +00:00
oharboe 333642fcff fix jtag_add_callback() args. The first argument is nothing special, it's just another generic argument.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2290 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-19 08:18:36 +00:00
zwelch 86e4324f1b Finish transforming 'u32' to 'uint32_t'.
- Replace '\([^_]\)u32' with '\1uint32_t'.
- Replace '^u32' with 'uint32_t'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2281 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 07:11:11 +00:00
zwelch c18947b947 Transform 'u8' to 'uint8_t'
- Replace '\([^_]\)u8' with '\1uint8_t'.
- Replace '^u8' with 'uint8_t'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2276 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 07:07:12 +00:00
zwelch d31e57a10d David Brownell <david-b@pacbell.net>:
Let jtag_call_event_callbacks() behave when the callback removes itself.
Oddly, this crashed on x86_32 but not x86_64.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2264 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 06:40:50 +00:00
zwelch a0c10dd29b David Brownell <david-b@pacbell.net>:
Extend the internal JTAG event handlers to cover enable/disable,
and use those events to make sure that targets get "examined" if
they were disabled when the scan chain was first set up:

 - Remove "enum jtag_tap_event", merge with "enum jtag_event",
   so C code can now listen for TAP enable/disable events.

 - Report those events so they can trigger callbacks.

 - During startup, make target_examine() register a handler to
   catch ENABLE events for any then-disabled targets.

This fixes bugs like "can't halt target after enabling its TAP".

One class of unresolved bugs:  if the target has an ETM hooked
up to an ETB, nothing activates the ETB.  But starting up the
ETM without access to the ETB registers fails...


git-svn-id: svn://svn.berlios.de/openocd/trunk@2251 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-16 12:17:18 +00:00
zwelch 5f9b74d055 David Brownell <david-b@pacbell.net>:
Doc update:  say "jtag newtap ... -disable" records the
state after exiting the RESET state, matching the only
implementation we're working with so far (TI ICEpick-C).

Matching code updates.  Now we can be sure that the
"enabled" flag value is correct after JTAG resets.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2246 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-16 00:23:00 +00:00
zwelch 03803a9d79 David Brownell <david-b@pacbell.net>:
Fix a memory leak in jtag_tap_free():  unregister the event
callback too.

Also fix the associated conceptual bug in unregistering JTAG
event callbacks:  since the same callback procedure is used
many times with different callback data (a TAP handle), that
data must be considered when unregistering any callback.

This could fix some crashes after TAP registration errors,
by making sure the reset event handler doesn't scribble over
memory that's now used by something else.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2245 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-16 00:22:52 +00:00
zwelch c7cfb3417b David Brownell <david-b@pacbell.net>:
Minor jtag cleanup:

 - remove hidden assumption about JTAG event numbering
 - move function declarations to a header
 - some end'o'line whitespace
 - use "calloc" not "malloc + memset"


git-svn-id: svn://svn.berlios.de/openocd/trunk@2244 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-16 00:22:40 +00:00
zwelch 8551803eb5 David Brownell <david-b@pacbell.net>:
Partial fix to the "long IR length" problems.

 - Current code could handle up to 32 bit IR lengths with
   full functionality, if it didn't just reject may of them
   out of hand.  So only reject clear errors, where the IR
   mask (or capture instruction) needs more than IrLen bits.

 - Longer IR lengths can only be handled in BYPASS mode
   for now.  Example:  TI's DSPs use 38-bit IR lengths.
   So we can't issue their IDCODE instructions...

A more complete fix would be able to issue longer instructions;
or minimally, would fail cleanly for the non-BYPASS case.

Note that this *could* make some currently broken scripts fail,
since the previous code accepted garbage values so long as
they didn't use more than 16 bits.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2222 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 21:43:53 +00:00
zwelch 5d657571cb Use parse_uint helper to replace strtoul call in jtag_tap_by_string.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2212 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 01:40:29 +00:00
zwelch 08382e0601 Out-of-line jtag_tap_next_enabled and simplify its logic.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2185 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 07:08:14 +00:00
zwelch 04cb121073 Move jtag_add_statemove decl/body nearer jtag_add_pathmove.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2184 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 07:08:03 +00:00
zwelch e8febc2255 Encapsulate the core jtag interface pointer:
- Add new jtag_config_khz to increase encapsulation of jtag->khz call.
- Add new jtag_get_speed_readable to encapsulate of jtag->speed_div call.
- Make definition of jtag static in core.c, remove extern from tcl.c.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2171 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 10:07:07 +00:00
zwelch 15974a0eeb Continue encapsulation of JTAG event callback sub-API:
- Move jtag_event_callbacks struct to core.c; it's an implementation detail.
- Move jtag_*_event_callbacks next to the definition of the new function type.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2169 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:41:36 +00:00
zwelch aabb31d571 Add jtag_event_handler_t:
- Define the function signature used by the JTAG event callback mechanism.
- Provide Doxygen block for new type, including TODO for its return value.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2168 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:41:29 +00:00
zwelch a485ded4bf Improve encapsulation of JTAG event handling:
- Move nvp_jtag_tap_event and jtag_tap_handle_event to tcl.c.
- Change both to be static; remove declaration of function from jtag.h.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2166 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:41:14 +00:00
zwelch a2d18e9111 Properly encapsulate core hasKHZ variable.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2165 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:41:08 +00:00
zwelch 55be316dbf Cleanup and encapsulate IR Capture verification:
- Add accessors for setting the jtag_verify_capture_ir flag.
- Use them in handle_verify_ircapture_cpmmand
- Change variable type to bool; make it static.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2164 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:41:00 +00:00
zwelch a70d77aec3 Add missing static keywords to a few variables in JTAG core module.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2163 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:40:54 +00:00
zwelch f9596e96c9 Move the jtag_error helper routines out of header file:
- Makes jtag_error static, add new get helper function for completeness.
- Improve and add documentation and style for these helpers.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2162 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:40:46 +00:00
zwelch 6dc2c2ce97 Encapsulate jtag_reset_config using accessors:
- Update handle_reset_config_command in tcl.c to use new helpers.
- Replace direct accesses in JTAG interface and target drivers.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2161 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:40:31 +00:00
zwelch cd7f89f6bc Add get and set accessors for jtag_speed:
- Setter calls the interface driver callback to improve core encapsulation.
- Use getter in standard JTAG interface drivers and ZY1000 minidriver.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2159 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:40:10 +00:00
zwelch bcad121d2b Encapsulate the jtag_event_callback list; add helper functions if needed.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2158 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:40:02 +00:00
zwelch 175867ea32 Encapsulate the jtag_trst and jtag_srst variables:
- Add accessor functions to return their value.
- Use new SRST accessor in cortex_m3.c and mips_m4k.c


git-svn-id: svn://svn.berlios.de/openocd/trunk@2157 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:39:50 +00:00
zwelch 133a616572 Replace 'jtag.c' with 'core.c' in code comments.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2152 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 04:54:09 +00:00