#include "config.h"
#endif
-#include "svf.h"
#include "jtag.h"
+#include "svf.h"
#include "time_support.h"
return ret;
}
-static int svf_add_statemove(tap_state_t state_to)
+int svf_add_statemove(tap_state_t state_to)
{
tap_state_t state_from = cmd_queue_cur_state;
uint8_t index;
return ERROR_OK;
}
-static int svf_tap_state_is_stable(tap_state_t state)
+bool svf_tap_state_is_stable(tap_state_t state)
{
- return ((TAP_RESET == state) || (TAP_IDLE == state) || (TAP_DRPAUSE == state) || (TAP_IRPAUSE == state));
+ return (TAP_RESET == state) || (TAP_IDLE == state)
+ || (TAP_DRPAUSE == state) || (TAP_IRPAUSE == state);
}
static int svf_tap_state_is_valid(tap_state_t state)
field.num_bits = i;
field.out_value = &svf_tdi_buffer[svf_buffer_index];
field.in_value = &svf_tdi_buffer[svf_buffer_index];
+ /* NOTE: doesn't use SVF-specified state paths */
jtag_add_plain_dr_scan(1, &field, svf_para.dr_end_state);
svf_buffer_index += (i + 7) >> 3;
field.num_bits = i;
field.out_value = &svf_tdi_buffer[svf_buffer_index];
field.in_value = &svf_tdi_buffer[svf_buffer_index];
+ /* NOTE: doesn't use SVF-specified state paths */
jtag_add_plain_ir_scan(1, &field, svf_para.ir_end_state);
svf_buffer_index += (i + 7) >> 3;
// run_state and end_state is checked to be stable state
// TODO: do runtest
#if 1
+ /* FIXME handle statemove failures */
+ int retval;
+
// enter into run_state if necessary
if (cmd_queue_cur_state != svf_para.runtest_run_state)
{
- svf_add_statemove(svf_para.runtest_run_state);
+ retval = svf_add_statemove(svf_para.runtest_run_state);
}
// call jtag_add_clocks
// move to end_state if necessary
if (svf_para.runtest_end_state != svf_para.runtest_run_state)
{
- svf_add_statemove(svf_para.runtest_end_state);
+ retval = svf_add_statemove(svf_para.runtest_end_state);
}
#else
if (svf_para.runtest_run_state != TAP_IDLE)
free(path);
return ERROR_FAIL;
}
+ /* OpenOCD refuses paths containing TAP_RESET */
if (TAP_RESET == path[i])
{
+ /* FIXME last state MUST be stable! */
if (i > 0)
{
jtag_add_pathmove(i, path);
state = svf_find_string_in_array(argus[1], (char **)svf_tap_state_name, dimof(svf_tap_state_name));
if (svf_tap_state_is_stable(state))
{
- // TODO: move to state
+ LOG_DEBUG("\tmove to %s by svf_add_statemove",
+ svf_tap_state_name[state]);
+ /* FIXME handle statemove failures */
svf_add_statemove(state);
-
- LOG_DEBUG("\tmove to %s by svf_add_statemove", svf_tap_state_name[state]);
}
else
{