sync up zy1000 interface to bitbang driver's handling of exiting the shift state

git-svn-id: svn://svn.berlios.de/openocd/trunk@1679 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
oharboe 2009-05-08 19:24:40 +00:00
parent 5f7791474b
commit 060f61ef24
1 changed files with 25 additions and 15 deletions

View File

@ -448,7 +448,7 @@ static void gotoEndState(void)
setCurrentState(cmd_queue_end_state); setCurrentState(cmd_queue_end_state);
} }
static __inline void scanFields(int num_fields, scan_field_t *fields, tap_state_t shiftState, int pause) static __inline void scanFields(int num_fields, scan_field_t *fields, tap_state_t shiftState, tap_state_t end_state)
{ {
int i; int i;
int j; int j;
@ -482,10 +482,10 @@ static __inline void scanFields(int num_fields, scan_field_t *fields, tap_state_
{ {
k=32; k=32;
/* we have more to shift out */ /* we have more to shift out */
} else if (pause&&(i == num_fields-1)) } else if (i == num_fields-1)
{ {
/* this was the last to shift out this time */ /* this was the last to shift out this time */
pause_state=(shiftState==TAP_DRSHIFT)?TAP_DRPAUSE:TAP_IRPAUSE; pause_state=end_state;
} }
// we have (num_bits+7)/8 bytes of bits to toggle out. // we have (num_bits+7)/8 bytes of bits to toggle out.
@ -535,7 +535,14 @@ int interface_jtag_add_ir_scan(int num_fields, scan_field_t *fields, tap_state_t
for(tap = jtag_NextEnabledTap(NULL); tap!= NULL; tap=nextTap) for(tap = jtag_NextEnabledTap(NULL); tap!= NULL; tap=nextTap)
{ {
nextTap=jtag_NextEnabledTap(tap); nextTap=jtag_NextEnabledTap(tap);
int pause=(nextTap==NULL); tap_state_t end_state;
if (nextTap==NULL)
{
end_state = cmd_queue_end_state;
} else
{
end_state = TAP_IRSHIFT;
}
int found = 0; int found = 0;
@ -548,7 +555,7 @@ int interface_jtag_add_ir_scan(int num_fields, scan_field_t *fields, tap_state_t
{ {
found = 1; found = 1;
scanFields(1, fields+j, TAP_IRSHIFT, pause); scanFields(1, fields+j, TAP_IRSHIFT, end_state);
/* update device information */ /* update device information */
buf_cpy(fields[j].out_value, tap->cur_instr, scan_size); buf_cpy(fields[j].out_value, tap->cur_instr, scan_size);
@ -566,13 +573,12 @@ int interface_jtag_add_ir_scan(int num_fields, scan_field_t *fields, tap_state_t
memset(&tmp, 0, sizeof(tmp)); memset(&tmp, 0, sizeof(tmp));
tmp.out_value = ones; tmp.out_value = ones;
tmp.num_bits = scan_size; tmp.num_bits = scan_size;
scanFields(1, &tmp, TAP_IRSHIFT, pause); scanFields(1, &tmp, TAP_IRSHIFT, end_state);
/* update device information */ /* update device information */
buf_cpy(tmp.out_value, tap->cur_instr, scan_size); buf_cpy(tmp.out_value, tap->cur_instr, scan_size);
tap->bypass = 1; tap->bypass = 1;
} }
} }
gotoEndState();
return ERROR_OK; return ERROR_OK;
} }
@ -583,8 +589,7 @@ int interface_jtag_add_ir_scan(int num_fields, scan_field_t *fields, tap_state_t
int interface_jtag_add_plain_ir_scan(int num_fields, scan_field_t *fields, tap_state_t state) int interface_jtag_add_plain_ir_scan(int num_fields, scan_field_t *fields, tap_state_t state)
{ {
scanFields(num_fields, fields, TAP_IRSHIFT, 1); scanFields(num_fields, fields, TAP_IRSHIFT, cmd_queue_end_state);
gotoEndState();
return ERROR_OK; return ERROR_OK;
} }
@ -600,7 +605,14 @@ int interface_jtag_add_dr_scan(int num_fields, scan_field_t *fields, tap_state_t
{ {
nextTap=jtag_NextEnabledTap(tap); nextTap=jtag_NextEnabledTap(tap);
int found=0; int found=0;
int pause=(nextTap==NULL); tap_state_t end_state;
if (nextTap==NULL)
{
end_state = cmd_queue_end_state;
} else
{
end_state = TAP_DRSHIFT;
}
for (j=0; j < num_fields; j++) for (j=0; j < num_fields; j++)
{ {
@ -608,7 +620,7 @@ int interface_jtag_add_dr_scan(int num_fields, scan_field_t *fields, tap_state_t
{ {
found = 1; found = 1;
scanFields(1, fields+j, TAP_DRSHIFT, pause); scanFields(1, fields+j, TAP_DRSHIFT, end_state);
} }
} }
if (!found) if (!found)
@ -619,20 +631,18 @@ int interface_jtag_add_dr_scan(int num_fields, scan_field_t *fields, tap_state_t
tmp.out_value = NULL; tmp.out_value = NULL;
tmp.in_value = NULL; tmp.in_value = NULL;
scanFields(1, &tmp, TAP_DRSHIFT, pause); scanFields(1, &tmp, TAP_DRSHIFT, end_state);
} }
else else
{ {
} }
} }
gotoEndState();
return ERROR_OK; return ERROR_OK;
} }
int interface_jtag_add_plain_dr_scan(int num_fields, scan_field_t *fields, tap_state_t state) int interface_jtag_add_plain_dr_scan(int num_fields, scan_field_t *fields, tap_state_t state)
{ {
scanFields(num_fields, fields, TAP_DRSHIFT, 1); scanFields(num_fields, fields, TAP_DRSHIFT, cmd_queue_end_state);
gotoEndState();
return ERROR_OK; return ERROR_OK;
} }