update zy1000 to svn head jtag api

git-svn-id: svn://svn.berlios.de/openocd/trunk@1197 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
oharboe 2008-12-01 14:21:24 +00:00
parent b8db7aa18b
commit 1006986ab1
5 changed files with 82 additions and 99 deletions

View File

@ -989,13 +989,13 @@ zylinjtag_Jim_Command_format_jffs2(Jim_Interp *interp,
int argc, int argc,
Jim_Obj * const *argv) Jim_Obj * const *argv)
{ {
int del;
if (argc != 1) if (argc != 1)
{ {
return JIM_ERR; return JIM_ERR;
} }
format(); format();
for(;;);
} }

View File

@ -310,25 +310,6 @@ jtag_NumEnabledTaps(void)
return n; return n;
} }
jtag_tap_t *
jtag_NextEnabledTap( jtag_tap_t *p )
{
if( p == NULL ){
// start at the head of list
p = jtag_AllTaps();
} else {
// start *after* this one
p = p->next_tap;
}
while( p ){
if( p->enabled ){
break;
} else {
p = p->next_tap;
}
}
return p;
}
jtag_tap_t *jtag_TapByString( const char *s ) jtag_tap_t *jtag_TapByString( const char *s )
{ {

View File

@ -186,7 +186,6 @@ struct jtag_tap_s
}; };
extern jtag_tap_t *jtag_AllTaps(void); extern jtag_tap_t *jtag_AllTaps(void);
extern jtag_tap_t *jtag_TapByPosition(int n); extern jtag_tap_t *jtag_TapByPosition(int n);
extern jtag_tap_t *jtag_NextEnabledTap( jtag_tap_t * );
extern jtag_tap_t *jtag_TapByPosition( int n ); extern jtag_tap_t *jtag_TapByPosition( int n );
extern jtag_tap_t *jtag_TapByString( const char *dotted_name ); extern jtag_tap_t *jtag_TapByString( const char *dotted_name );
extern jtag_tap_t *jtag_TapByJimObj( Jim_Interp *interp, Jim_Obj *obj ); extern jtag_tap_t *jtag_TapByJimObj( Jim_Interp *interp, Jim_Obj *obj );
@ -195,6 +194,27 @@ extern int jtag_NumEnabledTaps(void);
extern int jtag_NumTotalTaps(void); extern int jtag_NumTotalTaps(void);
static __inline__ jtag_tap_t *
jtag_NextEnabledTap( jtag_tap_t *p )
{
if( p == NULL ){
// start at the head of list
p = jtag_AllTaps();
} else {
// start *after* this one
p = p->next_tap;
}
while( p ){
if( p->enabled ){
break;
} else {
p = p->next_tap;
}
}
return p;
}
enum reset_line_mode enum reset_line_mode

View File

