amt_jtagaccel_speed(jtag_get_speed());
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
aw_control_rst &= ~0x8;
else
#ifdef _DEBUG_JTAG_IO_
LOG_DEBUG("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_reset_config & RESET_SRST_PULLS_TRST)))
+ if ((cmd->cmd.reset->trst == 1) || (cmd->cmd.reset->srst && (jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
{
tap_set_state(TAP_RESET);
}
#ifdef _DEBUG_JTAG_IO_
LOG_DEBUG("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_reset_config & RESET_SRST_PULLS_TRST) ) )
+ if ( (cmd->cmd.reset->trst == 1) || ( cmd->cmd.reset->srst && (jtag_get_reset_config() & RESET_SRST_PULLS_TRST) ) )
{
tap_set_state(TAP_RESET);
}
return ERROR_OK;
}
+enum reset_types jtag_get_reset_config(void)
+{
+ return jtag_reset_config;
+}
+void jtag_set_reset_config(enum reset_types type)
+{
+ jtag_reset_config = type;
+}
+
int jtag_get_trst(void)
{
return jtag_trst;
{
dummy_clock = 0;
- if (trst || (srst && (jtag_reset_config & RESET_SRST_PULLS_TRST)))
+ if (trst || (srst && (jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
dummy_state = TAP_RESET;
LOG_DEBUG("reset to: %s", tap_state_name(dummy_state) );
static void usbjtag_reset(int trst, int srst)
{
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (trst == 1)
{
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
static void jtagkey_reset(int trst, int srst)
{
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (trst == 1)
{
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
static void olimex_jtag_reset(int trst, int srst)
{
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (trst == 1)
{
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
return ERROR_JTAG_INIT_FAILED;
}
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
{
low_direction &= ~nTRSTnOE; /* nTRST input */
high_output = 0x0;
high_direction = 0x0c;
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
{
LOG_ERROR("can't set nTRSTOE to push-pull on the Dicarlo jtag");
high_output = 0x0;
high_direction = 0x0f;
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
{
high_output |= nTRSTnOE;
high_output = 0x0;
high_direction = 0x0f;
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
{
high_output |= nTRSTnOE;
nTRST = 0x10;
nSRST = 0x20;
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if ((jtag_reset_config & RESET_TRST_OPEN_DRAIN) != 0) {
low_direction &= ~nTRST; /* nTRST high impedance */
}
low_output &= ~nTRST;
}
else if (trst == 0) {
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if ((jtag_reset_config & RESET_TRST_OPEN_DRAIN) != 0)
low_direction &= ~nTRST;
else
RESET_SRST_PUSH_PULL = 0x20,
};
-extern enum reset_types jtag_reset_config;
+enum reset_types jtag_get_reset_config(void);
+void jtag_set_reset_config(enum reset_types type);
/**
* Initialize interface upon startup. Return a successful no-op upon
#ifdef _DEBUG_JTAG_IO_
LOG_DEBUG("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_reset_config & RESET_SRST_PULLS_TRST)))
+ if ((cmd->cmd.reset->trst == 1) || (cmd->cmd.reset->srst && (jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
{
tap_set_state(TAP_RESET);
}
}
/* clear previous values of those bits, save new values */
- jtag_reset_config &= ~mask;
- jtag_reset_config |= new_cfg;
+ enum reset_types old_cfg = jtag_get_reset_config();
+ old_cfg &= ~mask;
+ new_cfg |= old_cfg;
+ jtag_set_reset_config(new_cfg);
return ERROR_OK;
}
ZY1000_POKE(ZY1000_JTAG_BASE+0x10, 0x00000002);
}
- if (trst||(srst&&(jtag_reset_config & RESET_SRST_PULLS_TRST)))
+ if (trst||(srst&&(jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
{
waitIdle();
/* we're now in the RESET state until trst is deasserted */
{
if (target->reset_halt)
{
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if ((jtag_reset_config & RESET_SRST_PULLS_TRST)==0)
{
check_pc = 1;
LOG_DEBUG("target->state: %s",
Jim_Nvp_value2name_simple( nvp_target_state,target->state)->name);
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (!(jtag_reset_config & RESET_HAS_SRST))
{
LOG_ERROR("Can't assert SRST");
/* deassert reset lines */
jtag_add_reset(0, 0);
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (target->reset_halt&&(jtag_reset_config & RESET_SRST_PULLS_TRST)!=0)
{
LOG_WARNING("srst pulls trst - can not reset into halted mode. Issuing halt after reset.");
if (target->state == TARGET_RESET)
{
- if ((jtag_reset_config & RESET_SRST_PULLS_TRST) && jtag_get_srst())
+ if ((jtag_get_reset_config() & RESET_SRST_PULLS_TRST) && jtag_get_srst())
{
LOG_ERROR("can't request a halt while in reset if nSRST pulls nTRST");
return ERROR_TARGET_FAILURE;
LOG_DEBUG("target->state: %s",
Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name );
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (!(jtag_reset_config & RESET_HAS_SRST))
{
LOG_ERROR("Can't assert SRST");
if (target->state == TARGET_RESET)
{
- if ((jtag_reset_config & RESET_SRST_PULLS_TRST) && jtag_get_srst())
+ if ((jtag_get_reset_config() & RESET_SRST_PULLS_TRST) && jtag_get_srst())
{
LOG_ERROR("can't request a halt while in reset if nSRST pulls nTRST");
return ERROR_TARGET_FAILURE;
LOG_DEBUG("target->state: %s",
Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name);
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (!(jtag_reset_config & RESET_HAS_SRST))
{
LOG_ERROR("Can't assert SRST");