Less global variables....
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
uint8_t out_addr_buf;
jtag_set_end_state(TAP_IDLE);
- arm_jtag_set_instr(jtag_info, instr, NULL);
+ arm_jtag_set_instr(jtag_info, instr, NULL, TAP_IDLE);
/* Scan out a read or write operation using some DP or AP register.
* For APACC access with any sticky error flag set, this is discarded.
int retval;
struct scan_field fields[1];
- jtag_set_end_state(TAP_IDLE);
-
/* This is a standard JTAG operation -- no DAP tweakage */
- retval = arm_jtag_set_instr(jtag_info, JTAG_DP_IDCODE, NULL);
+ jtag_set_end_state(TAP_IDLE);
+ retval = arm_jtag_set_instr(jtag_info, JTAG_DP_IDCODE, NULL, TAP_IDLE);
if (retval != ERROR_OK)
return retval;
buf_set_u32(out_buf, 0, 32, flip_u32(out, 32));
jtag_set_end_state(TAP_DRPAUSE);
- if ((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(jtag_info, 0xf, TAP_DRPAUSE)) != ERROR_OK)
{
return retval;
}
- if ((retval = arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL)) != ERROR_OK)
+ if ((retval = arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_DRPAUSE)) != ERROR_OK)
{
return retval;
}
jtag_set_end_state(TAP_IDLE);
if (arm7_9->need_bypass_before_restart) {
arm7_9->need_bypass_before_restart = 0;
- arm_jtag_set_instr(jtag_info, 0xf, NULL);
+ arm_jtag_set_instr(jtag_info, 0xf, NULL, TAP_IDLE);
}
- arm_jtag_set_instr(jtag_info, 0x4, NULL);
+ arm_jtag_set_instr(jtag_info, 0x4, NULL, TAP_IDLE);
long long then = timeval_ms();
int timeout;
jtag_set_end_state(TAP_IDLE);
if (arm7_9->need_bypass_before_restart) {
arm7_9->need_bypass_before_restart = 0;
- arm_jtag_set_instr(jtag_info, 0xf, NULL);
+ arm_jtag_set_instr(jtag_info, 0xf, NULL, TAP_IDLE);
}
- arm_jtag_set_instr(jtag_info, 0x4, NULL);
+ arm_jtag_set_instr(jtag_info, 0x4, NULL, TAP_IDLE);
if (!set)
{
jtag_set_end_state(TAP_IDLE);
if (arm7_9->need_bypass_before_restart) {
arm7_9->need_bypass_before_restart = 0;
- arm_jtag_set_instr(jtag_info, 0xf, NULL);
+ arm_jtag_set_instr(jtag_info, 0xf, NULL, TAP_IDLE);
}
- arm_jtag_set_instr(jtag_info, 0x4, NULL);
+ arm_jtag_set_instr(jtag_info, 0x4, NULL, TAP_IDLE);
jtag_add_runtest(1, TAP_IDLE);
return jtag_execute_queue();
fields[1].out_value = NULL;
fields[1].in_value = databus;
- if ((retval = arm_jtag_scann(&arm7_9->jtag_info, 0x1)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(&arm7_9->jtag_info, 0x1, TAP_DRPAUSE)) != ERROR_OK)
{
return retval;
}
- arm_jtag_set_instr(&arm7_9->jtag_info, arm7_9->jtag_info.intest_instr, NULL);
+ arm_jtag_set_instr(&arm7_9->jtag_info, arm7_9->jtag_info.intest_instr, NULL, TAP_DRPAUSE);
jtag_add_dr_scan(arm7_9->jtag_info.tap, 2, fields, TAP_DRPAUSE);
if ((retval = jtag_execute_queue()) != ERROR_OK)
uint32_t out, uint32_t *deprecated, int breakpoint)
{
jtag_set_end_state(TAP_DRPAUSE);
- arm_jtag_scann(jtag_info, 0x1);
- arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+ arm_jtag_scann(jtag_info, 0x1, TAP_DRPAUSE);
+ arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_DRPAUSE);
return arm7tdmi_clock_out_inner(jtag_info, out, breakpoint);
}
struct scan_field fields[2];
jtag_set_end_state(TAP_DRPAUSE);
- if ((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(jtag_info, 0x1, TAP_DRPAUSE)) != ERROR_OK)
{
return retval;
}
- arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+ arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_DRPAUSE);
fields[0].num_bits = 1;
fields[0].out_value = NULL;
struct scan_field fields[2];
jtag_set_end_state(TAP_DRPAUSE);
- if ((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(jtag_info, 0x1, TAP_DRPAUSE)) != ERROR_OK)
{
return retval;
}
- arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+ arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_DRPAUSE);
fields[0].num_bits = 1;
fields[0].out_value = NULL;
jtag_info = &arm920t->arm7_9_common.jtag_info;
jtag_set_end_state(TAP_IDLE);
- arm_jtag_scann(jtag_info, 0xf);
- arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+ arm_jtag_scann(jtag_info, 0xf, TAP_IDLE);
+ arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_IDLE);
fields[0].num_bits = 1;
fields[0].out_value = &access_type_buf;
buf_set_u32(value_buf, 0, 32, value);
jtag_set_end_state(TAP_IDLE);
- arm_jtag_scann(jtag_info, 0xf);
- arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+ arm_jtag_scann(jtag_info, 0xf, TAP_IDLE);
+ arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_IDLE);
fields[0].num_bits = 1;
fields[0].out_value = &access_type_buf;
jtag_info = &arm920t->arm7_9_common.jtag_info;
jtag_set_end_state(TAP_IDLE);
- arm_jtag_scann(jtag_info, 0xf);
- arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+ arm_jtag_scann(jtag_info, 0xf, TAP_IDLE);
+ arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_IDLE);
buf_set_u32(cp15_opcode_buf, 0, 32, cp15_opcode);
buf_set_u32(address_buf, 0, 14, address);
jtag_set_end_state(TAP_IDLE);
- if ((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(jtag_info, 0xf, TAP_IDLE)) != ERROR_OK)
{
return retval;
}
- arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+ arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_IDLE);
fields[0].num_bits = 32;
fields[0].out_value = NULL;
LOG_DEBUG("addr: 0x%x value: %8.8x", address, *value);
#endif
- arm_jtag_set_instr(jtag_info, 0xc, NULL);
+ arm_jtag_set_instr(jtag_info, 0xc, NULL, TAP_IDLE);
return ERROR_OK;
}
buf_set_u32(value_buf, 0, 32, value);
jtag_set_end_state(TAP_IDLE);
- if ((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(jtag_info, 0xf, TAP_IDLE)) != ERROR_OK)
{
return retval;
}
- arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+ arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_IDLE);
fields[0].num_bits = 32;
fields[0].out_value = value_buf;
LOG_DEBUG("addr: 0x%x value: %8.8x", address, value);
#endif
- arm_jtag_set_instr(jtag_info, 0xf, NULL);
+ arm_jtag_set_instr(jtag_info, 0xf, NULL, TAP_IDLE);
return ERROR_OK;
}
uint8_t nr_w_buf = 0;
jtag_set_end_state(TAP_IDLE);
- if ((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(jtag_info, 0xf, TAP_IDLE)) != ERROR_OK)
{
return retval;
}
- arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+ arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_IDLE);
fields[0].num_bits = 32;
/* REVISIT: table 7-2 shows that bits 31-31 need to be
buf_set_u32(value_buf, 0, 32, value);
jtag_set_end_state(TAP_IDLE);
- if ((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(jtag_info, 0xf, TAP_IDLE)) != ERROR_OK)
{
return retval;
}
- arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+ arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_IDLE);
fields[0].num_bits = 32;
fields[0].out_value = value_buf;
fields[2].out_value = NULL;
fields[2].in_value = instructionbus;
- if ((retval = arm_jtag_scann(&arm7_9->jtag_info, 0x1)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(&arm7_9->jtag_info, 0x1, TAP_DRPAUSE)) != ERROR_OK)
{
return retval;
}
- arm_jtag_set_instr(&arm7_9->jtag_info, arm7_9->jtag_info.intest_instr, NULL);
+ arm_jtag_set_instr(&arm7_9->jtag_info, arm7_9->jtag_info.intest_instr, NULL, TAP_DRPAUSE);
jtag_add_dr_scan(arm7_9->jtag_info.tap, 3, fields, TAP_DRPAUSE);
if ((retval = jtag_execute_queue()) != ERROR_OK)
buf_set_u32(&sysspeed_buf, 2, 1, 1);
jtag_set_end_state(TAP_DRPAUSE);
- if ((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(jtag_info, 0x1, TAP_DRPAUSE)) != ERROR_OK)
{
return retval;
}
- arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+ arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_DRPAUSE);
fields[0].num_bits = 32;
fields[0].out_value = out_buf;
struct scan_field fields[3];
jtag_set_end_state(TAP_DRPAUSE);
- if ((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(jtag_info, 0x1, TAP_DRPAUSE)) != ERROR_OK)
{
return retval;
}
- arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+ arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_DRPAUSE);
fields[0].num_bits = 32;
fields[0].out_value = NULL;
struct scan_field fields[3];
jtag_set_end_state(TAP_DRPAUSE);
- if ((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK)
+ if ((retval = arm_jtag_scann(jtag_info, 0x1, TAP_DRPAUSE)) != ERROR_OK)
{
return retval;
}
- arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+ arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_DRPAUSE);
fields[0].num_bits = 32;
fields[0].out_value = NULL;
#define _ARM_JTAG_SCAN_N_CHECK_
#endif
-int arm_jtag_set_instr_inner(struct arm_jtag *jtag_info, uint32_t new_instr, void *no_verify_capture)
+int arm_jtag_set_instr_inner(struct arm_jtag *jtag_info, uint32_t new_instr, void *no_verify_capture, tap_state_t end_state)
{
struct jtag_tap *tap;
tap = jtag_info->tap;
if (no_verify_capture == NULL)
{
- jtag_add_ir_scan(tap, &field, jtag_get_end_state());
+ jtag_add_ir_scan(tap, &field, end_state);
} else
{
/* FIX!!!! this is a kludge!!! arm926ejs.c should reimplement this arm_jtag_set_instr to
* have special verification code.
*/
- jtag_add_ir_scan_noverify(tap, &field, jtag_get_end_state());
+ jtag_add_ir_scan_noverify(tap, &field, end_state);
}
return ERROR_OK;
}
-int arm_jtag_scann_inner(struct arm_jtag *jtag_info, uint32_t new_scan_chain)
+int arm_jtag_scann_inner(struct arm_jtag *jtag_info, uint32_t new_scan_chain, tap_state_t end_state)
{
int retval = ERROR_OK;
uint32_t values[1];
values[0]=new_scan_chain;
num_bits[0]=jtag_info->scann_size;
- if ((retval = arm_jtag_set_instr(jtag_info, jtag_info->scann_instr, NULL)) != ERROR_OK)
+ if ((retval = arm_jtag_set_instr(jtag_info, jtag_info->scann_instr, NULL, end_state)) != ERROR_OK)
{
return retval;
}
1,
num_bits,
values,
- jtag_get_end_state());
+ end_state);
jtag_info->cur_scan_chain = new_scan_chain;
* Copyright (C) 2005 by Dominic Rath *
* Dominic.Rath@gmx.de *
* *
- * Copyright (C) 2007,2008 Øyvind Harboe *
+ * Copyright (C) 2007-2010 Øyvind Harboe *
* oyvind.harboe@zylin.com *
* *
* This program is free software; you can redistribute it and/or modify *
uint32_t intest_instr;
};
-int arm_jtag_set_instr_inner(struct arm_jtag *jtag_info, uint32_t new_instr, void *no_verify_capture);
+int arm_jtag_set_instr_inner(struct arm_jtag *jtag_info, uint32_t new_instr,
+ void *no_verify_capture,
+ tap_state_t end_state);
static inline int arm_jtag_set_instr(struct arm_jtag *jtag_info,
- uint32_t new_instr, void *no_verify_capture)
+ uint32_t new_instr, void *no_verify_capture, tap_state_t end_state)
{
/* inline most common code path */
struct jtag_tap *tap;
if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != new_instr)
{
- return arm_jtag_set_instr_inner(jtag_info, new_instr, no_verify_capture);
+ return arm_jtag_set_instr_inner(jtag_info, new_instr, no_verify_capture, end_state);
}
return ERROR_OK;
}
-int arm_jtag_scann_inner(struct arm_jtag *jtag_info, uint32_t new_scan_chain);
-static inline int arm_jtag_scann(struct arm_jtag *jtag_info, uint32_t new_scan_chain)
+int arm_jtag_scann_inner(struct arm_jtag *jtag_info, uint32_t new_scan_chain, tap_state_t end_state);
+static inline int arm_jtag_scann(struct arm_jtag *jtag_info, uint32_t new_scan_chain, tap_state_t end_state)
{
/* inline most common code path */
int retval = ERROR_OK;
if (jtag_info->cur_scan_chain != new_scan_chain)
{
- return arm_jtag_scann_inner(jtag_info, new_scan_chain);
+ return arm_jtag_scann_inner(jtag_info, new_scan_chain, end_state);
}
return retval;
uint8_t field2_out[1];
jtag_set_end_state(TAP_IDLE);
- arm_jtag_scann(ice_reg->jtag_info, 0x2);
+ arm_jtag_scann(ice_reg->jtag_info, 0x2, TAP_IDLE);
- arm_jtag_set_instr(ice_reg->jtag_info, ice_reg->jtag_info->intest_instr, NULL);
+ arm_jtag_set_instr(ice_reg->jtag_info, ice_reg->jtag_info->intest_instr, NULL, TAP_IDLE);
/* bits 31:0 -- data (ignored here) */
fields[0].num_bits = 32;
uint8_t field2_out[1];
jtag_set_end_state(TAP_IDLE);
- arm_jtag_scann(jtag_info, 0x2);
- arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+ arm_jtag_scann(jtag_info, 0x2, TAP_IDLE);
+ arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_IDLE);
fields[0].num_bits = 32;
fields[0].out_value = NULL;
LOG_DEBUG("%i: 0x%8.8" PRIx32 "", ice_reg->addr, value);
jtag_set_end_state(TAP_IDLE);
- arm_jtag_scann(ice_reg->jtag_info, 0x2);
+ arm_jtag_scann(ice_reg->jtag_info, 0x2, TAP_IDLE);
- arm_jtag_set_instr(ice_reg->jtag_info, ice_reg->jtag_info->intest_instr, NULL);
+ arm_jtag_set_instr(ice_reg->jtag_info, ice_reg->jtag_info->intest_instr, NULL, TAP_IDLE);
uint8_t reg_addr = ice_reg->addr & 0x1f;
embeddedice_write_reg_inner(ice_reg->jtag_info->tap, reg_addr, value);
uint8_t field2_out[1];
jtag_set_end_state(TAP_IDLE);
- arm_jtag_scann(jtag_info, 0x2);
- arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+ arm_jtag_scann(jtag_info, 0x2, TAP_IDLE);
+ arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_IDLE);
fields[0].num_bits = 32;
fields[0].out_value = field0_out;
return ERROR_INVALID_ARGUMENTS;
jtag_set_end_state(TAP_IDLE);
- arm_jtag_scann(jtag_info, 0x2);
- arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+ arm_jtag_scann(jtag_info, 0x2, TAP_IDLE);
+ arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_IDLE);
fields[0].num_bits = 32;
fields[0].out_value = NULL;
LOG_DEBUG("%s (%u)", r->name, reg_addr);
jtag_set_end_state(TAP_IDLE);
- arm_jtag_scann(etm_reg->jtag_info, 0x6);
- arm_jtag_set_instr(etm_reg->jtag_info, etm_reg->jtag_info->intest_instr, NULL);
+ arm_jtag_scann(etm_reg->jtag_info, 0x6, TAP_IDLE);
+ arm_jtag_set_instr(etm_reg->jtag_info, etm_reg->jtag_info->intest_instr, NULL, TAP_IDLE);
fields[0].num_bits = 32;
fields[0].out_value = reg->value;
LOG_DEBUG("%s (%u): 0x%8.8" PRIx32 "", r->name, reg_addr, value);
jtag_set_end_state(TAP_IDLE);
- arm_jtag_scann(etm_reg->jtag_info, 0x6);
- arm_jtag_set_instr(etm_reg->jtag_info, etm_reg->jtag_info->intest_instr, NULL);
+ arm_jtag_scann(etm_reg->jtag_info, 0x6, TAP_IDLE);
+ arm_jtag_set_instr(etm_reg->jtag_info, etm_reg->jtag_info->intest_instr, NULL, TAP_IDLE);
fields[0].num_bits = 32;
uint8_t tmp1[4];
buf_set_u32(instr_buf, 0, 32, flip_u32(instr, 32));
jtag_set_end_state(TAP_DRPAUSE);
- arm_jtag_scann(jtag_info, 0x1);
+ arm_jtag_scann(jtag_info, 0x1, TAP_DRPAUSE);
- arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+ arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_DRPAUSE);
fields[0].num_bits = 32;
fields[0].out_value = out_buf;