make jtag_add_statemove() internal to the driver.
git-svn-id: svn://svn.berlios.de/openocd/trunk@527 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
parent
77d73b2523
commit
a3a3426e86
|
@ -222,7 +222,6 @@ int jtag_speed_post_reset = 0;
|
||||||
|
|
||||||
|
|
||||||
/* forward declarations */
|
/* forward declarations */
|
||||||
void jtag_add_statemove(enum tap_state endstate);
|
|
||||||
void jtag_add_pathmove(int num_states, enum tap_state *path);
|
void jtag_add_pathmove(int num_states, enum tap_state *path);
|
||||||
void jtag_add_runtest(int num_cycles, enum tap_state endstate);
|
void jtag_add_runtest(int num_cycles, enum tap_state endstate);
|
||||||
void jtag_add_reset(int trst, int srst);
|
void jtag_add_reset(int trst, int srst);
|
||||||
|
@ -245,7 +244,6 @@ int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cmd, char
|
||||||
int handle_endstate_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
int handle_endstate_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
||||||
int handle_jtag_reset_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
int handle_jtag_reset_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
||||||
int handle_runtest_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
int handle_runtest_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
||||||
int handle_statemove_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
|
||||||
int handle_irscan_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
int handle_irscan_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
||||||
int handle_drscan_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
int handle_drscan_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
||||||
|
|
||||||
|
@ -777,18 +775,20 @@ int MINIDRIVER(interface_jtag_add_plain_dr_scan)(int num_fields, scan_field_t *f
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
void jtag_add_statemove(enum tap_state state)
|
|
||||||
|
void jtag_add_tms()
|
||||||
{
|
{
|
||||||
jtag_prelude(state);
|
jtag_prelude(TAP_TLR);
|
||||||
|
|
||||||
int retval;
|
int retval;
|
||||||
retval=interface_jtag_add_statemove(cmd_queue_end_state);
|
retval=interface_jtag_add_tms();
|
||||||
if (retval!=ERROR_OK)
|
if (retval!=ERROR_OK)
|
||||||
jtag_error=retval;
|
jtag_error=retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MINIDRIVER(interface_jtag_add_statemove)(enum tap_state state)
|
int MINIDRIVER(interface_jtag_add_tms)()
|
||||||
{
|
{
|
||||||
|
enum tap_state state = TAP_TLR;
|
||||||
jtag_command_t **last_cmd = jtag_get_last_command_p();
|
jtag_command_t **last_cmd = jtag_get_last_command_p();
|
||||||
|
|
||||||
/* allocate memory for a new list member */
|
/* allocate memory for a new list member */
|
||||||
|
@ -943,7 +943,7 @@ void jtag_add_reset(int req_trst, int req_srst)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("JTAG reset with tms instead of TRST");
|
LOG_DEBUG("JTAG reset with tms instead of TRST");
|
||||||
jtag_add_end_state(TAP_TLR);
|
jtag_add_end_state(TAP_TLR);
|
||||||
jtag_add_statemove(TAP_TLR);
|
jtag_add_tms();
|
||||||
jtag_call_event_callbacks(JTAG_TRST_ASSERTED);
|
jtag_call_event_callbacks(JTAG_TRST_ASSERTED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1429,8 +1429,6 @@ int jtag_register_commands(struct command_context_s *cmd_ctx)
|
||||||
COMMAND_EXEC, "toggle reset lines <trst> <srst>");
|
COMMAND_EXEC, "toggle reset lines <trst> <srst>");
|
||||||
register_command(cmd_ctx, NULL, "runtest", handle_runtest_command,
|
register_command(cmd_ctx, NULL, "runtest", handle_runtest_command,
|
||||||
COMMAND_EXEC, "move to Run-Test/Idle, and execute <num_cycles>");
|
COMMAND_EXEC, "move to Run-Test/Idle, and execute <num_cycles>");
|
||||||
register_command(cmd_ctx, NULL, "statemove", handle_statemove_command,
|
|
||||||
COMMAND_EXEC, "move to current endstate or [tap_state]");
|
|
||||||
register_command(cmd_ctx, NULL, "irscan", handle_irscan_command,
|
register_command(cmd_ctx, NULL, "irscan", handle_irscan_command,
|
||||||
COMMAND_EXEC, "execute IR scan <device> <instr> [dev2] [instr2] ...");
|
COMMAND_EXEC, "execute IR scan <device> <instr> [dev2] [instr2] ...");
|
||||||
register_command(cmd_ctx, NULL, "drscan", handle_drscan_command,
|
register_command(cmd_ctx, NULL, "drscan", handle_drscan_command,
|
||||||
|
@ -1477,7 +1475,7 @@ int jtag_init(struct command_context_s *cmd_ctx)
|
||||||
device = device->next;
|
device = device->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
jtag_add_statemove(TAP_TLR);
|
jtag_add_tms();
|
||||||
jtag_execute_queue();
|
jtag_execute_queue();
|
||||||
|
|
||||||
/* examine chain first, as this could discover the real chain layout */
|
/* examine chain first, as this could discover the real chain layout */
|
||||||
|
@ -1837,28 +1835,6 @@ int handle_runtest_command(struct command_context_s *cmd_ctx, char *cmd, char **
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int handle_statemove_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
|
|
||||||
{
|
|
||||||
enum tap_state state;
|
|
||||||
|
|
||||||
state = -1;
|
|
||||||
if (argc == 1)
|
|
||||||
{
|
|
||||||
for (state = 0; state < 16; state++)
|
|
||||||
{
|
|
||||||
if (strcmp(args[0], tap_state_strings[state]) == 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jtag_add_statemove(state);
|
|
||||||
jtag_execute_queue();
|
|
||||||
|
|
||||||
return ERROR_OK;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int handle_irscan_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
|
int handle_irscan_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
|
||||||
{
|
{
|
||||||
|
|
|
@ -249,6 +249,13 @@ extern int jtag_register_commands(struct command_context_s *cmd_ctx);
|
||||||
*
|
*
|
||||||
* TAP_SD and TAP_SI are illegal end states. TAP_SD/SI as end states
|
* TAP_SD and TAP_SI are illegal end states. TAP_SD/SI as end states
|
||||||
* can be emulated by using a larger scan.
|
* can be emulated by using a larger scan.
|
||||||
|
*
|
||||||
|
* Code that is relatively insensitive to the path(as long
|
||||||
|
* as it is JTAG compliant) taken through state machine can use
|
||||||
|
* endstate for jtag_add_xxx_scan(). Otherwise the pause state must be
|
||||||
|
* specified as end state and a subsequent jtag_add_pathmove() must
|
||||||
|
* be issued.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
extern void jtag_add_ir_scan(int num_fields, scan_field_t *fields, enum tap_state endstate);
|
extern void jtag_add_ir_scan(int num_fields, scan_field_t *fields, enum tap_state endstate);
|
||||||
extern int interface_jtag_add_ir_scan(int num_fields, scan_field_t *fields, enum tap_state endstate);
|
extern int interface_jtag_add_ir_scan(int num_fields, scan_field_t *fields, enum tap_state endstate);
|
||||||
|
@ -258,30 +265,24 @@ extern void jtag_add_plain_ir_scan(int num_fields, scan_field_t *fields, enum ta
|
||||||
extern int interface_jtag_add_plain_ir_scan(int num_fields, scan_field_t *fields, enum tap_state endstate);
|
extern int interface_jtag_add_plain_ir_scan(int num_fields, scan_field_t *fields, enum tap_state endstate);
|
||||||
extern void jtag_add_plain_dr_scan(int num_fields, scan_field_t *fields, enum tap_state endstate);
|
extern void jtag_add_plain_dr_scan(int num_fields, scan_field_t *fields, enum tap_state endstate);
|
||||||
extern int interface_jtag_add_plain_dr_scan(int num_fields, scan_field_t *fields, enum tap_state endstate);
|
extern int interface_jtag_add_plain_dr_scan(int num_fields, scan_field_t *fields, enum tap_state endstate);
|
||||||
/* execute a state transition within the JTAG standard, but the exact path
|
/* run a TAP_TLR reset. End state is TAP_TLR, regardless
|
||||||
* path that is taken is undefined. Many implementations use precisely
|
* of start state.
|
||||||
* 7 clocks to perform a transition, but it could be more or less
|
|
||||||
* than that.
|
|
||||||
*
|
|
||||||
* The following assertions are made about certain common state moves:
|
|
||||||
*
|
|
||||||
* - A state move from Pause-[ID]R to Pause-[ID]R should always go through
|
|
||||||
* Update-[ID]R and Capture-[ID]R before returning to Pause-[ID]R, otherwise
|
|
||||||
* there's no way force a register update, if you can't go to Run-Test/Idle for
|
|
||||||
* some reason.
|
|
||||||
*
|
|
||||||
* - A state move from Pause-[ID]R to Shift-[ID]R must not go through
|
|
||||||
* Update-[ID]R.
|
|
||||||
*
|
|
||||||
* - Run-Test/Idle must not be entered unless requested, because R-T/I may have
|
|
||||||
* side effects.
|
|
||||||
*
|
|
||||||
* NB! a jtag_add_statemove() to the current state is not
|
|
||||||
* a no-operation.
|
|
||||||
*/
|
*/
|
||||||
extern void jtag_add_statemove(enum tap_state endstate);
|
extern void jtag_add_tms();
|
||||||
extern int interface_jtag_add_statemove(enum tap_state endstate);
|
extern int interface_jtag_add_tms();
|
||||||
/* A list of unambigious single clock state transitions, not
|
/* Do not use jtag_add_pathmove() unless you need to, but do use it
|
||||||
|
* if you have to.
|
||||||
|
*
|
||||||
|
* DANGER! If the target is dependent upon a particular sequence
|
||||||
|
* of transitions for things to work correctly(e.g. as a workaround
|
||||||
|
* for an errata that contradicts the JTAG standard), then pathmove
|
||||||
|
* must be used, even if some jtag interfaces happen to use the
|
||||||
|
* desired path. Worse, the jtag interface used for testing a
|
||||||
|
* particular implementation, could happen to use the "desired"
|
||||||
|
* path when transitioning to/from end
|
||||||
|
* state.
|
||||||
|
*
|
||||||
|
* A list of unambigious single clock state transitions, not
|
||||||
* all drivers can support this, but it is required for e.g.
|
* all drivers can support this, but it is required for e.g.
|
||||||
* XScale and Xilinx support
|
* XScale and Xilinx support
|
||||||
*
|
*
|
||||||
|
@ -289,6 +290,15 @@ extern int interface_jtag_add_statemove(enum tap_state endstate);
|
||||||
*
|
*
|
||||||
* Note that the first on the list must be reachable
|
* Note that the first on the list must be reachable
|
||||||
* via a single transition from the current state.
|
* via a single transition from the current state.
|
||||||
|
*
|
||||||
|
* All drivers are required to implement jtag_add_pathmove().
|
||||||
|
* However, if the pathmove sequence can not be precisely
|
||||||
|
* executed, an interface_jtag_add_pathmove() or jtag_execute_queue()
|
||||||
|
* must return an error. It is legal, but not recommended, that
|
||||||
|
* a driver returns an error in all cases for a pathmove if it
|
||||||
|
* can only implement a few transitions and therefore
|
||||||
|
* a partial implementation of pathmove would have little practical
|
||||||
|
* application.
|
||||||
*/
|
*/
|
||||||
extern void jtag_add_pathmove(int num_states, enum tap_state *path);
|
extern void jtag_add_pathmove(int num_states, enum tap_state *path);
|
||||||
extern int interface_jtag_add_pathmove(int num_states, enum tap_state *path);
|
extern int interface_jtag_add_pathmove(int num_states, enum tap_state *path);
|
||||||
|
|
|
@ -137,7 +137,7 @@ int virtex2_read_stat(struct pld_device_s *pld_device, u32 *status)
|
||||||
{
|
{
|
||||||
u32 data[5];
|
u32 data[5];
|
||||||
|
|
||||||
jtag_add_statemove(TAP_TLR);
|
jtag_add_tms();
|
||||||
|
|
||||||
data[0] = 0xaa995566; /* synch word */
|
data[0] = 0xaa995566; /* synch word */
|
||||||
data[1] = 0x2800E001; /* Type 1, read, address 7, 1 word */
|
data[1] = 0x2800E001; /* Type 1, read, address 7, 1 word */
|
||||||
|
@ -192,7 +192,7 @@ int virtex2_load(struct pld_device_s *pld_device, char *filename)
|
||||||
jtag_add_dr_scan(1, &field, TAP_PD);
|
jtag_add_dr_scan(1, &field, TAP_PD);
|
||||||
jtag_execute_queue();
|
jtag_execute_queue();
|
||||||
|
|
||||||
jtag_add_statemove(TAP_TLR);
|
jtag_add_tms();
|
||||||
|
|
||||||
jtag_add_end_state(TAP_RTI);
|
jtag_add_end_state(TAP_RTI);
|
||||||
virtex2_set_instr(virtex2_info->chain_pos, 0xc); /* JSTART */
|
virtex2_set_instr(virtex2_info->chain_pos, 0xc); /* JSTART */
|
||||||
|
|
|
@ -34,6 +34,9 @@ mww 0xCC000008 1 # Mode Select CL3
|
||||||
#mww 0xc4000020 0xffffee # CFG0: remove expansion bus boot flash
|
#mww 0xc4000020 0xffffee # CFG0: remove expansion bus boot flash
|
||||||
#mirror at 0x00000000
|
#mirror at 0x00000000
|
||||||
|
|
||||||
|
#big endian
|
||||||
|
reg XSCALE_CTRL 0xF8
|
||||||
|
|
||||||
#
|
#
|
||||||
# detect flash
|
# detect flash
|
||||||
#
|
#
|
||||||
|
|
|
@ -15,7 +15,7 @@ jtag_ntrst_delay 0
|
||||||
######################
|
######################
|
||||||
|
|
||||||
#target <type> <endianess> <reset mode> <JTAG pos> <variant>
|
#target <type> <endianess> <reset mode> <JTAG pos> <variant>
|
||||||
target arm926ejs little reset_init 0 arm926ejs
|
target arm926ejs big reset_init 0 arm926ejs
|
||||||
|
|
||||||
target_script 0 reset event/wi-9c_reset.script
|
target_script 0 reset event/wi-9c_reset.script
|
||||||
run_and_halt_time 0 30
|
run_and_halt_time 0 30
|
||||||
|
|
|
@ -66,6 +66,37 @@ int tap_to_xsvf[] =
|
||||||
0x0, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x1, 0x9, 0xa, 0xb, 0xc, 0xe, 0xf
|
0x0, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x1, 0x9, 0xa, 0xb, 0xc, 0xe, 0xf
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* xsvf has it's own definition of a statemove. This needs
|
||||||
|
* to be handled according to the specs, which has nothing
|
||||||
|
* to do with the JTAG spec or OpenOCD as such.
|
||||||
|
*
|
||||||
|
* Implemented via jtag_add_pathmove().
|
||||||
|
*/
|
||||||
|
void xsvf_add_statemove(enum tap_state state)
|
||||||
|
{
|
||||||
|
enum tap_state moves[7]; /* max # of transitions */
|
||||||
|
int i;
|
||||||
|
enum tap_state curstate=cmd_queue_cur_state;
|
||||||
|
u8 move=tap_move[cmd_queue_cur_state][state];
|
||||||
|
|
||||||
|
if ((state!=TAP_TLR)&&(state==cmd_queue_cur_state))
|
||||||
|
return;
|
||||||
|
for (i=0; i<7; i++)
|
||||||
|
{
|
||||||
|
int j=(move>>i)&1;
|
||||||
|
if (j)
|
||||||
|
{
|
||||||
|
curstate=tap_transitions[curstate].high;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
curstate=tap_transitions[curstate].low;
|
||||||
|
}
|
||||||
|
moves[i]=curstate;
|
||||||
|
}
|
||||||
|
jtag_add_pathmove(7, moves);
|
||||||
|
}
|
||||||
|
|
||||||
int xsvf_register_commands(struct command_context_s *cmd_ctx)
|
int xsvf_register_commands(struct command_context_s *cmd_ctx)
|
||||||
{
|
{
|
||||||
register_command(cmd_ctx, NULL, "xsvf", handle_xsvf_command,
|
register_command(cmd_ctx, NULL, "xsvf", handle_xsvf_command,
|
||||||
|
@ -203,13 +234,13 @@ int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, char **arg
|
||||||
jtag_add_runtest(xruntest, xsvf_to_tap[xendir]);
|
jtag_add_runtest(xruntest, xsvf_to_tap[xendir]);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
jtag_add_statemove(TAP_RTI);
|
xsvf_add_statemove(TAP_RTI);
|
||||||
jtag_add_sleep(xruntest);
|
jtag_add_sleep(xruntest);
|
||||||
jtag_add_statemove(xsvf_to_tap[xendir]);
|
xsvf_add_statemove(xsvf_to_tap[xendir]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (xendir != 0xd) /* Pause-IR */
|
else if (xendir != 0xd) /* Pause-IR */
|
||||||
jtag_add_statemove(xsvf_to_tap[xendir]);
|
xsvf_add_statemove(xsvf_to_tap[xendir]);
|
||||||
}
|
}
|
||||||
free(ir_buf);
|
free(ir_buf);
|
||||||
}
|
}
|
||||||
|
@ -242,13 +273,13 @@ int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, char **arg
|
||||||
jtag_add_runtest(xruntest, xsvf_to_tap[xenddr]);
|
jtag_add_runtest(xruntest, xsvf_to_tap[xenddr]);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
jtag_add_statemove(TAP_RTI);
|
xsvf_add_statemove(TAP_RTI);
|
||||||
jtag_add_sleep(xruntest);
|
jtag_add_sleep(xruntest);
|
||||||
jtag_add_statemove(xsvf_to_tap[xenddr]);
|
xsvf_add_statemove(xsvf_to_tap[xenddr]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (xendir != 0x6) /* Pause-DR */
|
else if (xendir != 0x6) /* Pause-DR */
|
||||||
jtag_add_statemove(xsvf_to_tap[xenddr]);
|
xsvf_add_statemove(xsvf_to_tap[xenddr]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x04: /* XRUNTEST */
|
case 0x04: /* XRUNTEST */
|
||||||
|
@ -316,13 +347,13 @@ int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, char **arg
|
||||||
jtag_add_runtest(xruntest, xsvf_to_tap[xenddr]);
|
jtag_add_runtest(xruntest, xsvf_to_tap[xenddr]);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
jtag_add_statemove(TAP_RTI);
|
xsvf_add_statemove(TAP_RTI);
|
||||||
jtag_add_sleep(xruntest);
|
jtag_add_sleep(xruntest);
|
||||||
jtag_add_statemove(xsvf_to_tap[xenddr]);
|
xsvf_add_statemove(xsvf_to_tap[xenddr]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (xendir != 0x6) /* Pause-DR */
|
else if (xendir != 0x6) /* Pause-DR */
|
||||||
jtag_add_statemove(xsvf_to_tap[xenddr]);
|
xsvf_add_statemove(xsvf_to_tap[xenddr]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -451,10 +482,10 @@ int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, char **arg
|
||||||
do_abort = 1;
|
do_abort = 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
jtag_add_statemove(xsvf_to_tap[uc]);
|
xsvf_add_statemove(xsvf_to_tap[uc]);
|
||||||
ui = be_to_h_u32(buf4);
|
ui = be_to_h_u32(buf4);
|
||||||
jtag_add_sleep(ui);
|
jtag_add_sleep(ui);
|
||||||
jtag_add_statemove(xsvf_to_tap[uc2]);
|
xsvf_add_statemove(xsvf_to_tap[uc2]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue