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:
parent
b8db7aa18b
commit
1006986ab1
|
@ -989,13 +989,13 @@ zylinjtag_Jim_Command_format_jffs2(Jim_Interp *interp,
|
|||
int argc,
|
||||
Jim_Obj * const *argv)
|
||||
{
|
||||
int del;
|
||||
if (argc != 1)
|
||||
{
|
||||
return JIM_ERR;
|
||||
}
|
||||
|
||||
format();
|
||||
for(;;);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -273,12 +273,12 @@ int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *argv);
|
|||
int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
|
||||
|
||||
|
||||
jtag_tap_t *jtag_AllTaps(void)
|
||||
{
|
||||
return jtag_all_taps;
|
||||
jtag_tap_t *jtag_AllTaps(void)
|
||||
{
|
||||
return jtag_all_taps;
|
||||
};
|
||||
|
||||
int
|
||||
int
|
||||
jtag_NumTotalTaps(void)
|
||||
{
|
||||
jtag_tap_t *t;
|
||||
|
@ -310,25 +310,6 @@ jtag_NumEnabledTaps(void)
|
|||
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 )
|
||||
{
|
||||
|
@ -369,7 +350,7 @@ jtag_TapByJimObj( Jim_Interp *interp, Jim_Obj *o )
|
|||
t = NULL;
|
||||
} else {
|
||||
t = jtag_TapByString( cp );
|
||||
}
|
||||
}
|
||||
if( t == NULL ){
|
||||
Jim_SetResult_sprintf(interp,"Tap: %s is unknown", cp );
|
||||
}
|
||||
|
@ -385,7 +366,7 @@ jtag_TapByAbsPosition( int n )
|
|||
|
||||
orig_n = n;
|
||||
t = jtag_AllTaps();
|
||||
|
||||
|
||||
while( t && (n > 0)) {
|
||||
n--;
|
||||
t = t->next_tap;
|
||||
|
@ -1348,7 +1329,7 @@ int jtag_check_value(u8 *captured, void *priv, scan_field_t *field)
|
|||
char *in_check_mask_char;
|
||||
in_check_mask_char = buf_to_str(field->in_check_mask, (num_bits > 64) ? 64 : num_bits, 16);
|
||||
LOG_WARNING("value captured during scan didn't pass the requested check:");
|
||||
LOG_WARNING("captured: 0x%s check_value: 0x%s check_mask: 0x%s",
|
||||
LOG_WARNING("captured: 0x%s check_value: 0x%s check_mask: 0x%s",
|
||||
captured_char, in_check_value_char, in_check_mask_char);
|
||||
free(in_check_mask_char);
|
||||
}
|
||||
|
@ -1499,7 +1480,7 @@ int jtag_examine_chain(void)
|
|||
LOG_ERROR("JTAG: No taps enabled?");
|
||||
return ERROR_JTAG_INIT_FAILED;
|
||||
}
|
||||
|
||||
|
||||
for (bit_count = 0; bit_count < (JTAG_MAX_CHAIN_SIZE * 32) - 31;)
|
||||
{
|
||||
u32 idcode = buf_get_u32(idcode_buffer, bit_count, 32);
|
||||
|
@ -1579,7 +1560,7 @@ int jtag_examine_chain(void)
|
|||
}
|
||||
} else {
|
||||
#if 0
|
||||
LOG_INFO("JTAG TAP ID: 0x%08x - Unknown - please report (A) chipname and (B) idcode to the openocd project",
|
||||
LOG_INFO("JTAG TAP ID: 0x%08x - Unknown - please report (A) chipname and (B) idcode to the openocd project",
|
||||
tap->idcode);
|
||||
#endif
|
||||
}
|
||||
|
@ -1642,7 +1623,7 @@ int jtag_validate_chain(void)
|
|||
if( tap == NULL ){
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (buf_get_u32(ir_test, chain_pos, 2) != 0x1)
|
||||
{
|
||||
|
@ -1697,7 +1678,7 @@ jim_newtap_cmd( Jim_GetOptInfo *goi )
|
|||
{ .name = NULL , .value = -1 },
|
||||
};
|
||||
|
||||
|
||||
|
||||
pTap = malloc( sizeof(jtag_tap_t) );
|
||||
memset( pTap, 0, sizeof(*pTap) );
|
||||
if( !pTap ){
|
||||
|
@ -1706,7 +1687,7 @@ jim_newtap_cmd( Jim_GetOptInfo *goi )
|
|||
}
|
||||
//
|
||||
// we expect CHIP + TAP + OPTIONS
|
||||
//
|
||||
//
|
||||
if( goi->argc < 3 ){
|
||||
Jim_SetResult_sprintf(goi->interp, "Missing CHIP TAP OPTIONS ....");
|
||||
return JIM_ERR;
|
||||
|
@ -1716,17 +1697,17 @@ jim_newtap_cmd( Jim_GetOptInfo *goi )
|
|||
|
||||
Jim_GetOpt_String( goi, &cp, NULL );
|
||||
pTap->tapname = strdup(cp);
|
||||
|
||||
|
||||
// name + dot + name + null
|
||||
x = strlen(pTap->chip) + 1 + strlen(pTap->tapname) + 1;
|
||||
cp = malloc( x );
|
||||
sprintf( cp, "%s.%s", pTap->chip, pTap->tapname );
|
||||
pTap->dotted_name = cp;
|
||||
|
||||
LOG_DEBUG("Creating New Tap, Chip: %s, Tap: %s, Dotted: %s, %d params",
|
||||
LOG_DEBUG("Creating New Tap, Chip: %s, Tap: %s, Dotted: %s, %d params",
|
||||
pTap->chip, pTap->tapname, pTap->dotted_name, goi->argc);
|
||||
|
||||
|
||||
|
||||
// default is enabled
|
||||
pTap->enabled = 1;
|
||||
|
||||
|
@ -1737,7 +1718,7 @@ jim_newtap_cmd( Jim_GetOptInfo *goi )
|
|||
|
||||
// clear them as we find them
|
||||
reqbits = (NTREQ_IRLEN | NTREQ_IRCAPTURE | NTREQ_IRMASK);
|
||||
|
||||
|
||||
while( goi->argc ){
|
||||
e = Jim_GetOpt_Nvp( goi, opts, &n );
|
||||
if( e != JIM_OK ){
|
||||
|
@ -1766,7 +1747,7 @@ jim_newtap_cmd( Jim_GetOptInfo *goi )
|
|||
}
|
||||
if( (w < 0) || (w > 0xffff) ){
|
||||
// wacky value
|
||||
Jim_SetResult_sprintf( goi->interp, "option: %s - wacky value: %d (0x%x)",
|
||||
Jim_SetResult_sprintf( goi->interp, "option: %s - wacky value: %d (0x%x)",
|
||||
n->name, (int)(w), (int)(w));
|
||||
return JIM_ERR;
|
||||
}
|
||||
|
@ -1789,9 +1770,9 @@ jim_newtap_cmd( Jim_GetOptInfo *goi )
|
|||
|
||||
// Did we get all the options?
|
||||
if( reqbits ){
|
||||
// no
|
||||
// no
|
||||
Jim_SetResult_sprintf( goi->interp,
|
||||
"newtap: %s missing required parameters",
|
||||
"newtap: %s missing required parameters",
|
||||
pTap->dotted_name);
|
||||
// fixme: Tell user what is missing :-(
|
||||
// no memory leaks pelase
|
||||
|
@ -1811,23 +1792,23 @@ jim_newtap_cmd( Jim_GetOptInfo *goi )
|
|||
pTap->ir_length,
|
||||
pTap->ir_capture_value );
|
||||
buf_set_u32( pTap->expected_mask,
|
||||
0,
|
||||
0,
|
||||
pTap->ir_length,
|
||||
pTap->ir_capture_mask );
|
||||
buf_set_ones( pTap->cur_instr,
|
||||
buf_set_ones( pTap->cur_instr,
|
||||
pTap->ir_length );
|
||||
|
||||
pTap->bypass = 1;
|
||||
|
||||
|
||||
jtag_register_event_callback(jtag_reset_callback, pTap );
|
||||
|
||||
|
||||
ppTap = &(jtag_all_taps);
|
||||
while( (*ppTap) != NULL ){
|
||||
ppTap = &((*ppTap)->next_tap);
|
||||
}
|
||||
*ppTap = pTap;
|
||||
{
|
||||
{
|
||||
static int n_taps = 0;
|
||||
pTap->abs_chain_position = n_taps++;
|
||||
}
|
||||
|
@ -1913,8 +1894,8 @@ jim_jtag_command( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
|
|||
Jim_SetResultString( goi.interp, "Too many parameters",-1 );
|
||||
return JIM_ERR;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
{
|
||||
jtag_tap_t *t;
|
||||
t = jtag_TapByJimObj( goi.interp, goi.argv[0] );
|
||||
if( t == NULL ){
|
||||
|
@ -2194,7 +2175,7 @@ int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *cmd, cha
|
|||
// argv[ 1] = ir capture
|
||||
// argv[ 2] = ir mask
|
||||
// argv[ 3] = not actually used by anything but in the docs
|
||||
|
||||
|
||||
if( argc < 4 ){
|
||||
command_print( cmd_ctx, "OLD DEPRECATED SYNTAX: Please use the NEW syntax");
|
||||
return ERROR_OK;
|
||||
|
@ -2208,7 +2189,7 @@ int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *cmd, cha
|
|||
command_print( cmd_ctx, "jtag newtap stm32 cortexm3 ....., thus creating the tap: \"stm32.cortexm3\"");
|
||||
command_print( cmd_ctx, "jtag newtap stm32 boundry ....., and the tap: \"stm32.boundery\"");
|
||||
command_print( cmd_ctx, "And then refer to the taps by the dotted name.");
|
||||
|
||||
|
||||
|
||||
|
||||
newargs[0] = Jim_NewStringObj( interp, "jtag", -1 );
|
||||
|
@ -2237,7 +2218,7 @@ int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *cmd, cha
|
|||
Jim_GetString( newargs[8], NULL ),
|
||||
Jim_GetString( newargs[9], NULL ) );
|
||||
|
||||
|
||||
|
||||
|
||||
e = jim_jtag_command( interp, 10, newargs );
|
||||
if( e != JIM_OK ){
|
||||
|
@ -2265,11 +2246,11 @@ int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cmd, char
|
|||
tap->abs_chain_position,
|
||||
tap->dotted_name,
|
||||
tap->enabled ? 'Y' : 'n',
|
||||
tap->idcode,
|
||||
tap->idcode,
|
||||
tap->expected_id,
|
||||
tap->ir_length,
|
||||
expected,
|
||||
expected_mask,
|
||||
tap->ir_length,
|
||||
expected,
|
||||
expected_mask,
|
||||
cur_instr);
|
||||
tap = tap->next_tap;
|
||||
}
|
||||
|
|
|
@ -186,7 +186,6 @@ struct jtag_tap_s
|
|||
};
|
||||
extern jtag_tap_t *jtag_AllTaps(void);
|
||||
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_TapByString( const char *dotted_name );
|
||||
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);
|
||||
|
||||
|
||||
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
|
||||
|
|
|
@ -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 i, j;
|
||||
int j;
|
||||
int scan_size = 0;
|
||||
jtag_device_t *device;
|
||||
|
||||
for (i=0; i < jtag_num_devices; i++)
|
||||
jtag_tap_t *tap, *nextTap;
|
||||
for(tap = jtag_NextEnabledTap(NULL); tap!= NULL; tap=nextTap)
|
||||
{
|
||||
int pause=i==(jtag_num_devices-1);
|
||||
int found = 0;
|
||||
device = jtag_get_device(i);
|
||||
if (device==NULL)
|
||||
{
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
nextTap=jtag_NextEnabledTap(tap);
|
||||
int pause=(nextTap==NULL);
|
||||
|
||||
scan_size = device->ir_length;
|
||||
int found = 0;
|
||||
|
||||
scan_size = tap->ir_length;
|
||||
|
||||
/* search the list */
|
||||
for (j=0; j < num_fields; j++)
|
||||
{
|
||||
if (i == fields[j].device)
|
||||
if (tap == fields[j].tap)
|
||||
{
|
||||
found = 1;
|
||||
|
||||
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)
|
||||
{
|
||||
fields[j].in_check_value = device->expected;
|
||||
fields[j].in_check_mask = device->expected_mask;
|
||||
fields[j].in_check_value = tap->expected;
|
||||
fields[j].in_check_mask = tap->expected_mask;
|
||||
}
|
||||
|
||||
scanFields(1, fields+j, TAP_SI, pause);
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
scanFields(1, &tmp, TAP_SI, pause);
|
||||
/* update device information */
|
||||
buf_cpy(tmp.out_value, device->cur_instr, scan_size);
|
||||
device->bypass = 1;
|
||||
buf_cpy(tmp.out_value, tap->cur_instr, scan_size);
|
||||
tap->bypass = 1;
|
||||
}
|
||||
}
|
||||
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 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;
|
||||
int pause = (i==(jtag_num_devices-1));
|
||||
nextTap=jtag_NextEnabledTap(tap);
|
||||
int found=0;
|
||||
int pause=(nextTap==NULL);
|
||||
|
||||
for (j=0; j < num_fields; j++)
|
||||
{
|
||||
if (i == fields[j].device)
|
||||
if (tap == fields[j].tap)
|
||||
{
|
||||
found = 1;
|
||||
|
||||
|
@ -586,15 +585,6 @@ int interface_jtag_add_dr_scan(int num_fields, scan_field_t *fields, enum tap_st
|
|||
}
|
||||
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;
|
||||
/* program the scan field to 1 bit length, and ignore it's value */
|
||||
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
|
||||
{
|
||||
#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();
|
||||
|
@ -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;
|
||||
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 */
|
||||
if (little)
|
||||
|
@ -771,7 +754,7 @@ void embeddedice_write_dcc(int chain_pos, int reg_addr, u8 *buffer, int little,
|
|||
int 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,8 +27,7 @@ if { [info exists ENDIAN] } {
|
|||
if { [info exists CPUTAPID ] } {
|
||||
set _CPUTAPID $CPUTAPID
|
||||
} else {
|
||||
# sharp changed the number!
|
||||
set _CPUTAPID 0x3f0f0f0f
|
||||
set _CPUTAPID 0x1f0f0f0f
|
||||
}
|
||||
jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
|
||||
|
||||
|
|
Loading…
Reference in New Issue