@ -492,43 +492,39 @@ int interface_jtag_add_end_state(enum tap_state state)
int interface_jtag_add_ir_scan(int num_fields, scan_field_t *fields, enum tap_state state) int interface_jtag_add_ir_scan(int num_fields, scan_field_t *fields, enum tap_state state)
{ {
int i, j; int j;
int scan_size = 0; int scan_size = 0;
jtag_device_t *device; jtag_tap_t *tap, *nextTap;
for(tap = jtag_NextEnabledTap(NULL); tap!= NULL; tap=nextTap)
for (i=0; i < jtag_num_devices; i++)
{ {
int pause=i==(jtag_num_devices-1); nextTap=jtag_NextEnabledTap(tap);
int pause=(nextTap==NULL);
int found = 0; int found = 0;
device = jtag_get_device(i);
if (device==NULL)
{
return ERROR_FAIL;
}
scan_size = device->ir_length; scan_size = tap->ir_length;
/* search the list */ /* search the list */
for (j=0; j < num_fields; j++) for (j=0; j < num_fields; j++)
{ {
if (i == fields[j].device) if (tap == fields[j].tap)
{ {
found = 1; found = 1;
if ((jtag_verify_capture_ir)&&(fields[j].in_handler==NULL)) if ((jtag_verify_capture_ir)&&(fields[j].in_handler==NULL))
{ {
jtag_set_check_value(fields+j, device->expected, device->expected_mask, NULL); jtag_set_check_value(fields+j, tap->expected, tap->expected_mask, NULL);
} else if (jtag_verify_capture_ir) } else if (jtag_verify_capture_ir)
{ {
fields[j].in_check_value = device->expected; fields[j].in_check_value = tap->expected;
fields[j].in_check_mask = device->expected_mask; fields[j].in_check_mask = tap->expected_mask;
} }
scanFields(1, fields+j, TAP_SI, pause); scanFields(1, fields+j, TAP_SI, pause);
/* update device information */ /* update device information */
buf_cpy(fields[j].out_value, device->cur_instr, scan_size); buf_cpy(fields[j].out_value, tap->cur_instr, scan_size);
device->bypass = 0; tap->bypass = 0;
break; break;
} }
} }
@ -544,8 +540,8 @@ int interface_jtag_add_ir_scan(int num_fields, scan_field_t *fields, enum tap_st
tmp.num_bits = scan_size; tmp.num_bits = scan_size;
scanFields(1, &tmp, TAP_SI, pause); scanFields(1, &tmp, TAP_SI, pause);
/* update device information */ /* update device information */
buf_cpy(tmp.out_value, device->cur_instr, scan_size); buf_cpy(tmp.out_value, tap->cur_instr, scan_size);
device->bypass = 1; tap->bypass = 1;
} }
} }
gotoEndState(); gotoEndState();
@ -569,15 +565,18 @@ int interface_jtag_add_plain_ir_scan(int num_fields, scan_field_t *fields, enum
int interface_jtag_add_dr_scan(int num_fields, scan_field_t *fields, enum tap_state state) int interface_jtag_add_dr_scan(int num_fields, scan_field_t *fields, enum tap_state state)
{ {
int i, j;
for (i=0; i < jtag_num_devices; i++) int j;
jtag_tap_t *tap, *nextTap;
for(tap = jtag_NextEnabledTap(NULL); tap!= NULL; tap=nextTap)
{ {
int found = 0; nextTap=jtag_NextEnabledTap(tap);
int pause = (i==(jtag_num_devices-1)); int found=0;
int pause=(nextTap==NULL);
for (j=0; j < num_fields; j++) for (j=0; j < num_fields; j++)
{ {
if (i == fields[j].device) if (tap == fields[j].tap)
{ {
found = 1; found = 1;
@ -586,15 +585,6 @@ int interface_jtag_add_dr_scan(int num_fields, scan_field_t *fields, enum tap_st
} }
if (!found) if (!found)
{ {
#ifdef _DEBUG_JTAG_IO_
/* if a device isn't listed, the BYPASS register should be selected */
if (!jtag_get_device(i)->bypass)
{
LOG_ERROR("BUG: no scan data for a device not in BYPASS");
exit(-1);
}
#endif
scan_field_t tmp; scan_field_t tmp;
/* program the scan field to 1 bit length, and ignore it's value */ /* program the scan field to 1 bit length, and ignore it's value */
tmp.num_bits = 1; tmp.num_bits = 1;
@ -610,13 +600,6 @@ int interface_jtag_add_dr_scan(int num_fields, scan_field_t *fields, enum tap_st
} }
else else
{ {
#ifdef _DEBUG_JTAG_IO_
/* if a device is listed, the BYPASS register must not be selected */
if (jtag_get_device(i)->bypass)
{
LOG_WARNING("scan data for a device in BYPASS");
}
#endif
} }
} }
gotoEndState(); gotoEndState();
@ -739,11 +722,11 @@ int interface_jtag_add_pathmove(int num_states, enum tap_state *path)
void embeddedice_write_dcc(int chain_pos, int reg_addr, u8 *buffer, int little, int count) void embeddedice_write_dcc(jtag_tap_t *tap, int reg_addr, u8 *buffer, int little, int count)
{ {
// static int const reg_addr=0x5; // static int const reg_addr=0x5;
enum tap_state end_state=cmd_queue_end_state; enum tap_state end_state=cmd_queue_end_state;
if (jtag_num_devices==1) if (jtag_NextEnabledTap(jtag_NextEnabledTap(NULL))==NULL)
{ {
/* better performance via code duplication */ /* better performance via code duplication */
if (little) if (little)
@ -771,7 +754,7 @@ void embeddedice_write_dcc(int chain_pos, int reg_addr, u8 *buffer, int little,
int i; int i;
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
embeddedice_write_reg_inner(chain_pos, reg_addr, fast_target_buffer_get_u32(buffer, little)); embeddedice_write_reg_inner(tap, reg_addr, fast_target_buffer_get_u32(buffer, little));
buffer += 4; buffer += 4;
} }
} }

View File

@ -27,8 +27,7 @@ if { [info exists ENDIAN] } {
if { [info exists CPUTAPID ] } { if { [info exists CPUTAPID ] } {
set _CPUTAPID $CPUTAPID set _CPUTAPID $CPUTAPID
} else { } else {
# sharp changed the number! set _CPUTAPID 0x1f0f0f0f
set _CPUTAPID 0x3f0f0f0f
} }
jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID