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>
This commit is contained in:
David Brownell
2009-10-23 01:00:32 -07:00
parent 517e812de3
commit 814183a5c4
5 changed files with 68 additions and 80 deletions
+4
View File
@@ -365,6 +365,10 @@ tap_state_t tap_state_by_name(const char *name)
{
tap_state_t x;
/* standard SVF name is "IDLE" */
if (0 == strcasecmp(name, "IDLE"))
return TAP_IDLE;
for (x = 0 ; x < TAP_NUM_STATES ; x++) {
/* be nice to the human */
if (0 == strcasecmp(name, tap_state_name(x))) {
-3
View File
@@ -160,9 +160,6 @@ bool tap_is_state_stable(tap_state_t astate);
*/
tap_state_t tap_state_transition(tap_state_t current_state, bool tms);
/// Provides user-friendly name lookup of TAP states.
tap_state_t tap_state_by_name(const char *name);
/// Allow switching between old and new TMS tables. @see tap_get_tms_path
void tap_use_new_tms_table(bool use_new);
/// @returns True if new TMS table is active; false otherwise.
+4 -1
View File
@@ -102,7 +102,10 @@ typedef enum tap_state
* Function tap_state_name
* Returns a string suitable for display representing the JTAG tap_state
*/
const char* tap_state_name(tap_state_t state);
const char *tap_state_name(tap_state_t state);
/// Provides user-friendly name lookup of TAP states.
tap_state_t tap_state_by_name(const char *name);
/// The current TAP state of the pending JTAG command queue.
extern tap_state_t cmd_queue_cur_state;