Browse Source

jtag: cut down on usage of unintended modification of global end state

jtag_get/set_end_state() is now deprecated.

There were lots of places in the code where the end state was
unintentionally modified.

The big Q is whether there were any places where the intention
was to modify the end state. 0.5 is a long way off, so we'll
get a fair amount of testing.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
tags/v0.5.0-rc1
Øyvind Harboe 12 years ago
parent
commit
36df240cea
24 changed files with 4062 additions and 99 deletions
  1. +13
    -13
      src/flash/nor/str9xpec.c
  2. +3
    -2
      src/jtag/core.c
  3. +5
    -2
      src/jtag/jtag.h
  4. +6
    -6
      src/pld/virtex2.c
  5. +3
    -3
      src/target/adi_v5_jtag.c
  6. +1
    -1
      src/target/arm11_dbgtap.c
  7. +3
    -3
      src/target/arm720t.c
  8. +1
    -1
      src/target/arm7_9_common.c
  9. +6
    -6
      src/target/arm7tdmi.c
  10. +4
    -4
      src/target/arm920t.c
  11. +4
    -4
      src/target/arm926ejs.c
  12. +3
    -3
      src/target/arm966e.c
  13. +8
    -8
      src/target/arm9tdmi.c
  14. +1981
    -0
      src/target/arm_adi_v5.c.orig
  15. +1981
    -0
      src/target/arm_adi_v5.c~
  16. +2
    -3
      src/target/avrt.c
  17. +2
    -4
      src/target/dsp563xx.c
  18. +7
    -7
      src/target/embeddedice.c
  19. +4
    -4
      src/target/etb.c
  20. +3
    -3
      src/target/etm.c
  21. +2
    -2
      src/target/feroceon.c
  22. +2
    -2
      src/target/mips_ejtag.c
  23. +14
    -14
      src/target/xscale.c
  24. +4
    -4
      src/xsvf/xsvf.c

+ 13
- 13
src/flash/nor/str9xpec.c View File

@@ -69,7 +69,7 @@ static uint8_t str9xpec_isc_status(struct jtag_tap *tap)
field.in_value = &status;


jtag_add_dr_scan(tap, 1, &field, jtag_set_end_state(TAP_IDLE));
jtag_add_dr_scan(tap, 1, &field, TAP_IDLE);
jtag_execute_queue();

LOG_DEBUG("status: 0x%2.2x", status);
@@ -156,7 +156,7 @@ static int str9xpec_read_config(struct flash_bank *bank)
field.in_value = str9xpec_info->options;


jtag_add_dr_scan(tap, 1, &field, jtag_set_end_state(TAP_IDLE));
jtag_add_dr_scan(tap, 1, &field, TAP_IDLE);
jtag_execute_queue();

status = str9xpec_isc_status(tap);
@@ -302,7 +302,7 @@ static int str9xpec_blank_check(struct flash_bank *bank, int first, int last)
field.out_value = buffer;
field.in_value = NULL;

jtag_add_dr_scan(tap, 1, &field, jtag_set_end_state(TAP_IDLE));
jtag_add_dr_scan(tap, 1, &field, TAP_IDLE);
jtag_add_sleep(40000);

/* read blank check result */
@@ -406,7 +406,7 @@ static int str9xpec_erase_area(struct flash_bank *bank, int first, int last)
field.out_value = buffer;
field.in_value = NULL;

jtag_add_dr_scan(tap, 1, &field, jtag_set_end_state(TAP_IDLE));
jtag_add_dr_scan(tap, 1, &field, TAP_IDLE);
jtag_execute_queue();

jtag_add_sleep(10);
@@ -466,7 +466,7 @@ static int str9xpec_lock_device(struct flash_bank *bank)
field.out_value = NULL;
field.in_value = &status;

jtag_add_dr_scan(tap, 1, &field, jtag_get_end_state());
jtag_add_dr_scan(tap, 1, &field, TAP_IDLE);
jtag_execute_queue();

} while (!(status & ISC_STATUS_BUSY));
@@ -546,7 +546,7 @@ static int str9xpec_set_address(struct flash_bank *bank, uint8_t sector)
field.out_value = &sector;
field.in_value = NULL;

jtag_add_dr_scan(tap, 1, &field, jtag_get_end_state());
jtag_add_dr_scan(tap, 1, &field, TAP_IRPAUSE);

