Convert DEBUG_JTAG_IO to LOG_DEBUG_IO
Change-Id: Ifee9723a57fea93a7022be3299f69680860f236b Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3910 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>bscan_optimization
parent
eea508d9af
commit
8b9560349f
13
configure.ac
13
configure.ac
|
@ -172,7 +172,6 @@ AC_ARG_ENABLE([werror],
|
|||
[gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
|
||||
|
||||
# set default verbose options, overridden by following options
|
||||
debug_jtag_io=no
|
||||
debug_usb_io=no
|
||||
debug_usb_comms=no
|
||||
|
||||
|
@ -180,16 +179,10 @@ AC_ARG_ENABLE([verbose],
|
|||
AS_HELP_STRING([--enable-verbose],
|
||||
[Enable verbose JTAG I/O messages (for debugging).]),
|
||||
[
|
||||
debug_jtag_io=$enableval
|
||||
debug_usb_io=$enableval
|
||||
debug_usb_comms=$enableval
|
||||
], [])
|
||||
|
||||
AC_ARG_ENABLE([verbose_jtag_io],
|
||||
AS_HELP_STRING([--enable-verbose-jtag-io],
|
||||
[Enable verbose JTAG I/O messages (for debugging).]),
|
||||
[debug_jtag_io=$enableval], [])
|
||||
|
||||
AC_ARG_ENABLE([verbose_usb_io],
|
||||
AS_HELP_STRING([--enable-verbose-usb-io],
|
||||
[Enable verbose USB I/O messages (for debugging)]),
|
||||
|
@ -200,12 +193,6 @@ AC_ARG_ENABLE([verbose_usb_comms],
|
|||
[Enable verbose USB communication messages (for debugging)]),
|
||||
[debug_usb_comms=$enableval], [])
|
||||
|
||||
AC_MSG_CHECKING([whether to enable verbose JTAG I/O messages]);
|
||||
AC_MSG_RESULT([$debug_jtag_io])
|
||||
AS_IF([test "x$debug_jtag_io" = "xyes"], [
|
||||
AC_DEFINE([_DEBUG_JTAG_IO_],[1], [Print verbose JTAG I/O messages])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([whether to enable verbose USB I/O messages]);
|
||||
AC_MSG_RESULT([$debug_usb_io])
|
||||
AS_IF([test "x$debug_usb_io" = "xyes"], [
|
||||
|
|
|
@ -150,7 +150,7 @@ static int aice_execute_reset(struct jtag_command *cmd)
|
|||
static int last_trst;
|
||||
int retval = ERROR_OK;
|
||||
|
||||
DEBUG_JTAG_IO("reset trst: %d", cmd->cmd.reset->trst);
|
||||
LOG_DEBUG_IO("reset trst: %d", cmd->cmd.reset->trst);
|
||||
|
||||
if (cmd->cmd.reset->trst != last_trst) {
|
||||
if (cmd->cmd.reset->trst)
|
||||
|
|
|
@ -400,7 +400,7 @@ static int aice_usb_write(uint8_t *out_buffer, int out_length)
|
|||
result = usb_bulk_write_ex(aice_handler.usb_handle, aice_handler.usb_write_ep,
|
||||
(char *)out_buffer, out_length, AICE_USB_TIMEOUT);
|
||||
|
||||
DEBUG_JTAG_IO("aice_usb_write, out_length = %i, result = %i",
|
||||
LOG_DEBUG_IO("aice_usb_write, out_length = %i, result = %i",
|
||||
out_length, result);
|
||||
|
||||
return result;
|
||||
|
@ -412,7 +412,7 @@ static int aice_usb_read(uint8_t *in_buffer, int expected_size)
|
|||
int32_t result = usb_bulk_read_ex(aice_handler.usb_handle, aice_handler.usb_read_ep,
|
||||
(char *)in_buffer, expected_size, AICE_USB_TIMEOUT);
|
||||
|
||||
DEBUG_JTAG_IO("aice_usb_read, result = %" PRId32, result);
|
||||
LOG_DEBUG_IO("aice_usb_read, result = %" PRId32, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -193,13 +193,13 @@ int jtag_build_buffer(const struct scan_command *cmd, uint8_t **buffer)
|
|||
|
||||
bit_count = 0;
|
||||
|
||||
DEBUG_JTAG_IO("%s num_fields: %i",
|
||||
LOG_DEBUG_IO("%s num_fields: %i",
|
||||
cmd->ir_scan ? "IRSCAN" : "DRSCAN",
|
||||
cmd->num_fields);
|
||||
|
||||
for (i = 0; i < cmd->num_fields; i++) {
|
||||
if (cmd->fields[i].out_value) {
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO)) {
|
||||
char *char_buf = buf_to_str(cmd->fields[i].out_value,
|
||||
(cmd->fields[i].num_bits > DEBUG_JTAG_IOZ)
|
||||
? DEBUG_JTAG_IOZ
|
||||
|
@ -208,18 +208,18 @@ int jtag_build_buffer(const struct scan_command *cmd, uint8_t **buffer)
|
|||
LOG_DEBUG("fields[%i].out_value[%i]: 0x%s", i,
|
||||
cmd->fields[i].num_bits, char_buf);
|
||||
free(char_buf);
|
||||
#endif
|
||||
}
|
||||
buf_set_buf(cmd->fields[i].out_value, 0, *buffer,
|
||||
bit_count, cmd->fields[i].num_bits);
|
||||
} else {
|
||||
DEBUG_JTAG_IO("fields[%i].out_value[%i]: NULL",
|
||||
LOG_DEBUG_IO("fields[%i].out_value[%i]: NULL",
|
||||
i, cmd->fields[i].num_bits);
|
||||
}
|
||||
|
||||
bit_count += cmd->fields[i].num_bits;
|
||||
}
|
||||
|
||||
/*DEBUG_JTAG_IO("bit_count totalling: %i", bit_count); */
|
||||
/*LOG_DEBUG_IO("bit_count totalling: %i", bit_count); */
|
||||
|
||||
return bit_count;
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ int jtag_read_buffer(uint8_t *buffer, const struct scan_command *cmd)
|
|||
uint8_t *captured = buf_set_buf(buffer, bit_count,
|
||||
malloc(DIV_ROUND_UP(num_bits, 8)), 0, num_bits);
|
||||
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO)) {
|
||||
char *char_buf = buf_to_str(captured,
|
||||
(num_bits > DEBUG_JTAG_IOZ)
|
||||
? DEBUG_JTAG_IOZ
|
||||
|
@ -251,7 +251,7 @@ int jtag_read_buffer(uint8_t *buffer, const struct scan_command *cmd)
|
|||
LOG_DEBUG("fields[%i].in_value[%i]: 0x%s",
|
||||
i, num_bits, char_buf);
|
||||
free(char_buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (cmd->fields[i].in_value)
|
||||
buf_cpy(captured, cmd->fields[i].in_value, num_bits);
|
||||
|
|
|
@ -343,35 +343,27 @@ static int amt_jtagaccel_execute_queue(void)
|
|||
while (cmd) {
|
||||
switch (cmd->type) {
|
||||
case JTAG_RESET:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("reset trst: %i srst %i",
|
||||
LOG_DEBUG_IO("reset trst: %i srst %i",
|
||||
cmd->cmd.reset->trst,
|
||||
cmd->cmd.reset->srst);
|
||||
#endif
|
||||
if (cmd->cmd.reset->trst == 1)
|
||||
tap_set_state(TAP_RESET);
|
||||
amt_jtagaccel_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
||||
break;
|
||||
case JTAG_RUNTEST:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("runtest %i cycles, end in %i",
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %i",
|
||||
cmd->cmd.runtest->num_cycles,
|
||||
cmd->cmd.runtest->end_state);
|
||||
#endif
|
||||
amt_jtagaccel_end_state(cmd->cmd.runtest->end_state);
|
||||
amt_jtagaccel_runtest(cmd->cmd.runtest->num_cycles);
|
||||
break;
|
||||
case JTAG_TLR_RESET:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("statemove end in %i", cmd->cmd.statemove->end_state);
|
||||
#endif
|
||||
LOG_DEBUG_IO("statemove end in %i", cmd->cmd.statemove->end_state);
|
||||
amt_jtagaccel_end_state(cmd->cmd.statemove->end_state);
|
||||
amt_jtagaccel_state_move();
|
||||
break;
|
||||
case JTAG_SCAN:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("scan end in %i", cmd->cmd.scan->end_state);
|
||||
#endif
|
||||
LOG_DEBUG_IO("scan end in %i", cmd->cmd.scan->end_state);
|
||||
amt_jtagaccel_end_state(cmd->cmd.scan->end_state);
|
||||
scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer);
|
||||
type = jtag_scan_type(cmd->cmd.scan);
|
||||
|
@ -382,9 +374,7 @@ static int amt_jtagaccel_execute_queue(void)
|
|||
free(buffer);
|
||||
break;
|
||||
case JTAG_SLEEP:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("sleep %" PRIi32, cmd->cmd.sleep->us);
|
||||
#endif
|
||||
LOG_DEBUG_IO("sleep %" PRIi32, cmd->cmd.sleep->us);
|
||||
jtag_sleep(cmd->cmd.sleep->us);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -106,7 +106,7 @@ static int armjtagew_execute_queue(void)
|
|||
while (cmd != NULL) {
|
||||
switch (cmd->type) {
|
||||
case JTAG_RUNTEST:
|
||||
DEBUG_JTAG_IO("runtest %i cycles, end in %i",
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %i",
|
||||
cmd->cmd.runtest->num_cycles, \
|
||||
cmd->cmd.runtest->end_state);
|
||||
|
||||
|
@ -115,14 +115,14 @@ static int armjtagew_execute_queue(void)
|
|||
break;
|
||||
|
||||
case JTAG_TLR_RESET:
|
||||
DEBUG_JTAG_IO("statemove end in %i", cmd->cmd.statemove->end_state);
|
||||
LOG_DEBUG_IO("statemove end in %i", cmd->cmd.statemove->end_state);
|
||||
|
||||
armjtagew_end_state(cmd->cmd.statemove->end_state);
|
||||
armjtagew_state_move();
|
||||
break;
|
||||
|
||||
case JTAG_PATHMOVE:
|
||||
DEBUG_JTAG_IO("pathmove: %i states, end in %i", \
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %i", \
|
||||
cmd->cmd.pathmove->num_states, \
|
||||
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
|
||||
|
||||
|
@ -131,12 +131,12 @@ static int armjtagew_execute_queue(void)
|
|||
break;
|
||||
|
||||
case JTAG_SCAN:
|
||||
DEBUG_JTAG_IO("scan end in %i", cmd->cmd.scan->end_state);
|
||||
LOG_DEBUG_IO("scan end in %i", cmd->cmd.scan->end_state);
|
||||
|
||||
armjtagew_end_state(cmd->cmd.scan->end_state);
|
||||
|
||||
scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer);
|
||||
DEBUG_JTAG_IO("scan input, length = %d", scan_size);
|
||||
LOG_DEBUG_IO("scan input, length = %d", scan_size);
|
||||
|
||||
#ifdef _DEBUG_USB_COMMS_
|
||||
armjtagew_debug_buffer(buffer, (scan_size + 7) / 8);
|
||||
|
@ -148,7 +148,7 @@ static int armjtagew_execute_queue(void)
|
|||
break;
|
||||
|
||||
case JTAG_RESET:
|
||||
DEBUG_JTAG_IO("reset trst: %i srst %i",
|
||||
LOG_DEBUG_IO("reset trst: %i srst %i",
|
||||
cmd->cmd.reset->trst,
|
||||
cmd->cmd.reset->srst);
|
||||
|
||||
|
@ -160,7 +160,7 @@ static int armjtagew_execute_queue(void)
|
|||
break;
|
||||
|
||||
case JTAG_SLEEP:
|
||||
DEBUG_JTAG_IO("sleep %i", cmd->cmd.sleep->us);
|
||||
LOG_DEBUG_IO("sleep %i", cmd->cmd.sleep->us);
|
||||
armjtagew_tap_execute();
|
||||
jtag_sleep(cmd->cmd.sleep->us);
|
||||
break;
|
||||
|
@ -647,7 +647,7 @@ static int armjtagew_tap_execute(void)
|
|||
/* Copy to buffer */
|
||||
buf_set_buf(tdo_buffer, first, buffer, 0, length);
|
||||
|
||||
DEBUG_JTAG_IO("pending scan result, length = %d", length);
|
||||
LOG_DEBUG_IO("pending scan result, length = %d", length);
|
||||
|
||||
#ifdef _DEBUG_USB_COMMS_
|
||||
armjtagew_debug_buffer(buffer, byte_length);
|
||||
|
@ -747,7 +747,7 @@ static int armjtagew_usb_write(struct armjtagew *armjtagew, int out_length)
|
|||
result = usb_bulk_write(armjtagew->usb_handle, ARMJTAGEW_EPT_BULK_OUT, \
|
||||
(char *)usb_out_buffer, out_length, ARMJTAGEW_USB_TIMEOUT);
|
||||
|
||||
DEBUG_JTAG_IO("armjtagew_usb_write, out_length = %d, result = %d", out_length, result);
|
||||
LOG_DEBUG_IO("armjtagew_usb_write, out_length = %d, result = %d", out_length, result);
|
||||
|
||||
#ifdef _DEBUG_USB_COMMS_
|
||||
armjtagew_debug_buffer(usb_out_buffer, out_length);
|
||||
|
@ -761,7 +761,7 @@ static int armjtagew_usb_read(struct armjtagew *armjtagew, int exp_in_length)
|
|||
int result = usb_bulk_read(armjtagew->usb_handle, ARMJTAGEW_EPT_BULK_IN, \
|
||||
(char *)usb_in_buffer, exp_in_length, ARMJTAGEW_USB_TIMEOUT);
|
||||
|
||||
DEBUG_JTAG_IO("armjtagew_usb_read, result = %d", result);
|
||||
LOG_DEBUG_IO("armjtagew_usb_read, result = %d", result);
|
||||
|
||||
#ifdef _DEBUG_USB_COMMS_
|
||||
armjtagew_debug_buffer(usb_in_buffer, result);
|
||||
|
|
|
@ -100,7 +100,7 @@ static int bitbang_execute_tms(struct jtag_command *cmd)
|
|||
unsigned num_bits = cmd->cmd.tms->num_bits;
|
||||
const uint8_t *bits = cmd->cmd.tms->bits;
|
||||
|
||||
DEBUG_JTAG_IO("TMS: %d bits", num_bits);
|
||||
LOG_DEBUG_IO("TMS: %d bits", num_bits);
|
||||
|
||||
int tms = 0;
|
||||
for (unsigned i = 0; i < num_bits; i++) {
|
||||
|
@ -315,11 +315,9 @@ int bitbang_execute_queue(void)
|
|||
while (cmd) {
|
||||
switch (cmd->type) {
|
||||
case JTAG_RESET:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("reset trst: %i srst %i",
|
||||
LOG_DEBUG_IO("reset trst: %i srst %i",
|
||||
cmd->cmd.reset->trst,
|
||||
cmd->cmd.reset->srst);
|
||||
#endif
|
||||
if ((cmd->cmd.reset->trst == 1) ||
|
||||
(cmd->cmd.reset->srst && (jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
|
||||
tap_set_state(TAP_RESET);
|
||||
|
@ -328,11 +326,9 @@ int bitbang_execute_queue(void)
|
|||
return ERROR_FAIL;
|
||||
break;
|
||||
case JTAG_RUNTEST:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("runtest %i cycles, end in %s",
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %s",
|
||||
cmd->cmd.runtest->num_cycles,
|
||||
tap_state_name(cmd->cmd.runtest->end_state));
|
||||
#endif
|
||||
bitbang_end_state(cmd->cmd.runtest->end_state);
|
||||
if (bitbang_runtest(cmd->cmd.runtest->num_cycles) != ERROR_OK)
|
||||
return ERROR_FAIL;
|
||||
|
@ -347,32 +343,26 @@ int bitbang_execute_queue(void)
|
|||
break;
|
||||
|
||||
case JTAG_TLR_RESET:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("statemove end in %s",
|
||||
LOG_DEBUG_IO("statemove end in %s",
|
||||
tap_state_name(cmd->cmd.statemove->end_state));
|
||||
#endif
|
||||
bitbang_end_state(cmd->cmd.statemove->end_state);
|
||||
if (bitbang_state_move(0) != ERROR_OK)
|
||||
return ERROR_FAIL;
|
||||
break;
|
||||
case JTAG_PATHMOVE:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("pathmove: %i states, end in %s",
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %s",
|
||||
cmd->cmd.pathmove->num_states,
|
||||
tap_state_name(cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]));
|
||||
#endif
|
||||
if (bitbang_path_move(cmd->cmd.pathmove) != ERROR_OK)
|
||||
return ERROR_FAIL;
|
||||
break;
|
||||
case JTAG_SCAN:
|
||||
bitbang_end_state(cmd->cmd.scan->end_state);
|
||||
scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer);
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("%s scan %d bits; end in %s",
|
||||
LOG_DEBUG_IO("%s scan %d bits; end in %s",
|
||||
(cmd->cmd.scan->ir_scan) ? "IR" : "DR",
|
||||
scan_size,
|
||||
tap_state_name(cmd->cmd.scan->end_state));
|
||||
#endif
|
||||
type = jtag_scan_type(cmd->cmd.scan);
|
||||
if (bitbang_scan(cmd->cmd.scan->ir_scan, type, buffer,
|
||||
scan_size) != ERROR_OK)
|
||||
|
@ -383,9 +373,7 @@ int bitbang_execute_queue(void)
|
|||
free(buffer);
|
||||
break;
|
||||
case JTAG_SLEEP:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("sleep %" PRIi32, cmd->cmd.sleep->us);
|
||||
#endif
|
||||
LOG_DEBUG_IO("sleep %" PRIi32, cmd->cmd.sleep->us);
|
||||
jtag_sleep(cmd->cmd.sleep->us);
|
||||
break;
|
||||
case JTAG_TMS:
|
||||
|
|
|
@ -59,9 +59,7 @@ static void bitq_in_proc(void)
|
|||
|
||||
int tdo = bitq_interface->in();
|
||||
if (tdo < 0) {
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("bitq in EOF");
|
||||
#endif
|
||||
LOG_DEBUG_IO("bitq in EOF");
|
||||
return;
|
||||
}
|
||||
if (in_mask == 0x01)
|
||||
|
@ -228,9 +226,7 @@ int bitq_execute_queue(void)
|
|||
while (cmd) {
|
||||
switch (cmd->type) {
|
||||
case JTAG_RESET:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
||||
#endif
|
||||
LOG_DEBUG_IO("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
||||
if ((cmd->cmd.reset->trst == 1) ||
|
||||
(cmd->cmd.reset->srst &&
|
||||
(jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
|
||||
|
@ -241,37 +237,26 @@ int bitq_execute_queue(void)
|
|||
break;
|
||||
|
||||
case JTAG_RUNTEST:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles, cmd->cmd.runtest->end_state);
|
||||
#endif
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles, cmd->cmd.runtest->end_state);
|
||||
bitq_end_state(cmd->cmd.runtest->end_state);
|
||||
bitq_runtest(cmd->cmd.runtest->num_cycles);
|
||||
break;
|
||||
|
||||
case JTAG_TLR_RESET:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("statemove end in %i", cmd->cmd.statemove->end_state);
|
||||
#endif
|
||||
LOG_DEBUG_IO("statemove end in %i", cmd->cmd.statemove->end_state);
|
||||
bitq_end_state(cmd->cmd.statemove->end_state);
|
||||
bitq_state_move(tap_get_end_state()); /* uncoditional TAP move */
|
||||
break;
|
||||
|
||||
case JTAG_PATHMOVE:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("pathmove: %i states, end in %i", cmd->cmd.pathmove->num_states,
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %i", cmd->cmd.pathmove->num_states,
|
||||
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
|
||||
#endif
|
||||
bitq_path_move(cmd->cmd.pathmove);
|
||||
break;
|
||||
|
||||
case JTAG_SCAN:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("scan end in %i", cmd->cmd.scan->end_state);
|
||||
if (cmd->cmd.scan->ir_scan)
|
||||
LOG_DEBUG("scan ir");
|
||||
else
|
||||
LOG_DEBUG("scan dr");
|
||||
#endif
|
||||
LOG_DEBUG_IO("scan end in %i", cmd->cmd.scan->end_state);
|
||||
LOG_DEBUG_IO("scan %s", cmd->cmd.scan->ir_scan ? "ir" : "dr");
|
||||
bitq_end_state(cmd->cmd.scan->end_state);
|
||||
bitq_scan(cmd->cmd.scan);
|
||||
if (tap_get_state() != tap_get_end_state())
|
||||
|
@ -279,9 +264,7 @@ int bitq_execute_queue(void)
|
|||
break;
|
||||
|
||||
case JTAG_SLEEP:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("sleep %i", cmd->cmd.sleep->us);
|
||||
#endif
|
||||
LOG_DEBUG_IO("sleep %i", cmd->cmd.sleep->us);
|
||||
bitq_interface->sleep(cmd->cmd.sleep->us);
|
||||
if (bitq_interface->in_rdy())
|
||||
bitq_in_proc();
|
||||
|
|
|
@ -171,7 +171,7 @@ static int buspirate_execute_queue(void)
|
|||
while (cmd) {
|
||||
switch (cmd->type) {
|
||||
case JTAG_RUNTEST:
|
||||
DEBUG_JTAG_IO("runtest %i cycles, end in %s",
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %s",
|
||||
cmd->cmd.runtest->num_cycles,
|
||||
tap_state_name(cmd->cmd.runtest
|
||||
->end_state));
|
||||
|
@ -181,7 +181,7 @@ static int buspirate_execute_queue(void)
|
|||
->num_cycles);
|
||||
break;
|
||||
case JTAG_TLR_RESET:
|
||||
DEBUG_JTAG_IO("statemove end in %s",
|
||||
LOG_DEBUG_IO("statemove end in %s",
|
||||
tap_state_name(cmd->cmd.statemove
|
||||
->end_state));
|
||||
buspirate_end_state(cmd->cmd.statemove
|
||||
|
@ -189,7 +189,7 @@ static int buspirate_execute_queue(void)
|
|||
buspirate_state_move();
|
||||
break;
|
||||
case JTAG_PATHMOVE:
|
||||
DEBUG_JTAG_IO("pathmove: %i states, end in %s",
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %s",
|
||||
cmd->cmd.pathmove->num_states,
|
||||
tap_state_name(cmd->cmd.pathmove
|
||||
->path[cmd->cmd.pathmove
|
||||
|
@ -199,7 +199,7 @@ static int buspirate_execute_queue(void)
|
|||
cmd->cmd.pathmove->path);
|
||||
break;
|
||||
case JTAG_SCAN:
|
||||
DEBUG_JTAG_IO("scan end in %s",
|
||||
LOG_DEBUG_IO("scan end in %s",
|
||||
tap_state_name(cmd->cmd.scan
|
||||
->end_state));
|
||||
|
||||
|
@ -214,7 +214,7 @@ static int buspirate_execute_queue(void)
|
|||
|
||||
break;
|
||||
case JTAG_RESET:
|
||||
DEBUG_JTAG_IO("reset trst: %i srst %i",
|
||||
LOG_DEBUG_IO("reset trst: %i srst %i",
|
||||
cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
||||
|
||||
/* flush buffers, so we can reset */
|
||||
|
@ -226,12 +226,12 @@ static int buspirate_execute_queue(void)
|
|||
cmd->cmd.reset->srst);
|
||||
break;
|
||||
case JTAG_SLEEP:
|
||||
DEBUG_JTAG_IO("sleep %i", cmd->cmd.sleep->us);
|
||||
LOG_DEBUG_IO("sleep %i", cmd->cmd.sleep->us);
|
||||
buspirate_tap_execute();
|
||||
jtag_sleep(cmd->cmd.sleep->us);
|
||||
break;
|
||||
case JTAG_STABLECLOCKS:
|
||||
DEBUG_JTAG_IO("stable clock %i cycles", cmd->cmd.stableclocks->num_cycles);
|
||||
LOG_DEBUG_IO("stable clock %i cycles", cmd->cmd.stableclocks->num_cycles);
|
||||
buspirate_stableclocks(cmd->cmd.stableclocks->num_cycles);
|
||||
break;
|
||||
default:
|
||||
|
@ -624,7 +624,7 @@ static void buspirate_runtest(int num_cycles)
|
|||
for (i = 0; i < num_cycles; i++)
|
||||
buspirate_tap_append(0, 0);
|
||||
|
||||
DEBUG_JTAG_IO("runtest: cur_state %s end_state %s",
|
||||
LOG_DEBUG_IO("runtest: cur_state %s end_state %s",
|
||||
tap_state_name(tap_get_state()),
|
||||
tap_state_name(tap_get_end_state()));
|
||||
|
||||
|
|
|
@ -1246,7 +1246,7 @@ static void cmsis_dap_flush(void)
|
|||
if (!queued_seq_count)
|
||||
return;
|
||||
|
||||
DEBUG_JTAG_IO("Flushing %d queued sequences (%d bytes) with %d pending scan results to capture",
|
||||
LOG_DEBUG_IO("Flushing %d queued sequences (%d bytes) with %d pending scan results to capture",
|
||||
queued_seq_count, queued_seq_buf_end, pending_scan_result_count);
|
||||
|
||||
/* prep CMSIS-DAP packet */
|
||||
|
@ -1268,7 +1268,7 @@ static void cmsis_dap_flush(void)
|
|||
}
|
||||
|
||||
#ifdef CMSIS_DAP_JTAG_DEBUG
|
||||
DEBUG_JTAG_IO("USB response buf:");
|
||||
LOG_DEBUG_IO("USB response buf:");
|
||||
for (int c = 0; c < queued_seq_buf_end + 3; ++c)
|
||||
printf("%02X ", buffer[c]);
|
||||
printf("\n");
|
||||
|
@ -1277,7 +1277,7 @@ static void cmsis_dap_flush(void)
|
|||
/* copy scan results into client buffers */
|
||||
for (int i = 0; i < pending_scan_result_count; ++i) {
|
||||
struct pending_scan_result *scan = &pending_scan_results[i];
|
||||
DEBUG_JTAG_IO("Copying pending_scan_result %d/%d: %d bits from byte %d -> buffer + %d bits",
|
||||
LOG_DEBUG_IO("Copying pending_scan_result %d/%d: %d bits from byte %d -> buffer + %d bits",
|
||||
i, pending_scan_result_count, scan->length, scan->first + 2, scan->buffer_offset);
|
||||
#ifdef CMSIS_DAP_JTAG_DEBUG
|
||||
for (uint32_t b = 0; b < DIV_ROUND_UP(scan->length, 8); ++b)
|
||||
|
@ -1302,7 +1302,7 @@ static void cmsis_dap_flush(void)
|
|||
static void cmsis_dap_add_jtag_sequence(int s_len, const uint8_t *sequence, int s_offset,
|
||||
bool tms, uint8_t *tdo_buffer, int tdo_buffer_offset)
|
||||
{
|
||||
DEBUG_JTAG_IO("[at %d] %d bits, tms %s, seq offset %d, tdo buf %p, tdo offset %d",
|
||||
LOG_DEBUG_IO("[at %d] %d bits, tms %s, seq offset %d, tdo buf %p, tdo offset %d",
|
||||
queued_seq_buf_end,
|
||||
s_len, tms ? "HIGH" : "LOW", s_offset, tdo_buffer, tdo_buffer_offset);
|
||||
|
||||
|
@ -1310,12 +1310,12 @@ static void cmsis_dap_add_jtag_sequence(int s_len, const uint8_t *sequence, int
|
|||
return;
|
||||
|
||||
if (s_len > 64) {
|
||||
DEBUG_JTAG_IO("START JTAG SEQ SPLIT");
|
||||
LOG_DEBUG_IO("START JTAG SEQ SPLIT");
|
||||
for (int offset = 0; offset < s_len; offset += 64) {
|
||||
int len = s_len - offset;
|
||||
if (len > 64)
|
||||
len = 64;
|
||||
DEBUG_JTAG_IO("Splitting long jtag sequence: %d-bit chunk starting at offset %d", len, offset);
|
||||
LOG_DEBUG_IO("Splitting long jtag sequence: %d-bit chunk starting at offset %d", len, offset);
|
||||
cmsis_dap_add_jtag_sequence(
|
||||
len,
|
||||
sequence,
|
||||
|
@ -1325,7 +1325,7 @@ static void cmsis_dap_add_jtag_sequence(int s_len, const uint8_t *sequence, int
|
|||
tdo_buffer == NULL ? 0 : (tdo_buffer_offset + offset)
|
||||
);
|
||||
}
|
||||
DEBUG_JTAG_IO("END JTAG SEQ SPLIT");
|
||||
LOG_DEBUG_IO("END JTAG SEQ SPLIT");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1362,7 +1362,7 @@ static void cmsis_dap_add_jtag_sequence(int s_len, const uint8_t *sequence, int
|
|||
/* queue a sequence of bits to clock out TMS, executing if the buffer is full */
|
||||
static void cmsis_dap_add_tms_sequence(const uint8_t *sequence, int s_len)
|
||||
{
|
||||
DEBUG_JTAG_IO("%d bits: %02X", s_len, *sequence);
|
||||
LOG_DEBUG_IO("%d bits: %02X", s_len, *sequence);
|
||||
/* we use a series of CMD_DAP_JTAG_SEQ commands to toggle TMS,
|
||||
because even though it seems ridiculously inefficient, it
|
||||
allows us to combine TMS and scan sequences into the same
|
||||
|
@ -1383,7 +1383,7 @@ static void cmsis_dap_state_move(void)
|
|||
tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state());
|
||||
tms_scan_bits = tap_get_tms_path_len(tap_get_state(), tap_get_end_state());
|
||||
|
||||
DEBUG_JTAG_IO("state move from %s to %s: %d clocks, %02X on tms",
|
||||
LOG_DEBUG_IO("state move from %s to %s: %d clocks, %02X on tms",
|
||||
tap_state_name(tap_get_state()), tap_state_name(tap_get_end_state()),
|
||||
tms_scan_bits, tms_scan);
|
||||
cmsis_dap_add_tms_sequence(&tms_scan, tms_scan_bits);
|
||||
|
@ -1395,7 +1395,7 @@ static void cmsis_dap_state_move(void)
|
|||
/* Execute a JTAG scan operation by queueing TMS and TDI/TDO sequences */
|
||||
static void cmsis_dap_execute_scan(struct jtag_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("%s type:%d", cmd->cmd.scan->ir_scan ? "IRSCAN" : "DRSCAN",
|
||||
LOG_DEBUG_IO("%s type:%d", cmd->cmd.scan->ir_scan ? "IRSCAN" : "DRSCAN",
|
||||
jtag_scan_type(cmd->cmd.scan));
|
||||
|
||||
/* Make sure there are no trailing fields with num_bits == 0, or the logic below will fail. */
|
||||
|
@ -1429,7 +1429,7 @@ static void cmsis_dap_execute_scan(struct jtag_command *cmd)
|
|||
|
||||
for (int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
|
||||
scan_size += field->num_bits;
|
||||
DEBUG_JTAG_IO("%s%s field %d/%d %d bits",
|
||||
LOG_DEBUG_IO("%s%s field %d/%d %d bits",
|
||||
field->in_value ? "in" : "",
|
||||
field->out_value ? "out" : "",
|
||||
i,
|
||||
|
@ -1437,7 +1437,7 @@ static void cmsis_dap_execute_scan(struct jtag_command *cmd)
|
|||
field->num_bits);
|
||||
|
||||
if (i == cmd->cmd.scan->num_fields - 1 && tap_get_state() != tap_get_end_state()) {
|
||||
DEBUG_JTAG_IO("Last field and have to move out of SHIFT state");
|
||||
LOG_DEBUG_IO("Last field and have to move out of SHIFT state");
|
||||
/* Last field, and we're leaving IRSHIFT/DRSHIFT. Clock last bit during tap
|
||||
* movement. This last field can't have length zero, it was checked above. */
|
||||
cmsis_dap_add_jtag_sequence(
|
||||
|
@ -1471,7 +1471,7 @@ static void cmsis_dap_execute_scan(struct jtag_command *cmd)
|
|||
0);
|
||||
tap_set_state(tap_state_transition(tap_get_state(), 0));
|
||||
} else {
|
||||
DEBUG_JTAG_IO("Internal field, staying in SHIFT state afterwards");
|
||||
LOG_DEBUG_IO("Internal field, staying in SHIFT state afterwards");
|
||||
/* Clocking part of a sequence into DR or IR with TMS=0,
|
||||
leaving TMS=0 at the end so we can continue later */
|
||||
cmsis_dap_add_jtag_sequence(
|
||||
|
@ -1489,7 +1489,7 @@ static void cmsis_dap_execute_scan(struct jtag_command *cmd)
|
|||
cmsis_dap_state_move();
|
||||
}
|
||||
|
||||
DEBUG_JTAG_IO("%s scan, %i bits, end in %s",
|
||||
LOG_DEBUG_IO("%s scan, %i bits, end in %s",
|
||||
(cmd->cmd.scan->ir_scan) ? "IR" : "DR", scan_size,
|
||||
tap_state_name(tap_get_end_state()));
|
||||
}
|
||||
|
@ -1519,7 +1519,7 @@ static void cmsis_dap_pathmove(int num_states, tap_state_t *path)
|
|||
|
||||
static void cmsis_dap_execute_pathmove(struct jtag_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("pathmove: %i states, end in %i",
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %i",
|
||||
cmd->cmd.pathmove->num_states,
|
||||
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
|
||||
|
||||
|
@ -1557,7 +1557,7 @@ static void cmsis_dap_runtest(int num_cycles)
|
|||
|
||||
static void cmsis_dap_execute_runtest(struct jtag_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles,
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles,
|
||||
cmd->cmd.runtest->end_state);
|
||||
|
||||
cmsis_dap_end_state(cmd->cmd.runtest->end_state);
|
||||
|
@ -1566,13 +1566,13 @@ static void cmsis_dap_execute_runtest(struct jtag_command *cmd)
|
|||
|
||||
static void cmsis_dap_execute_stableclocks(struct jtag_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("stableclocks %i cycles", cmd->cmd.runtest->num_cycles);
|
||||
LOG_DEBUG_IO("stableclocks %i cycles", cmd->cmd.runtest->num_cycles);
|
||||
cmsis_dap_stableclocks(cmd->cmd.runtest->num_cycles);
|
||||
}
|
||||
|
||||
static void cmsis_dap_execute_tms(struct jtag_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("TMS: %d bits", cmd->cmd.tms->num_bits);
|
||||
LOG_DEBUG_IO("TMS: %d bits", cmd->cmd.tms->num_bits);
|
||||
cmsis_dap_cmd_DAP_SWJ_Sequence(cmd->cmd.tms->num_bits, cmd->cmd.tms->bits);
|
||||
}
|
||||
|
||||
|
|
|
@ -675,7 +675,7 @@ static int syncbb_execute_tms(struct jtag_command *cmd)
|
|||
unsigned num_bits = cmd->cmd.tms->num_bits;
|
||||
const uint8_t *bits = cmd->cmd.tms->bits;
|
||||
|
||||
DEBUG_JTAG_IO("TMS: %d bits", num_bits);
|
||||
LOG_DEBUG_IO("TMS: %d bits", num_bits);
|
||||
|
||||
int tms = 0;
|
||||
for (unsigned i = 0; i < num_bits; i++) {
|
||||
|
|
|
@ -262,7 +262,7 @@ static void move_to_state(tap_state_t goal_state)
|
|||
int tms_count = tap_get_tms_path_len(start_state, goal_state);
|
||||
assert(tms_count <= 8);
|
||||
|
||||
DEBUG_JTAG_IO("start=%s goal=%s", tap_state_name(start_state), tap_state_name(goal_state));
|
||||
LOG_DEBUG_IO("start=%s goal=%s", tap_state_name(start_state), tap_state_name(goal_state));
|
||||
|
||||
/* Track state transitions step by step */
|
||||
for (int i = 0; i < tms_count; i++)
|
||||
|
@ -324,7 +324,7 @@ static void ftdi_execute_runtest(struct jtag_command *cmd)
|
|||
int i;
|
||||
uint8_t zero = 0;
|
||||
|
||||
DEBUG_JTAG_IO("runtest %i cycles, end in %s",
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %s",
|
||||
cmd->cmd.runtest->num_cycles,
|
||||
tap_state_name(cmd->cmd.runtest->end_state));
|
||||
|
||||
|
@ -345,14 +345,14 @@ static void ftdi_execute_runtest(struct jtag_command *cmd)
|
|||
if (tap_get_state() != tap_get_end_state())
|
||||
move_to_state(tap_get_end_state());
|
||||
|
||||
DEBUG_JTAG_IO("runtest: %i, end in %s",
|
||||
LOG_DEBUG_IO("runtest: %i, end in %s",
|
||||
cmd->cmd.runtest->num_cycles,
|
||||
tap_state_name(tap_get_end_state()));
|
||||
}
|
||||
|
||||
static void ftdi_execute_statemove(struct jtag_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("statemove end in %s",
|
||||
LOG_DEBUG_IO("statemove end in %s",
|
||||
tap_state_name(cmd->cmd.statemove->end_state));
|
||||
|
||||
ftdi_end_state(cmd->cmd.statemove->end_state);
|
||||
|
@ -368,7 +368,7 @@ static void ftdi_execute_statemove(struct jtag_command *cmd)
|
|||
*/
|
||||
static void ftdi_execute_tms(struct jtag_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("TMS: %d bits", cmd->cmd.tms->num_bits);
|
||||
LOG_DEBUG_IO("TMS: %d bits", cmd->cmd.tms->num_bits);
|
||||
|
||||
/* TODO: Missing tap state tracking, also missing from ft2232.c! */
|
||||
mpsse_clock_tms_cs_out(mpsse_ctx,
|
||||
|
@ -384,7 +384,7 @@ static void ftdi_execute_pathmove(struct jtag_command *cmd)
|
|||
tap_state_t *path = cmd->cmd.pathmove->path;
|
||||
int num_states = cmd->cmd.pathmove->num_states;
|
||||
|
||||
DEBUG_JTAG_IO("pathmove: %i states, current: %s end: %s", num_states,
|
||||
LOG_DEBUG_IO("pathmove: %i states, current: %s end: %s", num_states,
|
||||
tap_state_name(tap_get_state()),
|
||||
tap_state_name(path[num_states-1]));
|
||||
|
||||
|
@ -392,7 +392,7 @@ static void ftdi_execute_pathmove(struct jtag_command *cmd)
|
|||
unsigned bit_count = 0;
|
||||
uint8_t tms_byte = 0;
|
||||
|
||||
DEBUG_JTAG_IO("-");
|
||||
LOG_DEBUG_IO("-");
|
||||
|
||||
/* this loop verifies that the path is legal and logs each state in the path */
|
||||
while (num_states--) {
|
||||
|
@ -432,18 +432,18 @@ static void ftdi_execute_pathmove(struct jtag_command *cmd)
|
|||
|
||||
static void ftdi_execute_scan(struct jtag_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("%s type:%d", cmd->cmd.scan->ir_scan ? "IRSCAN" : "DRSCAN",
|
||||
LOG_DEBUG_IO("%s type:%d", cmd->cmd.scan->ir_scan ? "IRSCAN" : "DRSCAN",
|
||||
jtag_scan_type(cmd->cmd.scan));
|
||||
|
||||
/* Make sure there are no trailing fields with num_bits == 0, or the logic below will fail. */
|
||||
while (cmd->cmd.scan->num_fields > 0
|
||||
&& cmd->cmd.scan->fields[cmd->cmd.scan->num_fields - 1].num_bits == 0) {
|
||||
cmd->cmd.scan->num_fields--;
|
||||
DEBUG_JTAG_IO("discarding trailing empty field");
|
||||
LOG_DEBUG_IO("discarding trailing empty field");
|
||||
}
|
||||
|
||||
if (cmd->cmd.scan->num_fields == 0) {
|
||||
DEBUG_JTAG_IO("empty scan, doing nothing");
|
||||
LOG_DEBUG_IO("empty scan, doing nothing");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -462,7 +462,7 @@ static void ftdi_execute_scan(struct jtag_command *cmd)
|
|||
|
||||
for (int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
|
||||
scan_size += field->num_bits;
|
||||
DEBUG_JTAG_IO("%s%s field %d/%d %d bits",
|
||||
LOG_DEBUG_IO("%s%s field %d/%d %d bits",
|
||||
field->in_value ? "in" : "",
|
||||
field->out_value ? "out" : "",
|
||||
i,
|
||||
|
@ -512,14 +512,14 @@ static void ftdi_execute_scan(struct jtag_command *cmd)
|
|||
if (tap_get_state() != tap_get_end_state())
|
||||
move_to_state(tap_get_end_state());
|
||||
|
||||
DEBUG_JTAG_IO("%s scan, %i bits, end in %s",
|
||||
LOG_DEBUG_IO("%s scan, %i bits, end in %s",
|
||||
(cmd->cmd.scan->ir_scan) ? "IR" : "DR", scan_size,
|
||||
tap_state_name(tap_get_end_state()));
|
||||
}
|
||||
|
||||
static void ftdi_execute_reset(struct jtag_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("reset trst: %i srst %i",
|
||||
LOG_DEBUG_IO("reset trst: %i srst %i",
|
||||
cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
||||
|
||||
if (cmd->cmd.reset->trst == 1
|
||||
|
@ -555,17 +555,17 @@ static void ftdi_execute_reset(struct jtag_command *cmd)
|
|||
ftdi_set_signal(srst, 'z');
|
||||
}
|
||||
|
||||
DEBUG_JTAG_IO("trst: %i, srst: %i",
|
||||
LOG_DEBUG_IO("trst: %i, srst: %i",
|
||||
cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
||||
}
|
||||
|
||||
static void ftdi_execute_sleep(struct jtag_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("sleep %" PRIi32, cmd->cmd.sleep->us);
|
||||
LOG_DEBUG_IO("sleep %" PRIi32, cmd->cmd.sleep->us);
|
||||
|
||||
mpsse_flush(mpsse_ctx);
|
||||
jtag_sleep(cmd->cmd.sleep->us);
|
||||
DEBUG_JTAG_IO("sleep %" PRIi32 " usec while in %s",
|
||||
LOG_DEBUG_IO("sleep %" PRIi32 " usec while in %s",
|
||||
cmd->cmd.sleep->us,
|
||||
tap_state_name(tap_get_state()));
|
||||
}
|
||||
|
@ -589,7 +589,7 @@ static void ftdi_execute_stableclocks(struct jtag_command *cmd)
|
|||
num_cycles -= this_len;
|
||||
}
|
||||
|
||||
DEBUG_JTAG_IO("clocks %i while in %s",
|
||||
LOG_DEBUG_IO("clocks %i while in %s",
|
||||
cmd->cmd.stableclocks->num_cycles,
|
||||
tap_state_name(tap_get_state()));
|
||||
}
|
||||
|
|
|
@ -297,43 +297,33 @@ static int gw16012_execute_queue(void)
|
|||
while (cmd) {
|
||||
switch (cmd->type) {
|
||||
case JTAG_RESET:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
||||
#endif
|
||||
LOG_DEBUG_IO("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
||||
if (cmd->cmd.reset->trst == 1)
|
||||
tap_set_state(TAP_RESET);
|
||||
gw16012_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
||||
break;
|
||||
case JTAG_RUNTEST:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles,
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles,
|
||||
cmd->cmd.runtest->end_state);
|
||||
#endif
|
||||
gw16012_end_state(cmd->cmd.runtest->end_state);
|
||||
gw16012_runtest(cmd->cmd.runtest->num_cycles);
|
||||
break;
|
||||
case JTAG_TLR_RESET:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("statemove end in %i", cmd->cmd.statemove->end_state);
|
||||
#endif
|
||||
LOG_DEBUG_IO("statemove end in %i", cmd->cmd.statemove->end_state);
|
||||
gw16012_end_state(cmd->cmd.statemove->end_state);
|
||||
gw16012_state_move();
|
||||
break;
|
||||
case JTAG_PATHMOVE:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("pathmove: %i states, end in %i", cmd->cmd.pathmove->num_states,
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %i", cmd->cmd.pathmove->num_states,
|
||||
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
|
||||
#endif
|
||||
gw16012_path_move(cmd->cmd.pathmove);
|
||||
break;
|
||||
case JTAG_SCAN:
|
||||
gw16012_end_state(cmd->cmd.scan->end_state);
|
||||
scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer);
|
||||
type = jtag_scan_type(cmd->cmd.scan);
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("%s scan (%i) %i bit end in %i", (cmd->cmd.scan->ir_scan) ? "ir" : "dr",
|
||||
LOG_DEBUG_IO("%s scan (%i) %i bit end in %i", (cmd->cmd.scan->ir_scan) ? "ir" : "dr",
|
||||
type, scan_size, cmd->cmd.scan->end_state);
|
||||
#endif
|
||||
gw16012_scan(cmd->cmd.scan->ir_scan, type, buffer, scan_size);
|
||||
if (jtag_read_buffer(buffer, cmd->cmd.scan) != ERROR_OK)
|
||||
retval = ERROR_JTAG_QUEUE_FAILED;
|
||||
|
@ -341,9 +331,7 @@ static int gw16012_execute_queue(void)
|
|||
free(buffer);
|
||||
break;
|
||||
case JTAG_SLEEP:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("sleep %i", cmd->cmd.sleep->us);
|
||||
#endif
|
||||
LOG_DEBUG_IO("sleep %i", cmd->cmd.sleep->us);
|
||||
jtag_sleep(cmd->cmd.sleep->us);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -124,13 +124,13 @@ static int queued_retval;
|
|||
|
||||
static void jlink_execute_stableclocks(struct jtag_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("stableclocks %i cycles", cmd->cmd.runtest->num_cycles);
|
||||
LOG_DEBUG_IO("stableclocks %i cycles", cmd->cmd.runtest->num_cycles);
|
||||
jlink_stableclocks(cmd->cmd.runtest->num_cycles);
|
||||
}
|
||||
|
||||
static void jlink_execute_runtest(struct jtag_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles,
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles,
|
||||
cmd->cmd.runtest->end_state);
|
||||
|
||||
jlink_end_state(cmd->cmd.runtest->end_state);
|
||||
|
@ -139,7 +139,7 @@ static void jlink_execute_runtest(struct jtag_command *cmd)
|
|||
|
||||
static void jlink_execute_statemove(struct jtag_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("statemove end in %i", cmd->cmd.statemove->end_state);
|
||||
LOG_DEBUG_IO("statemove end in %i", cmd->cmd.statemove->end_state);
|
||||
|
||||
jlink_end_state(cmd->cmd.statemove->end_state);
|
||||
jlink_state_move();
|
||||
|
@ -147,7 +147,7 @@ static void jlink_execute_statemove(struct jtag_command *cmd)
|
|||
|
||||
static void jlink_execute_pathmove(struct jtag_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("pathmove: %i states, end in %i",
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %i",
|
||||
cmd->cmd.pathmove->num_states,
|
||||
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
|
||||
|
||||
|
@ -156,7 +156,7 @@ static void jlink_execute_pathmove(struct jtag_command *cmd)
|
|||
|
||||
static void jlink_execute_scan(struct jtag_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("%s type:%d", cmd->cmd.scan->ir_scan ? "IRSCAN" : "DRSCAN",
|
||||
LOG_DEBUG_IO("%s type:%d", cmd->cmd.scan->ir_scan ? "IRSCAN" : "DRSCAN",
|
||||
jtag_scan_type(cmd->cmd.scan));
|
||||
|
||||
/* Make sure there are no trailing fields with num_bits == 0, or the logic below will fail. */
|
||||
|
@ -190,7 +190,7 @@ static void jlink_execute_scan(struct jtag_command *cmd)
|
|||
|
||||
for (int i = 0; i < cmd->cmd.scan->num_fields; i++, field++) {
|
||||
scan_size += field->num_bits;
|
||||
DEBUG_JTAG_IO("%s%s field %d/%d %d bits",
|
||||
LOG_DEBUG_IO("%s%s field %d/%d %d bits",
|
||||
field->in_value ? "in" : "",
|
||||
field->out_value ? "out" : "",
|
||||
i,
|
||||
|
@ -242,14 +242,14 @@ static void jlink_execute_scan(struct jtag_command *cmd)
|
|||
jlink_state_move();
|
||||
}
|
||||
|
||||
DEBUG_JTAG_IO("%s scan, %i bits, end in %s",
|
||||
LOG_DEBUG_IO("%s scan, %i bits, end in %s",
|
||||
(cmd->cmd.scan->ir_scan) ? "IR" : "DR", scan_size,
|
||||
tap_state_name(tap_get_end_state()));
|
||||
}
|
||||
|
||||
static void jlink_execute_reset(struct jtag_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("reset trst: %i srst %i", cmd->cmd.reset->trst,
|
||||
LOG_DEBUG_IO("reset trst: %i srst %i", cmd->cmd.reset->trst,
|
||||
cmd->cmd.reset->srst);
|
||||
|
||||
jlink_flush();
|
||||
|
@ -259,7 +259,7 @@ static void jlink_execute_reset(struct jtag_command *cmd)
|
|||
|
||||
static void jlink_execute_sleep(struct jtag_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("sleep %" PRIi32 "", cmd->cmd.sleep->us);
|
||||
LOG_DEBUG_IO("sleep %" PRIi32 "", cmd->cmd.sleep->us);
|
||||
jlink_flush();
|
||||
jtag_sleep(cmd->cmd.sleep->us);
|
||||
}
|
||||
|
@ -2038,7 +2038,7 @@ static int jlink_flush(void)
|
|||
buf_set_buf(tdo_buffer, p->first, p->buffer,
|
||||
p->buffer_offset, p->length);
|
||||
|
||||
DEBUG_JTAG_IO("Pending scan result, length = %d.", p->length);
|
||||
LOG_DEBUG_IO("Pending scan result, length = %d.", p->length);
|
||||
}
|
||||
|
||||
jlink_tap_init();
|
||||
|
|
|
@ -29,26 +29,22 @@
|
|||
#define LIBUSB_CALL
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
#define DEBUG_IO(expr...) LOG_DEBUG(expr)
|
||||
#define DEBUG_PRINT_BUF(buf, len) \
|
||||
do { \
|
||||
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO)) { \
|
||||
char buf_string[32 * 3 + 1]; \
|
||||
int buf_string_pos = 0; \
|
||||
for (int i = 0; i < len; i++) { \
|
||||
buf_string_pos += sprintf(buf_string + buf_string_pos, " %02x", buf[i]); \
|
||||
if (i % 32 == 32 - 1) { \
|
||||
LOG_DEBUG("%s", buf_string); \
|
||||
LOG_DEBUG_IO("%s", buf_string); \
|
||||
buf_string_pos = 0; \
|
||||
} \
|
||||
} \
|
||||
if (buf_string_pos > 0) \
|
||||
LOG_DEBUG("%s", buf_string);\
|
||||
LOG_DEBUG_IO("%s", buf_string);\
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
#define DEBUG_IO(expr...) do {} while (0)
|
||||
#define DEBUG_PRINT_BUF(buf, len) do {} while (0)
|
||||
#endif
|
||||
|
||||
#define FTDI_DEVICE_OUT_REQTYPE (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE)
|
||||
#define FTDI_DEVICE_IN_REQTYPE (0x80 | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE)
|
||||
|
@ -458,7 +454,7 @@ static unsigned buffer_read_space(struct mpsse_ctx *ctx)
|
|||
|
||||
static void buffer_write_byte(struct mpsse_ctx *ctx, uint8_t data)
|
||||
{
|
||||
DEBUG_IO("%02x", data);
|
||||
LOG_DEBUG_IO("%02x", data);
|
||||
assert(ctx->write_count < ctx->write_size);
|
||||
ctx->write_buffer[ctx->write_count++] = data;
|
||||
}
|
||||
|
@ -466,7 +462,7 @@ static void buffer_write_byte(struct mpsse_ctx *ctx, uint8_t data)
|
|||
static unsigned buffer_write(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset,
|
||||
unsigned bit_count)
|
||||
{
|
||||
DEBUG_IO("%d bits", bit_count);
|
||||
LOG_DEBUG_IO("%d bits", bit_count);
|
||||
assert(ctx->write_count + DIV_ROUND_UP(bit_count, 8) <= ctx->write_size);
|
||||
bit_copy(ctx->write_buffer + ctx->write_count, 0, out, out_offset, bit_count);
|
||||
ctx->write_count += DIV_ROUND_UP(bit_count, 8);
|
||||
|
@ -476,7 +472,7 @@ static unsigned buffer_write(struct mpsse_ctx *ctx, const uint8_t *out, unsigned
|
|||
static unsigned buffer_add_read(struct mpsse_ctx *ctx, uint8_t *in, unsigned in_offset,
|
||||
unsigned bit_count, unsigned offset)
|
||||
{
|
||||
DEBUG_IO("%d bits, offset %d", bit_count, offset);
|
||||
LOG_DEBUG_IO("%d bits, offset %d", bit_count, offset);
|
||||
assert(ctx->read_count + DIV_ROUND_UP(bit_count, 8) <= ctx->read_size);
|
||||
bit_copy_queued(&ctx->read_queue, in, in_offset, ctx->read_buffer + ctx->read_count, offset,
|
||||
bit_count);
|
||||
|
@ -500,10 +496,10 @@ void mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_of
|
|||
unsigned in_offset, unsigned length, uint8_t mode)
|
||||
{
|
||||
/* TODO: Fix MSB first modes */
|
||||
DEBUG_IO("%s%s %d bits", in ? "in" : "", out ? "out" : "", length);
|
||||
LOG_DEBUG_IO("%s%s %d bits", in ? "in" : "", out ? "out" : "", length);
|
||||
|
||||
if (ctx->retval != ERROR_OK) {
|
||||
DEBUG_IO("Ignoring command due to previous error");
|
||||
LOG_DEBUG_IO("Ignoring command due to previous error");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -576,11 +572,11 @@ void mpsse_clock_tms_cs_out(struct mpsse_ctx *ctx, const uint8_t *out, unsigned
|
|||
void mpsse_clock_tms_cs(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_offset, uint8_t *in,
|
||||
unsigned in_offset, unsigned length, bool tdi, uint8_t mode)
|
||||
{
|
||||
DEBUG_IO("%sout %d bits, tdi=%d", in ? "in" : "", length, tdi);
|
||||
LOG_DEBUG_IO("%sout %d bits, tdi=%d", in ? "in" : "", length, tdi);
|
||||
assert(out);
|
||||
|
||||
if (ctx->retval != ERROR_OK) {
|
||||
DEBUG_IO("Ignoring command due to previous error");
|
||||
LOG_DEBUG_IO("Ignoring command due to previous error");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -626,10 +622,10 @@ void mpsse_clock_tms_cs(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_
|
|||
|
||||
void mpsse_set_data_bits_low_byte(struct mpsse_ctx *ctx, uint8_t data, uint8_t dir)
|
||||
{
|
||||
DEBUG_IO("-");
|
||||
LOG_DEBUG_IO("-");
|
||||
|
||||
if (ctx->retval != ERROR_OK) {
|
||||
DEBUG_IO("Ignoring command due to previous error");
|
||||
LOG_DEBUG_IO("Ignoring command due to previous error");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -643,10 +639,10 @@ void mpsse_set_data_bits_low_byte(struct mpsse_ctx *ctx, uint8_t data, uint8_t d
|
|||
|
||||
void mpsse_set_data_bits_high_byte(struct mpsse_ctx *ctx, uint8_t data, uint8_t dir)
|
||||
{
|
||||
DEBUG_IO("-");
|
||||
LOG_DEBUG_IO("-");
|
||||
|
||||
if (ctx->retval != ERROR_OK) {
|
||||
DEBUG_IO("Ignoring command due to previous error");
|
||||
LOG_DEBUG_IO("Ignoring command due to previous error");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -660,10 +656,10 @@ void mpsse_set_data_bits_high_byte(struct mpsse_ctx *ctx, uint8_t data, uint8_t
|
|||
|
||||
void mpsse_read_data_bits_low_byte(struct mpsse_ctx *ctx, uint8_t *data)
|
||||
{
|
||||
DEBUG_IO("-");
|
||||
LOG_DEBUG_IO("-");
|
||||
|
||||
if (ctx->retval != ERROR_OK) {
|
||||
DEBUG_IO("Ignoring command due to previous error");
|
||||
LOG_DEBUG_IO("Ignoring command due to previous error");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -676,10 +672,10 @@ void mpsse_read_data_bits_low_byte(struct mpsse_ctx *ctx, uint8_t *data)
|
|||
|
||||
void mpsse_read_data_bits_high_byte(struct mpsse_ctx *ctx, uint8_t *data)
|
||||
{
|
||||
DEBUG_IO("-");
|
||||
LOG_DEBUG_IO("-");
|
||||
|
||||
if (ctx->retval != ERROR_OK) {
|
||||
DEBUG_IO("Ignoring command due to previous error");
|
||||
LOG_DEBUG_IO("Ignoring command due to previous error");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -694,7 +690,7 @@ static void single_byte_boolean_helper(struct mpsse_ctx *ctx, bool var, uint8_t
|
|||
uint8_t val_if_false)
|
||||
{
|
||||
if (ctx->retval != ERROR_OK) {
|
||||
DEBUG_IO("Ignoring command due to previous error");
|
||||
LOG_DEBUG_IO("Ignoring command due to previous error");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -715,7 +711,7 @@ void mpsse_set_divisor(struct mpsse_ctx *ctx, uint16_t divisor)
|
|||
LOG_DEBUG("%d", divisor);
|
||||
|
||||
if (ctx->retval != ERROR_OK) {
|
||||
DEBUG_IO("Ignoring command due to previous error");
|
||||
LOG_DEBUG_IO("Ignoring command due to previous error");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -817,7 +813,7 @@ static LIBUSB_CALL void read_cb(struct libusb_transfer *transfer)
|
|||
}
|
||||
}
|
||||
|
||||
DEBUG_IO("raw chunk %d, transferred %d of %d", transfer->actual_length, res->transferred,
|
||||
LOG_DEBUG_IO("raw chunk %d, transferred %d of %d", transfer->actual_length, res->transferred,
|
||||
ctx->read_count);
|
||||
|
||||
if (!res->done)
|
||||
|
@ -832,7 +828,7 @@ static LIBUSB_CALL void write_cb(struct libusb_transfer *transfer)
|
|||
|
||||
res->transferred += transfer->actual_length;
|
||||
|
||||
DEBUG_IO("transferred %d of %d", res->transferred, ctx->write_count);
|
||||
LOG_DEBUG_IO("transferred %d of %d", res->transferred, ctx->write_count);
|
||||
|
||||
DEBUG_PRINT_BUF(transfer->buffer, transfer->actual_length);
|
||||
|
||||
|
@ -851,13 +847,13 @@ int mpsse_flush(struct mpsse_ctx *ctx)
|
|||
int retval = ctx->retval;
|
||||
|
||||
if (retval != ERROR_OK) {
|
||||
DEBUG_IO("Ignoring flush due to previous error");
|
||||
LOG_DEBUG_IO("Ignoring flush due to previous error");
|
||||
assert(ctx->write_count == 0 && ctx->read_count == 0);
|
||||
ctx->retval = ERROR_OK;
|
||||
return retval;
|
||||
}
|
||||
|
||||
DEBUG_IO("write %d%s, read %d", ctx->write_count, ctx->read_count ? "+1" : "",
|
||||
LOG_DEBUG_IO("write %d%s, read %d", ctx->write_count, ctx->read_count ? "+1" : "",
|
||||
ctx->read_count);
|
||||
assert(ctx->write_count > 0 || ctx->read_count == 0); /* No read data without write data */
|
||||
|
||||
|
|
|
@ -252,7 +252,7 @@ static int opendous_execute_queue(void)
|
|||
while (cmd != NULL) {
|
||||
switch (cmd->type) {
|
||||
case JTAG_RUNTEST:
|
||||
DEBUG_JTAG_IO("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles, \
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles, \
|
||||
cmd->cmd.runtest->end_state);
|
||||
|
||||
if (cmd->cmd.runtest->end_state != -1)
|
||||
|
@ -261,7 +261,7 @@ static int opendous_execute_queue(void)
|
|||
break;
|
||||
|
||||
case JTAG_TLR_RESET:
|
||||
DEBUG_JTAG_IO("statemove end in %i", cmd->cmd.statemove->end_state);
|
||||
LOG_DEBUG_IO("statemove end in %i", cmd->cmd.statemove->end_state);
|
||||
|
||||
if (cmd->cmd.statemove->end_state != -1)
|
||||
opendous_end_state(cmd->cmd.statemove->end_state);
|
||||
|
@ -269,7 +269,7 @@ static int opendous_execute_queue(void)
|
|||
break;
|
||||
|
||||
case JTAG_PATHMOVE:
|
||||
DEBUG_JTAG_IO("pathmove: %i states, end in %i", \
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %i", \
|
||||
cmd->cmd.pathmove->num_states, \
|
||||
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
|
||||
|
||||
|
@ -277,13 +277,13 @@ static int opendous_execute_queue(void)
|
|||
break;
|
||||
|
||||
case JTAG_SCAN:
|
||||
DEBUG_JTAG_IO("scan end in %i", cmd->cmd.scan->end_state);
|
||||
LOG_DEBUG_IO("scan end in %i", cmd->cmd.scan->end_state);
|
||||
|
||||
if (cmd->cmd.scan->end_state != -1)
|
||||
opendous_end_state(cmd->cmd.scan->end_state);
|
||||
|
||||
scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer);
|
||||
DEBUG_JTAG_IO("scan input, length = %d", scan_size);
|
||||
LOG_DEBUG_IO("scan input, length = %d", scan_size);
|
||||
|
||||
#ifdef _DEBUG_USB_COMMS_
|
||||
opendous_debug_buffer(buffer, (scan_size + 7) / 8);
|
||||
|
@ -293,7 +293,7 @@ static int opendous_execute_queue(void)
|
|||
break;
|
||||
|
||||
case JTAG_RESET:
|
||||
DEBUG_JTAG_IO("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
||||
LOG_DEBUG_IO("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
||||
|
||||
opendous_tap_execute();
|
||||
|
||||
|
@ -303,7 +303,7 @@ static int opendous_execute_queue(void)
|
|||
break;
|
||||
|
||||
case JTAG_SLEEP:
|
||||
DEBUG_JTAG_IO("sleep %" PRIi32, cmd->cmd.sleep->us);
|
||||
LOG_DEBUG_IO("sleep %" PRIi32, cmd->cmd.sleep->us);
|
||||
opendous_tap_execute();
|
||||
jtag_sleep(cmd->cmd.sleep->us);
|
||||
break;
|
||||
|
@ -528,7 +528,7 @@ void opendous_simple_command(uint8_t command, uint8_t _data)
|
|||
{
|
||||
int result;
|
||||
|
||||
DEBUG_JTAG_IO("0x%02x 0x%02x", command, _data);
|
||||
LOG_DEBUG_IO("0x%02x 0x%02x", command, _data);
|
||||
|
||||
usb_out_buffer[0] = 2;
|
||||
usb_out_buffer[1] = 0;
|
||||
|
@ -597,7 +597,7 @@ void opendous_tap_append_step(int tms, int tdi)
|
|||
|
||||
void opendous_tap_append_scan(int length, uint8_t *buffer, struct scan_command *command)
|
||||
{
|
||||
DEBUG_JTAG_IO("append scan, length = %d", length);
|
||||
LOG_DEBUG_IO("append scan, length = %d", length);
|
||||
|
||||
struct pending_scan_result *pending_scan_result = &pending_scan_results_buffer[pending_scan_results_length];
|
||||
int i;
|
||||
|
@ -679,7 +679,7 @@ int opendous_tap_execute(void)
|
|||
/* Copy to buffer */
|
||||
buf_set_buf(tdo_buffer, first, buffer, 0, length);
|
||||
|
||||
DEBUG_JTAG_IO("pending scan result, length = %d", length);
|
||||
LOG_DEBUG_IO("pending scan result, length = %d", length);
|
||||
|
||||
#ifdef _DEBUG_USB_COMMS_
|
||||
opendous_debug_buffer(buffer, byte_length_out);
|
||||
|
@ -770,7 +770,7 @@ int opendous_usb_write(struct opendous_jtag *opendous_jtag, int out_length)
|
|||
LOG_DEBUG("USB write end: %d bytes", result);
|
||||
#endif
|
||||
|
||||
DEBUG_JTAG_IO("opendous_usb_write, out_length = %d, result = %d", out_length, result);
|
||||
LOG_DEBUG_IO("opendous_usb_write, out_length = %d, result = %d", out_length, result);
|
||||
|
||||
#ifdef _DEBUG_USB_COMMS_
|
||||
opendous_debug_buffer(usb_out_buffer, out_length);
|
||||
|
@ -796,7 +796,7 @@ int opendous_usb_read(struct opendous_jtag *opendous_jtag)
|
|||
#ifdef _DEBUG_USB_COMMS_
|
||||
LOG_DEBUG("USB read end: %d bytes", result);
|
||||
#endif
|
||||
DEBUG_JTAG_IO("opendous_usb_read, result = %d", result);
|
||||
LOG_DEBUG_IO("opendous_usb_read, result = %d", result);
|
||||
|
||||
#ifdef _DEBUG_USB_COMMS_
|
||||
opendous_debug_buffer(usb_in_buffer, result);
|
||||
|
|
|
@ -292,7 +292,7 @@ static int openjtag_buf_read_standard(
|
|||
qty - *bytes_read);
|
||||
if (retval < 0) {
|
||||
*bytes_read = 0;
|
||||
DEBUG_JTAG_IO("ftdi_read_data: %s",
|
||||
LOG_DEBUG_IO("ftdi_read_data: %s",
|
||||
ftdi_get_error_string(&ftdic));
|
||||
return ERROR_JTAG_DEVICE_ERROR;
|
||||
}
|
||||
|
@ -574,7 +574,7 @@ static int openjtag_execute_tap_queue(void)
|
|||
|
||||
while (len > 0) {
|
||||
if (len <= 8 && openjtag_variant != OPENJTAG_VARIANT_CY7C65215) {
|
||||
DEBUG_JTAG_IO("bits < 8 buf = 0x%X, will be 0x%X",
|
||||
LOG_DEBUG_IO("bits < 8 buf = 0x%X, will be 0x%X",
|
||||
usb_rx_buf[rx_offs], usb_rx_buf[rx_offs] >> (8 - len));
|
||||
buffer[count] = usb_rx_buf[rx_offs] >> (8 - len);
|
||||
len = 0;
|
||||
|
@ -609,8 +609,8 @@ static void openjtag_add_byte(char buf)
|
|||
{
|
||||
|
||||
if (usb_tx_buf_offs == OPENJTAG_BUFFER_SIZE) {
|
||||
DEBUG_JTAG_IO("Forcing execute_tap_queue");
|
||||
DEBUG_JTAG_IO("TX Buff offs=%d", usb_tx_buf_offs);
|
||||
LOG_DEBUG_IO("Forcing execute_tap_queue");
|
||||
LOG_DEBUG_IO("TX Buff offs=%d", usb_tx_buf_offs);
|
||||
openjtag_execute_tap_queue();
|
||||
}
|
||||
|
||||
|
@ -624,8 +624,8 @@ static void openjtag_add_scan(uint8_t *buffer, int length, struct scan_command *
|
|||
/* Ensure space to send long chains */
|
||||
/* We add two byte for each eight (or less) bits, one for command, one for data */
|
||||
if (usb_tx_buf_offs + (DIV_ROUND_UP(length, 8) * 2) >= OPENJTAG_BUFFER_SIZE) {
|
||||
DEBUG_JTAG_IO("Forcing execute_tap_queue from scan");
|
||||
DEBUG_JTAG_IO("TX Buff offs=%d len=%d", usb_tx_buf_offs, DIV_ROUND_UP(length, 8) * 2);
|
||||
LOG_DEBUG_IO("Forcing execute_tap_queue from scan");
|
||||
LOG_DEBUG_IO("TX Buff offs=%d len=%d", usb_tx_buf_offs, DIV_ROUND_UP(length, 8) * 2);
|
||||
openjtag_execute_tap_queue();
|
||||
}
|
||||
|
||||
|
@ -670,7 +670,7 @@ static void openjtag_add_scan(uint8_t *buffer, int length, struct scan_command *
|
|||
static void openjtag_execute_reset(struct jtag_command *cmd)
|
||||
{
|
||||
|
||||
DEBUG_JTAG_IO("reset trst: %i srst %i",
|
||||
LOG_DEBUG_IO("reset trst: %i srst %i",
|
||||
cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
||||
|
||||
uint8_t buf = 0x00;
|
||||
|
@ -703,7 +703,7 @@ static void openjtag_set_state(uint8_t openocd_state)
|
|||
|
||||
static void openjtag_execute_statemove(struct jtag_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("state move to %i", cmd->cmd.statemove->end_state);
|
||||
LOG_DEBUG_IO("state move to %i", cmd->cmd.statemove->end_state);
|
||||
|
||||
tap_set_end_state(cmd->cmd.statemove->end_state);
|
||||
|
||||
|
@ -719,7 +719,7 @@ static void openjtag_execute_scan(struct jtag_command *cmd)
|
|||
int scan_size, old_state;
|
||||
uint8_t *buffer;
|
||||
|
||||
DEBUG_JTAG_IO("scan ends in %s", tap_state_name(cmd->cmd.scan->end_state));
|
||||
LOG_DEBUG_IO("scan ends in %s", tap_state_name(cmd->cmd.scan->end_state));
|
||||
|
||||
/* get scan info */
|
||||
tap_set_end_state(cmd->cmd.scan->end_state);
|
||||
|
@ -778,7 +778,7 @@ static void openjtag_execute_runtest(struct jtag_command *cmd)
|
|||
|
||||
static void openjtag_execute_command(struct jtag_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("openjtag_execute_command %i", cmd->type);
|
||||
LOG_DEBUG_IO("openjtag_execute_command %i", cmd->type);
|
||||
switch (cmd->type) {
|
||||
case JTAG_RESET:
|
||||
openjtag_execute_reset(cmd);
|
||||
|
|
|
@ -1299,11 +1299,9 @@ static int rlink_execute_queue(void)
|
|||
|
||||
switch (cmd->type) {
|
||||
case JTAG_RESET:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("reset trst: %i srst %i",
|
||||
LOG_DEBUG_IO("reset trst: %i srst %i",
|
||||
cmd->cmd.reset->trst,
|
||||
cmd->cmd.reset->srst);
|
||||
#endif
|
||||
if ((cmd->cmd.reset->trst == 1) ||
|
||||
(cmd->cmd.reset->srst &&
|
||||
(jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
|
||||
|
@ -1311,37 +1309,29 @@ static int rlink_execute_queue(void)
|
|||
rlink_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
||||
break;
|
||||
case JTAG_RUNTEST:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("runtest %i cycles, end in %i",
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %i",
|
||||
cmd->cmd.runtest->num_cycles,
|
||||
cmd->cmd.runtest->end_state);
|
||||
#endif
|
||||
if (cmd->cmd.runtest->end_state != -1)
|
||||
rlink_end_state(cmd->cmd.runtest->end_state);
|
||||
rlink_runtest(cmd->cmd.runtest->num_cycles);
|
||||
break;
|
||||
case JTAG_TLR_RESET:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("statemove end in %i", cmd->cmd.statemove->end_state);
|
||||
#endif
|
||||
LOG_DEBUG_IO("statemove end in %i", cmd->cmd.statemove->end_state);
|
||||
if (cmd->cmd.statemove->end_state != -1)
|
||||
rlink_end_state(cmd->cmd.statemove->end_state);
|
||||
rlink_state_move();
|
||||
break;
|
||||
case JTAG_PATHMOVE:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("pathmove: %i states, end in %i",
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %i",
|
||||
cmd->cmd.pathmove->num_states,
|
||||
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
|
||||
#endif
|
||||
rlink_path_move(cmd->cmd.pathmove);
|
||||
break;
|
||||
case JTAG_SCAN:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("%s scan end in %i",
|
||||
LOG_DEBUG_IO("%s scan end in %i",
|
||||
(cmd->cmd.scan->ir_scan) ? "IR" : "DR",
|
||||
cmd->cmd.scan->end_state);
|
||||
#endif
|
||||
if (cmd->cmd.scan->end_state != -1)
|
||||
rlink_end_state(cmd->cmd.scan->end_state);
|
||||
scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer);
|
||||
|
@ -1350,9 +1340,7 @@ static int rlink_execute_queue(void)
|
|||
retval = ERROR_FAIL;
|
||||
break;
|
||||
case JTAG_SLEEP:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("sleep %i", cmd->cmd.sleep->us);
|
||||
#endif
|
||||
LOG_DEBUG_IO("sleep %i", cmd->cmd.sleep->us);
|
||||
jtag_sleep(cmd->cmd.sleep->us);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -187,12 +187,7 @@ void ulink_clear_queue(struct ulink *device);
|
|||
int ulink_append_queue(struct ulink *device, struct ulink_cmd *ulink_cmd);
|
||||
int ulink_execute_queued_commands(struct ulink *device, int timeout);
|
||||
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
const char *ulink_cmd_id_string(uint8_t id);
|
||||
void ulink_print_command(struct ulink_cmd *ulink_cmd);
|
||||
void ulink_print_queue(struct ulink *device);
|
||||
static int ulink_calculate_frequency(enum ulink_delay_type type, int delay, long *f);
|
||||
#endif
|
||||
static void ulink_print_queue(struct ulink *device);
|
||||
|
||||
int ulink_append_scan_cmd(struct ulink *device,
|
||||
enum scan_type scan_type,
|
||||
|
@ -708,9 +703,8 @@ int ulink_execute_queued_commands(struct ulink *device, int timeout)
|
|||
int ret, i, index_out, index_in, count_out, count_in, transferred;
|
||||
uint8_t buffer[64];
|
||||
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO))
|
||||
ulink_print_queue(device);
|
||||
#endif
|
||||
|
||||
index_out = 0;
|
||||
count_out = 0;
|
||||
|
@ -759,15 +753,13 @@ int ulink_execute_queued_commands(struct ulink *device, int timeout)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
|
||||
/**
|
||||
* Convert an OpenULINK command ID (\a id) to a human-readable string.
|
||||
*
|
||||
* @param id the OpenULINK command ID.
|
||||
* @return the corresponding human-readable string.
|
||||
*/
|
||||
const char *ulink_cmd_id_string(uint8_t id)
|
||||
static const char *ulink_cmd_id_string(uint8_t id)
|
||||
{
|
||||
switch (id) {
|
||||
case CMD_SCAN_IN:
|
||||
|
@ -832,7 +824,7 @@ const char *ulink_cmd_id_string(uint8_t id)
|
|||
*
|
||||
* @param ulink_cmd pointer to OpenULINK command.
|
||||
*/
|
||||
void ulink_print_command(struct ulink_cmd *ulink_cmd)
|
||||
static void ulink_print_command(struct ulink_cmd *ulink_cmd)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -850,7 +842,7 @@ void ulink_print_command(struct ulink_cmd *ulink_cmd)
|
|||
*
|
||||
* @param device pointer to struct ulink identifying ULINK driver instance.
|
||||
*/
|
||||
void ulink_print_queue(struct ulink *device)
|
||||
static void ulink_print_queue(struct ulink *device)
|
||||
{
|
||||
struct ulink_cmd *current;
|
||||
|
||||
|
@ -860,8 +852,6 @@ void ulink_print_queue(struct ulink *device)
|
|||
ulink_print_command(current);
|
||||
}
|
||||
|
||||
#endif /* _DEBUG_JTAG_IO_ */
|
||||
|
||||
/**
|
||||
* Perform JTAG scan
|
||||
*
|
||||
|
@ -1367,7 +1357,6 @@ int ulink_calculate_delay(enum ulink_delay_type type, long f, int *delay)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
/**
|
||||
* Calculate frequency for a given delay value.
|
||||
*
|
||||
|
@ -1378,16 +1367,14 @@ int ulink_calculate_delay(enum ulink_delay_type type, long f, int *delay)
|
|||
*
|
||||
* @param type for which command to calculate the delay value.
|
||||
* @param delay delay value for which to calculate the resulting TCK frequency.
|
||||
* @param f where to store the resulting TCK frequency.
|
||||
* @return on success: ERROR_OK
|
||||
* @return on failure: ERROR_FAIL
|
||||
* @return the resulting TCK frequency
|
||||
*/
|
||||
static int ulink_calculate_frequency(enum ulink_delay_type type, int delay, long *f)
|
||||
static long ulink_calculate_frequency(enum ulink_delay_type type, int delay)
|
||||
{
|
||||
float t, f_float, f_rounded;
|
||||
float t, f_float;
|
||||
|
||||
if (delay > 255)
|
||||
return ERROR_FAIL;
|
||||
return 0;
|
||||
|
||||
switch (type) {
|
||||
case DELAY_CLOCK_TCK:
|
||||
|
@ -1421,17 +1408,12 @@ static int ulink_calculate_frequency(enum ulink_delay_type type, int delay, long
|
|||
t = (float)(4E-6) * (float)(delay) + (float)(1.3132E-5);
|
||||
break;
|
||||
default:
|
||||
return ERROR_FAIL;
|
||||
break;
|
||||
return 0;
|
||||
}
|
||||
|
||||
f_float = 1.0 / t;
|
||||
f_rounded = roundf(f_float);
|
||||
*f = (long)f_rounded;
|
||||
|
||||
return ERROR_OK;
|
||||
return roundf(f_float);
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************* Interface between OpenULINK and OpenOCD ******************/
|
||||
|
||||
|
@ -2065,31 +2047,21 @@ static int ulink_khz(int khz, int *jtag_speed)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
long f_tck = 0, f_tms = 0, f_scan_in = 0, f_scan_out = 0, f_scan_io = 0;
|
||||
|
||||
ulink_calculate_frequency(DELAY_CLOCK_TCK, ulink_handle->delay_clock_tck,
|
||||
&f_tck);
|
||||
ulink_calculate_frequency(DELAY_CLOCK_TMS, ulink_handle->delay_clock_tms,
|
||||
&f_tms);
|
||||
ulink_calculate_frequency(DELAY_SCAN_IN, ulink_handle->delay_scan_in,
|
||||
&f_scan_in);
|
||||
ulink_calculate_frequency(DELAY_SCAN_OUT, ulink_handle->delay_scan_out,
|
||||
&f_scan_out);
|
||||
ulink_calculate_frequency(DELAY_SCAN_IO, ulink_handle->delay_scan_io,
|
||||
&f_scan_io);
|
||||
|
||||
DEBUG_JTAG_IO("ULINK TCK setup: delay_tck = %i (%li Hz),",
|
||||
ulink_handle->delay_clock_tck, f_tck);
|
||||
DEBUG_JTAG_IO(" delay_tms = %i (%li Hz),",
|
||||
ulink_handle->delay_clock_tms, f_tms);
|
||||
DEBUG_JTAG_IO(" delay_scan_in = %i (%li Hz),",
|
||||
ulink_handle->delay_scan_in, f_scan_in);
|
||||
DEBUG_JTAG_IO(" delay_scan_out = %i (%li Hz),",
|
||||
ulink_handle->delay_scan_out, f_scan_out);
|
||||
DEBUG_JTAG_IO(" delay_scan_io = %i (%li Hz),",
|
||||
ulink_handle->delay_scan_io, f_scan_io);
|
||||
#endif
|
||||
LOG_DEBUG_IO("ULINK TCK setup: delay_tck = %i (%li Hz),",
|
||||
ulink_handle->delay_clock_tck,
|
||||
ulink_calculate_frequency(DELAY_CLOCK_TCK, ulink_handle->delay_clock_tck));
|
||||
LOG_DEBUG_IO(" delay_tms = %i (%li Hz),",
|
||||
ulink_handle->delay_clock_tms,
|
||||
ulink_calculate_frequency(DELAY_CLOCK_TMS, ulink_handle->delay_clock_tms));
|
||||
LOG_DEBUG_IO(" delay_scan_in = %i (%li Hz),",
|
||||
ulink_handle->delay_scan_in,
|
||||
ulink_calculate_frequency(DELAY_SCAN_IN, ulink_handle->delay_scan_in));
|
||||
LOG_DEBUG_IO(" delay_scan_out = %i (%li Hz),",
|
||||
ulink_handle->delay_scan_out,
|
||||
ulink_calculate_frequency(DELAY_SCAN_OUT, ulink_handle->delay_scan_out));
|
||||
LOG_DEBUG_IO(" delay_scan_io = %i (%li Hz),",
|
||||
ulink_handle->delay_scan_io,
|
||||
ulink_calculate_frequency(DELAY_SCAN_IO, ulink_handle->delay_scan_io));
|
||||
|
||||
/* Configure the ULINK device with the new delay values */
|
||||
ret = ulink_append_configure_tck_cmd(ulink_handle,
|
||||
|
|
|
@ -174,7 +174,7 @@ static int ublast_buf_read(uint8_t *buf, unsigned size, uint32_t *bytes_read)
|
|||
int ret = info.drv->read(info.drv, buf, size, bytes_read);
|
||||
char *str = hexdump(buf, *bytes_read);
|
||||
|
||||
DEBUG_JTAG_IO("(size=%d, buf=[%s]) -> %u", size, str,
|
||||
LOG_DEBUG_IO("(size=%d, buf=[%s]) -> %u", size, str,
|
||||
*bytes_read);
|
||||
free(str);
|
||||
return ret;
|
||||
|
@ -185,7 +185,7 @@ static int ublast_buf_write(uint8_t *buf, int size, uint32_t *bytes_written)
|
|||
int ret = info.drv->write(info.drv, buf, size, bytes_written);
|
||||
char *str = hexdump(buf, *bytes_written);
|
||||
|
||||
DEBUG_JTAG_IO("(size=%d, buf=[%s]) -> %u", size, str,
|
||||
LOG_DEBUG_IO("(size=%d, buf=[%s]) -> %u", size, str,
|
||||
*bytes_written);
|
||||
free(str);
|
||||
return ret;
|
||||
|
@ -266,7 +266,7 @@ static void ublast_queue_byte(uint8_t abyte)
|
|||
info.buf[info.bufidx++] = abyte;
|
||||
if (nb_buf_remaining() == 0)
|
||||
ublast_flush_buffer();
|
||||
DEBUG_JTAG_IO("(byte=0x%02x)", abyte);
|
||||
LOG_DEBUG_IO("(byte=0x%02x)", abyte);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -337,7 +337,7 @@ static void ublast_clock_tms(int tms)
|
|||
{
|
||||
uint8_t out;
|
||||
|
||||
DEBUG_JTAG_IO("(tms=%d)", !!tms);
|
||||
LOG_DEBUG_IO("(tms=%d)", !!tms);
|
||||
info.tms = !!tms;
|
||||
info.tdi = 0;
|
||||
out = ublast_build_out(SCAN_OUT);
|
||||
|
@ -354,7 +354,7 @@ static void ublast_idle_clock(void)
|
|||
{
|
||||
uint8_t out = ublast_build_out(SCAN_OUT);
|
||||
|
||||
DEBUG_JTAG_IO(".");
|
||||
LOG_DEBUG_IO(".");
|
||||
ublast_queue_byte(out);
|
||||
}
|
||||
|
||||
|
@ -375,7 +375,7 @@ static void ublast_clock_tdi(int tdi, enum scan_type type)
|
|||
{
|
||||
uint8_t out;
|
||||
|
||||
DEBUG_JTAG_IO("(tdi=%d)", !!tdi);
|
||||
LOG_DEBUG_IO("(tdi=%d)", !!tdi);
|
||||
info.tdi = !!tdi;
|
||||
|
||||
out = ublast_build_out(SCAN_OUT);
|
||||
|
@ -400,7 +400,7 @@ static void ublast_clock_tdi_flip_tms(int tdi, enum scan_type type)
|
|||
{
|
||||
uint8_t out;
|
||||
|
||||
DEBUG_JTAG_IO("(tdi=%d)", !!tdi);
|
||||
LOG_DEBUG_IO("(tdi=%d)", !!tdi);
|
||||
info.tdi = !!tdi;
|
||||
info.tms = !info.tms;
|
||||
|
||||
|
@ -430,7 +430,7 @@ static void ublast_queue_bytes(uint8_t *bytes, int nb_bytes)
|
|||
info.bufidx + nb_bytes);
|
||||
exit(-1);
|
||||
}
|
||||
DEBUG_JTAG_IO("(nb_bytes=%d, bytes=[0x%02x, ...])", nb_bytes,
|
||||
LOG_DEBUG_IO("(nb_bytes=%d, bytes=[0x%02x, ...])", nb_bytes,
|
||||
bytes ? bytes[0] : 0);
|
||||
if (bytes)
|
||||
memcpy(&info.buf[info.bufidx], bytes, nb_bytes);
|
||||
|
@ -457,7 +457,7 @@ static void ublast_tms_seq(const uint8_t *bits, int nb_bits, int skip)
|
|||
{
|
||||
int i;
|
||||
|
||||
DEBUG_JTAG_IO("(bits=%02x..., nb_bits=%d)", bits[0], nb_bits);
|
||||
LOG_DEBUG_IO("(bits=%02x..., nb_bits=%d)", bits[0], nb_bits);
|
||||
for (i = skip; i < nb_bits; i++)
|
||||
ublast_clock_tms((bits[i / 8] >> (i % 8)) & 0x01);
|
||||
ublast_idle_clock();
|
||||
|
@ -469,7 +469,7 @@ static void ublast_tms_seq(const uint8_t *bits, int nb_bits, int skip)
|
|||
*/
|
||||
static void ublast_tms(struct tms_command *cmd)
|
||||
{
|
||||
DEBUG_JTAG_IO("(num_bits=%d)", cmd->num_bits);
|
||||
LOG_DEBUG_IO("(num_bits=%d)", cmd->num_bits);
|
||||
ublast_tms_seq(cmd->bits, cmd->num_bits, 0);
|
||||
}
|
||||
|
||||
|
@ -487,7 +487,7 @@ static void ublast_path_move(struct pathmove_command *cmd)
|
|||
{
|
||||
int i;
|
||||
|
||||
DEBUG_JTAG_IO("(num_states=%d, last_state=%d)",
|
||||
LOG_DEBUG_IO("(num_states=%d, last_state=%d)",
|
||||
cmd->num_states, cmd->path[cmd->num_states - 1]);
|
||||
for (i = 0; i < cmd->num_states; i++) {
|
||||
if (tap_state_transition(tap_get_state(), false) == cmd->path[i])
|
||||
|
@ -512,7 +512,7 @@ static void ublast_state_move(tap_state_t state, int skip)
|
|||
uint8_t tms_scan;
|
||||
int tms_len;
|
||||
|
||||
DEBUG_JTAG_IO("(from %s to %s)", tap_state_name(tap_get_state()),
|
||||
LOG_DEBUG_IO("(from %s to %s)", tap_state_name(tap_get_state()),
|
||||
tap_state_name(state));
|
||||
if (tap_get_state() == state)
|
||||
return;
|
||||
|
@ -541,7 +541,7 @@ static int ublast_read_byteshifted_tdos(uint8_t *buf, int nb_bytes)
|
|||
unsigned int retlen;
|
||||
int ret = ERROR_OK;
|
||||
|
||||
DEBUG_JTAG_IO("%s(buf=%p, num_bits=%d)", __func__, buf, nb_bytes * 8);
|
||||
LOG_DEBUG_IO("%s(buf=%p, num_bits=%d)", __func__, buf, nb_bytes * 8);
|
||||
ublast_flush_buffer();
|
||||
while (ret == ERROR_OK && nb_bytes > 0) {
|
||||
ret = ublast_buf_read(buf, nb_bytes, &retlen);
|
||||
|
@ -573,7 +573,7 @@ static int ublast_read_bitbang_tdos(uint8_t *buf, int nb_bits)
|
|||
unsigned int retlen;
|
||||
uint8_t tmp[8];
|
||||
|
||||
DEBUG_JTAG_IO("%s(buf=%p, num_bits=%d)", __func__, buf, nb_bits);
|
||||
LOG_DEBUG_IO("%s(buf=%p, num_bits=%d)", __func__, buf, nb_bits);
|
||||
|
||||
/*
|
||||
* Ensure all previous bitbang writes were issued to the dongle, so that
|
||||
|
@ -688,7 +688,7 @@ static void ublast_queue_tdi(uint8_t *bits, int nb_bits, enum scan_type scan)
|
|||
|
||||
static void ublast_runtest(int cycles, tap_state_t state)
|
||||
{
|
||||
DEBUG_JTAG_IO("%s(cycles=%i, end_state=%d)", __func__, cycles, state);
|
||||
LOG_DEBUG_IO("%s(cycles=%i, end_state=%d)", __func__, cycles, state);
|
||||
|
||||
ublast_state_move(TAP_IDLE, 0);
|
||||
ublast_queue_tdi(NULL, cycles, SCAN_OUT);
|
||||
|
@ -697,7 +697,7 @@ static void ublast_runtest(int cycles, tap_state_t state)
|
|||
|
||||
static void ublast_stableclocks(int cycles)
|
||||
{
|
||||
DEBUG_JTAG_IO("%s(cycles=%i)", __func__, cycles);
|
||||
LOG_DEBUG_IO("%s(cycles=%i)", __func__, cycles);
|
||||
ublast_queue_tdi(NULL, cycles, SCAN_OUT);
|
||||
}
|
||||
|
||||
|
@ -727,7 +727,7 @@ static int ublast_scan(struct scan_command *cmd)
|
|||
ublast_state_move(TAP_DRSHIFT, 0);
|
||||
|
||||
log_buf = hexdump(buf, DIV_ROUND_UP(scan_bits, 8));
|
||||
DEBUG_JTAG_IO("%s(scan=%s, type=%s, bits=%d, buf=[%s], end_state=%d)", __func__,
|
||||
LOG_DEBUG_IO("%s(scan=%s, type=%s, bits=%d, buf=[%s], end_state=%d)", __func__,
|
||||
cmd->ir_scan ? "IRSCAN" : "DRSCAN",
|
||||
type2str[type],
|
||||
scan_bits, log_buf, cmd->end_state);
|
||||
|
@ -749,7 +749,7 @@ static int ublast_scan(struct scan_command *cmd)
|
|||
|
||||
static void ublast_usleep(int us)
|
||||
{
|
||||
DEBUG_JTAG_IO("%s(us=%d)", __func__, us);
|
||||
LOG_DEBUG_IO("%s(us=%d)", __func__, us);
|
||||
jtag_sleep(us);
|
||||
}
|
||||
|
||||
|
|
|
@ -104,43 +104,33 @@ static int usbprog_execute_queue(void)
|
|||
while (cmd) {
|
||||
switch (cmd->type) {
|
||||
case JTAG_RESET:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("reset trst: %i srst %i",
|
||||
LOG_DEBUG_IO("reset trst: %i srst %i",
|
||||
cmd->cmd.reset->trst,
|
||||
cmd->cmd.reset->srst);
|
||||
#endif
|
||||
if (cmd->cmd.reset->trst == 1)
|
||||
tap_set_state(TAP_RESET);
|
||||
usbprog_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
|
||||
break;
|
||||
case JTAG_RUNTEST:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("runtest %i cycles, end in %i",
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %i",
|
||||
cmd->cmd.runtest->num_cycles,
|
||||
cmd->cmd.runtest->end_state);
|
||||
#endif
|
||||
usbprog_end_state(cmd->cmd.runtest->end_state);
|
||||
usbprog_runtest(cmd->cmd.runtest->num_cycles);
|
||||
break;
|
||||
case JTAG_TLR_RESET:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("statemove end in %i", cmd->cmd.statemove->end_state);
|
||||
#endif
|
||||
LOG_DEBUG_IO("statemove end in %i", cmd->cmd.statemove->end_state);
|
||||
usbprog_end_state(cmd->cmd.statemove->end_state);
|
||||
usbprog_state_move();
|
||||
break;
|
||||
case JTAG_PATHMOVE:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("pathmove: %i states, end in %i",
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %i",
|
||||
cmd->cmd.pathmove->num_states,
|
||||
cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
|
||||
#endif
|
||||
usbprog_path_move(cmd->cmd.pathmove);
|
||||
break;
|
||||
case JTAG_SCAN:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("scan end in %i", cmd->cmd.scan->end_state);
|
||||
#endif
|
||||
LOG_DEBUG_IO("scan end in %i", cmd->cmd.scan->end_state);
|
||||
usbprog_end_state(cmd->cmd.scan->end_state);
|
||||
scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer);
|
||||
type = jtag_scan_type(cmd->cmd.scan);
|
||||
|
@ -151,9 +141,7 @@ static int usbprog_execute_queue(void)
|
|||
free(buffer);
|
||||
break;
|
||||
case JTAG_SLEEP:
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("sleep %i", cmd->cmd.sleep->us);
|
||||
#endif
|
||||
LOG_DEBUG_IO("sleep %i", cmd->cmd.sleep->us);
|
||||
jtag_sleep(cmd->cmd.sleep->us);
|
||||
break;
|
||||
default:
|
||||
|
@ -270,10 +258,8 @@ static void usbprog_runtest(int num_cycles)
|
|||
usbprog_write(0, 0, 0);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
LOG_DEBUG("runtest: cur_state %s end_state %s", tap_state_name(
|
||||
LOG_DEBUG_IO("runtest: cur_state %s end_state %s", tap_state_name(
|
||||
tap_get_state()), tap_state_name(tap_get_end_state()));
|
||||
#endif
|
||||
|
||||
/* finish in end_state */
|
||||
/*
|
||||
|
|
|
@ -82,9 +82,7 @@ struct vsllink {
|
|||
static int vsllink_usb_open(struct vsllink *vsllink);
|
||||
static void vsllink_usb_close(struct vsllink *vsllink);
|
||||
|
||||
#if defined _DEBUG_JTAG_IO_
|
||||
static void vsllink_debug_buffer(uint8_t *buffer, int length);
|
||||
#endif
|
||||
|
||||
static int tap_length;
|
||||
static int tap_buffer_size;
|
||||
|
@ -103,14 +101,14 @@ static int vsllink_execute_queue(void)
|
|||
enum scan_type type;
|
||||
uint8_t *buffer;
|
||||
|
||||
DEBUG_JTAG_IO("-------------------------------------"
|
||||
LOG_DEBUG_IO("-------------------------------------"
|
||||
" vsllink "
|
||||
"-------------------------------------");
|
||||
|
||||
while (cmd != NULL) {
|
||||
switch (cmd->type) {
|
||||
case JTAG_RUNTEST:
|
||||
DEBUG_JTAG_IO("runtest %i cycles, end in %s",
|
||||
LOG_DEBUG_IO("runtest %i cycles, end in %s",
|
||||
cmd->cmd.runtest->num_cycles,
|
||||
tap_state_name(cmd->cmd.runtest->end_state));
|
||||
|
||||
|
@ -119,7 +117,7 @@ static int vsllink_execute_queue(void)
|
|||
break;
|
||||
|
||||
case JTAG_TLR_RESET:
|
||||
DEBUG_JTAG_IO("statemove end in %s",
|
||||
LOG_DEBUG_IO("statemove end in %s",
|
||||
tap_state_name(cmd->cmd.statemove->end_state));
|
||||
|
||||
vsllink_end_state(cmd->cmd.statemove->end_state);
|
||||
|
@ -127,7 +125,7 @@ static int vsllink_execute_queue(void)
|
|||
break;
|
||||
|
||||
case JTAG_PATHMOVE:
|
||||
DEBUG_JTAG_IO("pathmove: %i states, end in %s",
|
||||
LOG_DEBUG_IO("pathmove: %i states, end in %s",
|
||||
cmd->cmd.pathmove->num_states,
|
||||
tap_state_name(cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]));
|
||||
|
||||
|
@ -135,7 +133,7 @@ static int vsllink_execute_queue(void)
|
|||
break;
|
||||
|
||||
case JTAG_SCAN:
|
||||
DEBUG_JTAG_IO("JTAG Scan...");
|
||||
LOG_DEBUG_IO("JTAG Scan...");
|
||||
|
||||
vsllink_end_state(cmd->cmd.scan->end_state);
|
||||
|
||||
|
@ -143,23 +141,21 @@ static int vsllink_execute_queue(void)
|
|||
cmd->cmd.scan, &buffer);
|
||||
|
||||
if (cmd->cmd.scan->ir_scan)
|
||||
DEBUG_JTAG_IO(
|
||||
LOG_DEBUG_IO(
|
||||
"JTAG Scan write IR(%d bits), "
|
||||
"end in %s:",
|
||||
scan_size,
|
||||
tap_state_name(cmd->cmd.scan->end_state));
|
||||
|
||||
else
|
||||
DEBUG_JTAG_IO(
|
||||
LOG_DEBUG_IO(
|
||||
"JTAG Scan write DR(%d bits), "
|
||||
"end in %s:",
|
||||
scan_size,
|
||||
tap_state_name(cmd->cmd.scan->end_state));
|
||||
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
vsllink_debug_buffer(buffer,
|
||||
DIV_ROUND_UP(scan_size, 8));
|
||||
#endif
|
||||
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO))
|
||||
vsllink_debug_buffer(buffer, DIV_ROUND_UP(scan_size, 8));
|
||||
|
||||
type = jtag_scan_type(cmd->cmd.scan);
|
||||
|
||||
|
@ -169,7 +165,7 @@ static int vsllink_execute_queue(void)
|
|||
break;
|
||||
|
||||
case JTAG_RESET:
|
||||
DEBUG_JTAG_IO("reset trst: %i srst %i",
|
||||
LOG_DEBUG_IO("reset trst: %i srst %i",
|
||||
cmd->cmd.reset->trst,
|
||||
cmd->cmd.reset->srst);
|
||||
|
||||
|
@ -183,13 +179,13 @@ static int vsllink_execute_queue(void)
|
|||
break;
|
||||
|
||||
case JTAG_SLEEP:
|
||||
DEBUG_JTAG_IO("sleep %i", cmd->cmd.sleep->us);
|
||||
LOG_DEBUG_IO("sleep %i", cmd->cmd.sleep->us);
|
||||
vsllink_tap_execute();
|
||||
jtag_sleep(cmd->cmd.sleep->us);
|
||||
break;
|
||||
|
||||
case JTAG_STABLECLOCKS:
|
||||
DEBUG_JTAG_IO("add %d clocks",
|
||||
LOG_DEBUG_IO("add %d clocks",
|
||||
cmd->cmd.stableclocks->num_cycles);
|
||||
|
||||
switch (tap_get_state()) {
|
||||
|
@ -219,7 +215,7 @@ static int vsllink_execute_queue(void)
|
|||
break;
|
||||
|
||||
case JTAG_TMS:
|
||||
DEBUG_JTAG_IO("add %d jtag tms",
|
||||
LOG_DEBUG_IO("add %d jtag tms",
|
||||
cmd->cmd.tms->num_bits);
|
||||
|
||||
vsllink_tms(cmd->cmd.tms->num_bits, cmd->cmd.tms->bits);
|
||||
|
@ -681,13 +677,11 @@ static int vsllink_jtag_execute(void)
|
|||
command = pending_scan_result->command;
|
||||
buf_set_buf(tdo_buffer, src_first, buffer, dest_first, length);
|
||||
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
DEBUG_JTAG_IO(
|
||||
LOG_DEBUG_IO(
|
||||
"JTAG scan read(%d bits, from src %d bits to dest %d bits):",
|
||||
length, src_first, dest_first);
|
||||
vsllink_debug_buffer(buffer + dest_first / 8,
|
||||
DIV_ROUND_UP(length, 7));
|
||||
#endif
|
||||
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO))
|
||||
vsllink_debug_buffer(buffer + dest_first / 8, DIV_ROUND_UP(length, 7));
|
||||
|
||||
if (last) {
|
||||
if (jtag_read_buffer(buffer, command)
|
||||
|
@ -895,7 +889,6 @@ static void vsllink_usb_close(struct vsllink *vsllink)
|
|||
|
||||
#define BYTES_PER_LINE 16
|
||||
|
||||
#if defined _DEBUG_JTAG_IO_
|
||||
static void vsllink_debug_buffer(uint8_t *buffer, int length)
|
||||
{
|
||||
char line[81];
|
||||
|
@ -904,15 +897,14 @@ static void vsllink_debug_buffer(uint8_t *buffer, int length)
|
|||
int j;
|
||||
|
||||
for (i = 0; i < length; i += BYTES_PER_LINE) {
|
||||
snprintf(line, 5, "%04x", i);
|
||||
snprintf(line, 5, "%04x", i & 0xffff);
|
||||
for (j = i; j < i + BYTES_PER_LINE && j < length; j++) {
|
||||
snprintf(s, 4, " %02x", buffer[j]);
|
||||
strcat(line, s);
|
||||
}
|
||||
LOG_DEBUG("%s", line);
|
||||
LOG_DEBUG_IO("%s", line);
|
||||
}
|
||||
}
|
||||
#endif /* _DEBUG_JTAG_IO_ */
|
||||
|
||||
static const struct command_registration vsllink_command_handlers[] = {
|
||||
{
|
||||
|
|
|
@ -376,15 +376,13 @@ tap_state_t tap_state_by_name(const char *name)
|
|||
return TAP_INVALID;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
|
||||
#define JTAG_DEBUG_STATE_APPEND(buf, len, bit) \
|
||||
do { buf[len] = bit ? '1' : '0'; } while (0)
|
||||
#define JTAG_DEBUG_STATE_PRINT(a, b, astr, bstr) \
|
||||
DEBUG_JTAG_IO("TAP/SM: %9s -> %5s\tTMS: %s\tTDI: %s", \
|
||||
LOG_DEBUG_IO("TAP/SM: %9s -> %5s\tTMS: %s\tTDI: %s", \
|
||||
tap_state_name(a), tap_state_name(b), astr, bstr)
|
||||
|
||||
tap_state_t jtag_debug_state_machine(const void *tms_buf, const void *tdi_buf,
|
||||
tap_state_t jtag_debug_state_machine_(const void *tms_buf, const void *tdi_buf,
|
||||
unsigned tap_bits, tap_state_t next_state)
|
||||
{
|
||||
const uint8_t *tms_buffer;
|
||||
|
@ -401,13 +399,13 @@ tap_state_t jtag_debug_state_machine(const void *tms_buf, const void *tdi_buf,
|
|||
|
||||
/* set startstate (and possibly last, if tap_bits == 0) */
|
||||
last_state = next_state;
|
||||
DEBUG_JTAG_IO("TAP/SM: START state: %s", tap_state_name(next_state));
|
||||
LOG_DEBUG_IO("TAP/SM: START state: %s", tap_state_name(next_state));
|
||||
|
||||
tms_buffer = (const uint8_t *)tms_buf;
|
||||
tdi_buffer = (const uint8_t *)tdi_buf;
|
||||
|
||||
tap_bytes = DIV_ROUND_UP(tap_bits, 8);
|
||||
DEBUG_JTAG_IO("TAP/SM: TMS bits: %u (bytes: %u)", tap_bits, tap_bytes);
|
||||
LOG_DEBUG_IO("TAP/SM: TMS bits: %u (bytes: %u)", tap_bits, tap_bytes);
|
||||
|
||||
tap_out_bits = 0;
|
||||
for (cur_byte = 0; cur_byte < tap_bytes; cur_byte++) {
|
||||
|
@ -452,11 +450,10 @@ tap_state_t jtag_debug_state_machine(const void *tms_buf, const void *tdi_buf,
|
|||
JTAG_DEBUG_STATE_PRINT(last_state, next_state, tms_str, tdi_str);
|
||||
}
|
||||
|
||||
DEBUG_JTAG_IO("TAP/SM: FINAL state: %s", tap_state_name(next_state));
|
||||
LOG_DEBUG_IO("TAP/SM: FINAL state: %s", tap_state_name(next_state));
|
||||
|
||||
return next_state;
|
||||
}
|
||||
#endif /* _DEBUG_JTAG_IO_ */
|
||||
|
||||
void tap_use_new_tms_table(bool use_new)
|
||||
{
|
||||
|
|
|
@ -56,18 +56,11 @@ void tap_set_state_impl(tap_state_t new_state);
|
|||
* @param new_state The state we think the TAPs are currently in (or
|
||||
* are about to enter).
|
||||
*/
|
||||
#if defined(_DEBUG_JTAG_IO_)
|
||||
#define tap_set_state(new_state) \
|
||||
do { \
|
||||
LOG_DEBUG("tap_set_state(%s)", tap_state_name(new_state)); \
|
||||
LOG_DEBUG_IO("tap_set_state(%s)", tap_state_name(new_state)); \
|
||||
tap_set_state_impl(new_state); \
|
||||
} while (0)
|
||||
#else
|
||||
static inline void tap_set_state(tap_state_t new_state)
|
||||
{
|
||||
tap_set_state_impl(new_state);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This function gets the state of the "state follower" which tracks the
|
||||
|
@ -164,7 +157,7 @@ void tap_use_new_tms_table(bool use_new);
|
|||
/** @returns True if new TMS table is active; false otherwise. */
|
||||
bool tap_uses_new_tms_table(void);
|
||||
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
|
||||
/**
|
||||
* @brief Prints verbose TAP state transitions for the given TMS/TDI buffers.
|
||||
* @param tms_buf must points to a buffer containing the TMS bitstream.
|
||||
|
@ -173,15 +166,18 @@ bool tap_uses_new_tms_table(void);
|
|||
* @param start_tap_state must specify the current TAP state.
|
||||
* @returns the final TAP state; pass as @a start_tap_state in following call.
|
||||
*/
|
||||
tap_state_t jtag_debug_state_machine(const void *tms_buf, const void *tdi_buf,
|
||||
unsigned tap_len, tap_state_t start_tap_state);
|
||||
#else
|
||||
static inline tap_state_t jtag_debug_state_machine(const void *tms_buf,
|
||||
const void *tdi_buf, unsigned tap_len, tap_state_t start_tap_state)
|
||||
{
|
||||
/* Private declaration */
|
||||
tap_state_t jtag_debug_state_machine_(const void *tms_buf, const void *tdi_buf,
|
||||
unsigned tap_len, tap_state_t start_tap_state);
|
||||
|
||||
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO))
|
||||
return jtag_debug_state_machine_(tms_buf, tdi_buf, tap_len, start_tap_state);
|
||||
else
|
||||
return start_tap_state;
|
||||
}
|
||||
#endif /* _DEBUG_JTAG_IO_ */
|
||||
|
||||
/**
|
||||
* Represents a driver for a debugging interface.
|
||||
|
|
|
@ -25,14 +25,6 @@
|
|||
#include <helper/binarybuffer.h>
|
||||
#include <helper/log.h>
|
||||
|
||||
#ifdef _DEBUG_JTAG_IO_
|
||||
#define DEBUG_JTAG_IO(expr ...) \
|
||||
do { if (1) LOG_DEBUG(expr); } while (0)
|
||||
#else
|
||||
#define DEBUG_JTAG_IO(expr ...) \
|
||||
do { if (0) LOG_DEBUG(expr); } while (0)
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG_JTAG_IOZ
|
||||
#define DEBUG_JTAG_IOZ 64
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue