- Fixes '==' whitespace

- Replace ')\(==\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\(==\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2371 b42882b7-edfa-0310-969c-e2dbd0fdcd60
__archive__
zwelch 2009-06-23 22:42:03 +00:00
parent aea6815462
commit 3813fda44a
39 changed files with 150 additions and 150 deletions

View File

@ -284,7 +284,7 @@ static int at91sam7_flash_command(struct flash_bank_s *bank, uint8_t cmd, uint16
target_write_u32(target, MC_FCR[bank->bank_number], fcr); target_write_u32(target, MC_FCR[bank->bank_number], fcr);
LOG_DEBUG("Flash command: 0x%" PRIx32 ", flash bank: %i, page number: %u", fcr, bank->bank_number+1, pagen); LOG_DEBUG("Flash command: 0x%" PRIx32 ", flash bank: %i, page number: %u", fcr, bank->bank_number+1, pagen);
if ((at91sam7_info->cidr_arch == 0x60) && ((cmd==SLB)|(cmd==CLB))) if ((at91sam7_info->cidr_arch == 0x60) && ((cmd == SLB)|(cmd == CLB)))
{ {
/* Lock bit manipulation on AT91SAM7A3 waits for FC_FSR bit 1, EOL */ /* Lock bit manipulation on AT91SAM7A3 waits for FC_FSR bit 1, EOL */
if (at91sam7_wait_status_busy(bank, MC_FSR_EOL, 10)&0x0C) if (at91sam7_wait_status_busy(bank, MC_FSR_EOL, 10)&0x0C)

View File

@ -654,7 +654,7 @@ static int handle_flash_write_image_command(struct command_context_s *cmd_ctx, c
/* flash auto-erase is disabled by default*/ /* flash auto-erase is disabled by default*/
int auto_erase = 0; int auto_erase = 0;
if (strcmp(args[0], "erase")==0) if (strcmp(args[0], "erase") == 0)
{ {
auto_erase = 1; auto_erase = 1;
args++; args++;
@ -894,7 +894,7 @@ static int handle_flash_write_bank_command(struct command_context_s *cmd_ctx, ch
fileio_close(&fileio); fileio_close(&fileio);
return retvaltemp; return retvaltemp;
} }
if (retval==ERROR_OK) if (retval == ERROR_OK)
{ {
command_print(cmd_ctx, command_print(cmd_ctx,
"wrote %lld byte from file %s to flash bank %li at offset 0x%8.8" PRIx32 " in %s (%f kb/s)", "wrote %lld byte from file %s to flash bank %li at offset 0x%8.8" PRIx32 " in %s (%f kb/s)",

View File

@ -172,7 +172,7 @@ static int ocl_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset
int i; int i;
/* check preconditions */ /* check preconditions */
if (ocl->buflen == 0 || ocl->bufalign==0) if (ocl->buflen == 0 || ocl->bufalign == 0)
return ERROR_FLASH_BANK_NOT_PROBED; return ERROR_FLASH_BANK_NOT_PROBED;
if (bank->target->state != TARGET_RUNNING) if (bank->target->state != TARGET_RUNNING)
@ -373,7 +373,7 @@ static int ocl_auto_probe(struct flash_bank_s *bank)
{ {
ocl_priv_t *ocl = bank->driver_priv; ocl_priv_t *ocl = bank->driver_priv;
if (ocl->buflen == 0 || ocl->bufalign==0) if (ocl->buflen == 0 || ocl->bufalign == 0)
return ERROR_FLASH_BANK_NOT_PROBED; return ERROR_FLASH_BANK_NOT_PROBED;
return ERROR_OK; return ERROR_OK;

View File

@ -27,7 +27,7 @@ uint32 dcc_rd(void)
do { do {
asm volatile ("mrc p14, 0, %0, C0, C0" : "=r" (dcc_reg) : ); asm volatile ("mrc p14, 0, %0, C0, C0" : "=r" (dcc_reg) : );
} while ((dcc_reg&1)==0); } while ((dcc_reg&1) == 0);
asm volatile ("mrc p14, 0, %0, C1, C0" : "=r" (dcc_reg) : ); asm volatile ("mrc p14, 0, %0, C1, C0" : "=r" (dcc_reg) : );
return dcc_reg; return dcc_reg;

View File

@ -86,7 +86,7 @@ int flash_page_program(uint32 *data, int page_num)
else efc_ofs=0; else efc_ofs=0;
/* wait until FLASH is ready, just for sure */ /* wait until FLASH is ready, just for sure */
while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0); while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0);
/* calculate page address, only lower 8 bits are used to address the latch, /* calculate page address, only lower 8 bits are used to address the latch,
but the upper part of address is needed for writing to proper EFC */ but the upper part of address is needed for writing to proper EFC */
@ -103,7 +103,7 @@ int flash_page_program(uint32 *data, int page_num)
outr(MC_FCR+efc_ofs, ((page_num&0x3ff) << 8) | MC_KEY | MC_FCMD_WP); outr(MC_FCR+efc_ofs, ((page_num&0x3ff) << 8) | MC_KEY | MC_FCMD_WP);
/* wait until it's done */ /* wait until it's done */
while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0); while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0);
/* check for errors */ /* check for errors */
if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE; if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE;
@ -134,12 +134,12 @@ int flash_erase_plane(int efc_ofs)
if (lockbits&1) { if (lockbits&1) {
/* wait until FLASH is ready, just for sure */ /* wait until FLASH is ready, just for sure */
while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0); while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0);
outr(MC_FCR+efc_ofs, ((page_num&0x3ff) << 8) | 0x5a000004); outr(MC_FCR+efc_ofs, ((page_num&0x3ff) << 8) | 0x5a000004);
/* wait until it's done */ /* wait until it's done */
while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0); while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0);
/* check for errors */ /* check for errors */
if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE; if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE;
@ -151,13 +151,13 @@ int flash_erase_plane(int efc_ofs)
} }
/* wait until FLASH is ready, just for sure */ /* wait until FLASH is ready, just for sure */
while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0); while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0);
/* erase all command to FCR */ /* erase all command to FCR */
outr(MC_FCR+efc_ofs, 0x5a000008); outr(MC_FCR+efc_ofs, 0x5a000008);
/* wait until it's done */ /* wait until it's done */
while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0); while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0);
/* check for errors */ /* check for errors */
if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE; if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE;

View File