return ERROR_OK;
}
@@ -631,7 +631,7 @@ static int str9xpec_write(struct flash_bank *bank, uint8_t *buffer,
field.out_value = (buffer + bytes_written);
field.in_value = NULL;

jtag_add_dr_scan(tap, 1, &field, jtag_set_end_state(TAP_IDLE));
jtag_add_dr_scan(tap, 1, &field, TAP_IDLE);

/* small delay before polling */
jtag_add_sleep(50);
@@ -643,7 +643,7 @@ static int str9xpec_write(struct flash_bank *bank, uint8_t *buffer,
field.out_value = NULL;
field.in_value = scanbuf;

jtag_add_dr_scan(tap, 1, &field, jtag_get_end_state());
jtag_add_dr_scan(tap, 1, &field, TAP_IRPAUSE);
jtag_execute_queue();

status = buf_get_u32(scanbuf, 0, 8);
@@ -679,7 +679,7 @@ static int str9xpec_write(struct flash_bank *bank, uint8_t *buffer,
field.out_value = last_dword;
field.in_value = NULL;

jtag_add_dr_scan(tap, 1, &field, jtag_set_end_state(TAP_IDLE));
jtag_add_dr_scan(tap, 1, &field, TAP_IDLE);

/* small delay before polling */
jtag_add_sleep(50);
@@ -691,7 +691,7 @@ static int str9xpec_write(struct flash_bank *bank, uint8_t *buffer,
field.out_value = NULL;
field.in_value = scanbuf;

jtag_add_dr_scan(tap, 1, &field, jtag_get_end_state());
jtag_add_dr_scan(tap, 1, &field, TAP_IRPAUSE);
jtag_execute_queue();

status = buf_get_u32(scanbuf, 0, 8);
@@ -744,7 +744,7 @@ COMMAND_HANDLER(str9xpec_handle_part_id_command)
field.out_value = NULL;
field.in_value = buffer;

jtag_add_dr_scan(tap, 1, &field, jtag_set_end_state(TAP_IDLE));
jtag_add_dr_scan(tap, 1, &field, TAP_IDLE);
jtag_execute_queue();

idcode = buf_get_u32(buffer, 0, 32);
@@ -860,7 +860,7 @@ static int str9xpec_write_options(struct flash_bank *bank)
field.out_value = str9xpec_info->options;
field.in_value = NULL;

jtag_add_dr_scan(tap, 1, &field, jtag_set_end_state(TAP_IDLE));
jtag_add_dr_scan(tap, 1, &field, TAP_IDLE);

/* small delay before polling */
jtag_add_sleep(50);
@@ -872,7 +872,7 @@ static int str9xpec_write_options(struct flash_bank *bank)
field.out_value = NULL;
field.in_value = &status;

jtag_add_dr_scan(tap, 1, &field, jtag_get_end_state());
jtag_add_dr_scan(tap, 1, &field, TAP_IRPAUSE);
jtag_execute_queue();

} while (!(status & ISC_STATUS_BUSY));


+ 3
- 2
src/jtag/core.c View File

@@ -743,7 +743,8 @@ void jtag_add_reset(int req_tlr_or_trst, int req_srst)
}
}

tap_state_t jtag_set_end_state(tap_state_t state)
/* DEPRECATED! store such global state outside JTAG layer */
void jtag_set_end_state(tap_state_t state)
{
if ((state == TAP_DRSHIFT)||(state == TAP_IRSHIFT))
{
@@ -752,9 +753,9 @@ tap_state_t jtag_set_end_state(tap_state_t state)

if (state != TAP_INVALID)
cmd_queue_end_state = state;
return cmd_queue_end_state;
}

/* DEPRECATED! store such global state outside JTAG layer */
tap_state_t jtag_get_end_state(void)
{
return cmd_queue_end_state;


+ 5
- 2
src/jtag/jtag.h View File

@@ -552,15 +552,18 @@ void jtag_add_reset(int req_tlr_or_trst, int srst);


/**
* DEPRECATED! store such global state outside JTAG layer
*
* Function jtag_set_end_state
*
* Set a global variable to \a state if \a state != TAP_INVALID.
*
* Return the value of the global variable.
*/
tap_state_t jtag_set_end_state(tap_state_t state);
void jtag_set_end_state(tap_state_t state);

/**
* DEPRECATED! store such global state outside JTAG layer
*
* Function jtag_get_end_state
*
* Return the value of the global variable for end state


+ 6
- 6
src/pld/virtex2.c View File

@@ -40,7 +40,7 @@ static int virtex2_set_instr(struct jtag_tap *tap, uint32_t new_instr)
buf_set_u32(field.out_value, 0, field.num_bits, new_instr);
field.in_value = NULL;

jtag_add_ir_scan(tap, &field, jtag_set_end_state(TAP_IDLE));
jtag_add_ir_scan(tap, &field, TAP_IDLE);

free(field.out_value);
}
@@ -67,7 +67,7 @@ static int virtex2_send_32(struct pld_device *pld_device,

virtex2_set_instr(virtex2_info->tap, 0x5); /* CFG_IN */

jtag_add_dr_scan(virtex2_info->tap, 1, &scan_field, jtag_set_end_state(TAP_DRPAUSE));
jtag_add_dr_scan(virtex2_info->tap, 1, &scan_field, TAP_DRPAUSE);

free(values);

@@ -96,7 +96,7 @@ static int virtex2_receive_32(struct pld_device *pld_device,
{
scan_field.in_value = (uint8_t *)words;

jtag_add_dr_scan(virtex2_info->tap, 1, &scan_field, jtag_set_end_state(TAP_DRPAUSE));
jtag_add_dr_scan(virtex2_info->tap, 1, &scan_field, TAP_DRPAUSE);

jtag_add_callback(virtexflip32, (jtag_callback_data_t)words);

@@ -155,18 +155,18 @@ static int virtex2_load(struct pld_device *pld_device, const char *filename)
field.num_bits = bit_file.length * 8;
field.out_value = bit_file.data;

jtag_add_dr_scan(virtex2_info->tap, 1, &field, jtag_set_end_state(TAP_DRPAUSE));
jtag_add_dr_scan(virtex2_info->tap, 1, &field, TAP_DRPAUSE);
jtag_execute_queue();

jtag_add_tlr();

jtag_set_end_state(TAP_IDLE);
virtex2_set_instr(virtex2_info->tap, 0xc); /* JSTART */
jtag_add_runtest(13, jtag_set_end_state(TAP_IDLE));
jtag_add_runtest(13, TAP_IDLE);
virtex2_set_instr(virtex2_info->tap, 0x3f); /* BYPASS */
virtex2_set_instr(virtex2_info->tap, 0x3f); /* BYPASS */
virtex2_set_instr(virtex2_info->tap, 0xc); /* JSTART */
jtag_add_runtest(13, jtag_set_end_state(TAP_IDLE));
jtag_add_runtest(13, TAP_IDLE);
virtex2_set_instr(virtex2_info->tap, 0x3f); /* BYPASS */
jtag_execute_queue();



+ 3
- 3
src/target/adi_v5_jtag.c View File

@@ -107,7 +107,7 @@ int adi_jtag_dp_scan(struct adiv5_dap *swjdp,
fields[1].out_value = outvalue;
fields[1].in_value = invalue;

jtag_add_dr_scan(jtag_info->tap, 2, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 2, fields, TAP_IDLE);

/* Add specified number of tck clocks after starting memory bus
* access, giving the hardware time to complete the access.
@@ -119,7 +119,7 @@ int adi_jtag_dp_scan(struct adiv5_dap *swjdp,
|| ((reg_addr & 0xF0) == AP_REG_BD0))
&& (swjdp->memaccess_tck != 0))
jtag_add_runtest(swjdp->memaccess_tck,
jtag_set_end_state(TAP_IDLE));
TAP_IDLE);

return jtag_get_error();
}
@@ -341,7 +341,7 @@ static int jtag_idcode_q_read(struct adiv5_dap *dap,
fields[0].out_value = NULL;
fields[0].in_value = (void *) data;

jtag_add_dr_scan(jtag_info->tap, 1, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 1, fields, TAP_IDLE);
retval = jtag_get_error();
if (retval != ERROR_OK)
return retval;


+ 1
- 1
src/target/arm11_dbgtap.c View File

@@ -482,7 +482,7 @@ int arm11_run_instr_data_to_core(struct arm11_common * arm11, uint32_t opcode, u
{
Data = *data;

arm11_add_dr_scan_vc(arm11->arm.target->tap, ARRAY_SIZE(chain5_fields), chain5_fields, jtag_set_end_state(TAP_IDLE));
arm11_add_dr_scan_vc(arm11->arm.target->tap, ARRAY_SIZE(chain5_fields), chain5_fields, TAP_IDLE);

CHECK_RETVAL(jtag_execute_queue());



+ 3
- 3
src/target/arm720t.c View File

@@ -75,15 +75,15 @@ static int arm720t_scan_cp15(struct target *target,
if (in)
{
fields[1].in_value = (uint8_t *)in;
jtag_add_dr_scan(jtag_info->tap, 2, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 2, fields, TAP_DRPAUSE);
jtag_add_callback(arm7flip32, (jtag_callback_data_t)in);
} else
{
jtag_add_dr_scan(jtag_info->tap, 2, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 2, fields, TAP_DRPAUSE);
}

if (clock)
jtag_add_runtest(0, jtag_get_end_state());
jtag_add_runtest(0, TAP_DRPAUSE);

#ifdef _DEBUG_INSTRUCTION_EXECUTION_
if ((retval = jtag_execute_queue()) != ERROR_OK)


+ 1
- 1
src/target/arm7_9_common.c View File

@@ -1750,7 +1750,7 @@ int arm7_9_restart_core(struct target *target)
}
arm_jtag_set_instr(jtag_info, 0x4, NULL);

jtag_add_runtest(1, jtag_set_end_state(TAP_IDLE));
jtag_add_runtest(1, TAP_IDLE);
return jtag_execute_queue();
}



+ 6
- 6
src/target/arm7tdmi.c View File

@@ -72,7 +72,7 @@ static int arm7tdmi_examine_debug_reason(struct target *target)
}
arm_jtag_set_instr(&arm7_9->jtag_info, arm7_9->jtag_info.intest_instr, NULL);

jtag_add_dr_scan(arm7_9->jtag_info.tap, 2, fields, jtag_set_end_state(TAP_DRPAUSE));
jtag_add_dr_scan(arm7_9->jtag_info.tap, 2, fields, TAP_DRPAUSE);
if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
@@ -83,7 +83,7 @@ static int arm7tdmi_examine_debug_reason(struct target *target)
fields[1].in_value = NULL;
fields[1].out_value = databus;

jtag_add_dr_scan(arm7_9->jtag_info.tap, 2, fields, jtag_set_end_state(TAP_DRPAUSE));
jtag_add_dr_scan(arm7_9->jtag_info.tap, 2, fields, TAP_DRPAUSE);

if (breakpoint & 1)
target->debug_reason = DBG_REASON_WATCHPOINT;
@@ -147,11 +147,11 @@ static int arm7tdmi_clock_data_in(struct arm_jtag *jtag_info, uint32_t *in)
fields[1].out_value = NULL;
fields[1].in_value = (uint8_t *)in;

jtag_add_dr_scan(jtag_info->tap, 2, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 2, fields, TAP_DRPAUSE);

jtag_add_callback(arm7flip32, (jtag_callback_data_t)in);

jtag_add_runtest(0, jtag_get_end_state());
jtag_add_runtest(0, TAP_DRPAUSE);

#ifdef _DEBUG_INSTRUCTION_EXECUTION_
if ((retval = jtag_execute_queue()) != ERROR_OK)
@@ -232,11 +232,11 @@ static int arm7tdmi_clock_data_in_endianness(struct arm_jtag *jtag_info,
fields[1].out_value = NULL;
jtag_alloc_in_value32(&fields[1]);

jtag_add_dr_scan(jtag_info->tap, 2, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 2, fields, TAP_DRPAUSE);

jtag_add_callback4(arm7endianness, (jtag_callback_data_t)in, (jtag_callback_data_t)size, (jtag_callback_data_t)be, (jtag_callback_data_t)fields[1].in_value);

jtag_add_runtest(0, jtag_get_end_state());
jtag_add_runtest(0, TAP_DRPAUSE);

#ifdef _DEBUG_INSTRUCTION_EXECUTION_
{


+ 4
- 4
src/target/arm920t.c View File

@@ -111,11 +111,11 @@ static int arm920t_read_cp15_physical(struct target *target,
fields[3].out_value = &nr_w_buf;
fields[3].in_value = NULL;

jtag_add_dr_scan(jtag_info->tap, 4, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 4, fields, TAP_IDLE);

fields[1].in_value = (uint8_t *)value;

jtag_add_dr_scan(jtag_info->tap, 4, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 4, fields, TAP_IDLE);

jtag_add_callback(arm_le_to_h_u32, (jtag_callback_data_t)value);

@@ -162,7 +162,7 @@ static int arm920t_write_cp15_physical(struct target *target,
fields[3].out_value = &nr_w_buf;
fields[3].in_value = NULL;

jtag_add_dr_scan(jtag_info->tap, 4, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 4, fields, TAP_IDLE);

#ifdef _DEBUG_INSTRUCTION_EXECUTION_
LOG_DEBUG("addr: 0x%x value: %8.8x", reg_addr, value);
@@ -214,7 +214,7 @@ static int arm920t_execute_cp15(struct target *target, uint32_t cp15_opcode,
fields[3].out_value = &nr_w_buf;
fields[3].in_value = NULL;

jtag_add_dr_scan(jtag_info->tap, 4, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 4, fields, TAP_IDLE);

arm9tdmi_clock_out(jtag_info, arm_opcode, 0, NULL, 0);
arm9tdmi_clock_out(jtag_info, ARMV4_5_NOP, 0, NULL, 1);


+ 4
- 4
src/target/arm926ejs.c View File

@@ -86,7 +86,7 @@ static int arm926ejs_cp15_read(struct target *target, uint32_t op1, uint32_t op2
fields[3].out_value = &nr_w_buf;
fields[3].in_value = NULL;

jtag_add_dr_scan(jtag_info->tap, 4, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 4, fields, TAP_IDLE);

long long then = timeval_ms();

@@ -95,7 +95,7 @@ static int arm926ejs_cp15_read(struct target *target, uint32_t op1, uint32_t op2
/* rescan with NOP, to wait for the access to complete */
access = 0;
nr_w_buf = 0;
jtag_add_dr_scan(jtag_info->tap, 4, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 4, fields, TAP_IDLE);

jtag_add_callback(arm_le_to_h_u32, (jtag_callback_data_t)value);

@@ -175,7 +175,7 @@ static int arm926ejs_cp15_write(struct target *target, uint32_t op1, uint32_t op
fields[3].out_value = &nr_w_buf;
fields[3].in_value = NULL;

jtag_add_dr_scan(jtag_info->tap, 4, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 4, fields, TAP_IDLE);

long long then = timeval_ms();

@@ -184,7 +184,7 @@ static int arm926ejs_cp15_write(struct target *target, uint32_t op1, uint32_t op
/* rescan with NOP, to wait for the access to complete */
access = 0;
nr_w_buf = 0;
jtag_add_dr_scan(jtag_info->tap, 4, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 4, fields, TAP_IDLE);
if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;


+ 3
- 3
src/target/arm966e.c View File

@@ -106,11 +106,11 @@ static int arm966e_read_cp15(struct target *target, int reg_addr, uint32_t *valu
fields[2].out_value = &nr_w_buf;
fields[2].in_value = NULL;

jtag_add_dr_scan(jtag_info->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);

fields[1].in_value = (uint8_t *)value;

jtag_add_dr_scan(jtag_info->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);

jtag_add_callback(arm_le_to_h_u32, (jtag_callback_data_t)value);

@@ -158,7 +158,7 @@ int arm966e_write_cp15(struct target *target, int reg_addr, uint32_t value)
fields[2].out_value = &nr_w_buf;
fields[2].in_value = NULL;

jtag_add_dr_scan(jtag_info->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);

#ifdef _DEBUG_INSTRUCTION_EXECUTION_
LOG_DEBUG("addr: 0x%x value: %8.8x", reg_addr, value);


+ 8
- 8
src/target/arm9tdmi.c View File

@@ -107,7 +107,7 @@ int arm9tdmi_examine_debug_reason(struct target *target)
}
arm_jtag_set_instr(&arm7_9->jtag_info, arm7_9->jtag_info.intest_instr, NULL);

jtag_add_dr_scan(arm7_9->jtag_info.tap, 3, fields, jtag_set_end_state(TAP_DRPAUSE));
jtag_add_dr_scan(arm7_9->jtag_info.tap, 3, fields, TAP_DRPAUSE);
if ((retval = jtag_execute_queue()) != ERROR_OK)
{
return retval;
@@ -120,7 +120,7 @@ int arm9tdmi_examine_debug_reason(struct target *target)
fields[2].in_value = NULL;
fields[2].out_value = instructionbus;

jtag_add_dr_scan(arm7_9->jtag_info.tap, 3, fields, jtag_set_end_state(TAP_DRPAUSE));
jtag_add_dr_scan(arm7_9->jtag_info.tap, 3, fields, TAP_DRPAUSE);

if (debug_reason & 0x4)
if (debug_reason & 0x2)
@@ -177,13 +177,13 @@ int arm9tdmi_clock_out(struct arm_jtag *jtag_info, uint32_t instr,
if (in)
{
fields[0].in_value = (uint8_t *)in;
jtag_add_dr_scan(jtag_info->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_DRPAUSE);

jtag_add_callback(arm_le_to_h_u32, (jtag_callback_data_t)in);
}
else
{
jtag_add_dr_scan(jtag_info->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_DRPAUSE);
}

jtag_add_runtest(0, jtag_get_end_state());
@@ -233,11 +233,11 @@ int arm9tdmi_clock_data_in(struct arm_jtag *jtag_info, uint32_t *in)
fields[2].out_value = NULL;
fields[2].in_value = NULL;

jtag_add_dr_scan(jtag_info->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_DRPAUSE);

jtag_add_callback(arm_le_to_h_u32, (jtag_callback_data_t)in);

jtag_add_runtest(0, jtag_get_end_state());
jtag_add_runtest(0, TAP_DRPAUSE);

#ifdef _DEBUG_INSTRUCTION_EXECUTION_
{
@@ -300,11 +300,11 @@ int arm9tdmi_clock_data_in_endianness(struct arm_jtag *jtag_info,
fields[2].out_value = NULL;
fields[2].in_value = NULL;

jtag_add_dr_scan(jtag_info->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_DRPAUSE);

jtag_add_callback4(arm9endianness, (jtag_callback_data_t)in, (jtag_callback_data_t)size, (jtag_callback_data_t)be, (jtag_callback_data_t)fields[0].in_value);

jtag_add_runtest(0, jtag_get_end_state());
jtag_add_runtest(0, TAP_DRPAUSE);

#ifdef _DEBUG_INSTRUCTION_EXECUTION_
{


+ 1981
- 0
src/target/arm_adi_v5.c.orig
File diff suppressed because it is too large
View File


+ 1981
- 0
src/target/arm_adi_v5.c~
File diff suppressed because it is too large
View File


+ 2
- 3
src/target/avrt.c View File

@@ -190,8 +190,7 @@ int mcu_write_ir(struct jtag_tap *tap, uint8_t *ir_in, uint8_t *ir_out, int ir_l
}

{
jtag_add_plain_ir_scan(tap->ir_length, ir_out, ir_in,
jtag_set_end_state(TAP_IDLE));
jtag_add_plain_ir_scan(tap->ir_length, ir_out, ir_in, TAP_IDLE);
}

return ERROR_OK;
@@ -206,7 +205,7 @@ int mcu_write_dr(struct jtag_tap *tap, uint8_t *dr_in, uint8_t *dr_out, int dr_l
}

{
jtag_add_plain_dr_scan(dr_len, dr_out, dr_in, jtag_set_end_state(TAP_IDLE));
jtag_add_plain_dr_scan(dr_len, dr_out, dr_in, TAP_IDLE);
}

return ERROR_OK;


+ 2
- 4
src/target/dsp563xx.c View File

@@ -863,8 +863,7 @@ int dsp563xx_write_ir(struct jtag_tap *tap, uint8_t * ir_in, uint8_t * ir_out,
}

{
jtag_add_plain_ir_scan(tap->ir_length, ir_out, ir_in,
jtag_set_end_state(TAP_IDLE));
jtag_add_plain_ir_scan(tap->ir_length, ir_out, ir_in, TAP_IDLE);
}

return ERROR_OK;
@@ -880,8 +879,7 @@ int dsp563xx_write_dr(struct jtag_tap *tap, uint8_t * dr_in, uint8_t * dr_out,
}

{
jtag_add_plain_dr_scan(dr_len, dr_out, dr_in,
jtag_set_end_state(TAP_IDLE));
jtag_add_plain_dr_scan(dr_len, dr_out, dr_in, TAP_IDLE);
}

return ERROR_OK;


+ 7
- 7
src/target/embeddedice.c View File

@@ -372,7 +372,7 @@ int embeddedice_read_reg_w_check(struct reg *reg,
fields[2].check_mask = NULL;

/* traverse Update-DR, setting address for the next read */
jtag_add_dr_scan(ice_reg->jtag_info->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(ice_reg->jtag_info->tap, 3, fields, TAP_IDLE);

/* bits 31:0 -- the data we're reading (and maybe checking) */
fields[0].in_value = reg->value;
@@ -386,7 +386,7 @@ int embeddedice_read_reg_w_check(struct reg *reg,
fields[1].out_value[0] = eice_regs[EICE_COMMS_CTRL].addr;

/* traverse Update-DR, reading but with no other side effects */
jtag_add_dr_scan_check(ice_reg->jtag_info->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan_check(ice_reg->jtag_info->tap, 3, fields, TAP_IDLE);

return ERROR_OK;
}
@@ -423,7 +423,7 @@ int embeddedice_receive(struct arm_jtag *jtag_info, uint32_t *data, uint32_t siz
fields[2].out_value[0] = 0;
fields[2].in_value = NULL;

jtag_add_dr_scan(jtag_info->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);

while (size > 0)
{
@@ -434,7 +434,7 @@ int embeddedice_receive(struct arm_jtag *jtag_info, uint32_t *data, uint32_t siz
fields[1].out_value[0] = eice_regs[EICE_COMMS_CTRL].addr;

fields[0].in_value = (uint8_t *)data;
jtag_add_dr_scan(jtag_info->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);
jtag_add_callback(arm_le_to_h_u32, (jtag_callback_data_t)data);

data++;
@@ -545,7 +545,7 @@ int embeddedice_send(struct arm_jtag *jtag_info, uint32_t *data, uint32_t size)
while (size > 0)
{
buf_set_u32(fields[0].out_value, 0, 32, *data);
jtag_add_dr_scan(jtag_info->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);

data++;
size--;
@@ -594,10 +594,10 @@ int embeddedice_handshake(struct arm_jtag *jtag_info, int hsbit, uint32_t timeou
fields[2].out_value[0] = 0;
fields[2].in_value = NULL;

jtag_add_dr_scan(jtag_info->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);
gettimeofday(&lap, NULL);
do {
jtag_add_dr_scan(jtag_info->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);
if ((retval = jtag_execute_queue()) != ERROR_OK)
return retval;



+ 4
- 4
src/target/etb.c View File

@@ -191,7 +191,7 @@ static int etb_read_ram(struct etb *etb, uint32_t *data, int num_frames)
buf_set_u32(fields[2].out_value, 0, 1, 0);
fields[2].in_value = NULL;

jtag_add_dr_scan(etb->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(etb->tap, 3, fields, TAP_IDLE);

for (i = 0; i < num_frames; i++)
{
@@ -205,7 +205,7 @@ static int etb_read_ram(struct etb *etb, uint32_t *data, int num_frames)
buf_set_u32(fields[1].out_value, 0, 7, 0);

fields[0].in_value = (uint8_t *)(data + i);
jtag_add_dr_scan(etb->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(etb->tap, 3, fields, TAP_IDLE);

jtag_add_callback(etb_getbuf, (jtag_callback_data_t)(data + i));
}
@@ -251,7 +251,7 @@ static int etb_read_reg_w_check(struct reg *reg,
fields[2].check_value = NULL;
fields[2].check_mask = NULL;

jtag_add_dr_scan(etb_reg->etb->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(etb_reg->etb->tap, 3, fields, TAP_IDLE);

/* read the identification register in the second run, to make sure we
* don't read the ETB data register twice, skipping every second entry
@@ -261,7 +261,7 @@ static int etb_read_reg_w_check(struct reg *reg,
fields[0].check_value = check_value;
fields[0].check_mask = check_mask;

jtag_add_dr_scan_check(etb_reg->etb->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan_check(etb_reg->etb->tap, 3, fields, TAP_IDLE);

free(fields[1].out_value);
free(fields[2].out_value);


+ 3
- 3
src/target/etm.c View File

@@ -528,13 +528,13 @@ static int etm_read_reg_w_check(struct reg *reg,
fields[2].check_value = NULL;
fields[2].check_mask = NULL;

jtag_add_dr_scan(etm_reg->jtag_info->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(etm_reg->jtag_info->tap, 3, fields, TAP_IDLE);

fields[0].in_value = reg->value;
fields[0].check_value = check_value;
fields[0].check_mask = check_mask;

jtag_add_dr_scan_check(etm_reg->jtag_info->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan_check(etm_reg->jtag_info->tap, 3, fields, TAP_IDLE);

free(fields[1].out_value);
free(fields[2].out_value);
@@ -609,7 +609,7 @@ static int etm_write_reg(struct reg *reg, uint32_t value)
buf_set_u32(fields[2].out_value, 0, 1, 1);
fields[2].in_value = NULL;

jtag_add_dr_scan(etm_reg->jtag_info->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(etm_reg->jtag_info->tap, 3, fields, TAP_IDLE);

return ERROR_OK;
}


+ 2
- 2
src/target/feroceon.c View File

@@ -101,9 +101,9 @@ int feroceon_dummy_clock_out(struct arm_jtag *jtag_info, uint32_t instr)
fields[2].out_value = instr_buf;
fields[2].in_value = NULL;

jtag_add_dr_scan(jtag_info->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_DRPAUSE);

/* no jtag_add_runtest(0, jtag_get_end_state()) here */
/* no jtag_add_runtest(0, TAP_DRPAUSE) here */

return ERROR_OK;
}


+ 2
- 2
src/target/mips_ejtag.c View File

@@ -64,7 +64,7 @@ int mips_ejtag_get_idcode(struct mips_ejtag *ejtag_info, uint32_t *idcode)
field.out_value = NULL;
field.in_value = (void*)idcode;

jtag_add_dr_scan(ejtag_info->tap, 1, &field, jtag_get_end_state());
jtag_add_dr_scan(ejtag_info->tap, 1, &field, TAP_IDLE);

if (jtag_execute_queue() != ERROR_OK)
{
@@ -86,7 +86,7 @@ int mips_ejtag_get_impcode(struct mips_ejtag *ejtag_info, uint32_t *impcode)
field.out_value = NULL;
field.in_value = (void*)impcode;

jtag_add_dr_scan(ejtag_info->tap, 1, &field, jtag_get_end_state());
jtag_add_dr_scan(ejtag_info->tap, 1, &field, TAP_IDLE);

if (jtag_execute_queue() != ERROR_OK)
{


+ 14
- 14
src/target/xscale.c View File

@@ -213,7 +213,7 @@ static int xscale_read_dcsr(struct target *target)
uint8_t tmp2;
fields[2].in_value = &tmp2;

jtag_add_dr_scan(target->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(target->tap, 3, fields, TAP_DRPAUSE);

jtag_check_value_mask(fields + 0, &field0_check_value, &field0_check_mask);
jtag_check_value_mask(fields + 2, &field2_check_value, &field2_check_mask);
@@ -236,7 +236,7 @@ static int xscale_read_dcsr(struct target *target)

jtag_set_end_state(TAP_IDLE);

jtag_add_dr_scan(target->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(target->tap, 3, fields, TAP_DRPAUSE);

/* DANGER!!! this must be here. It will make sure that the arguments
* to jtag_set_check_value() does not go out of scope! */
@@ -288,7 +288,7 @@ static int xscale_receive(struct target *target, uint32_t *buffer, int num_words
jtag_set_end_state(TAP_IDLE);
xscale_jtag_set_instr(target->tap,
XSCALE_DBGTX << xscale->xscale_variant);
jtag_add_runtest(1, jtag_get_end_state()); /* ensures that we're in the TAP_IDLE state as the above could be a no-op */
jtag_add_runtest(1, TAP_IDLE); /* ensures that we're in the TAP_IDLE state as the above could be a no-op */

/* repeat until all words have been collected */
int attempts = 0;
@@ -304,7 +304,7 @@ static int xscale_receive(struct target *target, uint32_t *buffer, int num_words

fields[1].in_value = (uint8_t *)(field1 + i);

jtag_add_dr_scan_check(target->tap, 3, fields, jtag_set_end_state(TAP_IDLE));
jtag_add_dr_scan_check(target->tap, 3, fields, TAP_IDLE);

jtag_add_callback(xscale_getbuf, (jtag_callback_data_t)(field1 + i));

@@ -411,7 +411,7 @@ static int xscale_read_tx(struct target *target, int consume)
jtag_add_pathmove(ARRAY_SIZE(noconsume_path), noconsume_path);
}

jtag_add_dr_scan(target->tap, 3, fields, jtag_set_end_state(TAP_IDLE));
jtag_add_dr_scan(target->tap, 3, fields, TAP_IDLE);

jtag_check_value_mask(fields + 0, &field0_check_value, &field0_check_mask);
jtag_check_value_mask(fields + 2, &field2_check_value, &field2_check_mask);
@@ -489,7 +489,7 @@ static int xscale_write_rx(struct target *target)
LOG_DEBUG("polling RX");
for (;;)
{
jtag_add_dr_scan(target->tap, 3, fields, jtag_set_end_state(TAP_IDLE));
jtag_add_dr_scan(target->tap, 3, fields, TAP_IDLE);

jtag_check_value_mask(fields + 0, &field0_check_value, &field0_check_mask);
jtag_check_value_mask(fields + 2, &field2_check_value, &field2_check_mask);
@@ -521,7 +521,7 @@ static int xscale_write_rx(struct target *target)

/* set rx_valid */
field2 = 0x1;
jtag_add_dr_scan(target->tap, 3, fields, jtag_set_end_state(TAP_IDLE));
jtag_add_dr_scan(target->tap, 3, fields, TAP_IDLE);

if ((retval = jtag_execute_queue()) != ERROR_OK)
{
@@ -585,7 +585,7 @@ static int xscale_send(struct target *target, uint8_t *buffer, int count, int si
3,
bits,
t,
jtag_set_end_state(TAP_IDLE));
TAP_IDLE);
buffer += size;
}

@@ -646,7 +646,7 @@ static int xscale_write_dcsr(struct target *target, int hold_rst, int ext_dbg_br
uint8_t tmp2;
fields[2].in_value = &tmp2;

jtag_add_dr_scan(target->tap, 3, fields, jtag_get_end_state());
jtag_add_dr_scan(target->tap, 3, fields, TAP_IDLE);

jtag_check_value_mask(fields + 0, &field0_check_value, &field0_check_mask);
jtag_check_value_mask(fields + 2, &field2_check_value, &field2_check_mask);
@@ -707,7 +707,7 @@ static int xscale_load_ic(struct target *target, uint32_t va, uint32_t buffer[8]
fields[1].num_bits = 27;
fields[1].out_value = packet;

jtag_add_dr_scan(target->tap, 2, fields, jtag_get_end_state());
jtag_add_dr_scan(target->tap, 2, fields, TAP_IDLE);

/* rest of packet is a cacheline: 8 instructions, with parity */
fields[0].num_bits = 32;
@@ -724,7 +724,7 @@ static int xscale_load_ic(struct target *target, uint32_t va, uint32_t buffer[8]
memcpy(&value, packet, sizeof(uint32_t));
cmd = parity(value);

jtag_add_dr_scan(target->tap, 2, fields, jtag_get_end_state());
jtag_add_dr_scan(target->tap, 2, fields, TAP_IDLE);
}

return jtag_execute_queue();
@@ -755,7 +755,7 @@ static int xscale_invalidate_ic_line(struct target *target, uint32_t va)
fields[1].num_bits = 27;
fields[1].out_value = packet;

jtag_add_dr_scan(target->tap, 2, fields, jtag_get_end_state());
jtag_add_dr_scan(target->tap, 2, fields, TAP_IDLE);

return ERROR_OK;
}
@@ -1556,7 +1556,7 @@ static int xscale_deassert_reset(struct target *target)
/* wait 300ms; 150 and 100ms were not enough */
jtag_add_sleep(300*1000);

jtag_add_runtest(2030, jtag_set_end_state(TAP_IDLE));
jtag_add_runtest(2030, TAP_IDLE);
jtag_execute_queue();

/* set Hold reset, Halt mode and Trap Reset */
@@ -1613,7 +1613,7 @@ static int xscale_deassert_reset(struct target *target)
if (retval != ERROR_OK)
return retval;

jtag_add_runtest(30, jtag_set_end_state(TAP_IDLE));
jtag_add_runtest(30, TAP_IDLE);

jtag_add_sleep(100000);



+ 4
- 4
src/xsvf/xsvf.c View File

@@ -482,9 +482,9 @@ COMMAND_HANDLER(handle_xsvf_command)

if (tap == NULL)
jtag_add_plain_dr_scan(field.num_bits, field.out_value, field.in_value,
jtag_set_end_state(TAP_DRPAUSE));
TAP_DRPAUSE);
else
jtag_add_dr_scan(tap, 1, &field, jtag_set_end_state(TAP_DRPAUSE));
jtag_add_dr_scan(tap, 1, &field, TAP_DRPAUSE);

jtag_check_value_mask(&field, dr_in_buf, dr_in_mask);

@@ -939,9 +939,9 @@ COMMAND_HANDLER(handle_xsvf_command)

if (tap == NULL)
jtag_add_plain_dr_scan(field.num_bits, field.out_value, field.in_value,
jtag_set_end_state(TAP_DRPAUSE));
TAP_DRPAUSE);
else
jtag_add_dr_scan(tap, 1, &field, jtag_set_end_state(TAP_DRPAUSE));
jtag_add_dr_scan(tap, 1, &field, TAP_DRPAUSE);

jtag_check_value_mask(&field, dr_in_buf, dr_in_mask);



Loading…
Cancel
Save