From: zwelch Date: Tue, 23 Jun 2009 22:45:47 +0000 (+0000) Subject: - Fixes '[<>]' whitespace X-Git-Tag: v0.2.0~140 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6d1d58a1fc3dfd60e9cac89460b5a6e438d11efa;p=openocd - Fixes '[<>]' whitespace - Replace ')\([<>]\)(' with ') \1 ('. - Replace ')\([<>]\)\(\w\)' with ') \1 \2'. - Replace '\(\w\)\([<>]\)(' with '\1 \2 ('. - Replace '\(\w\)\([<>]\)\(\w\)' with '\1 \2 \3'. git-svn-id: svn://svn.berlios.de/openocd/trunk@2375 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- diff --git a/src/flash/at91sam7.c b/src/flash/at91sam7.c index 8be4bc95..bb2a28f5 100644 --- a/src/flash/at91sam7.c +++ b/src/flash/at91sam7.c @@ -550,7 +550,7 @@ static int at91sam7_read_part_info(struct flash_bank_s *bank) /* calculate bank size */ bank_size = sectors_num * pages_per_sector * page_size; - for (bnk = 0; bnk 0) { @@ -575,7 +575,7 @@ static int at91sam7_read_part_info(struct flash_bank_s *bank) /* allocate sectors */ t_bank->sectors = malloc(sectors_num * sizeof(flash_sector_t)); - for (sec = 0; secsectors[sec].offset = sec * pages_per_sector * page_size; t_bank->sectors[sec].size = pages_per_sector * page_size; @@ -639,7 +639,7 @@ static int at91sam7_erase_check(struct flash_bank_s *bank) at91sam7_set_flash_mode(bank, FMR_TIMING_FLASH); fast_check = 1; - for (nSector = 0; nSectornum_sectors; nSector++) + for (nSector = 0; nSector < bank->num_sectors; nSector++) { retval = target_blank_check_memory(target, bank->base + bank->sectors[nSector].offset, bank->sectors[nSector].size, &blank); @@ -662,7 +662,7 @@ static int at91sam7_erase_check(struct flash_bank_s *bank) LOG_USER("Running slow fallback erase check - add working memory"); buffer = malloc(bank->sectors[0].size); - for (nSector = 0; nSectornum_sectors; nSector++) + for (nSector = 0; nSector < bank->num_sectors; nSector++) { bank->sectors[nSector].is_erased = 1; retval = target_read_memory(target, bank->base + bank->sectors[nSector].offset, 4, @@ -670,7 +670,7 @@ static int at91sam7_erase_check(struct flash_bank_s *bank) if (retval != ERROR_OK) return retval; - for (nByte = 0; nBytesectors[nSector].size; nByte++) + for (nByte = 0; nByte < bank->sectors[nSector].size; nByte++) { if (buffer[nByte] != 0xFF) { @@ -705,7 +705,7 @@ static int at91sam7_protect_check(struct flash_bank_s *bank) at91sam7_info->lockbits = (status >> 16); at91sam7_info->num_lockbits_on = 0; - for (lock_pos = 0; lock_posnum_sectors; lock_pos++) + for (lock_pos = 0; lock_pos < bank->num_sectors; lock_pos++) { if ( ((status >> (16 + lock_pos))&(0x0001)) == 1) { @@ -723,7 +723,7 @@ static int at91sam7_protect_check(struct flash_bank_s *bank) at91sam7_info->nvmbits = (status >> 8)&0xFF; at91sam7_info->num_nvmbits_on = 0; - for (gpnvm_pos = 0; gpnvm_posnum_nvmbits; gpnvm_pos++) + for (gpnvm_pos = 0; gpnvm_pos < at91sam7_info->num_nvmbits; gpnvm_pos++) { if ( ((status >> (8 + gpnvm_pos))&(0x01)) == 1) { @@ -809,7 +809,7 @@ static int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char * /* calculate bank size */ bank_size = num_sectors * pages_per_sector * page_size; - for (bnk = 0; bnk 0) { @@ -834,7 +834,7 @@ static int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char * /* allocate sectors */ t_bank->sectors = malloc(num_sectors * sizeof(flash_sector_t)); - for (sec = 0; secsectors[sec].offset = sec * pages_per_sector * page_size; t_bank->sectors[sec].size = pages_per_sector * page_size; @@ -902,7 +902,7 @@ static int at91sam7_erase(struct flash_bank_s *bank, int first, int last) /* allocate and clean buffer */ nbytes = (last - first + 1) * bank->sectors[first].size; buffer = malloc(nbytes * sizeof(uint8_t)); - for (pos = 0; posx16_as_x8) { uint8_t i; - for (i = 0;i<2;i++) + for (i = 0;i < 2;i++) target_read_memory(target, flash_address(bank, sector, offset + i), bank->bus_width, 1, &data[i*bank->bus_width] ); } @@ -234,7 +234,7 @@ static uint32_t cfi_query_u32(flash_bank_t *bank, int sector, uint32_t offset) if (cfi_info->x16_as_x8) { uint8_t i; - for (i = 0;i<4;i++) + for (i = 0;i < 4;i++) target_read_memory(target, flash_address(bank, sector, offset + i), bank->bus_width, 1, &data[i*bank->bus_width] ); } diff --git a/src/flash/ecos.c b/src/flash/ecos.c index 1a2aa68d..0f1752b6 100644 --- a/src/flash/ecos.c +++ b/src/flash/ecos.c @@ -319,10 +319,10 @@ static int eCosBoard_flash(ecosflash_flash_bank_t *info, void *data, uint32_t ad uint32_t i; - for (i = 0; ichunk) + if (t > chunk) { t = chunk; } diff --git a/src/flash/flash.c b/src/flash/flash.c index a850ced9..5ca26622 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -791,7 +791,7 @@ static int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cm duration_start_measure(&duration); - for (wrote = 0; wrote<(count*wordsize); wrote += cur_size) + for (wrote = 0; wrote < (count*wordsize); wrote += cur_size) { cur_size = MIN( (count*wordsize - wrote), sizeof(chunk) ); flash_bank_t *bank; @@ -809,7 +809,7 @@ static int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cm return err; unsigned i; - for (i = 0; iflash_driver_callback() + * corresponding static flash_driver_ < i>callback () * routine in flash.c. */ typedef struct flash_driver_s diff --git a/src/flash/ocl.c b/src/flash/ocl.c index 06cbbaad..a2dac50a 100644 --- a/src/flash/ocl.c +++ b/src/flash/ocl.c @@ -200,7 +200,7 @@ static int ocl_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset chksum = OCL_CHKS_INIT; /* copy data to DCC buffer in proper byte order and properly aligned */ - for (i = 0; isize / bank->num_sectors; - for (i = 0; inum_sectors; i++) + for (i = 0; i < bank->num_sectors; i++) { bank->sectors[i].offset = i * sectsize; bank->sectors[i].size = sectsize; diff --git a/src/flash/ocl/at91sam7x/main.c b/src/flash/ocl/at91sam7x/main.c index c675b20a..2146d74e 100644 --- a/src/flash/ocl/at91sam7x/main.c +++ b/src/flash/ocl/at91sam7x/main.c @@ -45,13 +45,13 @@ void cmd_flash(uint32 cmd) bi_start = ofs/4; bi_end = (ofs + len + 3)/4; - if (bi_end>BUFSIZE) { + if (bi_end > BUFSIZE) { dcc_wr(OCL_BUFF_OVER); return; } chksum = OCL_CHKS_INIT; - for (bi = 0; biflash_page_count) break; + if ((page_num += flash_lock_pages) > flash_page_count) break; lockbits>>=1; } @@ -178,7 +178,7 @@ int flash_erase_all(void) if ((result = flash_erase_plane(0)) != FLASH_STAT_OK) return result; /* the second flash controller, if any */ - if (flash_page_count>1024) result = flash_erase_plane(0x10); + if (flash_page_count > 1024) result = flash_erase_plane(0x10); return result; } diff --git a/src/flash/stellaris.c b/src/flash/stellaris.c index d06aa9a5..4e76b0e6 100644 --- a/src/flash/stellaris.c +++ b/src/flash/stellaris.c @@ -322,7 +322,7 @@ static int stellaris_info(struct flash_bank_s *bank, char *buf, int buf_size) buf += printed; buf_size -= printed; - if (stellaris_info->num_lockbits>0) + if (stellaris_info->num_lockbits > 0) { printed = snprintf(buf, buf_size, diff --git a/src/flash/str9x.c b/src/flash/str9x.c index cfd37b9d..1911b59a 100644 --- a/src/flash/str9x.c +++ b/src/flash/str9x.c @@ -300,7 +300,7 @@ static int str9x_erase(struct flash_bank_s *bank, int first, int last) } int timeout; - for (timeout = 0; timeout<1000; timeout++) { + for (timeout = 0; timeout < 1000; timeout++) { if ((retval = target_read_u8(target, adr, &status)) != ERROR_OK) { return retval; @@ -575,7 +575,7 @@ static int str9x_write(struct flash_bank_s *bank, target_write_u16(target, bank_adr, 0x70); int timeout; - for (timeout = 0; timeout<1000; timeout++) + for (timeout = 0; timeout < 1000; timeout++) { target_read_u8(target, bank_adr, &status); if ( status & 0x80 ) @@ -624,7 +624,7 @@ static int str9x_write(struct flash_bank_s *bank, target_write_u16(target, bank_adr, 0x70); int timeout; - for (timeout = 0; timeout<1000; timeout++) + for (timeout = 0; timeout < 1000; timeout++) { target_read_u8(target, bank_adr, &status); if ( status & 0x80 ) diff --git a/src/helper/binarybuffer.h b/src/helper/binarybuffer.h index a0a6a45b..dede72d5 100644 --- a/src/helper/binarybuffer.h +++ b/src/helper/binarybuffer.h @@ -42,7 +42,7 @@ static inline void buf_set_u32(uint8_t* buffer, unsigned int first, unsigned int { unsigned int i; - for (i = first; i> (i-first))&1) == 1) buffer[i/8] |= 1 << (i%8); @@ -61,7 +61,7 @@ static inline uint32_t buf_get_u32(const uint8_t* buffer, unsigned int first, un uint32_t result = 0; unsigned int i; - for (i = first; i>(i%8))&1) == 1) result |= 1 << (i-first); diff --git a/src/helper/command.c b/src/helper/command.c index bfb4cf8b..c259c648 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -492,7 +492,7 @@ int command_run_line(command_context_t *context, char *line) int reslen; result = Jim_GetString(Jim_GetResult(interp), &reslen); - if (reslen>0) + if (reslen > 0) { int i; char buff[256 + 1]; diff --git a/src/helper/fileio.c b/src/helper/fileio.c index e40e019a..484d87df 100644 --- a/src/helper/fileio.c +++ b/src/helper/fileio.c @@ -84,7 +84,7 @@ static inline int fileio_open_local(fileio_t *fileio) result2 = fseek(fileio->file, 0, SEEK_SET); - if ((fileio->size<0)||(result<0)||(result2<0)) + if ((fileio->size < 0)||(result < 0)||(result2 < 0)) { fileio_close(fileio); return ERROR_FILEIO_OPERATION_FAILED; diff --git a/src/helper/jim.c b/src/helper/jim.c index bd077d2a..2bdf15a6 100644 --- a/src/helper/jim.c +++ b/src/helper/jim.c @@ -503,8 +503,8 @@ int Jim_StringToDouble(const char *str, double *doublePtr) static jim_wide JimPowWide(jim_wide b, jim_wide e) { jim_wide i, res = 1; - if ((b == 0 && e != 0) || (e<0)) return 0; - for (i = 0; iwB; break; + case JIM_EXPROP_LT: wC = wA < wB; break; + case JIM_EXPROP_GT: wC = wA > wB; break; case JIM_EXPROP_LTE: wC = wA <= wB; break; case JIM_EXPROP_GTE: wC = wA >= wB; break; case JIM_EXPROP_LSHIFT: wC = wA << wB; break; @@ -7058,8 +7058,8 @@ trydouble: case JIM_EXPROP_ADD: dC = dA + dB; break; case JIM_EXPROP_SUB: dC = dA-dB; break; case JIM_EXPROP_MUL: dC = dA*dB; break; - case JIM_EXPROP_LT: dC = dAdB; break; + case JIM_EXPROP_LT: dC = dA < dB; break; + case JIM_EXPROP_GT: dC = dA > dB; break; case JIM_EXPROP_LTE: dC = dA <= dB; break; case JIM_EXPROP_GTE: dC = dA >= dB; break; case JIM_EXPROP_NUMEQ: dC = dA == dB; break; @@ -8197,7 +8197,7 @@ static char *JimFindBestPackage(Jim_Interp *interp, char **prefixes, strncmp(fileName + fileNameLen-4, ".dll", 4) == 0 || strncmp(fileName + fileNameLen-3, ".so", 3) == 0)) { - char ver[6]; /* xx.yy */ + char ver[6]; /* xx.yy < nulterm> */ char *p = strrchr(fileName, '.'); int verLen, fileVer; diff --git a/src/helper/log.c b/src/helper/log.c index c65c2fb1..3ee04e05 100644 --- a/src/helper/log.c +++ b/src/helper/log.c @@ -384,7 +384,7 @@ char *alloc_printf(const char *format, ...) void keep_alive() { current_time = timeval_ms(); - if (current_time-last_time>1000) + if (current_time-last_time > 1000) { extern int gdb_actual_connections; @@ -400,7 +400,7 @@ void keep_alive() "trouble with GDB connections.", current_time-last_time); } - if (current_time-last_time>500) + if (current_time-last_time > 500) { /* this will keep the GDB connection alive */ LOG_USER_N("%s", ""); @@ -429,10 +429,10 @@ void alive_sleep(int ms) { int i; int napTime = 10; - for (i = 0; inapTime) + if (sleep_a_bit > napTime) { sleep_a_bit = napTime; } @@ -445,7 +445,7 @@ void busy_sleep(int ms) { long long then; then = timeval_ms(); - while ((timeval_ms()-then)(b))?(a):(b)) +#define MAX(a,b) (((a) > (b))?(a):(b)) #endif /* for systems that do not support ENOTSUP diff --git a/src/jtag/bitq.c b/src/jtag/bitq.c index e843733c..2a153b2f 100644 --- a/src/jtag/bitq.c +++ b/src/jtag/bitq.c @@ -54,7 +54,7 @@ void bitq_in_proc(void) if (bitq_in_state.cmd->type == JTAG_SCAN) { /* loop through the fields */ - while (bitq_in_state.field_idxcmd.scan->num_fields) + while (bitq_in_state.field_idx < bitq_in_state.cmd->cmd.scan->num_fields) { field = &bitq_in_state.cmd->cmd.scan->fields[bitq_in_state.field_idx]; if (field->in_value) @@ -69,7 +69,7 @@ void bitq_in_proc(void) else { /* buffer reallocation needed? */ - if (field->num_bits>bitq_in_bufsize * 8) + if (field->num_bits > bitq_in_bufsize * 8) { /* buffer previously allocated? */ if (bitq_in_buffer != NULL) @@ -79,7 +79,7 @@ void bitq_in_proc(void) bitq_in_buffer = NULL; } /* double the buffer size until it fits */ - while (field->num_bits>bitq_in_bufsize * 8) + while (field->num_bits > bitq_in_bufsize * 8) bitq_in_bufsize *= 2; } /* if necessary, allocate buffer and check for malloc error */ @@ -93,9 +93,9 @@ void bitq_in_proc(void) } /* field scanning */ - while (bitq_in_state.bit_posnum_bits) + while (bitq_in_state.bit_pos < field->num_bits) { - if ( ( tdo = bitq_interface->in() )<0 ) + if ( ( tdo = bitq_interface->in() ) < 0 ) { #ifdef _DEBUG_JTAG_IO_ LOG_DEBUG("bitq in EOF"); @@ -161,7 +161,7 @@ void bitq_state_move(tap_state_t new_state) tms_scan = tap_get_tms_path(tap_get_state(), new_state); int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state()); - for (i = 0; i>= 1; @@ -229,7 +229,7 @@ void bitq_scan_field(scan_field_t* field, int pause) if (field->out_value == NULL) { /* 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--) bitq_io(0, 0, tdo_req); bitq_io(pause, 0, tdo_req); @@ -239,7 +239,7 @@ void bitq_scan_field(scan_field_t* field, int pause) /* send data, and optionally request TDO */ out_mask = 0x01; out_ptr = field->out_value; - 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); if (out_mask == 0x80) diff --git a/src/jtag/ft2232.c b/src/jtag/ft2232.c index c56d309e..5cea4d48 100644 --- a/src/jtag/ft2232.c +++ b/src/jtag/ft2232.c @@ -2794,7 +2794,7 @@ static int ft2232_handle_device_desc_command(struct command_context_s* cmd_ctx, cp[-2] = 0; ft2232_device_desc = strdup(buf); } else { - // A not defined + // A not defined // so create it sprintf(buf, "%s A", ft2232_device_desc); ft2232_device_desc_A = strdup(buf); diff --git a/src/jtag/gw16012.c b/src/jtag/gw16012.c index 51958db4..7096d62c 100644 --- a/src/jtag/gw16012.c +++ b/src/jtag/gw16012.c @@ -500,7 +500,7 @@ static int gw16012_init_device(void) LOG_DEBUG("opening %s...", buffer); device_handle = open(buffer, O_WRONLY); - if (device_handle<0) + if (device_handle < 0) { LOG_ERROR("cannot open device. check it exists and that user read and write rights are set"); return ERROR_JTAG_INIT_FAILED; diff --git a/src/jtag/parport.c b/src/jtag/parport.c index ab393e58..50c08314 100644 --- a/src/jtag/parport.c +++ b/src/jtag/parport.c @@ -345,7 +345,7 @@ static int parport_init(void) #if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) i = ioctl(device_handle, PPCLAIM); - if (i<0) + if (i < 0) { LOG_ERROR("cannot claim device"); return ERROR_JTAG_INIT_FAILED; @@ -353,7 +353,7 @@ static int parport_init(void) i = PARPORT_MODE_COMPAT; i= ioctl(device_handle, PPSETMODE, & i); - if (i<0) + if (i < 0) { LOG_ERROR(" cannot set compatible mode to device"); return ERROR_JTAG_INIT_FAILED; @@ -361,7 +361,7 @@ static int parport_init(void) i = IEEE1284_MODE_COMPAT; i = ioctl(device_handle, PPNEGOT, & i); - if (i<0) + if (i < 0) { LOG_ERROR("cannot set compatible 1284 mode to device"); return ERROR_JTAG_INIT_FAILED; diff --git a/src/jtag/presto.c b/src/jtag/presto.c index fceae34a..9aca9097 100644 --- a/src/jtag/presto.c +++ b/src/jtag/presto.c @@ -553,7 +553,7 @@ static int presto_getbyte(void) if (presto_flush() != ERROR_OK) return -1; - if (presto->buff_in_posbuff_in_len) + if (presto->buff_in_pos < presto->buff_in_len) return presto->buff_in[presto->buff_in_pos++]; return -1; @@ -625,14 +625,14 @@ static int presto_bitq_out(int tms, int tdi, int tdo_req) } /* delay with TCK low */ - for (i = presto->jtag_speed; i>1; i--) + for (i = presto->jtag_speed; i > 1; i--) presto_sendbyte(cmd); cmd |= 0x04; presto_sendbyte(cmd | (tdo_req ? 0x10 : 0)); /* delay with TCK high */ - for (i = presto->jtag_speed; i>1; i--) + for (i = presto->jtag_speed; i > 1; i--) presto_sendbyte(cmd); presto->jtag_tck = 1; diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 593330b5..a6f7b5dd 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -1396,7 +1396,7 @@ static int Jim_Command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *ar script_debug(interp, "pathmove", argc, args); int i; - for (i = 0; i0) && ((state == TAP_DRSHIFT)||(state == TAP_SI))) + if ((repeat > 0) && ((state == TAP_DRSHIFT)||(state == TAP_SI))) { int i; /* sample shift register for every bit. */ - for (i = 0; i> i); @@ -167,7 +167,7 @@ static __inline__ void interface_jtag_add_dr_out_core(jtag_tap_t *target_tap, if (tap == target_tap) { int j; - for (j = 0; j<(num_fields-1); j++) + for (j = 0; j < (num_fields-1); j++) { shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, num_bits[j], value[j]); } diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c index 73efcd2e..33947332 100644 --- a/src/jtag/zy1000/zy1000.c +++ b/src/jtag/zy1000/zy1000.c @@ -164,7 +164,7 @@ void zy1000_reset(int trst, int srst) if (!srst) { int i; - for (i = 0; i<1000; i++) + for (i = 0; i < 1000; i++) { // We don't want to sense our own reset, so we clear here. // There is of course a timing hole where we could loose @@ -179,7 +179,7 @@ void zy1000_reset(int trst, int srst) if (i == 1000) { LOG_USER("SRST didn't deassert after %dms", i); - } else if (i>1) + } else if (i > 1) { LOG_USER("SRST took %dms to deassert", i); } @@ -434,13 +434,13 @@ static __inline void scanFields(int num_fields, const scan_field_t *fields, tap_ // here we shuffle N bits out/in j = 0; - while (j32) + if (k > 32) { k = 32; /* we have more to shift out */ @@ -455,7 +455,7 @@ static __inline void scanFields(int num_fields, const scan_field_t *fields, tap_ value = 0; if (fields[i].out_value != NULL) { - for (l = 0; l>= 32-k; - for (l = 0; l> l)&0xff; } @@ -634,11 +634,11 @@ static int zy1000_jtag_add_clocks(int num_cycles, tap_state_t state, tap_state_t /* execute num_cycles, 32 at the time. */ int i; - for (i = 0; ibuf_cnt>0) + if (gdb_con->buf_cnt > 0) { *got_data = 1; return ERROR_OK; @@ -125,7 +125,7 @@ int check_pending(connection_t *connection, int timeout_s, int *got_data) /* This can typically be because a "monitor" command took too long * before printing any progress messages */ - if (timeout_s>0) + if (timeout_s > 0) { return ERROR_GDB_TIMEOUT; } else @@ -649,7 +649,7 @@ int gdb_output_con(connection_t *connection, const char* line) return ERROR_GDB_BUFFER_TOO_SMALL; hex_buffer[0] = 'O'; - for (i = 0; ibase == b2->base) { return 0; - } else if (b1->base>b2->base) + } else if (b1->base > b2->base) { return 1; } else @@ -1654,7 +1654,7 @@ int gdb_query_packet(connection_t *connection, target_t *target, char *packet, i xml_printf(&retval, &buffer, &pos, &size, "PacketSize=%x;qXfer:memory-map:read%c;qXfer:features:read-;QStartNoAckMode+", - (GDB_BUFFER_SIZE - 1), ((gdb_use_memory_map == 1) && (flash_get_bank_count()>0)) ? '+' : '-'); + (GDB_BUFFER_SIZE - 1), ((gdb_use_memory_map == 1) && (flash_get_bank_count() > 0)) ? '+' : '-'); if (retval != ERROR_OK) { @@ -1667,7 +1667,7 @@ int gdb_query_packet(connection_t *connection, target_t *target, char *packet, i return ERROR_OK; } - else if (strstr(packet, "qXfer:memory-map:read::") && (flash_get_bank_count()>0)) + else if (strstr(packet, "qXfer:memory-map:read::") && (flash_get_bank_count() > 0)) { /* We get away with only specifying flash here. Regions that are not * specified are treated as if we provided no memory map(if not we @@ -1702,7 +1702,7 @@ int gdb_query_packet(connection_t *connection, target_t *target, char *packet, i flash_bank_t **banks = malloc(sizeof(flash_bank_t *)*flash_get_bank_count()); int i; - for (i = 0; ibase) + if (ram_start < p->base) { xml_printf(&retval, &xml, &pos, &size, "\n", ram_start, p->base-ram_start); @@ -1800,7 +1800,7 @@ int gdb_query_packet(connection_t *connection, target_t *target, char *packet, i } xml_printf(&retval, &xml, &pos, &size, \ - "l\narm\n\n"); + "l < target version=\"1.0\">\n < architecture > arm\n\n"); if (retval != ERROR_OK) { diff --git a/src/server/httpd.c b/src/server/httpd.c index e7772168..a3137d90 100644 --- a/src/server/httpd.c +++ b/src/server/httpd.c @@ -34,7 +34,7 @@ #include #include -#define PAGE_NOT_FOUND "File not foundFile not found" +#define PAGE_NOT_FOUND " File not found File not found" int loadFile(const char *name, void **data, size_t *len); @@ -71,7 +71,7 @@ static const char *httpd_exec_cgi_tcl_error(Jim_Interp *interp) t = appendf(t, "Runtime error, file \"%s\", line %d:
", interp->errorFileName, interp->errorLine); - t = appendf(t, " %s
", Jim_GetString(interp->result, NULL)); + t = appendf(t, " %s < br>", Jim_GetString(interp->result, NULL)); Jim_ListLength(interp, interp->stackTrace, &len); for (i = 0; i < len; i += 3) { @@ -84,7 +84,7 @@ static const char *httpd_exec_cgi_tcl_error(Jim_Interp *interp) file = Jim_GetString(objPtr, NULL); Jim_ListIndex(interp, interp->stackTrace, i + 2, &objPtr, JIM_NONE); line = Jim_GetString(objPtr, NULL); - t = appendf(t, "In procedure '%s' called at file \"%s\", line %s
", + t = appendf(t, "In procedure '%s' called at file \"%s\", line %s < br>", proc, file, line); } t = appendf(t, "\n"); diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c index bb888aa5..186fb9ec 100644 --- a/src/server/telnet_server.c +++ b/src/server/telnet_server.c @@ -120,8 +120,8 @@ void telnet_log_callback(void *priv, const char *file, int line, /* clear the command line */ telnet_write(connection, "\r", 1); - for (i = strlen(t_con->prompt) + t_con->line_size; i>0; i -= 16) - telnet_write(connection, " ", i>16 ? 16 : i); + for (i = strlen(t_con->prompt) + t_con->line_size; i > 0; i -= 16) + telnet_write(connection, " ", i > 16 ? 16 : i); telnet_write(connection, "\r", 1); /* output the message */ @@ -130,7 +130,7 @@ void telnet_log_callback(void *priv, const char *file, int line, /* put the command line to its previous state */ telnet_prompt(connection); telnet_write(connection, t_con->line, t_con->line_size); - for (i = t_con->line_size; i>t_con->line_cursor; i--) + for (i = t_con->line_size; i > t_con->line_cursor; i--) telnet_write(connection, "\b", 1); } diff --git a/src/target/arm11_dbgtap.c b/src/target/arm11_dbgtap.c index e69d5988..5b6188f5 100644 --- a/src/target/arm11_dbgtap.c +++ b/src/target/arm11_dbgtap.c @@ -75,9 +75,9 @@ int arm11_add_dr_scan_vc(int num_fields, scan_field_t *fields, tap_state_t state * \param arm11 Target state variable. * \param num_bits Length of the data field * \param out_data pointer to the data that will be sent out - * (data is read when it is added to the JTAG queue) + * (data is read when it is added to the JTAG queue) * \param in_data pointer to the memory that will receive data that was clocked in - * (data is written when the JTAG queue is executed) + * (data is written when the JTAG queue is executed) * \param field target data structure that will be initialized */ void arm11_setup_field(arm11_common_t * arm11, int num_bits, void * out_data, void * in_data, scan_field_t * field) diff --git a/src/target/arm720t.c b/src/target/arm720t.c index efca08dd..49bdb887 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -375,7 +375,7 @@ int arm720t_soft_reset_halt(struct target_s *target) long long then = timeval_ms(); int timeout; - while (!(timeout = ((timeval_ms()-then)>1000))) + while (!(timeout = ((timeval_ms()-then) > 1000))) { if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) == 0) { diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index 1b08d474..266b7bf4 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -702,7 +702,7 @@ int arm7_9_execute_sys_speed(struct target_s *target) long long then = timeval_ms(); int timeout; - while (!(timeout = ((timeval_ms()-then)>1000))) + while (!(timeout = ((timeval_ms()-then) > 1000))) { /* read debug status register */ embeddedice_read_reg(dbg_stat); @@ -862,11 +862,11 @@ int arm7_9_handle_target_request(void *priv) * what happens: * * - * - * - * - * - * + * + * + * + * + * *
StateAction
TARGET_RUNNING | TARGET_RESETEnters debug mode. If TARGET_RESET, pc may be checked
TARGET_UNKNOWNWarning is logged
TARGET_DEBUG_RUNNINGEnters debug mode
TARGET_HALTEDNothing
State Action
TARGET_RUNNING | TARGET_RESET Enters debug mode. If TARGET_RESET, pc may be checked
TARGET_UNKNOWN Warning is logged
TARGET_DEBUG_RUNNING Enters debug mode
TARGET_HALTED Nothing
* * If the target does not end up in the halted state, a warning is produced. If @@ -1152,7 +1152,7 @@ int arm7_9_soft_reset_halt(struct target_s *target) long long then = timeval_ms(); int timeout; - while (!(timeout = ((timeval_ms()-then)>1000))) + while (!(timeout = ((timeval_ms()-then) > 1000))) { if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) != 0) break; @@ -2582,7 +2582,7 @@ static int arm7_9_dcc_completion(struct target_s *target, uint32_t exit_point, i int little = target->endianness == TARGET_LITTLE_ENDIAN; int count = dcc_count; uint8_t *buffer = dcc_buffer; - if (count>2) + if (count > 2) { /* Handle first & last using standard embeddedice_write_reg and the middle ones w/the * core function repeated. */ diff --git a/src/target/arm920t.c b/src/target/arm920t.c index 10428a65..92cee83c 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -574,7 +574,7 @@ int arm920t_soft_reset_halt(struct target_s *target) long long then = timeval_ms(); int timeout; - while (!(timeout = ((timeval_ms()-then)>1000))) + while (!(timeout = ((timeval_ms()-then) > 1000))) { if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) == 0) { diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c index 0d6f0172..04981abe 100644 --- a/src/target/arm926ejs.c +++ b/src/target/arm926ejs.c @@ -574,7 +574,7 @@ int arm926ejs_soft_reset_halt(struct target_s *target) long long then = timeval_ms(); int timeout; - while (!(timeout = ((timeval_ms()-then)>1000))) + while (!(timeout = ((timeval_ms()-then) > 1000))) { if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) == 0) { diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index a77daa70..13c66f02 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -1118,7 +1118,7 @@ int dap_info_command(struct command_context_s *cmd_ctx, swjdp_common_t *swjdp, i command_print(cmd_ctx, "\t\tEnd of ROM table"); } entry_offset += 4; - } while (romentry>0); + } while (romentry > 0); } else { diff --git a/src/target/arm_disassembler.c b/src/target/arm_disassembler.c index e460e468..d290b670 100644 --- a/src/target/arm_disassembler.c +++ b/src/target/arm_disassembler.c @@ -891,7 +891,7 @@ int evaluate_misc_instr(uint32_t opcode, uint32_t address, arm_instruction_t *in int x = (opcode & 0x20) >> 5; int y = (opcode & 0x40) >> 6; - /* SMLA */ + /* SMLA < x> */ if ((opcode & 0x00600000) == 0x00000000) { uint8_t Rd, Rm, Rs, Rn; @@ -906,7 +906,7 @@ int evaluate_misc_instr(uint32_t opcode, uint32_t address, arm_instruction_t *in Rd, Rm, Rs, Rn); } - /* SMLAL */ + /* SMLAL < x> */ if ((opcode & 0x00600000) == 0x00400000) { uint8_t RdLow, RdHi, Rm, Rs; @@ -921,7 +921,7 @@ int evaluate_misc_instr(uint32_t opcode, uint32_t address, arm_instruction_t *in RdLow, RdHi, Rm, Rs); } - /* SMLAW */ + /* SMLAW < y> */ if (((opcode & 0x00600000) == 0x00100000) && (x == 0)) { uint8_t Rd, Rm, Rs, Rn; @@ -936,7 +936,7 @@ int evaluate_misc_instr(uint32_t opcode, uint32_t address, arm_instruction_t *in Rd, Rm, Rs, Rn); } - /* SMUL */ + /* SMUL < x> */ if ((opcode & 0x00600000) == 0x00300000) { uint8_t Rd, Rm, Rs; @@ -950,7 +950,7 @@ int evaluate_misc_instr(uint32_t opcode, uint32_t address, arm_instruction_t *in Rd, Rm, Rs); } - /* SMULW */ + /* SMULW < y> */ if (((opcode & 0x00600000) == 0x00100000) && (x == 1)) { uint8_t Rd, Rm, Rs; @@ -1922,7 +1922,7 @@ int evaluate_load_store_multiple_thumb(uint16_t opcode, uint32_t address, arm_in if (reg_list & (1 << i)) reg_names_p += snprintf(reg_names_p, (reg_names + 40 - reg_names_p), "r%i, ", i); } - if (reg_names_p>reg_names) + if (reg_names_p > reg_names) reg_names_p[-2] = '\0'; else /* invalid op : no registers */ reg_names[0] = '\0'; diff --git a/src/target/image.c b/src/target/image.c index 40b320fa..0ffa5fd3 100644 --- a/src/target/image.c +++ b/src/target/image.c @@ -414,12 +414,12 @@ static int image_elf_read_headers(image_t *image) /* count useful segments (loadable), ignore BSS section */ image->num_sections = 0; - for (i = 0;isegment_count;i++) + for (i = 0;i < elf->segment_count;i++) if ((field32(elf, elf->segments[i].p_type) == PT_LOAD) && (field32(elf, elf->segments[i].p_filesz) != 0)) image->num_sections++; /* alloc and fill sections array with loadable segments */ image->sections = malloc(image->num_sections * sizeof(image_section_t)); - for (i = 0,j = 0;isegment_count;i++) + for (i = 0,j = 0;i < elf->segment_count;i++) { if ((field32(elf, elf->segments[i].p_type) == PT_LOAD) && (field32(elf, elf->segments[i].p_filesz) != 0)) { @@ -449,7 +449,7 @@ static int image_elf_read_section(image_t *image, int section, uint32_t offset, LOG_DEBUG("load segment %d at 0x%" PRIx32 " (sz = 0x%" PRIx32 ")",section,offset,size); /* read initialized data in current segment if any */ - if (offsetp_filesz)) + if (offset < field32(elf,segment->p_filesz)) { /* maximal size present in file for the current segment */ read_size = MIN(size, field32(elf,segment->p_filesz)-offset); @@ -1015,10 +1015,10 @@ int image_calculate_checksum(uint8_t* buffer, uint32_t nbytes, uint32_t* checksu crc32_table[i] = c; } - while (nbytes>0) + while (nbytes > 0) { int run = nbytes; - if (run>32768) + if (run > 32768) { run = 32768; } diff --git a/src/target/mips32_dmaacc.c b/src/target/mips32_dmaacc.c index 6c57e783..e67c4ce7 100644 --- a/src/target/mips32_dmaacc.c +++ b/src/target/mips32_dmaacc.c @@ -369,7 +369,7 @@ int mips32_dmaacc_read_mem32(mips_ejtag_t *ejtag_info, uint32_t addr, int count, int i; int retval; - for (i = 0; iname); } - if (cur-then>500) + if (cur-then > 500) { keep_alive(); } - if ((cur-then)>ms) + if ((cur-then) > ms) { LOG_ERROR("timed out while waiting for target %s", Jim_Nvp_value2name_simple(nvp_target_state,state)->name); @@ -2280,16 +2280,16 @@ static int handle_load_image_command(struct command_context_s *cmd_ctx, char *cm /* DANGER!!! beware of unsigned comparision here!!! */ if ((image.sections[i].base_address + buf_cnt >= min_address)&& - (image.sections[i].base_addressmax_address) + if (image.sections[i].base_address + buf_cnt > max_address) { length -= (image.sections[i].base_address + buf_cnt)-max_address; } @@ -2790,7 +2790,7 @@ static void writeData(FILE *f, const void *data, size_t len) static void writeLong(FILE *f, int l) { int i; - for (i = 0; i<4; i++) + for (i = 0; i < 4; i++) { char c = (l >> (i*8))&0xff; writeData(f, &c, 1); @@ -2822,13 +2822,13 @@ static void writeGmon(uint32_t *samples, uint32_t sampleNum, char *filename) /* figure out bucket size */ uint32_t min = samples[0]; uint32_t max = samples[0]; - for (i = 0; isamples[i]) + if (min > samples[i]) { min = samples[i]; } - if (max65535) + if (val > 65535) { val = 65535; } @@ -4389,7 +4389,7 @@ static void free_fastload(void) if (fastload != NULL) { int i; - for (i = 0; i= min_address)&& - (image.sections[i].base_addressmax_address) + if (image.sections[i].base_address + buf_cnt > max_address) { length -= (image.sections[i].base_address + buf_cnt)-max_address; } @@ -4514,7 +4514,7 @@ static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, cha static int handle_fast_load_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - if (argc>0) + if (argc > 0) return ERROR_COMMAND_SYNTAX_ERROR; if (fastload == NULL) { @@ -4525,7 +4525,7 @@ static int handle_fast_load_command(struct command_context_s *cmd_ctx, char *cmd int ms = timeval_ms(); int size = 0; int retval = ERROR_OK; - for (i = 0; i0 ) + if ( attempt > 0 ) { /* perform the XC9500 exception handling sequence shown in xapp067.pdf and illustrated in psuedo code at end of this file. We start from state @@ -836,7 +836,7 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha if (limit < 1) limit = 1; - for ( attempt = 0; attempt