@ -309,7 +309,7 @@ static int str9x_erase(struct flash_bank_s *bank, int first, int last)
break; break;
alive_sleep(1); alive_sleep(1);
} }
if (timeout==1000) if (timeout == 1000)
{ {
LOG_ERROR("erase timed out"); LOG_ERROR("erase timed out");
return ERROR_FAIL; return ERROR_FAIL;
@ -582,7 +582,7 @@ static int str9x_write(struct flash_bank_s *bank,
break; break;
alive_sleep(1); alive_sleep(1);
} }
if (timeout==1000) if (timeout == 1000)
{ {
LOG_ERROR("write timed out"); LOG_ERROR("write timed out");
return ERROR_FAIL; return ERROR_FAIL;
@ -631,7 +631,7 @@ static int str9x_write(struct flash_bank_s *bank,
break; break;
alive_sleep(1); alive_sleep(1);
} }
if (timeout==1000) if (timeout == 1000)
{ {
LOG_ERROR("write timed out"); LOG_ERROR("write timed out");
return ERROR_FAIL; return ERROR_FAIL;

View File

@ -32,7 +32,7 @@
/* inlining this will help show what fn that is taking time during profiling. */ /* inlining this will help show what fn that is taking time during profiling. */
static inline void buf_set_u32(uint8_t* buffer, unsigned int first, unsigned int num, uint32_t value) static inline void buf_set_u32(uint8_t* buffer, unsigned int first, unsigned int num, uint32_t value)
{ {
if ((num==32) && (first==0)) if ((num == 32) && (first == 0))
{ {
buffer[3]=(value >> 24)&0xff; buffer[3]=(value >> 24)&0xff;
buffer[2]=(value >> 16)&0xff; buffer[2]=(value >> 16)&0xff;
@ -53,7 +53,7 @@ static inline void buf_set_u32(uint8_t* buffer, unsigned int first, unsigned int
} }
static inline uint32_t buf_get_u32(const uint8_t* buffer, unsigned int first, unsigned int num) static inline uint32_t buf_get_u32(const uint8_t* buffer, unsigned int first, unsigned int num)
{ {
if ((num==32) && (first==0)) if ((num == 32) && (first == 0))
{ {
return (((uint32_t)buffer[3]) << 24)|(((uint32_t)buffer[2]) << 16)|(((uint32_t)buffer[1]) << 8)|(((uint32_t)buffer[0]) << 0); return (((uint32_t)buffer[3]) << 24)|(((uint32_t)buffer[2]) << 16)|(((uint32_t)buffer[1]) << 8)|(((uint32_t)buffer[0]) << 0);
} else } else

View File

@ -94,9 +94,9 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
* to the fn and fish it out manually. * to the fn and fish it out manually.
*/ */
c = interp->cmdPrivData; c = interp->cmdPrivData;
if (c==NULL) if (c == NULL)
{ {
LOG_ERROR("BUG: interp->cmdPrivData==NULL"); LOG_ERROR("BUG: interp->cmdPrivData == NULL");
return JIM_ERR; return JIM_ERR;
} }
target_call_timer_callbacks_now(); target_call_timer_callbacks_now();
@ -157,7 +157,7 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
*return_retval = retval; *return_retval = retval;
} }
return (retval==ERROR_OK)?JIM_OK:JIM_ERR; return (retval == ERROR_OK)?JIM_OK:JIM_ERR;
} }
/* nice short description of source file */ /* nice short description of source file */
@ -212,7 +212,7 @@ command_t* register_command(command_context_t *context, command_t *parent, char
} }
/* just a placeholder, no handler */ /* just a placeholder, no handler */
if (c->handler==NULL) if (c->handler == NULL)
return c; return c;
/* If this is a two level command, e.g. "flash banks", then the /* If this is a two level command, e.g. "flash banks", then the
@ -478,7 +478,7 @@ int command_run_line(command_context_t *context, char *line)
/* We do not print the connection closed error message */ /* We do not print the connection closed error message */
Jim_PrintErrorMessage(interp); Jim_PrintErrorMessage(interp);
} }
if (retval==ERROR_OK) if (retval == ERROR_OK)
{ {
/* It wasn't a low level OpenOCD command that failed */ /* It wasn't a low level OpenOCD command that failed */
return ERROR_FAIL; return ERROR_FAIL;
@ -745,7 +745,7 @@ command_context_t* command_init()
#if !BUILD_ECOSBOARD #if !BUILD_ECOSBOARD
Jim_EventLoopOnLoad(interp); Jim_EventLoopOnLoad(interp);
#endif #endif
if (Jim_Eval_Named(interp, startup_tcl, "embedded:startup.tcl",1)==JIM_ERR) if (Jim_Eval_Named(interp, startup_tcl, "embedded:startup.tcl",1) == JIM_ERR)
{ {
LOG_ERROR("Failed to run startup.tcl (embedded into OpenOCD compile time)"); LOG_ERROR("Failed to run startup.tcl (embedded into OpenOCD compile time)");
Jim_PrintErrorMessage(interp); Jim_PrintErrorMessage(interp);
@ -812,7 +812,7 @@ int handle_fast_command(struct command_context_s *cmd_ctx, char *cmd, char **arg
if (argc != 1) if (argc != 1)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
fast_and_dangerous = strcmp("enable", args[0])==0; fast_and_dangerous = strcmp("enable", args[0]) == 0;
return ERROR_OK; return ERROR_OK;
} }
@ -856,7 +856,7 @@ long jim_global_long(const char *variable)
{ {
Jim_Obj *objPtr=Jim_GetGlobalVariableStr(interp, variable, JIM_ERRMSG); Jim_Obj *objPtr=Jim_GetGlobalVariableStr(interp, variable, JIM_ERRMSG);
long t; long t;
if (Jim_GetLong(interp, objPtr, &t)==JIM_OK) if (Jim_GetLong(interp, objPtr, &t) == JIM_OK)
{ {
return t; return t;
} }

View File

@ -94,7 +94,7 @@ FILE *open_file_from_path (char *file, char *mode)
} else } else
{ {
char *full_path=find_file(file); char *full_path=find_file(file);
if (full_path==NULL) if (full_path == NULL)
return NULL; return NULL;
FILE *fp = NULL; FILE *fp = NULL;
fp = fopen(full_path, mode); fp = fopen(full_path, mode);

View File

@ -84,7 +84,7 @@ int loadFile(const char *fileName, void **data, size_t *len)
FILE * pFile; FILE * pFile;
pFile = fopen(fileName,"rb"); pFile = fopen(fileName,"rb");
if (pFile==NULL) if (pFile == NULL)
{ {
LOG_ERROR("Can't open %s\n", fileName); LOG_ERROR("Can't open %s\n", fileName);
return ERROR_FAIL; return ERROR_FAIL;
@ -111,7 +111,7 @@ int loadFile(const char *fileName, void **data, size_t *len)
return ERROR_FAIL; return ERROR_FAIL;
} }
*data = malloc(*len + 1); *data = malloc(*len + 1);
if (*data==NULL) if (*data == NULL)
{ {
LOG_ERROR("Can't open %s\n", fileName); LOG_ERROR("Can't open %s\n", fileName);
fclose(pFile); fclose(pFile);
@ -233,7 +233,7 @@ int handle_append_command(struct command_context_s *cmd_ctx, char *cmd,
break; break;
} }
} }
if ((i==argc) && (fwrite("\n", 1, 1, config_file)==1)) if ((i == argc) && (fwrite("\n", 1, 1, config_file) == 1))
{ {
retval=ERROR_OK; retval=ERROR_OK;
} }
@ -274,7 +274,7 @@ int handle_cp_command(struct command_context_s *cmd_ctx, char *cmd, char **args,
chunk = maxChunk; chunk = maxChunk;
} }
if ((retval==ERROR_OK) && (fwrite(((char *)data)+pos, 1, chunk, f) != chunk)) if ((retval == ERROR_OK) && (fwrite(((char *)data)+pos, 1, chunk, f) != chunk))
retval = ERROR_INVALID_ARGUMENTS; retval = ERROR_INVALID_ARGUMENTS;
if (retval != ERROR_OK) if (retval != ERROR_OK)
@ -363,7 +363,7 @@ void copydir(char *name, char *destdir)
DIR *dirp; DIR *dirp;
dirp = opendir(destdir); dirp = opendir(destdir);
if (dirp==NULL) if (dirp == NULL)
{ {
mkdir(destdir, 0777); mkdir(destdir, 0777);
} else } else
@ -477,7 +477,7 @@ zylinjtag_Jim_Command_ls(Jim_Interp *interp,
if (entry == NULL) if (entry == NULL)
break; break;
if ((strcmp(".", entry->d_name)==0)||(strcmp("..", entry->d_name)==0)) if ((strcmp(".", entry->d_name) == 0)||(strcmp("..", entry->d_name) == 0))
continue; continue;
Jim_ListAppendElement(interp, objPtr, Jim_NewStringObj(interp, entry->d_name, strlen(entry->d_name))); Jim_ListAppendElement(interp, objPtr, Jim_NewStringObj(interp, entry->d_name, strlen(entry->d_name)));

View File

@ -198,7 +198,7 @@ static jim_wide JimStrtoll(const char *nptr, char **endptr, register int base)
* digit. For instance, if the range for quads is * digit. For instance, if the range for quads is
* [-9223372036854775808..9223372036854775807] and the input base * [-9223372036854775808..9223372036854775807] and the input base
* is 10, cutoff will be set to 922337203685477580 and cutlim to * is 10, cutoff will be set to 922337203685477580 and cutlim to
* either 7 (neg==0) or 8 (neg==1), meaning that if we have * either 7 (neg == 0) or 8 (neg == 1), meaning that if we have
* accumulated a value > 922337203685477580, or equal but the * accumulated a value > 922337203685477580, or equal but the
* next digit is > 7 (or 8), the number is too big, and we will * next digit is > 7 (or 8), the number is too big, and we will
* return a range error. * return a range error.
@ -503,7 +503,7 @@ int Jim_StringToDouble(const char *str, double *doublePtr)
static jim_wide JimPowWide(jim_wide b, jim_wide e) static jim_wide JimPowWide(jim_wide b, jim_wide e)
{ {
jim_wide i, res = 1; jim_wide i, res = 1;
if ((b==0 && e != 0) || (e<0)) return 0; if ((b == 0 && e != 0) || (e<0)) return 0;
for (i=0; i<e; i++) {res *= b;} for (i=0; i<e; i++) {res *= b;}
return res; return res;
} }
@ -568,7 +568,7 @@ void Jim_Panic(Jim_Interp *interp, const char *fmt, ...)
void *Jim_Alloc(int size) void *Jim_Alloc(int size)
{ {
/* We allocate zero length arrayes, etc. to use a single orthogonal codepath */ /* We allocate zero length arrayes, etc. to use a single orthogonal codepath */
if (size==0) if (size == 0)
size=1; size=1;
void *p = malloc(size); void *p = malloc(size);
if (p == NULL) if (p == NULL)
@ -583,7 +583,7 @@ void Jim_Free(void *ptr) {
void *Jim_Realloc(void *ptr, int size) void *Jim_Realloc(void *ptr, int size)
{ {
/* We allocate zero length arrayes, etc. to use a single orthogonal codepath */ /* We allocate zero length arrayes, etc. to use a single orthogonal codepath */
if (size==0) if (size == 0)
size=1; size=1;
void *p = realloc(ptr, size); void *p = realloc(ptr, size);
if (p == NULL) if (p == NULL)
@ -6959,7 +6959,7 @@ int Jim_EvalExpression(Jim_Interp *interp, Jim_Obj *exprObjPtr,
case JIM_EXPROP_GTE: wC = wA >= wB; break; case JIM_EXPROP_GTE: wC = wA >= wB; break;
case JIM_EXPROP_LSHIFT: wC = wA << wB; break; case JIM_EXPROP_LSHIFT: wC = wA << wB; break;
case JIM_EXPROP_RSHIFT: wC = wA >> wB; break; case JIM_EXPROP_RSHIFT: wC = wA >> wB; break;
case JIM_EXPROP_NUMEQ: wC = wA==wB; break; case JIM_EXPROP_NUMEQ: wC = wA == wB; break;
case JIM_EXPROP_NUMNE: wC = wA != wB; break; case JIM_EXPROP_NUMNE: wC = wA != wB; break;
case JIM_EXPROP_BITAND: wC = wA&wB; break; case JIM_EXPROP_BITAND: wC = wA&wB; break;
case JIM_EXPROP_BITXOR: wC = wA^wB; break; case JIM_EXPROP_BITXOR: wC = wA^wB; break;
@ -7062,7 +7062,7 @@ trydouble:
case JIM_EXPROP_GT: dC = dA>dB; break; case JIM_EXPROP_GT: dC = dA>dB; break;
case JIM_EXPROP_LTE: dC = dA <= dB; break; case JIM_EXPROP_LTE: dC = dA <= dB; break;
case JIM_EXPROP_GTE: dC = dA >= dB; break; case JIM_EXPROP_GTE: dC = dA >= dB; break;
case JIM_EXPROP_NUMEQ: dC = dA==dB; break; case JIM_EXPROP_NUMEQ: dC = dA == dB; break;
case JIM_EXPROP_NUMNE: dC = dA != dB; break; case JIM_EXPROP_NUMNE: dC = dA != dB; break;
case JIM_EXPROP_LOGICAND_LEFT: case JIM_EXPROP_LOGICAND_LEFT:
if (dA == 0) { if (dA == 0) {

View File

@ -578,7 +578,7 @@ typedef struct Jim_Reference {
* An NVP Table is terminated with ".name=NULL". * An NVP Table is terminated with ".name=NULL".
* *
* During the 'name2value' operation, if no matching string is found * During the 'name2value' operation, if no matching string is found
* the pointer to the terminal element (with p->name==NULL) is returned. * the pointer to the terminal element (with p->name == NULL) is returned.
* *
* Example: * Example:
* \code * \code

View File

@ -189,7 +189,7 @@ static void bitbang_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int
for (bit_cnt = 0; bit_cnt < scan_size; bit_cnt++) for (bit_cnt = 0; bit_cnt < scan_size; bit_cnt++)
{ {
int val=0; int val=0;
int tms=(bit_cnt==scan_size-1) ? 1 : 0; int tms=(bit_cnt == scan_size-1) ? 1 : 0;
int tdi; int tdi;
int bytec=bit_cnt/8; int bytec=bit_cnt/8;
int bcval=1 << (bit_cnt % 8); int bcval=1 << (bit_cnt % 8);

View File

@ -51,7 +51,7 @@ void bitq_in_proc(void)
while (bitq_in_state.cmd) while (bitq_in_state.cmd)
{ {
/* only JTAG_SCAN command may return data */ /* only JTAG_SCAN command may return data */
if (bitq_in_state.cmd->type==JTAG_SCAN) if (bitq_in_state.cmd->type == JTAG_SCAN)
{ {
/* loop through the fields */ /* loop through the fields */
while (bitq_in_state.field_idx<bitq_in_state.cmd->cmd.scan->num_fields) while (bitq_in_state.field_idx<bitq_in_state.cmd->cmd.scan->num_fields)
@ -59,7 +59,7 @@ void bitq_in_proc(void)
field = &bitq_in_state.cmd->cmd.scan->fields[bitq_in_state.field_idx]; field = &bitq_in_state.cmd->cmd.scan->fields[bitq_in_state.field_idx];
if (field->in_value) if (field->in_value)
{ {
if (bitq_in_state.bit_pos==0) if (bitq_in_state.bit_pos == 0)
{ {
/* initialize field scanning */ /* initialize field scanning */
in_mask = 0x01; in_mask = 0x01;
@ -83,7 +83,7 @@ void bitq_in_proc(void)
bitq_in_bufsize *= 2; bitq_in_bufsize *= 2;
} }
/* if necessary, allocate buffer and check for malloc error */ /* if necessary, allocate buffer and check for malloc error */
if (bitq_in_buffer==NULL && ( bitq_in_buffer = malloc(bitq_in_bufsize) )==NULL) if (bitq_in_buffer == NULL && ( bitq_in_buffer = malloc(bitq_in_bufsize) ) == NULL)
{ {
LOG_ERROR("malloc error"); LOG_ERROR("malloc error");
exit(-1); exit(-1);
@ -102,11 +102,11 @@ void bitq_in_proc(void)
#endif #endif
return; return;
} }
if (in_mask==0x01) if (in_mask == 0x01)
in_buff[in_idx] = 0; in_buff[in_idx] = 0;
if (tdo) if (tdo)
in_buff[in_idx] |= in_mask; in_buff[in_idx] |= in_mask;
if (in_mask==0x80) if (in_mask == 0x80)
{ {
in_mask = 0x01; in_mask = 0x01;
in_idx++; in_idx++;
@ -226,7 +226,7 @@ void bitq_scan_field(scan_field_t* field, int pause)
else else
tdo_req = 0; tdo_req = 0;
if (field->out_value==NULL) if (field->out_value == NULL)
{ {
/* just send zeros and request data from TDO */ /* just send zeros and request data from TDO */
for (bit_cnt = field->num_bits; bit_cnt>1; bit_cnt--) for (bit_cnt = field->num_bits; bit_cnt>1; bit_cnt--)
@ -242,7 +242,7 @@ void bitq_scan_field(scan_field_t* field, int pause)
for (bit_cnt = field->num_bits; bit_cnt>1; bit_cnt--) for (bit_cnt = field->num_bits; bit_cnt>1; bit_cnt--)
{ {
bitq_io(0, ( (*out_ptr) & out_mask ) != 0, tdo_req); bitq_io(0, ( (*out_ptr) & out_mask ) != 0, tdo_req);
if (out_mask==0x80) if (out_mask == 0x80)
{ {
out_mask = 0x01; out_mask = 0x01;
out_ptr++; out_ptr++;
@ -257,9 +257,9 @@ void bitq_scan_field(scan_field_t* field, int pause)
if (pause) if (pause)
{ {
bitq_io(0, 0, 0); bitq_io(0, 0, 0);
if (tap_get_state()==TAP_IRSHIFT) if (tap_get_state() == TAP_IRSHIFT)
tap_set_state(TAP_IRPAUSE); tap_set_state(TAP_IRPAUSE);
else if (tap_get_state()==TAP_DRSHIFT) else if (tap_get_state() == TAP_DRSHIFT)
tap_set_state(TAP_DRPAUSE); tap_set_state(TAP_DRPAUSE);
} }
} }

View File

@ -508,9 +508,9 @@ int jtag_add_statemove(tap_state_t goal_state)
tap_state_name(goal_state) ); tap_state_name(goal_state) );
if (goal_state==cur_state ) if (goal_state == cur_state )
; /* nothing to do */ ; /* nothing to do */
else if ( goal_state==TAP_RESET ) else if ( goal_state == TAP_RESET )
{ {
jtag_add_tlr(); jtag_add_tlr();
} }
@ -576,7 +576,7 @@ void jtag_add_reset(int req_tlr_or_trst, int req_srst)
*/ */
if ((jtag_reset_config & RESET_HAS_SRST)&& if ((jtag_reset_config & RESET_HAS_SRST)&&
(jtag_reset_config & RESET_HAS_TRST)&& (jtag_reset_config & RESET_HAS_TRST)&&
((jtag_reset_config & RESET_SRST_PULLS_TRST)==0)) ((jtag_reset_config & RESET_SRST_PULLS_TRST) == 0))
{ {
if (((req_tlr_or_trst&&!jtag_trst)|| if (((req_tlr_or_trst&&!jtag_trst)||
(!req_tlr_or_trst && jtag_trst))&& (!req_tlr_or_trst && jtag_trst))&&
@ -746,7 +746,7 @@ void jtag_check_value_mask(scan_field_t *field, uint8_t *value, uint8_t *mask)
{ {
assert(field->in_value != NULL); assert(field->in_value != NULL);
if (value==NULL) if (value == NULL)
{ {
/* no checking to do */ /* no checking to do */
return; return;
@ -1216,7 +1216,7 @@ int jtag_init_reset(struct command_context_s *cmd_ctx)
if (jtag_reset_config & RESET_HAS_SRST) if (jtag_reset_config & RESET_HAS_SRST)
{ {
jtag_add_reset(1, 1); jtag_add_reset(1, 1);
if ((jtag_reset_config & RESET_SRST_PULLS_TRST)==0) if ((jtag_reset_config & RESET_SRST_PULLS_TRST) == 0)
jtag_add_reset(0, 1); jtag_add_reset(0, 1);
} }
jtag_add_reset(0, 0); jtag_add_reset(0, 0);
@ -1238,7 +1238,7 @@ int jtag_init(struct command_context_s *cmd_ctx)
int retval; int retval;
if ((retval=jtag_interface_init(cmd_ctx)) != ERROR_OK) if ((retval=jtag_interface_init(cmd_ctx)) != ERROR_OK)
return retval; return retval;
if (jtag_init_inner(cmd_ctx)==ERROR_OK) if (jtag_init_inner(cmd_ctx) == ERROR_OK)
{ {
return ERROR_OK; return ERROR_OK;
} }

View File

@ -476,7 +476,7 @@ void interface_jtag_add_callback4(jtag_callback_t callback, jtag_callback_data_t
entry->data2=data2; entry->data2=data2;
entry->data3=data3; entry->data3=data3;
if (jtag_callback_queue_head==NULL) if (jtag_callback_queue_head == NULL)
{ {
jtag_callback_queue_head=entry; jtag_callback_queue_head=entry;
jtag_callback_queue_tail=entry; jtag_callback_queue_tail=entry;

View File

@ -131,7 +131,7 @@ static void dummy_reset(int trst, int srst)
static int dummy_khz(int khz, int *jtag_speed) static int dummy_khz(int khz, int *jtag_speed)
{ {
if (khz==0) if (khz == 0)
{ {
*jtag_speed=0; *jtag_speed=0;
} }
@ -144,7 +144,7 @@ static int dummy_khz(int khz, int *jtag_speed)
static int dummy_speed_div(int speed, int *khz) static int dummy_speed_div(int speed, int *khz)
{ {
if (speed==0) if (speed == 0)
{ {
*khz = 0; *khz = 0;
} }

View File

@ -50,7 +50,7 @@
#include <assert.h> #include <assert.h>
#if (BUILD_FT2232_FTD2XX==1 && BUILD_FT2232_LIBFTDI==1) #if (BUILD_FT2232_FTD2XX == 1 && BUILD_FT2232_LIBFTDI == 1)
#error "BUILD_FT2232_FTD2XX && BUILD_FT2232_LIBFTDI are mutually exclusive" #error "BUILD_FT2232_FTD2XX && BUILD_FT2232_LIBFTDI are mutually exclusive"
#elif (BUILD_FT2232_FTD2XX != 1 && BUILD_FT2232_LIBFTDI != 1) #elif (BUILD_FT2232_FTD2XX != 1 && BUILD_FT2232_LIBFTDI != 1)
#error "BUILD_FT2232_FTD2XX || BUILD_FT2232_LIBFTDI must be chosen" #error "BUILD_FT2232_FTD2XX || BUILD_FT2232_LIBFTDI must be chosen"
@ -274,7 +274,7 @@ static void clock_tms(uint8_t mpsse_cmd, int tms_bits, int tms_count, bool tdi_b
*/ */
++tms_ndx; ++tms_ndx;
if (tms_ndx==7 || i==tms_count-1) if (tms_ndx == 7 || i == tms_count-1)
{ {
buffer_write(mpsse_cmd); buffer_write(mpsse_cmd);
buffer_write(tms_ndx - 1); buffer_write(tms_ndx - 1);
@ -498,7 +498,7 @@ static int ft2232_speed_div(int speed, int* khz)
static int ft2232_khz(int khz, int* jtag_speed) static int ft2232_khz(int khz, int* jtag_speed)
{ {
if (khz==0) if (khz == 0)
{ {
#ifdef BUILD_FTD2XX_HIGHSPEED #ifdef BUILD_FTD2XX_HIGHSPEED
*jtag_speed = 0; *jtag_speed = 0;
@ -2049,7 +2049,7 @@ static int ft2232_init(void)
const ft2232_layout_t* cur_layout = ft2232_layouts; const ft2232_layout_t* cur_layout = ft2232_layouts;
int i; int i;
if (tap_get_tms_path_len(TAP_IRPAUSE,TAP_IRPAUSE)==7) if (tap_get_tms_path_len(TAP_IRPAUSE,TAP_IRPAUSE) == 7)
{ {
LOG_DEBUG("ft2232 interface using 7 step jtag state transitions"); LOG_DEBUG("ft2232 interface using 7 step jtag state transitions");
} }

View File

@ -770,7 +770,7 @@ static int jlink_tap_execute(void)
/* JLink returns an extra NULL in packet when size of in message is a multiple of 64, creates problems with usb comms */ /* JLink returns an extra NULL in packet when size of in message is a multiple of 64, creates problems with usb comms */
/* WARNING This will interfere with tap state counting */ /* WARNING This will interfere with tap state counting */
while ((TAP_SCAN_BYTES(tap_length)%64)==0) while ((TAP_SCAN_BYTES(tap_length)%64) == 0)
{ {
jlink_tap_append_step((tap_get_state() == TAP_RESET)?1:0, 0); jlink_tap_append_step((tap_get_state() == TAP_RESET)?1:0, 0);
} }
@ -932,7 +932,7 @@ static int jlink_usb_message(jlink_jtag_t *jlink_jtag, int out_length, int in_le
if (1 != result2) if (1 != result2)
{ {
LOG_ERROR("jlink_usb_read_emu_result retried requested=1, result=%d, in_length=%i", result2,in_length); LOG_ERROR("jlink_usb_read_emu_result retried requested=1, result=%d, in_length=%i", result2,in_length);
/* Try again once, should only happen if (in_length%64==0) */ /* Try again once, should only happen if (in_length%64 == 0) */
result2 = jlink_usb_read_emu_result(jlink_jtag); result2 = jlink_usb_read_emu_result(jlink_jtag);
if (1 != result2) if (1 != result2)
{ {

View File

@ -534,7 +534,7 @@ static int presto_sendbyte(int data)
if (presto->buff_out_pos >= BUFFER_SIZE) if (presto->buff_out_pos >= BUFFER_SIZE)
#elif BUILD_PRESTO_LIBFTDI == 1 #elif BUILD_PRESTO_LIBFTDI == 1
/* libftdi does not do background read, be sure that USB IN buffer does not overflow (128 bytes only!) */ /* libftdi does not do background read, be sure that USB IN buffer does not overflow (128 bytes only!) */
if (presto->buff_out_pos >= BUFFER_SIZE || presto->buff_in_exp==128) if (presto->buff_out_pos >= BUFFER_SIZE || presto->buff_in_exp == 128)
#endif #endif
return presto_flush(); return presto_flush();

View File

@ -1208,7 +1208,7 @@ static int handle_irscan_command(struct command_context_s *cmd_ctx, char *cmd, c
for (i = 0; i < num_fields; i++) for (i = 0; i < num_fields; i++)
{ {
tap = jtag_tap_by_string( args[i*2] ); tap = jtag_tap_by_string( args[i*2] );
if (tap==NULL) if (tap == NULL)
{ {
command_print( cmd_ctx, "Tap: %s unknown", args[i*2] ); command_print( cmd_ctx, "Tap: %s unknown", args[i*2] );
return ERROR_FAIL; return ERROR_FAIL;

View File

@ -591,7 +591,7 @@ static void usbprog_jtag_write_tdi(struct usbprog_jtag *usbprog_jtag, char * buf
{ {
send_bits = size; send_bits = size;
loops = size/8; loops = size/8;
/* if (loops==0) */ /* if (loops == 0) */
loops++; loops++;
size = 0; size = 0;
} }

View File

@ -41,7 +41,7 @@ static __inline__ void waitIdle(void)
do do
{ {
ZY1000_PEEK(ZY1000_JTAG_BASE+0x10, empty); ZY1000_PEEK(ZY1000_JTAG_BASE+0x10, empty);
} while ((empty & 0x100)==0); } while ((empty & 0x100) == 0);
} }
static __inline__ void waitQueue(void) static __inline__ void waitQueue(void)
@ -64,7 +64,7 @@ static void setCurrentState(enum tap_state state)
cyg_uint32 a; cyg_uint32 a;
a=state; a=state;
int repeat=0; int repeat=0;
if (state==TAP_RESET) if (state == TAP_RESET)
{ {
// The FPGA nor we know the current state of the CPU TAP // The FPGA nor we know the current state of the CPU TAP
// controller. This will move it to TAP for sure. // controller. This will move it to TAP for sure.
@ -92,7 +92,7 @@ static __inline__ void shiftValueInner(const enum tap_state state, const enum ta
ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value); ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value);
#if 1 #if 1
#if TEST_MANUAL() #if TEST_MANUAL()
if ((state==TAP_DRSHIFT) && (endState != TAP_DRSHIFT)) if ((state == TAP_DRSHIFT) && (endState != TAP_DRSHIFT))
{ {
int i; int i;
setCurrentState(state); setCurrentState(state);
@ -100,7 +100,7 @@ static __inline__ void shiftValueInner(const enum tap_state state, const enum ta
{ {
int tms; int tms;
tms=0; tms=0;
if ((i==repeat-1) && (state != endState)) if ((i == repeat-1) && (state != endState))
{ {
tms=1; tms=1;
} }
@ -124,7 +124,7 @@ static __inline__ void shiftValueInner(const enum tap_state state, const enum ta
#endif #endif
#else #else
/* maximum debug version */ /* maximum debug version */
if ((repeat>0) && ((state==TAP_DRSHIFT)||(state==TAP_SI))) if ((repeat>0) && ((state == TAP_DRSHIFT)||(state == TAP_SI)))
{ {
int i; int i;
/* sample shift register for every bit. */ /* sample shift register for every bit. */
@ -160,7 +160,7 @@ static __inline__ void interface_jtag_add_dr_out_core(jtag_tap_t *target_tap,
for (tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap=nextTap) for (tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap=nextTap)
{ {
nextTap=jtag_tap_next_enabled(tap); nextTap=jtag_tap_next_enabled(tap);
if (nextTap==NULL) if (nextTap == NULL)
{ {
pause_state = end_state; pause_state = end_state;
} }
@ -187,14 +187,14 @@ static __inline__ void interface_jtag_add_dr_out(jtag_tap_t *target_tap,
enum tap_state end_state) enum tap_state end_state)
{ {
int singletap=(jtag_tap_next_enabled(jtag_tap_next_enabled(NULL))==NULL); int singletap=(jtag_tap_next_enabled(jtag_tap_next_enabled(NULL)) == NULL);
if ((singletap) && (num_fields==3)) if ((singletap) && (num_fields == 3))
{ {
/* used by embeddedice_write_reg_inner() */ /* used by embeddedice_write_reg_inner() */
shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, num_bits[0], value[0]); shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, num_bits[0], value[0]);
shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, num_bits[1], value[1]); shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, num_bits[1], value[1]);
shiftValueInner(TAP_DRSHIFT, end_state, num_bits[2], value[2]); shiftValueInner(TAP_DRSHIFT, end_state, num_bits[2], value[2]);
} else if ((singletap) && (num_fields==2)) } else if ((singletap) && (num_fields == 2))
{ {
/* used by arm7 code */ /* used by arm7 code */
shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, num_bits[0], value[0]); shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, num_bits[0], value[0]);

View File

@ -49,7 +49,7 @@ int zy1000_handle_zy1000_port_command(struct command_context_s *cmd_ctx, char *c
static int zy1000_khz(int khz, int *jtag_speed) static int zy1000_khz(int khz, int *jtag_speed)
{ {
if (khz==0) if (khz == 0)
{ {
*jtag_speed=0; *jtag_speed=0;
} }
@ -62,7 +62,7 @@ static int zy1000_khz(int khz, int *jtag_speed)
static int zy1000_speed_div(int speed, int *khz) static int zy1000_speed_div(int speed, int *khz)
{ {
if (speed==0) if (speed == 0)
{ {
*khz = 0; *khz = 0;
} }
@ -176,7 +176,7 @@ void zy1000_reset(int trst, int srst)
alive_sleep(1); alive_sleep(1);
} }
if (i==1000) if (i == 1000)
{ {
LOG_USER("SRST didn't deassert after %dms", i); LOG_USER("SRST didn't deassert after %dms", i);
} else if (i>1) } else if (i>1)
@ -439,7 +439,7 @@ static __inline void scanFields(int num_fields, const scan_field_t *fields, tap_
tap_state_t pause_state; tap_state_t pause_state;
int l; int l;
k=num_bits-j; k=num_bits-j;
pause_state=(shiftState==TAP_DRSHIFT)?TAP_DRSHIFT:TAP_IRSHIFT; pause_state=(shiftState == TAP_DRSHIFT)?TAP_DRSHIFT:TAP_IRSHIFT;
if (k>32) if (k>32)
{ {
k=32; k=32;
@ -498,7 +498,7 @@ int interface_jtag_add_ir_scan(int num_fields, const scan_field_t *fields, tap_s
{ {
nextTap=jtag_tap_next_enabled(tap); nextTap=jtag_tap_next_enabled(tap);
tap_state_t end_state; tap_state_t end_state;
if (nextTap==NULL) if (nextTap == NULL)
{ {
end_state = state; end_state = state;
} else } else
@ -568,7 +568,7 @@ int interface_jtag_add_dr_scan(int num_fields, const scan_field_t *fields, tap_s
nextTap=jtag_tap_next_enabled(tap); nextTap=jtag_tap_next_enabled(tap);
int found=0; int found=0;
tap_state_t end_state; tap_state_t end_state;
if (nextTap==NULL) if (nextTap == NULL)
{ {
end_state = state; end_state = state;
} else } else
@ -732,7 +732,7 @@ void embeddedice_write_dcc(jtag_tap_t *tap, int reg_addr, uint8_t *buffer, int l
{ {
// static int const reg_addr=0x5; // static int const reg_addr=0x5;
tap_state_t end_state=jtag_get_end_state(); tap_state_t end_state=jtag_get_end_state();
if (jtag_tap_next_enabled(jtag_tap_next_enabled(NULL))==NULL) if (jtag_tap_next_enabled(jtag_tap_next_enabled(NULL)) == NULL)
{ {
/* better performance via code duplication */ /* better performance via code duplication */
if (little) if (little)

View File

@ -105,7 +105,7 @@ int check_pending(connection_t *connection, int timeout_s, int *got_data)
fd_set read_fds; fd_set read_fds;
gdb_connection_t *gdb_con = connection->priv; gdb_connection_t *gdb_con = connection->priv;
int t; int t;
if (got_data==NULL) if (got_data == NULL)
got_data=&t; got_data=&t;
*got_data=0; *got_data=0;
@ -1397,7 +1397,7 @@ int gdb_breakpoint_watchpoint_packet(connection_t *connection, target_t *target,
else if (type == 4) /* access watchpoint */ else if (type == 4) /* access watchpoint */
wp_type = WPT_ACCESS; wp_type = WPT_ACCESS;
if (gdb_breakpoint_override && ((bp_type==BKPT_SOFT)||(bp_type==BKPT_HARD))) if (gdb_breakpoint_override && ((bp_type == BKPT_SOFT)||(bp_type == BKPT_HARD)))
{ {
bp_type=gdb_breakpoint_override_type; bp_type=gdb_breakpoint_override_type;
} }
@ -1560,7 +1560,7 @@ static int compare_bank (const void * a, const void * b)
b1=*((flash_bank_t **)a); b1=*((flash_bank_t **)a);
b2=*((flash_bank_t **)b); b2=*((flash_bank_t **)b);
if (b1->base==b2->base) if (b1->base == b2->base)
{ {
return 0; return 0;
} else if (b1->base>b2->base) } else if (b1->base>b2->base)
@ -2349,13 +2349,13 @@ int handle_gdb_breakpoint_override_command(struct command_context_s *cmd_ctx, ch
if (argc == 0) if (argc == 0)
{ {
} else if (argc==1) } else if (argc == 1)
{ {
gdb_breakpoint_override = 1; gdb_breakpoint_override = 1;
if (strcmp(args[0], "hard")==0) if (strcmp(args[0], "hard") == 0)
{ {
gdb_breakpoint_override_type=BKPT_HARD; gdb_breakpoint_override_type=BKPT_HARD;
} else if (strcmp(args[0], "soft")==0) } else if (strcmp(args[0], "soft") == 0)
{ {
gdb_breakpoint_override_type=BKPT_SOFT; gdb_breakpoint_override_type=BKPT_SOFT;
} else if (strcmp(args[0], "disable") == 0) } else if (strcmp(args[0], "disable") == 0)
@ -2368,7 +2368,7 @@ int handle_gdb_breakpoint_override_command(struct command_context_s *cmd_ctx, ch
} }
if (gdb_breakpoint_override) if (gdb_breakpoint_override)
{ {
LOG_USER("force %s breakpoints", (gdb_breakpoint_override_type==BKPT_HARD)?"hard":"soft"); LOG_USER("force %s breakpoints", (gdb_breakpoint_override_type == BKPT_HARD)?"hard":"soft");
} else } else
{ {
LOG_USER("breakpoint type is not overriden"); LOG_USER("breakpoint type is not overriden");

View File

@ -1540,7 +1540,7 @@ int arm11_target_create(struct target_s *target, Jim_Interp *interp)
arm11->target = target; arm11->target = target;
if (target->tap==NULL) if (target->tap == NULL)
return ERROR_FAIL; return ERROR_FAIL;
if (target->tap->ir_length != 5) if (target->tap->ir_length != 5)

View File

@ -131,7 +131,7 @@ static int arm7_9_set_software_breakpoints(arm7_9_common_t *arm7_9)
return ERROR_FAIL; return ERROR_FAIL;
} }
if (arm7_9->sw_breakpoints_added==1) if (arm7_9->sw_breakpoints_added == 1)
{ {
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_DATA_VALUE], arm7_9->arm_bkpt); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_DATA_VALUE], arm7_9->arm_bkpt);
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_DATA_MASK], 0x0); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_DATA_MASK], 0x0);
@ -139,7 +139,7 @@ static int arm7_9_set_software_breakpoints(arm7_9_common_t *arm7_9)
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_MASK], ~EICE_W_CTRL_nOPC & 0xff); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_MASK], ~EICE_W_CTRL_nOPC & 0xff);
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_VALUE], EICE_W_CTRL_ENABLE); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_VALUE], EICE_W_CTRL_ENABLE);
} }
else if (arm7_9->sw_breakpoints_added==2) else if (arm7_9->sw_breakpoints_added == 2)
{ {
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_DATA_VALUE], arm7_9->arm_bkpt); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_DATA_VALUE], arm7_9->arm_bkpt);
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_DATA_MASK], 0x0); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_DATA_MASK], 0x0);
@ -232,12 +232,12 @@ int arm7_9_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
uint32_t mask = (breakpoint->length == 4) ? 0x3u : 0x1u; uint32_t mask = (breakpoint->length == 4) ? 0x3u : 0x1u;
/* reassign a hw breakpoint */ /* reassign a hw breakpoint */
if (breakpoint->set==0) if (breakpoint->set == 0)
{ {
arm7_9_assign_wp(arm7_9, breakpoint); arm7_9_assign_wp(arm7_9, breakpoint);
} }
if (breakpoint->set==1) if (breakpoint->set == 1)
{ {
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_ADDR_VALUE], breakpoint->address); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_ADDR_VALUE], breakpoint->address);
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_ADDR_MASK], mask); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_ADDR_MASK], mask);
@ -245,7 +245,7 @@ int arm7_9_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_MASK], ~EICE_W_CTRL_nOPC & 0xff); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_MASK], ~EICE_W_CTRL_nOPC & 0xff);
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_VALUE], EICE_W_CTRL_ENABLE); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_VALUE], EICE_W_CTRL_ENABLE);
} }
else if (breakpoint->set==2) else if (breakpoint->set == 2)
{ {
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_ADDR_VALUE], breakpoint->address); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_ADDR_VALUE], breakpoint->address);
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_ADDR_MASK], mask); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_ADDR_MASK], mask);
@ -377,7 +377,7 @@ int arm7_9_unset_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
{ {
return retval; return retval;
} }
if (current_instr==arm7_9->arm_bkpt) if (current_instr == arm7_9->arm_bkpt)
if ((retval = target_write_memory(target, breakpoint->address, 4, 1, breakpoint->orig_instr)) != ERROR_OK) if ((retval = target_write_memory(target, breakpoint->address, 4, 1, breakpoint->orig_instr)) != ERROR_OK)
{ {
return retval; return retval;
@ -391,7 +391,7 @@ int arm7_9_unset_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
{ {
return retval; return retval;
} }
if (current_instr==arm7_9->thumb_bkpt) if (current_instr == arm7_9->thumb_bkpt)
if ((retval = target_write_memory(target, breakpoint->address, 2, 1, breakpoint->orig_instr)) != ERROR_OK) if ((retval = target_write_memory(target, breakpoint->address, 2, 1, breakpoint->orig_instr)) != ERROR_OK)
{ {
return retval; return retval;
@ -423,7 +423,7 @@ int arm7_9_add_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
return ERROR_TARGET_NOT_HALTED; return ERROR_TARGET_NOT_HALTED;
} }
if (arm7_9->breakpoint_count==0) if (arm7_9->breakpoint_count == 0)
{ {
/* make sure we don't have any dangling breakpoints. This is vital upon /* make sure we don't have any dangling breakpoints. This is vital upon
* GDB connect/disconnect * GDB connect/disconnect
@ -478,7 +478,7 @@ int arm7_9_remove_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
arm7_9->wp_available++; arm7_9->wp_available++;
arm7_9->breakpoint_count--; arm7_9->breakpoint_count--;
if (arm7_9->breakpoint_count==0) if (arm7_9->breakpoint_count == 0)
{ {
/* make sure we don't have any dangling breakpoints */ /* make sure we don't have any dangling breakpoints */
if ((retval = arm7_9_clear_watchpoints(arm7_9)) != ERROR_OK) if ((retval = arm7_9_clear_watchpoints(arm7_9)) != ERROR_OK)
@ -906,7 +906,7 @@ int arm7_9_poll(target_t *target)
if (target->reset_halt) if (target->reset_halt)
{ {
enum reset_types jtag_reset_config = jtag_get_reset_config(); enum reset_types jtag_reset_config = jtag_get_reset_config();
if ((jtag_reset_config & RESET_SRST_PULLS_TRST)==0) if ((jtag_reset_config & RESET_SRST_PULLS_TRST) == 0)
{ {
check_pc = 1; check_pc = 1;
} }
@ -1022,7 +1022,7 @@ int arm7_9_assert_reset(target_t *target)
armv4_5_invalidate_core_regs(target); armv4_5_invalidate_core_regs(target);
if ((target->reset_halt) && ((jtag_reset_config & RESET_SRST_PULLS_TRST)==0)) if ((target->reset_halt) && ((jtag_reset_config & RESET_SRST_PULLS_TRST) == 0))
{ {
/* debug entry was already prepared in arm7_9_assert_reset() */ /* debug entry was already prepared in arm7_9_assert_reset() */
target->debug_reason = DBG_REASON_DBGRQ; target->debug_reason = DBG_REASON_DBGRQ;
@ -1246,7 +1246,7 @@ int arm7_9_soft_reset_halt(struct target_s *target)
*/ */
int arm7_9_halt(target_t *target) int arm7_9_halt(target_t *target)
{ {
if (target->state==TARGET_RESET) if (target->state == TARGET_RESET)
{ {
LOG_ERROR("BUG: arm7/9 does not support halt during reset. This is handled in arm7_9_assert_reset()"); LOG_ERROR("BUG: arm7/9 does not support halt during reset. This is handled in arm7_9_assert_reset()");
return ERROR_OK; return ERROR_OK;
@ -2272,7 +2272,7 @@ int arm7_9_read_memory(struct target_s *target, uint32_t address, uint32_t size,
buffer += thisrun_accesses * 4; buffer += thisrun_accesses * 4;
num_accesses += thisrun_accesses; num_accesses += thisrun_accesses;
if ((j++%1024)==0) if ((j++%1024) == 0)
{ {
keep_alive(); keep_alive();
} }
@ -2310,7 +2310,7 @@ int arm7_9_read_memory(struct target_s *target, uint32_t address, uint32_t size,
buffer += thisrun_accesses * 2; buffer += thisrun_accesses * 2;
num_accesses += thisrun_accesses; num_accesses += thisrun_accesses;
if ((j++%1024)==0) if ((j++%1024) == 0)
{ {
keep_alive(); keep_alive();
} }
@ -2347,7 +2347,7 @@ int arm7_9_read_memory(struct target_s *target, uint32_t address, uint32_t size,
buffer += thisrun_accesses * 1; buffer += thisrun_accesses * 1;
num_accesses += thisrun_accesses; num_accesses += thisrun_accesses;
if ((j++%1024)==0) if ((j++%1024) == 0)
{ {
keep_alive(); keep_alive();
} }
@ -2579,7 +2579,7 @@ static int arm7_9_dcc_completion(struct target_s *target, uint32_t exit_point, i
if ((retval=target_wait_state(target, TARGET_DEBUG_RUNNING, 500)) != ERROR_OK) if ((retval=target_wait_state(target, TARGET_DEBUG_RUNNING, 500)) != ERROR_OK)
return retval; return retval;
int little=target->endianness==TARGET_LITTLE_ENDIAN; int little=target->endianness == TARGET_LITTLE_ENDIAN;
int count=dcc_count; int count=dcc_count;
uint8_t *buffer=dcc_buffer; uint8_t *buffer=dcc_buffer;
if (count>2) if (count>2)
@ -2674,7 +2674,7 @@ int arm7_9_bulk_write_memory(target_t *target, uint32_t address, uint32_t count,
retval = armv4_5_run_algorithm_inner(target, 0, NULL, 1, reg_params, retval = armv4_5_run_algorithm_inner(target, 0, NULL, 1, reg_params,
arm7_9->dcc_working_area->address, arm7_9->dcc_working_area->address+6*4, 20*1000, &armv4_5_info, arm7_9_dcc_completion); arm7_9->dcc_working_area->address, arm7_9->dcc_working_area->address+6*4, 20*1000, &armv4_5_info, arm7_9_dcc_completion);
if (retval==ERROR_OK) if (retval == ERROR_OK)
{ {
uint32_t endaddress=buf_get_u32(reg_params[0].value, 0, 32); uint32_t endaddress=buf_get_u32(reg_params[0].value, 0, 32);
if (endaddress != (address+count*4)) if (endaddress != (address+count*4))

View File

@ -254,7 +254,7 @@ static int arm7endianness(jtag_callback_data_t arg, jtag_callback_data_t size, j
/* clock the target, and read the databus /* clock the target, and read the databus
* the *in pointer points to a buffer where elements of 'size' bytes * the *in pointer points to a buffer where elements of 'size' bytes
* are stored in big (be==1) or little (be==0) endianness * are stored in big (be == 1) or little (be == 0) endianness
*/ */
int arm7tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, void *in, int size, int be) int arm7tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, void *in, int size, int be)
{ {
@ -725,7 +725,7 @@ int arm7tdmi_examine(struct target_s *target)
/* get pointers to arch-specific information */ /* get pointers to arch-specific information */
reg_cache_t **cache_p = register_get_last_cache_p(&target->reg_cache); reg_cache_t **cache_p = register_get_last_cache_p(&target->reg_cache);
reg_cache_t *t=embeddedice_build_reg_cache(target, arm7_9); reg_cache_t *t=embeddedice_build_reg_cache(target, arm7_9);
if (t==NULL) if (t == NULL)
return ERROR_FAIL; return ERROR_FAIL;
(*cache_p) = t; (*cache_p) = t;

View File

@ -301,7 +301,7 @@ static int arm9endianness(jtag_callback_data_t arg, jtag_callback_data_t size, j
/* clock the target, and read the databus /* clock the target, and read the databus
* the *in pointer points to a buffer where elements of 'size' bytes * the *in pointer points to a buffer where elements of 'size' bytes
* are stored in big (be==1) or little (be==0) endianness * are stored in big (be == 1) or little (be == 0) endianness
*/ */
int arm9tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, void *in, int size, int be) int arm9tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, void *in, int size, int be)
{ {
@ -818,7 +818,7 @@ int arm9tdmi_examine(struct target_s *target)
reg_cache_t *t; reg_cache_t *t;
/* one extra register (vector catch) */ /* one extra register (vector catch) */
t=embeddedice_build_reg_cache(target, arm7_9); t=embeddedice_build_reg_cache(target, arm7_9);
if (t==NULL) if (t == NULL)
return ERROR_FAIL; return ERROR_FAIL;
(*cache_p) = t; (*cache_p) = t;
arm7_9->eice_cache = (*cache_p); arm7_9->eice_cache = (*cache_p);

View File

@ -165,7 +165,7 @@ int scan_inout_check_u32(swjdp_common_t *swjdp, uint8_t instr, uint8_t reg_addr,
{ {
adi_jtag_dp_scan_u32(swjdp, instr, reg_addr, RnW, outvalue, NULL, NULL); adi_jtag_dp_scan_u32(swjdp, instr, reg_addr, RnW, outvalue, NULL, NULL);
if ((RnW==DPAP_READ) && (invalue != NULL)) if ((RnW == DPAP_READ) && (invalue != NULL))
{ {
adi_jtag_dp_scan_u32(swjdp, DAP_IR_DPACC, DP_RDBUFF, DPAP_READ, 0, invalue, &swjdp->ack); adi_jtag_dp_scan_u32(swjdp, DAP_IR_DPACC, DP_RDBUFF, DPAP_READ, 0, invalue, &swjdp->ack);
} }
@ -1108,7 +1108,7 @@ int dap_info_command(struct command_context_s *cmd_ctx, swjdp_common_t *swjdp, i
command_print(cmd_ctx, "\t\tComponent cid1 0x%" PRIx32 ", class is %s",c_cid1,class_description[(c_cid1 >> 4)&0xF]); /* Se ARM DDI 0314 C Table 2.2 */ command_print(cmd_ctx, "\t\tComponent cid1 0x%" PRIx32 ", class is %s",c_cid1,class_description[(c_cid1 >> 4)&0xF]); /* Se ARM DDI 0314 C Table 2.2 */
command_print(cmd_ctx, "\t\tCID3 0x%" PRIx32 ", CID2 0x%" PRIx32 ", CID1 0x%" PRIx32 ", CID0, 0x%" PRIx32 "",c_cid3,c_cid2,c_cid1,c_cid0); command_print(cmd_ctx, "\t\tCID3 0x%" PRIx32 ", CID2 0x%" PRIx32 ", CID1 0x%" PRIx32 ", CID0, 0x%" PRIx32 "",c_cid3,c_cid2,c_cid1,c_cid0);
command_print(cmd_ctx, "\t\tPID3 0x%" PRIx32 ", PID2 0x%" PRIx32 ", PID1 0x%" PRIx32 ", PID0, 0x%" PRIx32 "",c_pid3,c_pid2,c_pid1,c_pid0); command_print(cmd_ctx, "\t\tPID3 0x%" PRIx32 ", PID2 0x%" PRIx32 ", PID1 0x%" PRIx32 ", PID0, 0x%" PRIx32 "",c_pid3,c_pid2,c_pid1,c_pid0);
/* For CoreSight components, (c_cid1 >> 4)&0xF==9 , we also read 0xFC8 DevId and 0xFCC DevType */ /* For CoreSight components, (c_cid1 >> 4)&0xF == 9 , we also read 0xFC8 DevId and 0xFCC DevType */
} }
else else
{ {

View File

@ -1158,7 +1158,7 @@ int evaluate_data_proc(uint32_t opcode, uint32_t address, arm_instruction_t *ins
} }
else if ((op == 0xd) || (op == 0xf)) /* <opcode1>{<cond>}{S} <Rd>, <shifter_operand> */ else if ((op == 0xd) || (op == 0xf)) /* <opcode1>{<cond>}{S} <Rd>, <shifter_operand> */
{ {
if (opcode==0xe1a00000) /* print MOV r0,r0 as NOP */ if (opcode == 0xe1a00000) /* print MOV r0,r0 as NOP */
snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tNOP",address, opcode); snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tNOP",address, opcode);
else else
snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\t%s%s%s r%i, %s", snprintf(instruction->text, 128, "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\t%s%s%s r%i, %s",
@ -1327,7 +1327,7 @@ int evaluate_b_bl_blx_thumb(uint16_t opcode, uint32_t address, arm_instruction_t
char *mnemonic = NULL; char *mnemonic = NULL;
/* sign extend 11-bit offset */ /* sign extend 11-bit offset */
if (((opc==0) || (opc==2)) && (offset & 0x00000400)) if (((opc == 0) || (opc == 2)) && (offset & 0x00000400))
offset = 0xfffff800 | offset; offset = 0xfffff800 | offset;
target_address = address + 4 + (offset << 1); target_address = address + 4 + (offset << 1);
@ -1435,7 +1435,7 @@ int evaluate_shift_imm_thumb(uint16_t opcode, uint32_t address, arm_instruction_
break; break;
} }
if ((imm==0) && (opc != 0)) if ((imm == 0) && (opc != 0))
imm = 32; imm = 32;
instruction->info.data_proc.Rd = Rd; instruction->info.data_proc.Rd = Rd;
@ -1748,7 +1748,7 @@ int evaluate_load_store_imm_thumb(uint16_t opcode, uint32_t address, arm_instruc
mnemonic = "STR"; mnemonic = "STR";
} }
if ((opcode&0xF000)==0x8000) if ((opcode&0xF000) == 0x8000)
{ {
suffix = 'H'; suffix = 'H';
shift = 1; shift = 1;

View File

@ -35,7 +35,7 @@ int arm_jtag_set_instr(arm_jtag_t *jtag_info, uint32_t new_instr, void *no_veri
{ {
jtag_tap_t *tap; jtag_tap_t *tap;
tap = jtag_info->tap; tap = jtag_info->tap;
if (tap==NULL) if (tap == NULL)
return ERROR_FAIL; return ERROR_FAIL;
if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != new_instr) if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != new_instr)
@ -51,7 +51,7 @@ int arm_jtag_set_instr(arm_jtag_t *jtag_info, uint32_t new_instr, void *no_veri
if (no_verify_capture==NULL) if (no_verify_capture == NULL)
{ {
jtag_add_ir_scan(1, &field, jtag_get_end_state()); jtag_add_ir_scan(1, &field, jtag_get_end_state());
} else } else

View File

@ -99,13 +99,13 @@ static void breakpoint_free(target_t *target, breakpoint_t *breakpoint_remove)
while (breakpoint) while (breakpoint)
{ {
if (breakpoint==breakpoint_remove) if (breakpoint == breakpoint_remove)
break; break;
breakpoint_p = &breakpoint->next; breakpoint_p = &breakpoint->next;
breakpoint = breakpoint->next; breakpoint = breakpoint->next;
} }
if (breakpoint==NULL) if (breakpoint == NULL)
return; return;
target_remove_breakpoint(target, breakpoint); target_remove_breakpoint(target, breakpoint);
@ -227,7 +227,7 @@ static void watchpoint_free(target_t *target, watchpoint_t *watchpoint_remove)
watchpoint = watchpoint->next; watchpoint = watchpoint->next;
} }
if (watchpoint==NULL) if (watchpoint == NULL)
return; return;
target_remove_watchpoint(target, watchpoint); target_remove_watchpoint(target, watchpoint);
(*watchpoint_p) = watchpoint->next; (*watchpoint_p) = watchpoint->next;

View File

@ -49,7 +49,7 @@ static int etb_set_instr(etb_t *etb, uint32_t new_instr)
jtag_tap_t *tap; jtag_tap_t *tap;
tap = etb->tap; tap = etb->tap;
if (tap==NULL) if (tap == NULL)
return ERROR_FAIL; return ERROR_FAIL;
if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != new_instr) if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != new_instr)

View File

@ -34,11 +34,11 @@
/* convert ELF header field to host endianness */ /* convert ELF header field to host endianness */
#define field16(elf,field)\ #define field16(elf,field)\
((elf->endianness==ELFDATA2LSB)? \ ((elf->endianness == ELFDATA2LSB)? \
le_to_h_u16((uint8_t*)&field):be_to_h_u16((uint8_t*)&field)) le_to_h_u16((uint8_t*)&field):be_to_h_u16((uint8_t*)&field))
#define field32(elf,field)\ #define field32(elf,field)\
((elf->endianness==ELFDATA2LSB)? \ ((elf->endianness == ELFDATA2LSB)? \
le_to_h_u32((uint8_t*)&field):be_to_h_u32((uint8_t*)&field)) le_to_h_u32((uint8_t*)&field):be_to_h_u32((uint8_t*)&field))
static int autodetect_image_type(image_t *image, char *url) static int autodetect_image_type(image_t *image, char *url)
@ -55,7 +55,7 @@ static int autodetect_image_type(image_t *image, char *url)
} }
retval = fileio_read(&fileio, 9, buffer, &read_bytes); retval = fileio_read(&fileio, 9, buffer, &read_bytes);
if (retval==ERROR_OK) if (retval == ERROR_OK)
{ {
if (read_bytes != 9) if (read_bytes != 9)
{ {
@ -68,7 +68,7 @@ static int autodetect_image_type(image_t *image, char *url)
return retval; return retval;
/* check header against known signatures */ /* check header against known signatures */
if (strncmp((char*)buffer,ELFMAG,SELFMAG)==0) if (strncmp((char*)buffer,ELFMAG,SELFMAG) == 0)
{ {
LOG_DEBUG("ELF image detected."); LOG_DEBUG("ELF image detected.");
image->type = IMAGE_ELF; image->type = IMAGE_ELF;
@ -382,7 +382,7 @@ static int image_elf_read_headers(image_t *image)
} }
elf->segment_count = field16(elf,elf->header->e_phnum); elf->segment_count = field16(elf,elf->header->e_phnum);
if (elf->segment_count==0) if (elf->segment_count == 0)
{ {
LOG_ERROR("invalid ELF file, no program headers"); LOG_ERROR("invalid ELF file, no program headers");
return ERROR_IMAGE_FORMAT_ERROR; return ERROR_IMAGE_FORMAT_ERROR;

View File

@ -278,7 +278,7 @@ int mips32_pracc_read_mem(mips_ejtag_t *ejtag_info, uint32_t addr, int size, int
case 2: case 2:
return mips32_pracc_read_mem16(ejtag_info, addr, count, (uint16_t*)buf); return mips32_pracc_read_mem16(ejtag_info, addr, count, (uint16_t*)buf);
case 4: case 4:
if (count==1) if (count == 1)
return mips32_pracc_read_u32(ejtag_info, addr, (uint32_t*)buf); return mips32_pracc_read_u32(ejtag_info, addr, (uint32_t*)buf);
else else
return mips32_pracc_read_mem32(ejtag_info, addr, count, (uint32_t*)buf); return mips32_pracc_read_mem32(ejtag_info, addr, count, (uint32_t*)buf);
@ -562,7 +562,7 @@ int mips32_pracc_write_mem(mips_ejtag_t *ejtag_info, uint32_t addr, int size, in
case 2: case 2:
return mips32_pracc_write_mem16(ejtag_info, addr, count,(uint16_t*)buf); return mips32_pracc_write_mem16(ejtag_info, addr, count,(uint16_t*)buf);
case 4: case 4:
if (count==1) if (count == 1)
return mips32_pracc_write_u32(ejtag_info, addr, (uint32_t*)buf); return mips32_pracc_write_u32(ejtag_info, addr, (uint32_t*)buf);
else else
return mips32_pracc_write_mem32(ejtag_info, addr, count, (uint32_t*)buf); return mips32_pracc_write_mem32(ejtag_info, addr, count, (uint32_t*)buf);

View File

@ -32,7 +32,7 @@ int mips_ejtag_set_instr(mips_ejtag_t *ejtag_info, int new_instr, void *delete_m
jtag_tap_t *tap; jtag_tap_t *tap;
tap = ejtag_info->tap; tap = ejtag_info->tap;
if (tap==NULL) if (tap == NULL)
return ERROR_FAIL; return ERROR_FAIL;
if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != (uint32_t)new_instr) if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != (uint32_t)new_instr)
@ -115,7 +115,7 @@ int mips_ejtag_drscan_32(mips_ejtag_t *ejtag_info, uint32_t *data)
jtag_tap_t *tap; jtag_tap_t *tap;
tap = ejtag_info->tap; tap = ejtag_info->tap;
if (tap==NULL) if (tap == NULL)
return ERROR_FAIL; return ERROR_FAIL;
scan_field_t field; scan_field_t field;
uint8_t t[4], r[4]; uint8_t t[4], r[4];

View File

@ -1079,7 +1079,7 @@ int target_register_commands(struct command_context_s *cmd_ctx)
int target_arch_state(struct target_s *target) int target_arch_state(struct target_s *target)
{ {
int retval; int retval;
if (target==NULL) if (target == NULL)
{ {
LOG_USER("No target has been configured"); LOG_USER("No target has been configured");
return ERROR_OK; return ERROR_OK;
@ -1851,7 +1851,7 @@ static int handle_poll_command(struct command_context_s *cmd_ctx, char *cmd, cha
return retval; return retval;
} }
else if (argc==1) else if (argc == 1)
{ {
if (strcmp(args[0], "on") == 0) if (strcmp(args[0], "on") == 0)
{ {
@ -2314,7 +2314,7 @@ static int handle_load_image_command(struct command_context_s *cmd_ctx, char *cm
return retvaltemp; return retvaltemp;
} }
if (retval==ERROR_OK) if (retval == ERROR_OK)
{ {
command_print(cmd_ctx, "downloaded %u byte in %s", command_print(cmd_ctx, "downloaded %u byte in %s",
(unsigned int)image_size, (unsigned int)image_size,
@ -2390,7 +2390,7 @@ static int handle_dump_image_command(struct command_context_s *cmd_ctx, char *cm
if ((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK) if ((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK)
return retvaltemp; return retvaltemp;
if (retval==ERROR_OK) if (retval == ERROR_OK)
{ {
command_print(cmd_ctx, "dumped %lld byte in %s", command_print(cmd_ctx, "dumped %lld byte in %s",
fileio.size, duration_text); fileio.size, duration_text);
@ -2517,7 +2517,7 @@ static int handle_verify_image_command_internal(struct command_context_s *cmd_ct
retval=ERROR_FAIL; retval=ERROR_FAIL;
goto done; goto done;
} }
if ((t%16384)==0) if ((t%16384) == 0)
{ {
keep_alive(); keep_alive();
} }
@ -2544,7 +2544,7 @@ done:
return retvaltemp; return retvaltemp;
} }
if (retval==ERROR_OK) if (retval == ERROR_OK)
{ {
command_print(cmd_ctx, "verified %u bytes in %s", command_print(cmd_ctx, "verified %u bytes in %s",
(unsigned int)image_size, (unsigned int)image_size,
@ -2808,7 +2808,7 @@ static void writeGmon(uint32_t *samples, uint32_t sampleNum, char *filename)
{ {
uint32_t i; uint32_t i;
FILE *f=fopen(filename, "w"); FILE *f=fopen(filename, "w");
if (f==NULL) if (f == NULL)
return; return;
writeString(f, "gmon"); writeString(f, "gmon");
writeLong(f, 0x00000001); /* Version */ writeLong(f, 0x00000001); /* Version */
@ -2843,7 +2843,7 @@ static void writeGmon(uint32_t *samples, uint32_t sampleNum, char *filename)
length=maxBuckets; length=maxBuckets;
} }
int *buckets=malloc(sizeof(int)*length); int *buckets=malloc(sizeof(int)*length);
if (buckets==NULL) if (buckets == NULL)
{ {
fclose(f); fclose(f);
return; return;
@ -2918,7 +2918,7 @@ static int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd,
static const int maxSample=10000; static const int maxSample=10000;
uint32_t *samples=malloc(sizeof(uint32_t)*maxSample); uint32_t *samples=malloc(sizeof(uint32_t)*maxSample);
if (samples==NULL) if (samples == NULL)
return ERROR_OK; return ERROR_OK;
int numSamples=0; int numSamples=0;
@ -4432,7 +4432,7 @@ static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, cha
retval = ERROR_OK; retval = ERROR_OK;
fastload_num=image.num_sections; fastload_num=image.num_sections;
fastload=(struct FastLoad *)malloc(sizeof(struct FastLoad)*image.num_sections); fastload=(struct FastLoad *)malloc(sizeof(struct FastLoad)*image.num_sections);
if (fastload==NULL) if (fastload == NULL)
{ {
image_close(&image); image_close(&image);
return ERROR_FAIL; return ERROR_FAIL;
@ -4477,7 +4477,7 @@ static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, cha
fastload[i].address=image.sections[i].base_address+offset; fastload[i].address=image.sections[i].base_address+offset;
fastload[i].data=malloc(length); fastload[i].data=malloc(length);
if (fastload[i].data==NULL) if (fastload[i].data == NULL)
{ {
free(buffer); free(buffer);
break; break;
@ -4495,7 +4495,7 @@ static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, cha
} }
duration_stop_measure(&duration, &duration_text); duration_stop_measure(&duration, &duration_text);
if (retval==ERROR_OK) if (retval == ERROR_OK)
{ {
command_print(cmd_ctx, "Loaded %u bytes in %s", (unsigned int)image_size, duration_text); command_print(cmd_ctx, "Loaded %u bytes in %s", (unsigned int)image_size, duration_text);
command_print(cmd_ctx, "NB!!! image has not been loaded to target, issue a subsequent 'fast_load' to do so."); command_print(cmd_ctx, "NB!!! image has not been loaded to target, issue a subsequent 'fast_load' to do so.");
@ -4516,7 +4516,7 @@ static int handle_fast_load_command(struct command_context_s *cmd_ctx, char *cmd
{ {
if (argc>0) if (argc>0)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
if (fastload==NULL) if (fastload == NULL)
{ {
LOG_ERROR("No image in memory"); LOG_ERROR("No image in memory");
return ERROR_FAIL; return ERROR_FAIL;
@ -4531,7 +4531,7 @@ static int handle_fast_load_command(struct command_context_s *cmd_ctx, char *cmd
command_print(cmd_ctx, "Write to 0x%08x, length 0x%08x", command_print(cmd_ctx, "Write to 0x%08x, length 0x%08x",
(unsigned int)(fastload[i].address), (unsigned int)(fastload[i].address),
(unsigned int)(fastload[i].length)); (unsigned int)(fastload[i].length));
if (retval==ERROR_OK) if (retval == ERROR_OK)
{ {
retval = target_write_buffer(target, fastload[i].address, fastload[i].length, fastload[i].data); retval = target_write_buffer(target, fastload[i].address, fastload[i].length, fastload[i].data);
} }

View File

@ -197,7 +197,7 @@ int xscale_get_arch_pointers(target_t *target, armv4_5_common_t **armv4_5_p, xsc
int xscale_jtag_set_instr(jtag_tap_t *tap, uint32_t new_instr) int xscale_jtag_set_instr(jtag_tap_t *tap, uint32_t new_instr)
{ {
if (tap==NULL) if (tap == NULL)
return ERROR_FAIL; return ERROR_FAIL;
if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != new_instr) if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != new_instr)
@ -301,7 +301,7 @@ static void xscale_getbuf(jtag_callback_data_t arg)
int xscale_receive(target_t *target, uint32_t *buffer, int num_words) int xscale_receive(target_t *target, uint32_t *buffer, int num_words)
{ {
if (num_words==0) if (num_words == 0)
return ERROR_INVALID_ARGUMENTS; return ERROR_INVALID_ARGUMENTS;
int retval=ERROR_OK; int retval=ERROR_OK;
@ -392,7 +392,7 @@ int xscale_receive(target_t *target, uint32_t *buffer, int num_words)
words_scheduled--; words_scheduled--;
} }
} }
if (words_scheduled==0) if (words_scheduled == 0)
{ {
if (attempts++==1000) if (attempts++==1000)
{ {