summaryrefslogtreecommitdiff
path: root/src/target/arm_adi_v5.c
Commit message (Collapse)AuthorAgeFilesLines
* arm_adi: -Wshadow warning fixØyvind Harboe2010-06-151-3/+3
| | | | Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* arm_adi_v5: correct ahbap_debugport_init mem-ap id (bug #23)Spencer Oliver2010-05-211-0/+3
| | | | | | | | We request a id register read at the end of ahbap_debugport_init but we never actually run the queue. In some cases this causes a segfault. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* change %x and %d to PRIx32 and PRId32 where needed for cygwinDaniel Bäder2010-03-251-1/+1
|
* ADI_v5 - it's not always an "SWJ-DP"David Brownell2010-03-181-140/+140
| | | | | | | So don't use the name "swjdp" for all DAPs; rename to plain old "dap", which *is* always correct. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* remove more duplicationDavid Brownell2010-03-181-25/+0
| | | | | | | | Not sure how the original "move code to adi_v5_swd.c" patch left some code in the "arm_adi_v5.c" file, but a recent patch was only a partial fix -- it didn't remove all the duplication. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* linker error: fix problem with duplicate fnØyvind Harboe2010-03-181-33/+0
| | | | | | | | | | | A fn was copied instead of moved to a new file. The linker can discard exact copies of fn's without warning. This is a C++'ism. However on my Ubuntu 9.10 machine, it fails. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* ADIv5 transport support moves to separate filesDavid Brownell2010-03-161-423/+11
| | | | | | | | | | | | | | | | | | | Unclutter arm_adi_v5.c by moving most transport-specific code to a transport-specific files adi_v5_{jtag,swd}.c ... it's not a full cleanup, because of some issues which need to be addressed as part of SWD support (along with implementing the DAP operations on top of SWD transport): - The mess where mem_ap_read_buf_u32() is currently coded to know about JTAG scan chains, and thus needs rewriting before it will work with SWD; - Initialization is still JTAG-specific Also move JTAG_{DP,ACK}_* constants from adi_v5.h to the JTAG file; no other code should care about those values. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* jtag: retire tap fieldØyvind Harboe2010-03-081-5/+2
| | | | | | | | | | | | | | | | | jtag_add_dr/ir_scan() now takes the tap as the first argument, rather than for each of the fields passed in. The code never exercised the path where there was more than one tap being scanned, who knows if it even worked. This simplifies the implementation and reduces clutter in the calling code. use jtag_add_ir/dr_plain_scan() for more fancy situations. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* ADIv5 share DAP command supportDavid Brownell2010-03-051-23/+116
| | | | | | | | | | | | | | Get rid of needless and undesirable code duplication for all the DAP commands (resolving a FIXME) ... there's no need for coreas to have private copies of that stuff. Stick a pointer to the DAP in "struct arm", letting common code get to it. Also rename the "swjdp_info" symbol; just call it "dap". This is an overall code shrink. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* rename "swjdp_common" as "adiv5_dap"David Brownell2010-03-041-32/+32
| | | | | | | | | | | | | This partially corrects an inappropriate name choice (and its associated FIXME). There are still too many variables named "swjdp", bug little current code actually relies on them referencing an SWJ-DP instead of some other flavor of DAP. Only the two new dap_to{swd,jtag}() calls could behave differently on an SWJ-DP instead of a SW-DP or a JTAG-DP. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ADIv5: use new DAP ops for AP read/writeDavid Brownell2010-03-021-98/+67
| | | | | | | | | | | | | | | | | | | Make ADIv5 internals use the two new transport-neutral calls for reading and writing DP registers; and do the same for external callers. Also, bugfix some of their call sites to handle the fault returns, instead of ignoring them. Remove most of the JTAG-specific calls, using their code as the bodies of the JTAG-specific implementation for the new methods. NOTE that there's a remaining issue: mem_ap_read_buf_u32() makes calls which are JTAG-specific. A later patch will need to remove those, so JTAG-specific operations can be removed from this file, and so that SWD support will be able to properly drop in as just a transport layer to the ADIv5 infrastructure. (The way read results are posted may need some more attention in the transport-neutrality interface.) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ADIv5: use new DAP ops for DP read/writeDavid Brownell2010-03-021-32/+38
| | | | | | | | | | | Make ADIv5 internals use the two new transport-neutral calls for reading and writing DP registers. Also, bugfix some of their call sites to handle the fault returns, instead of ignoring them. Remove the old JTAG-specific calls, using their code as the bodies of the JTAG-specific implementation for the new methods. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ADIv5: use new dap_run() operationDavid Brownell2010-03-021-26/+59
| | | | | | | | | | Make ADIv5 use one of the new transport-neutral interfaces: call dap_run(), not jtagdp_transaction_endcheck(). Also, make that old interface private; and bugfix some of its call sites to handle the fault returns, instead of ignoring them. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM: start abstracting ADIv5 transports (JTAG/SWD)David Brownell2010-03-021-0/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | To support both JTAG and SWD, ADIv5 needs DAP operations which are transport-neutral, instead being of JTAG-specific. This patch: - Defines such a transport-neutral interface, abstracting access to DP and AP registers through a conceptual queue of operations. - Builds the first implementation of such a transport with the existing JTAG-specific code. In contrast to the current JTAG-only interface, the interface adds support for two previously-missing (and unused) DAP operations: - aborting the current AP transaction (untested); - reading the IDCODE register (tested) ... required for SWD init. The choice of transports may be fixed at the chip, board, or JTAG/SWD adapter level. Or if all the relevant hardware supports both transport options, the choice may be made at runtime, This patch provides basic infrastructure to support whichever choice is made. The current "JTAG-only" transport choice policy will necessarily continue for now, until SWD support becomes available in OpenOCD. Later patches start phasing out JTAG-specific calls in favor of transport-neutral calls. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ADIv5: use right ID for Cortex-M3 ETMDavid Brownell2010-03-021-4/+4
| | | | | | | | | Correct a mistake made copying the ID of the Cortex-M3 ETM module from the TRM, so that "dap info" on a CM3 with an ETM will now correctly describe ROM table entries for such modules. (They are included on LPC17xx and some other cores.) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ADIv5 DAP ops switching to JTAG or SWD modesDavid Brownell2010-02-271-0/+113
| | | | | | | | | | | Define two new DAP operations which use the new jtag_add_tms_seq() calls to put the DAP's transport into either SWD or JTAG mode, when the hardware allows. Tested with the Stellaris 'Recovering a "Locked" Device' procedure, which loops five times over both of these. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM ADIv5 doxygen and cleanupDavid Brownell2010-02-241-15/+42
| | | | | | | Add doxygen for mem_ap_read_buf_u{8,16,32}() calls, and shrink a few overlong lines. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM ADIv5: rename more JTAG-specific routinesDavid Brownell2010-02-231-11/+11
| | | | | | | Highlight more of the internal JTAG-specific utilities, so it's easier to identify code needing changes to become transport-neutral. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ADIv5: relocate memacess_tck cyclesDavid Brownell2010-02-211-12/+12
| | | | | | | | | | | | | When using an AP to access a memory (or a memory-mapped register), some extra TCK (assuming JTAG) cycles should be added to ensure the AP has enugh time to complete that access before trying to collect the response. The previous code was adding these cycles *before* trying to access (read or write) data to that address, not *after*. Fix by putting the delays in the right location. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ADIv5: remove ATOMIC/COMPOSITE interface modeDavid Brownell2010-02-211-84/+27
| | | | | | | | | | | | | This removes context-sensitivity from the programming interface and makes it possible to know what a block of code does without needing to know the previous history (specifically, the DAP's "trans_mode" setting). The mode was only set to ATOMIC briefly after DAP initialization, making this patch be primarily cleanup; almost everything depends on COMPOSITE. The transactions which shouldn't have been queued were already properly flushing the queue. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM: ADIv5, deadcode cleanupDavid Brownell2010-02-211-13/+13
| | | | | | | | | | | | I have no idea what the scan_inout_check() was *expecting* to achieve by issuing a read of the DP_RDBUFF register. But in any case, that code was clearly never being called ("invalue" always NULL) ... so remove it, and the associated comment. Also rename it as ap_write_check(), facilitating a cleanup of its single call site by removing constant parameters. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM: ADIv5 code shrinkage, cleanupDavid Brownell2010-02-211-40/+16
| | | | | | | | | | adi_jtag_dp_scan_u32() now wraps adi_jtag_dp_scan(), removing code duplication. Include doxygen for the former. Comment some particularly relevant points. Minor fault handling fixes for both routines: don't register a callback that can't run, or return ERROR_OK after an error. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ADIv5 clean up AP fault handlingDavid Brownell2010-02-211-32/+46
| | | | | | | | | | | | | | | | | Pass up fault codes from various routines, so their callers can clean up after failures, and remove the FIXME comments highlighting those previously goofy code paths. dap_ap_{read,write}_reg_u32() dap_ap_write_reg() mem_ap_{read,write}_u32() mem_ap_{read,write}_atomic_u32() dap_setup_accessport() Make dap_ap_write_reg_u32() just wrap dap_ap_write_reg(), instead of cloning its core code (and broken fault handling). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ADIv5 clean up AP selection and register cachingDavid Brownell2010-02-211-22/+21
| | | | | | | | | | | | | | | | | | | Handling of AP (and AP register bank) selection, and cached AP registers, is pretty loose ... start tightening it: - It's "AP bank" select support ... there are no DP banks. Rename. + dap_dp_bankselect() becomes dap_ap_bankselect() + "dp_select_value" struct field becomes "ap_bank_value" - Remove duplicate AP cache init paths ... only use dap_ap_select(), and don't make Cortex (A8 or M3) cores roll their own code. - For dap_ap_bankselect(), pass up any fault code from writing the SELECT register. (Nothing yet checks those codes.) - Add various bits of Doxygen Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ADIv5: doxygenDavid Brownell2010-02-061-27/+131
| | | | | | | | | | | | | | | | | Provide doxygen for many of the public ADIv5 interfaces (i.e. the ones called from Cortex core support code). Add FIXMEs (and a TODO) to help resolve implementation issues which became more apparent when trying to document this code: - Error-prone context-sensitivity (queued/nonqueued) in many procedures. - Procedures that lie by ignoring errors and wrongly claiming success. Also, there was no point in a return from dap_ap_select(); it can't fail, and no caller checks its return status. Clean that up, make it void. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ADIv5: more messaging cleanup, docsDavid Brownell2010-01-311-12/+20
| | | | | | | | | When the TAR cache was explicitly invalidated, don't bother printing it; the actual hardware status is more informative. Provide some doxygen for the MEM-AP setup routine. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* Subject: ADIv5: fix more diagnosticsDavid Brownell2010-01-311-9/+16
| | | | | | | | | | | If the MEM-AP cache is invalid, don't display it; just report that invalidity as an error. (This bug has been observed with "mdw 0 32" after just a "reset halt". Some code is being wrongly bypassed...) If it's valid, display that cache at DEBUG level, not ERROR. Also, don't assume it's an AHB-AP; it could be another flavor of MEM-AP. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ADIv5 error checking for Tcl commandsDavid Brownell2010-01-301-1/+17
| | | | | | | | | Reject invalid AP numbers (256+) as Tcl operation parameters. Shrink one of the overlong lines. Add my copyright to the ADIv5 code (multiple contributions). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM ADIv5: fix diagnostics for block writesDavid Brownell2010-01-301-5/+14
| | | | | | They were reporting "read" errors, not "write" errors. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ADIv5: cleanup, rename swjdp_transaction_endcheck()David Brownell2010-01-291-28/+37
| | | | | | | | | | | | | | | | Make messages reference "DAP" if they're actually transport-agnostic, or "JTAG-DP" when they're JTAG-specific. Saying SWJ-DP is often wrong (on most Cortex-A8 chips) and is confusing even if correct (since we don't yet support SWD). Rename a JTAG-specific routine to jtagdp_transaction_endcheck() to highlight that it's JTAG-specific, and that identify DAP clients undesirably depending on JTAG. (They will all need to change for SWD support.) Shrink a few overlong lines of code. Copy a comment from code removed in a previous patch (for the ARMv7-M "dap baseaddr" command). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM ADIv5: messaging tweaksDavid Brownell2010-01-271-2/+5
| | | | | | | Add space missing after the invalid ACK value. On init, say which AP is being used, and don't assume it's an AHP-AP. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ADIv5 improved diagnosticDavid Brownell2010-01-151-2/+3
| | | | | | | Don't just complain about an invalid ACK; say what the value was, to help troubleshooting. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM ADIv5: add commentsDavid Brownell2010-01-141-1/+27
| | | | | | | Add doxygen and other comments for what's more or less the lowest level JDAG-DP primitive, to access JTAG_DP_{A,D}PACC registers. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARMv7: help/usage updatesDavid Brownell2010-01-071-0/+8
| | | | | | | | | | | | | | | | | | Provide helptext which was sometimes missing; update some of it to be more accurate. Usage syntax messages have the same EBNF as the User's Guide; there should be no angle brackets in either place. Don't use "&function"; functions are like arrays, their address is their name. Shrink some overlong lines, remove some empties. Add a couple comments about things that should change: those extra TCK cycles for MEM-AP reads are in the wrong place (that might explain some problems we've seen); the DAP command tables should be shared, not copied. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM: add #defines for JTAG ack codesDavid Brownell2010-01-051-6/+5
| | | | | | | | JTAG has only two possible JTAG ack codes for APACC and DPACC register reads/writes. Define them, and remove empty "else" clause in the code which now uses those codes. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM: add comments re DAP assumptionsDavid Brownell2010-01-051-2/+14
| | | | | | | I think some of these assumptions are not well-founded. Related, that swjdp_transaction_endcheck() is a bit iffy. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM: ADIv5 JTAG symbol cleanupDavid Brownell2010-01-021-33/+63
| | | | | | | | | | | | | | Rename DAP_IR_* as JTAG_DP_* since those symbols are specifically for JTAG-DP (or SWJ-DP in JTAG mode), and won't work with SWD. Define the JTAG ABORT and IDCODE instructions for completeness; add a comment about where to (someday) use ABORT. Fix messaging which assumes everything is an SWJ-DP; say "JTAG-DP" instead, it's at least more appropriate for all JTAG transports. Shrink the affected lines. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM: dap info fix + tweaksDavid Brownell2010-01-021-8/+14
| | | | | | | | Fix: don't print the BASE address except if it's a MEM-AP; that's an unlikely error, but there's no point getting it wrong. Tweaks: comments, capitalization. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM: ADIv5 export cleanupDavid Brownell2010-01-021-19/+27
| | | | | | | | | Make some private functions "static". Remove their public declarations, and what is now an obviously unused function. Shrinks this object's size (about 5% on x86_64) while making the code's scope easier to understand. Shrink the affected lines. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM: ADIv5 symbol and comment cleanupDavid Brownell2010-01-021-18/+57
| | | | | | | | | | | Instead of magic numbers, use their AP_REG_* constants. Rename the ROM address symbol as BASE to match ARM's documentation. Comment various other symbols in the header; add some missing ones. Remove an unused struct. Add some doxygen for stuff including the DAP structure and initialization. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* change #include "time_support.h" to <helper/time_support.h>Zachary T Welch2009-12-031-1/+1
| | | | | | | | | | | | 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.
* ARM: comment tweaks in ADIv5David Brownell2009-11-251-2/+5
| | | | | | "OptimoDE DESS" is ARM's semicustom DSPish stuff. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* command_handler: change 'cmd_ctx' to CMD_CTXZachary T Welch2009-11-171-4/+4
| | | | Convert all command handler 'cmd_ctx' parameter usage with CMD_CTX.
* command_handler: change 'args' to CMD_ARGVZachary T Welch2009-11-171-4/+4
| | | | | This patch converts all instances of 'args' in COMMAND_HANDLER routines to use CMD_ARGV macro.
* command_handler: change to 'argc' to CMD_ARGCZachary T Welch2009-11-171-4/+4
| | | | | This patch converts all instances of 'argc' in COMMAND_HANDLER routines to use CMD_ARGC.
* command_context_t -> struct command_contextZachary T Welch2009-11-131-1/+1
| | | | Remove misleading typedef and redundant suffix from struct command_context.
* arm_jtag_t -> struct arm_jtagZachary T Welch2009-11-131-2/+2
| | | | Remove misleading typedef and redundant suffix from struct arm_jtag.
* swjdp_common_t -> struct swjdp_commonZachary T Welch2009-11-131-34/+34
| | | | Remove misleading typedef and redundant suffix from struct swjdp_common.
* scan_field_t -> struct scan_fieldZachary T Welch2009-11-131-2/+2
| | | | Remove useless structure typedef.
* arm_adi,armv7[am]: use COMMAND_HELPER for helpersZachary T Welch2009-11-131-8/+4
| | | | | Rewrites the dap_* command helpers to use the COMMAND_HELPER paradigm. Uses CALL_COMMAND_HELPER to hide inherited calling conventions.