This is the hack I used to dump TMS path tables at startup.
---
 src/jtag/interface.c |   41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

--- a/src/jtag/interface.c
+++ b/src/jtag/interface.c
@@ -375,6 +375,47 @@ tap_state_t tap_state_by_name(const char
        return TAP_INVALID;
 }
 
+static void dump_tap_seq(tap_state_t cur, tap_state_t end)
+{
+       unsigned path = tap_get_tms_path(cur, end);
+       unsigned len = tap_get_tms_path_len(cur, end);
+
+       printf("\t{ %s", tap_state_name(cur));
+       while (len--) {
+               cur = tap_state_transition(cur, (path & 1) == 1);
+               path >>= 1;
+               printf(", %s", tap_state_name(cur));
+       }
+       printf(" }\n");
+}
+
+static void dump_tap_table(const char *label, tms_table *table)
+{
+       static const tap_state_t stable[6] = {
+               TAP_RESET, TAP_IDLE,
+               TAP_DRSHIFT, TAP_DRPAUSE,
+               TAP_IRSHIFT, TAP_IRPAUSE,
+       };
+
+       tms_seqs = table;
+       printf("TMS Table: %s\n", label);
+
+       for (int i = 0; i < 6; i++) {
+               printf("\t/* from %s */\n", tap_state_name(stable[i]));
+               for (int j = 0; j < 6; j++)
+                       dump_tap_seq(stable[i], stable[j]);
+       }
+       printf("\n");
+}
+
+static void dump_tap_tables(void) __attribute__ ((constructor));
+static void dump_tap_tables(void)
+{
+       dump_tap_table("old", &old_tms_seqs);
+       dump_tap_table("short", &short_tms_seqs);
+       fflush(stdout);
+}
+
 #ifdef _DEBUG_JTAG_IO_
 
 #define JTAG_DEBUG_STATE_APPEND(buf, len, bit) \
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to