LOG_USER("target state: %s",
Jim_Nvp_value2name_simple(nvp_target_state,target->state)->name);
- if (target->state!=TARGET_HALTED)
+ if (target->state != TARGET_HALTED)
return ERROR_OK;
retval=target->type->arch_state(target);
static int prevPowerdropout = 0;
int retval;
- if ((retval=jtag_power_dropout(&powerDropout))!=ERROR_OK)
+ if ((retval=jtag_power_dropout(&powerDropout)) != ERROR_OK)
return retval;
int powerRestored;
lastPower = current;
}
- if ((retval=jtag_srst_asserted(&srstAsserted))!=ERROR_OK)
+ if ((retval=jtag_srst_asserted(&srstAsserted)) != ERROR_OK)
return retval;
int srstDeasserted;
for (;;)
{
- if ((retval=target_poll(target))!=ERROR_OK)
+ if ((retval=target_poll(target)) != ERROR_OK)
return retval;
if (target->state == state)
{
if (image.sections[i].base_address<min_address)
{
/* clip addresses below */
- offset+=min_address-image.sections[i].base_address;
- length-=offset;
+ offset += min_address-image.sections[i].base_address;
+ length -= offset;
}
if (image.sections[i].base_address+buf_cnt>max_address)
{
- length-=(image.sections[i].base_address+buf_cnt)-max_address;
+ length -= (image.sections[i].base_address+buf_cnt)-max_address;
}
if ((retval = target_write_buffer(target, image.sections[i].base_address+offset, length, buffer+offset)) != ERROR_OK)
return retval;
// fall through
case 3:
- switch(args[2][0])
+ switch (args[2][0])
{
case 'r':
type = WPT_READ;
/*append binary memory gmon.out profile_hist_data (profile_hist_data + profile_hist_hdr.hist_size) */
char *data=malloc(2*length);
- if (data!=NULL)
+ if (data != NULL)
{
for (i=0; i<length;i++)
{
struct timeval timeout, now;
gettimeofday(&timeout, NULL);
- if (argc!=2)
+ if (argc != 2)
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
retval=ERROR_OK;
break;
}
- if (retval!=ERROR_OK)
+ if (retval != ERROR_OK)
{
break;
}
e,
Jim_Nvp_value2name_simple( nvp_target_event, e )->name,
Jim_GetString( teap->body, NULL ) );
- if (Jim_EvalObj( interp, teap->body )!=JIM_OK)
+ if (Jim_EvalObj( interp, teap->body ) != JIM_OK)
{
Jim_PrintErrorMessage(interp);
}
Jim_GetOpt_NvpUnknown( goi, nvp_config_opts, 0 );
return e;
}
- switch( n->value ){
+ switch ( n->value ){
case TCFG_TYPE:
/* not setable */
if ( goi->isconfigure ){
/* Assume blank result */
Jim_SetEmptyResult( goi.interp );
- switch( n->value ){
+ switch ( n->value ){
case TS_CMD_CONFIGURE:
if ( goi.argc < 2 ){
Jim_WrongNumArgs( goi.interp, goi.argc, goi.argv, "missing: -option VALUE ...");
c = 1;
}
- switch( n->value ){
+ switch ( n->value ){
case TS_CMD_MWW:
target_buffer_set_u32( target, target_buf, b );
b = 4;
b = 1;
break;
}
- for( x = 0 ; x < c ; x++ ){
+ for ( x = 0 ; x < c ; x++ ){
e = target_write_memory( target, a, b, 1, target_buf );
if ( e != ERROR_OK ){
Jim_SetResult_sprintf( interp, "Error writing @ 0x%08x: %d\n", (int)(a), e );
c = 1;
}
b = 1; /* shut up gcc */
- switch( n->value ){
+ switch ( n->value ){
case TS_CMD_MDW:
b = 4;
break;
}
Jim_fprintf( interp, interp->cookie_stdout, "0x%08x ", (int)(a) );
- switch( b ){
+ switch ( b ){
case 4:
- for( x = 0 ; (x < 16) && (x < y) ; x += 4 ){
+ for ( x = 0 ; (x < 16) && (x < y) ; x += 4 ){
z = target_buffer_get_u32( target, &(target_buf[ x * 4 ]) );
Jim_fprintf( interp, interp->cookie_stdout, "%08x ", (int)(z) );
}
- for( ; (x < 16) ; x += 4 ){
+ for ( ; (x < 16) ; x += 4 ){
Jim_fprintf( interp, interp->cookie_stdout, " " );
}
break;
case 2:
- for( x = 0 ; (x < 16) && (x < y) ; x += 2 ){
+ for ( x = 0 ; (x < 16) && (x < y) ; x += 2 ){
z = target_buffer_get_u16( target, &(target_buf[ x * 2 ]) );
Jim_fprintf( interp, interp->cookie_stdout, "%04x ", (int)(z) );
}
- for( ; (x < 16) ; x += 2 ){
+ for ( ; (x < 16) ; x += 2 ){
Jim_fprintf( interp, interp->cookie_stdout, " " );
}
break;
case 1:
default:
- for( x = 0 ; (x < 16) && (x < y) ; x += 1 ){
+ for ( x = 0 ; (x < 16) && (x < y) ; x += 1 ){
z = target_buffer_get_u8( target, &(target_buf[ x * 4 ]) );
Jim_fprintf( interp, interp->cookie_stdout, "%02x ", (int)(z) );
}
- for( ; (x < 16) ; x += 1 ){
+ for ( ; (x < 16) ; x += 1 ){
Jim_fprintf( interp, interp->cookie_stdout, " " );
}
break;
}
/* ascii-ify the bytes */
- for( x = 0 ; x < y ; x++ ){
+ for ( x = 0 ; x < y ; x++ ){
if ( (target_buf[x] >= 0x20) &&
(target_buf[x] <= 0x7e) ){
/* good */
e = Jim_GetOpt_String( goi, &cp2, NULL );
cp = cp2;
/* now does target type exist */
- for( x = 0 ; target_types[x] ; x++ ){
+ for ( x = 0 ; target_types[x] ; x++ ){
if ( 0 == strcmp( cp, target_types[x]->name ) ){
/* found */
break;
}
if ( target_types[x] == NULL ){
Jim_SetResult_sprintf( goi->interp, "Unknown target type %s, try one of ", cp );
- for( x = 0 ; target_types[x] ; x++ ){
+ for ( x = 0 ; target_types[x] ; x++ ){
if ( target_types[x+1] ){
Jim_AppendStrings( goi->interp,
Jim_GetResult(goi->interp),
return r;
}
- switch(x){
+ switch (x){
default:
Jim_Panic(goi.interp,"Why am I here?");
return JIM_ERR;
return JIM_ERR;
}
Jim_SetResult( goi.interp, Jim_NewListObj( goi.interp, NULL, 0 ) );
- for( x = 0 ; target_types[x] ; x++ ){
+ for ( x = 0 ; target_types[x] ; x++ ){
Jim_ListAppendElement( goi.interp,
Jim_GetResult(goi.interp),
Jim_NewStringObj( goi.interp, target_types[x]->name, -1 ) );
static void free_fastload(void)
{
- if (fastload!=NULL)
+ if (fastload != NULL)
{
int i;
for (i=0; i<fastload_num; i++)
if (image.sections[i].base_address<min_address)
{
/* clip addresses below */
- offset+=min_address-image.sections[i].base_address;
- length-=offset;
+ offset += min_address-image.sections[i].base_address;
+ length -= offset;
}
if (image.sections[i].base_address+buf_cnt>max_address)
{
- length-=(image.sections[i].base_address+buf_cnt)-max_address;
+ length -= (image.sections[i].base_address+buf_cnt)-max_address;
}
fastload[i].address=image.sections[i].base_address+offset;
image_close(&image);
- if (retval!=ERROR_OK)
+ if (retval != ERROR_OK)
{
free_fastload();
}
{
retval = target_write_buffer(target, fastload[i].address, fastload[i].length, fastload[i].data);
}
- size+=fastload[i].length;
+ size += fastload[i].length;
}
int after=timeval_ms();
command_print(cmd_ctx, "Loaded image %f kBytes/s", (float)(size/1024.0)/((float)(after-ms)/1000.0));