Merge pull request #127 from riscv/jtag_debug
Clean up this JTAG debug code.
This commit is contained in:
commit
9b4628c9fc
|
@ -838,108 +838,57 @@ int default_interface_jtag_execute_queue(void)
|
||||||
|
|
||||||
int result = jtag->execute_queue();
|
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;
|
struct jtag_command *cmd = jtag_command_queue;
|
||||||
while (debug_level >= LOG_LVL_DEBUG && cmd) {
|
while (debug_level >= LOG_LVL_DEBUG && cmd) {
|
||||||
switch (cmd->type) {
|
switch (cmd->type) {
|
||||||
case JTAG_SCAN:
|
case JTAG_SCAN:
|
||||||
#if 0
|
DEBUG_JTAG_IO("JTAG %s SCAN to %s",
|
||||||
LOG_DEBUG("JTAG %s SCAN to %s",
|
|
||||||
cmd->cmd.scan->ir_scan ? "IR" : "DR",
|
cmd->cmd.scan->ir_scan ? "IR" : "DR",
|
||||||
tap_state_name(cmd->cmd.scan->end_state));
|
tap_state_name(cmd->cmd.scan->end_state));
|
||||||
for (int i = 0; i < cmd->cmd.scan->num_fields; i++) {
|
for (int i = 0; i < cmd->cmd.scan->num_fields; i++) {
|
||||||
struct scan_field *field = cmd->cmd.scan->fields + i;
|
struct scan_field *field = cmd->cmd.scan->fields + i;
|
||||||
if (field->out_value) {
|
if (field->out_value) {
|
||||||
char *str = buf_to_str(field->out_value, field->num_bits, 16);
|
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);
|
free(str);
|
||||||
}
|
}
|
||||||
if (field->in_value) {
|
if (field->in_value) {
|
||||||
char *str = buf_to_str(field->in_value, field->num_bits, 16);
|
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);
|
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;
|
break;
|
||||||
case JTAG_TLR_RESET:
|
case JTAG_TLR_RESET:
|
||||||
#if 0
|
DEBUG_JTAG_IO("JTAG TLR RESET to %s",
|
||||||
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,
|
|
||||||
tap_state_name(cmd->cmd.statemove->end_state));
|
tap_state_name(cmd->cmd.statemove->end_state));
|
||||||
break;
|
break;
|
||||||
case JTAG_RUNTEST:
|
case JTAG_RUNTEST:
|
||||||
#if 0
|
DEBUG_JTAG_IO("JTAG RUNTEST %d cycles to %s",
|
||||||
LOG_DEBUG("JTAG RUNTEST %d cycles to %s",
|
|
||||||
cmd->cmd.runtest->num_cycles,
|
cmd->cmd.runtest->num_cycles,
|
||||||
tap_state_name(cmd->cmd.runtest->end_state));
|
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;
|
break;
|
||||||
case JTAG_RESET:
|
case JTAG_RESET:
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
const char *reset_str[3] = {
|
const char *reset_str[3] = {
|
||||||
"leave", "deassert", "assert"
|
"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->trst + 1],
|
||||||
reset_str[cmd->cmd.reset->srst + 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;
|
break;
|
||||||
case JTAG_PATHMOVE:
|
case JTAG_PATHMOVE:
|
||||||
LOG_DEBUG("JTAG PATHMOVE (TODO)");
|
DEBUG_JTAG_IO("JTAG PATHMOVE (TODO)");
|
||||||
break;
|
break;
|
||||||
case JTAG_SLEEP:
|
case JTAG_SLEEP:
|
||||||
LOG_DEBUG("JTAG SLEEP (TODO)");
|
DEBUG_JTAG_IO("JTAG SLEEP (TODO)");
|
||||||
break;
|
break;
|
||||||
case JTAG_STABLECLOCKS:
|
case JTAG_STABLECLOCKS:
|
||||||
LOG_DEBUG("JTAG STABLECLOCKS (TODO)");
|
DEBUG_JTAG_IO("JTAG STABLECLOCKS (TODO)");
|
||||||
break;
|
break;
|
||||||
case JTAG_TMS:
|
case JTAG_TMS:
|
||||||
LOG_DEBUG("JTAG STABLECLOCKS (TODO)");
|
DEBUG_JTAG_IO("JTAG STABLECLOCKS (TODO)");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_ERROR("Unknown JTAG command: %d", cmd->type);
|
LOG_ERROR("Unknown JTAG command: %d", cmd->type);
|
||||||
|
@ -947,7 +896,6 @@ int default_interface_jtag_execute_queue(void)
|
||||||
}
|
}
|
||||||
cmd = cmd->next;
|
cmd = cmd->next;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue