From 7aafd6195327e6d17747bf0d4f40b79d030ad24f Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Fri, 6 Oct 2017 13:55:52 -0700 Subject: Clean up this JTAG debug code. Change-Id: Ie7c773b98271d11085d5e50c40b64990710de387 --- src/jtag/core.c | 72 ++++++++------------------------------------------------- 1 file changed, 10 insertions(+), 62 deletions(-) diff --git a/src/jtag/core.c b/src/jtag/core.c index e21d476..71a731d 100644 --- a/src/jtag/core.c +++ b/src/jtag/core.c @@ -838,108 +838,57 @@ int default_interface_jtag_execute_queue(void) int result = jtag->execute_queue(); -#if 0 - // TODO: I like these better than some of the other JTAG debug statements, - // but having both is silly. struct jtag_command *cmd = jtag_command_queue; while (debug_level >= LOG_LVL_DEBUG && cmd) { switch (cmd->type) { case JTAG_SCAN: -#if 0 - LOG_DEBUG("JTAG %s SCAN to %s", + DEBUG_JTAG_IO("JTAG %s SCAN to %s", cmd->cmd.scan->ir_scan ? "IR" : "DR", tap_state_name(cmd->cmd.scan->end_state)); for (int i = 0; i < cmd->cmd.scan->num_fields; i++) { struct scan_field *field = cmd->cmd.scan->fields + i; if (field->out_value) { char *str = buf_to_str(field->out_value, field->num_bits, 16); - LOG_DEBUG(" %db out: %s", field->num_bits, str); + DEBUG_JTAG_IO(" %db out: %s", field->num_bits, str); free(str); } if (field->in_value) { char *str = buf_to_str(field->in_value, field->num_bits, 16); - LOG_DEBUG(" %db in: %s", field->num_bits, str); + DEBUG_JTAG_IO(" %db in: %s", field->num_bits, str); free(str); } - if (field->check_value) { - char *str = buf_to_str(field->check_value, field->num_bits, 16); - LOG_DEBUG(" %db check: %s", field->num_bits, str); - free(str); - } - if (field->check_mask) { - char *str = buf_to_str(field->check_mask, field->num_bits, 16); - LOG_DEBUG(" %db mask: %s", field->num_bits, str); - free(str); - } - } -#endif - { - uint8_t *buf = NULL; - int scan_bits = jtag_build_buffer(cmd->cmd.scan, &buf); - char *str_out = buf_to_str(buf, scan_bits, 16); - free(buf); - LOG_DEBUG("vvv jtag_scan(%d, %d, %d'h%s, %d); // %s", - cmd->cmd.scan->ir_scan, - scan_bits, - scan_bits, str_out, - cmd->cmd.scan->end_state, tap_state_name(cmd->cmd.scan->end_state)); - free(str_out); - - struct scan_field *last_field = cmd->cmd.scan->fields + cmd->cmd.scan->num_fields - 1; - if (last_field->in_value) { - char *str_in = buf_to_str(last_field->in_value, last_field->num_bits, 16); - LOG_DEBUG("vvv jtag_check_tdo(%d, %d'h%s);", - last_field->num_bits, - last_field->num_bits, str_in); - free(str_in); - } } break; case JTAG_TLR_RESET: -#if 0 - LOG_DEBUG("JTAG TLR RESET to %s", - tap_state_name(cmd->cmd.statemove->end_state)); -#endif - LOG_DEBUG("vvv jtag_tlr_reset(%d); // %s", - cmd->cmd.statemove->end_state, + DEBUG_JTAG_IO("JTAG TLR RESET to %s", tap_state_name(cmd->cmd.statemove->end_state)); break; case JTAG_RUNTEST: -#if 0 - LOG_DEBUG("JTAG RUNTEST %d cycles to %s", + DEBUG_JTAG_IO("JTAG RUNTEST %d cycles to %s", cmd->cmd.runtest->num_cycles, tap_state_name(cmd->cmd.runtest->end_state)); -#endif - LOG_DEBUG("vvv jtag_runtest(%d, %d); // %s", - cmd->cmd.runtest->num_cycles, - cmd->cmd.runtest->end_state, - tap_state_name(cmd->cmd.runtest->end_state)); break; case JTAG_RESET: { -#if 0 const char *reset_str[3] = { "leave", "deassert", "assert" }; - LOG_DEBUG("JTAG RESET %s TRST, %s SRST", + DEBUG_JTAG_IO("JTAG RESET %s TRST, %s SRST", reset_str[cmd->cmd.reset->trst + 1], reset_str[cmd->cmd.reset->srst + 1]); -#endif - LOG_DEBUG("vvv jtag_reset(%d, %d);", - cmd->cmd.reset->trst, cmd->cmd.reset->srst); } break; case JTAG_PATHMOVE: - LOG_DEBUG("JTAG PATHMOVE (TODO)"); + DEBUG_JTAG_IO("JTAG PATHMOVE (TODO)"); break; case JTAG_SLEEP: - LOG_DEBUG("JTAG SLEEP (TODO)"); + DEBUG_JTAG_IO("JTAG SLEEP (TODO)"); break; case JTAG_STABLECLOCKS: - LOG_DEBUG("JTAG STABLECLOCKS (TODO)"); + DEBUG_JTAG_IO("JTAG STABLECLOCKS (TODO)"); break; case JTAG_TMS: - LOG_DEBUG("JTAG STABLECLOCKS (TODO)"); + DEBUG_JTAG_IO("JTAG STABLECLOCKS (TODO)"); break; default: LOG_ERROR("Unknown JTAG command: %d", cmd->type); @@ -947,7 +896,6 @@ int default_interface_jtag_execute_queue(void) } cmd = cmd->next; } -#endif return result; } -- cgit v1.1