/*
* we expect CHIP + TAP + OPTIONS
* */
- if( goi->argc < 3 ){
+ if ( goi->argc < 3 ){
Jim_SetResult_sprintf(goi->interp, "Missing CHIP TAP OPTIONS ....");
return JIM_ERR;
}
/* clear them as we find them */
reqbits = (NTREQ_IRLEN | NTREQ_IRCAPTURE | NTREQ_IRMASK);
- while( goi->argc ){
+ while ( goi->argc ){
e = Jim_GetOpt_Nvp( goi, opts, &n );
- if( e != JIM_OK ){
+ if ( e != JIM_OK ){
Jim_GetOpt_NvpUnknown( goi, opts, 0 );
return e;
}
LOG_DEBUG("Processing option: %s", n->name );
- switch( n->value ){
+ switch ( n->value ){
case NTAP_OPT_ENABLED:
pTap->disabled_after_reset = false;
break;
break;
case NTAP_OPT_EXPECTED_ID:
{
- u32 *new_expected_ids;
+ uint32_t *new_expected_ids;
e = Jim_GetOpt_Wide( goi, &w );
- if( e != JIM_OK) {
+ if ( e != JIM_OK) {
Jim_SetResult_sprintf(goi->interp, "option: %s bad parameter", n->name);
return e;
}
- new_expected_ids = malloc(sizeof(u32) * (pTap->expected_ids_cnt + 1));
+ new_expected_ids = malloc(sizeof(uint32_t) * (pTap->expected_ids_cnt + 1));
if (new_expected_ids == NULL) {
Jim_SetResult_sprintf( goi->interp, "no memory");
return JIM_ERR;
}
- memcpy(new_expected_ids, pTap->expected_ids, sizeof(u32) * pTap->expected_ids_cnt);
+ memcpy(new_expected_ids, pTap->expected_ids, sizeof(uint32_t) * pTap->expected_ids_cnt);
new_expected_ids[pTap->expected_ids_cnt] = w;
case NTAP_OPT_IRMASK:
case NTAP_OPT_IRCAPTURE:
e = Jim_GetOpt_Wide( goi, &w );
- if( e != JIM_OK ){
+ if ( e != JIM_OK ){
Jim_SetResult_sprintf( goi->interp, "option: %s bad parameter", n->name );
return e;
}
- switch(n->value){
+ switch (n->value){
case NTAP_OPT_IRLEN:
if (w > (jim_wide) (8 * sizeof(pTap->ir_capture_value)))
LOG_WARNING("huge IR length %d", (int) w);
reqbits &= (~(NTREQ_IRCAPTURE));
break;
}
- } /* switch(n->value) */
- } /* while( goi->argc ) */
+ } /* switch (n->value) */
+ } /* while ( goi->argc ) */
/* default is enabled-after-reset */
pTap->enabled = !pTap->disabled_after_reset;
context = Jim_GetAssocData(interp, "context");
/* go past the command */
- Jim_GetOpt_Setup( &goi, interp, argc-1, argv+1 );
+ Jim_GetOpt_Setup( &goi, interp, argc-1, argv + 1 );
e = Jim_GetOpt_Nvp( &goi, jtag_cmds, &n );
- if( e != JIM_OK ){
+ if ( e != JIM_OK ){
Jim_GetOpt_NvpUnknown( &goi, jtag_cmds, 0 );
return e;
}
Jim_SetEmptyResult( goi.interp );
- switch( n->value ){
+ switch ( n->value ){
case JTAG_CMD_INTERFACE:
/* return the name of the interface */
/* TCL code might need to know the exact type... */
/* FUTURE: we allow this as a means to "set" the interface. */
- if( goi.argc != 0 ){
+ if ( goi.argc != 0 ){
Jim_WrongNumArgs( goi.interp, 1, goi.argv-1, "(no params)");
return JIM_ERR;
}
Jim_SetResultString( goi.interp, jtag_interface->name, -1 );
return JIM_OK;
case JTAG_CMD_INIT_RESET:
- if( goi.argc != 0 ){
+ if ( goi.argc != 0 ){
Jim_WrongNumArgs( goi.interp, 1, goi.argv-1, "(no params)");
return JIM_ERR;
}
e = jtag_init_reset(context);
- if( e != ERROR_OK ){
+ if ( e != ERROR_OK ){
Jim_SetResult_sprintf( goi.interp, "error: %d", e);
return JIM_ERR;
}
case JTAG_CMD_TAPISENABLED:
case JTAG_CMD_TAPENABLE:
case JTAG_CMD_TAPDISABLE:
- if( goi.argc != 1 ){
+ if ( goi.argc != 1 ){
Jim_SetResultString( goi.interp, "Too many parameters",-1 );
return JIM_ERR;
}
break;
case JTAG_CMD_CGET:
- if( goi.argc < 2 ){
+ if ( goi.argc < 2 ){
Jim_WrongNumArgs( goi.interp, 0, NULL, "?tap-name? -option ...");
return JIM_ERR;
}
Jim_GetOpt_Obj(&goi, &o);
t = jtag_tap_by_jim_obj( goi.interp, o );
- if( t == NULL ){
+ if ( t == NULL ){
return JIM_ERR;
}
break;
case JTAG_CMD_CONFIGURE:
- if( goi.argc < 3 ){
+ if ( goi.argc < 3 ){
Jim_WrongNumArgs( goi.interp, 0, NULL, "?tap-name? -option ?VALUE? ...");
return JIM_ERR;
}
Jim_GetOpt_Obj(&goi, &o);
t = jtag_tap_by_jim_obj( goi.interp, o );
- if( t == NULL ){
+ if ( t == NULL ){
return JIM_ERR;
}
static int default_power_dropout(int *dropout)
{
- *dropout=0; /* by default we can't detect power dropout */
+ *dropout = 0; /* by default we can't detect power dropout */
return ERROR_OK;
}
static int default_srst_asserted(int *srst_asserted)
{
- *srst_asserted=0; /* by default we can't detect srst asserted */
+ *srst_asserted = 0; /* by default we can't detect srst asserted */
return ERROR_OK;
}
* argv[ 3] = not actually used by anything but in the docs
*/
- if( argc < 4 ){
+ if ( argc < 4 ){
command_print( cmd_ctx, "OLD DEPRECATED SYNTAX: Please use the NEW syntax");
return ERROR_OK;
}
Jim_GetString( newargs[9], NULL ) );
e = jim_jtag_command( interp, 10, newargs );
- if( e != JIM_OK ){
+ if ( e != JIM_OK ){
command_print( cmd_ctx, "%s", Jim_GetString( Jim_GetResult(interp), NULL ) );
}
return e;
command_print(cmd_ctx, " TapName | Enabled | IdCode Expected IrLen IrCap IrMask Instr ");
command_print(cmd_ctx, "---|--------------------|---------|------------|------------|------|------|------|---------");
- while( tap ){
- u32 expected, expected_mask, cur_instr, ii;
+ while ( tap ){
+ uint32_t expected, expected_mask, cur_instr, ii;
expected = buf_get_u32(tap->expected, 0, tap->ir_length);
expected_mask = buf_get_u32(tap->expected_mask, 0, tap->ir_length);
cur_instr = buf_get_u32(tap->cur_instr, 0, tap->ir_length);
tap->abs_chain_position,
tap->dotted_name,
tap->enabled ? 'Y' : 'n',
- tap->idcode,
- (tap->expected_ids_cnt > 0 ? tap->expected_ids[0] : 0),
- tap->ir_length,
- expected,
- expected_mask,
- cur_instr);
+ (unsigned int)(tap->idcode),
+ (unsigned int)(tap->expected_ids_cnt > 0 ? tap->expected_ids[0] : 0),
+ (unsigned int)(tap->ir_length),
+ (unsigned int)(expected),
+ (unsigned int)(expected_mask),
+ (unsigned int)(cur_instr));
for (ii = 1; ii < tap->expected_ids_cnt; ii++) {
command_print(cmd_ctx, " | | | | 0x%08x | | | | ",
- tap->expected_ids[ii]);
+ (unsigned int)(tap->expected_ids[ii]));
}
tap = tap->next_tap;
*/
endstate = TAP_IDLE;
- if( argc >= 4 ){
+ if ( argc >= 4 ){
/* have at least one pair of numbers. */
/* is last pair the magic text? */
- if( 0 == strcmp( "-endstate", args[ argc - 2 ] ) ){
+ if ( 0 == strcmp( "-endstate", args[ argc - 2 ] ) ){
const char *cpA;
const char *cpS;
cpA = args[ argc-1 ];
- for( endstate = 0 ; endstate < TAP_NUM_STATES ; endstate++ ){
+ for ( endstate = 0 ; endstate < TAP_NUM_STATES ; endstate++ ){
cpS = tap_state_name( endstate );
- if( 0 == strcmp( cpA, cpS ) ){
+ if ( 0 == strcmp( cpA, cpS ) ){
break;
}
}
- if( endstate >= TAP_NUM_STATES ){
+ if ( endstate >= TAP_NUM_STATES ){
return ERROR_COMMAND_SYNTAX_ERROR;
} else {
if (!scan_is_safe(endstate))
for (i = 0; i < num_fields; i++)
{
tap = jtag_tap_by_string( args[i*2] );
- if (tap==NULL)
+ if (tap == NULL)
{
command_print( cmd_ctx, "Tap: %s unknown", args[i*2] );
return ERROR_FAIL;
fields[i].num_bits = field_size;
fields[i].out_value = malloc(CEIL(field_size, 8));
- u32 value;
+ uint32_t value;
retval = parse_u32(args[i * 2 + 1], &value);
if (ERROR_OK != retval)
goto error_return;
* args[N-2] = "-endstate"
* args[N-1] = statename
*/
- if ((argc < 4) || ((argc % 2)!=0))
+ if ((argc < 4) || ((argc % 2) != 0))
{
Jim_WrongNumArgs(interp, 1, args, "wrong arguments");
return JIM_ERR;
/* validate arguments as numbers */
e = JIM_OK;
- for (i = 2; i < argc; i+=2)
+ for (i = 2; i < argc; i += 2)
{
long bits;
const char *cp;
e = Jim_GetLong(interp, args[i], &bits);
/* If valid - try next arg */
- if( e == JIM_OK ){
+ if ( e == JIM_OK ){
continue;
}
/* Not valid.. are we at the end? */
- if ( ((i+2) != argc) ){
+ if ( ((i + 2) != argc) ){
/* nope, then error */
return e;
}
/* get arg as a string. */
cp = Jim_GetString( args[i], NULL );
/* is it the magic? */
- if( 0 == strcmp( "-endstate", cp ) ){
+ if ( 0 == strcmp( "-endstate", cp ) ){
/* is the statename valid? */
- cp = Jim_GetString( args[i+1], NULL );
+ cp = Jim_GetString( args[i + 1], NULL );
/* see if it is a valid state name */
endstate = tap_state_by_name(cp);
- if( endstate < 0 ){
+ if ( endstate < 0 ){
/* update the error message */
Jim_SetResult_sprintf(interp,"endstate: %s invalid", cp );
} else {
}
/* Still an error? */
- if( e != JIM_OK ){
+ if ( e != JIM_OK ){
return e; /* too bad */
}
} /* validate args */
tap = jtag_tap_by_jim_obj( interp, args[1] );
- if( tap == NULL ){
+ if ( tap == NULL ){
return JIM_ERR;
}
- num_fields=(argc-2)/2;
+ num_fields = (argc-2)/2;
fields = malloc(sizeof(scan_field_t) * num_fields);
- for (i = 2; i < argc; i+=2)
+ for (i = 2; i < argc; i += 2)
{
long bits;
int len;
const char *str;
Jim_GetLong(interp, args[i], &bits);
- str = Jim_GetString(args[i+1], &len);
+ str = Jim_GetString(args[i + 1], &len);
fields[field_count].tap = tap;
fields[field_count].num_bits = bits;
return JIM_ERR;
}
- field_count=0;
+ field_count = 0;
Jim_Obj *list = Jim_NewListObj(interp, NULL, 0);
- for (i = 2; i < argc; i+=2)
+ for (i = 2; i < argc; i += 2)
{
long bits;
char *str;
{
tap_state_t states[8];
- if ((argc < 2) || ((size_t)argc > (sizeof(states)/sizeof(*states)+1)))
+ if ((argc < 2) || ((size_t)argc > (sizeof(states)/sizeof(*states) + 1)))
{
Jim_WrongNumArgs(interp, 1, args, "wrong arguments");
return JIM_ERR;
script_debug(interp, "pathmove", argc, args);
int i;
- for (i=0; i<argc-1; i++)
+ for (i = 0; i<argc-1; i++)
{
const char *cp;
- cp = Jim_GetString( args[i+1], NULL );
+ cp = Jim_GetString( args[i + 1], NULL );
states[i] = tap_state_by_name(cp);
- if( states[i] < 0 )
+ if ( states[i] < 0 )
{
/* update the error message */
Jim_SetResult_sprintf(interp,"endstate: %s invalid", cp );
return JIM_ERR;
}
- jtag_add_pathmove(argc-2, states+1);
+ jtag_add_pathmove(argc-2, states + 1);
if (jtag_execute_queue()!= ERROR_OK)
{
return ERROR_OK;
}
-