Debug message updates:
authordbrownell <dbrownell@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Sun, 20 Sep 2009 07:55:11 +0000 (07:55 +0000)
committerdbrownell <dbrownell@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Sun, 20 Sep 2009 07:55:11 +0000 (07:55 +0000)
 - 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

src/jtag/core.c
src/jtag/tcl.c
src/target/target.c

index 6a314ece1d868dfc27932c887a688f06daf2f9d3..bf4a9cc7f69a54c27a46d2d5d22e07c0977d8aea 100644 (file)
@@ -60,9 +60,9 @@ static int jtag_error = ERROR_OK;
 
 static const char *jtag_event_strings[] =
 {
-       [JTAG_TRST_ASSERTED] = "JTAG controller reset (TLR or TRST)",
+       [JTAG_TRST_ASSERTED] = "TAP reset",
        [JTAG_TAP_EVENT_ENABLE] = "TAP enabled",
-       [JTAG_TAP_EVENT_POST_RESET] = "post reset",
+       [JTAG_TAP_EVENT_POST_RESET] = "TAP post reset",
        [JTAG_TAP_EVENT_DISABLE] = "TAP disabled",
 };
 
@@ -820,9 +820,6 @@ static int jtag_reset_callback(enum jtag_event event, void *priv)
 {
        jtag_tap_t *tap = priv;
 
-       LOG_DEBUG("TAP %s event %s", tap->dotted_name,
-                       jtag_event_strings[event]);
-
        if (event == JTAG_TRST_ASSERTED)
        {
                tap->enabled = !tap->disabled_after_reset;
@@ -943,15 +940,10 @@ static bool jtag_examine_chain_match_tap(const struct jtag_tap_s *tap)
        for (ii = 0; ii < tap->expected_ids_cnt; ii++)
        {
                if (tap->idcode == tap->expected_ids[ii])
-                       break;
+                       return true;
        }
 
        /* If none of the expected ids matched, log an error */
-       if (ii != tap->expected_ids_cnt)
-       {
-               LOG_DEBUG("JTAG Tap/device matched");
-               return true;
-       }
        jtag_examine_chain_display(LOG_LVL_ERROR, "got",
                        tap->dotted_name, tap->idcode);
        for (ii = 0; ii < tap->expected_ids_cnt; ii++)
@@ -994,7 +986,8 @@ static int jtag_examine_chain(void)
                if ((idcode & 1) == 0)
                {
                        /* LSB must not be 0, this indicates a device in bypass */
-                       LOG_WARNING("Tap/Device does not have IDCODE");
+                       LOG_WARNING("TAP %s does not have IDCODE",
+                                       tap->dotted_name);
                        idcode = 0;
                        tap->hasidcode = false;
 
@@ -1017,15 +1010,11 @@ static int jtag_examine_chain(void)
                        }
 
                        jtag_examine_chain_display(LOG_LVL_INFO, "tap/device found",
-                                       tap ? tap->dotted_name : "(not-named)",
-                                       idcode);
+                                       tap->dotted_name, idcode);
 
                        bit_count += 32;
                }
                device_count++;
-               if (!tap)
-                       continue;
-
                tap->idcode = idcode;
 
                // ensure the TAP ID does matches what was expected
index 04fca22770ce545da0c126c5571bbbc3d0771aa2..0368c4f89549031fa558623c5bce2a5d827cc5d6 100644 (file)
@@ -358,14 +358,9 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
 static void jtag_tap_handle_event(jtag_tap_t *tap, enum jtag_event e)
 {
        jtag_tap_event_action_t * jteap;
-       int done;
 
-       jteap = tap->event_action;
-
-       done = 0;
-       while (jteap) {
+       for (jteap = tap->event_action; jteap != NULL; jteap = jteap->next) {
                if (jteap->event == e) {
-                       done = 1;
                        LOG_DEBUG("JTAG tap: %s event: %d (%s) action: %s\n",
                                        tap->dotted_name,
                                        e,
@@ -386,14 +381,6 @@ static void jtag_tap_handle_event(jtag_tap_t *tap, enum jtag_event e)
                                break;
                        }
                }
-
-               jteap = jteap->next;
-       }
-
-       if (!done) {
-               LOG_DEBUG("event %d %s - no action",
-                               e,
-                               Jim_Nvp_value2name_simple(nvp_jtag_tap_event, e)->name);
        }
 }
 
index 16e36816b22c18b5a4b89aaff23af54f028d3d64..f0e9d8eeb21beba749b8505b789bcc91aa4957d9 100644 (file)
@@ -3409,14 +3409,9 @@ void target_all_handle_event(enum target_event e)
 void target_handle_event(target_t *target, enum target_event e)
 {
        target_event_action_t *teap;
-       int done;
 
-       teap = target->event_action;
-
-       done = 0;
-       while (teap) {
+       for (teap = target->event_action; teap != NULL; teap = teap->next) {
                if (teap->event == e) {
-                       done = 1;
                        LOG_DEBUG("target: (%d) %s (%s) event: %d (%s) action: %s",
                                           target->target_number,
                                           target->cmd_name,
@@ -3429,12 +3424,6 @@ void target_handle_event(target_t *target, enum target_event e)
                                Jim_PrintErrorMessage(interp);
                        }
                }
-               teap = teap->next;
-       }
-       if (!done) {
-               LOG_DEBUG("event: %d %s - no action",
-                                  e,
-                                  Jim_Nvp_value2name_simple(nvp_target_event, e)->name);
        }
 }