]> git.sur5r.net Git - openocd/commitdiff
- Replace 'for(' with 'for ('.
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 23 Jun 2009 22:37:21 +0000 (22:37 +0000)
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 23 Jun 2009 22:37:21 +0000 (22:37 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@2360 b42882b7-edfa-0310-969c-e2dbd0fdcd60

18 files changed:
src/flash/cfi.c
src/flash/flash.c
src/flash/nand_ecc.c
src/flash/pic32mx.c
src/helper/jim.c
src/helper/options.c
src/jtag/core.c
src/jtag/interface.c
src/jtag/rlink/rlink.c
src/jtag/tcl.c
src/jtag/zy1000/jtag_minidriver.h
src/jtag/zy1000/zy1000.c
src/server/gdb_server.c
src/target/mips_m4k.c
src/target/target.c
src/target/xscale.c
src/xsvf/xsvf.c
testing/examples/PIC32/BlinkingLeds.c

index 529890740cac8d893d14273d8aaecbe52ff305a6..f6ddead30c6c47ca2a0c9e3758b5667a9324fa4e 100644 (file)
@@ -212,7 +212,7 @@ static uint16_t cfi_query_u16(flash_bank_t *bank, int sector, uint32_t offset)
        if (cfi_info->x16_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] );
        }
index 02505b038a6422bee49b307e019d4c6973510868..796af715222475294a6ec321fedb364edda1c3b8 100644 (file)
@@ -770,13 +770,13 @@ static int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cm
        switch (wordsize)
        {
        case 4:
-               for(i = 0; i < chunk_count; i++)
+               for (i = 0; i < chunk_count; i++)
                {
                        target_buffer_set_u32(target, chunk + i * wordsize, pattern);
                }
                break;
        case 2:
-               for(i = 0; i < chunk_count; i++)
+               for (i = 0; i < chunk_count; i++)
                {
                        target_buffer_set_u16(target, chunk + i * wordsize, pattern);
                }
index 567e3b3806982101a983dfe861507508512f5a40..c154d6979898841730bcff583068b8ffaff789b4 100644 (file)
@@ -77,7 +77,7 @@ int nand_calculate_ecc(struct nand_device_s *device, const uint8_t *dat, uint8_t
        reg1 = reg2 = reg3 = 0;
 
        /* Build up column parity */
-       for(i = 0; i < 256; i++) {
+       for (i = 0; i < 256; i++) {
                /* Get CP0 - CP5 from table */
                idx = nand_ecc_precalc_table[*dat++];
                reg1 ^= (idx & 0x3f);
index 378d9b242de718ffceebcb9eccce2d3b66a9a811..65bdef1c406bba31ed3ea982d687be101ca87c47 100644 (file)
@@ -620,7 +620,7 @@ static int pic32mx_probe(struct flash_bank_s *bank)
                num_pages = 12;
        } else {
                /* 0xBD000000: Program flash size varies with device */
-               for(i=0; pic32mx_devs[i].name != NULL; i++)
+               for (i=0; pic32mx_devs[i].name != NULL; i++)
                        if (pic32mx_devs[i].devid == ((device_id >> 12) & 0xff)) {
                                num_pages = pic32mx_devs[i].pfm_size;
                                break;
@@ -704,7 +704,7 @@ static int pic32mx_info(struct flash_bank_s *bank, char *buf, int buf_size)
                                 PIC32MX_MANUF_ID);
                return ERROR_FLASH_OPERATION_FAILED;
        }
-       for(i=0; pic32mx_devs[i].name != NULL; i++)
+       for (i=0; pic32mx_devs[i].name != NULL; i++)
                if (pic32mx_devs[i].devid == ((device_id >> 12) & 0xff)) {
                        printed = snprintf(buf, buf_size, "PIC32MX%s", pic32mx_devs[i].name);
                        break;
index 84ac39b5e9b032a0dff93f932118125f136d0c86..ab0b18c6c9116049e05651efa706477e14eb3762 100644 (file)
@@ -504,7 +504,7 @@ 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; i<e; i++) {res *= b;}
+    for (i=0; i<e; i++) {res *= b;}
     return res;
 }
 
@@ -10425,7 +10425,7 @@ static int Jim_SwitchCoreCommand(Jim_Interp *interp, int argc,
           script = caseList[i+1];
         }
     }
-    for(; i < patCount && Jim_CompareStringImmediate(interp, script, "-");
+    for (; i < patCount && Jim_CompareStringImmediate(interp, script, "-");
         i += 2)
         script = caseList[i+1];
     if (script && Jim_CompareStringImmediate(interp, script, "-")) {
@@ -12599,7 +12599,7 @@ Jim_GetOpt_Debug( Jim_GetOptInfo *p )
        int x;
 
        Jim_fprintf( p->interp, p->interp->cookie_stderr, "---args---\n");
-       for( x = 0 ; x < p->argc ; x++ ){
+       for ( x = 0 ; x < p->argc ; x++ ){
                Jim_fprintf( p->interp, p->interp->cookie_stderr, 
                                         "%2d) %s\n", 
                                         x, 
@@ -12823,7 +12823,7 @@ Jim_Debug_ArgvString( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
        }
 
        debug_string_obj = Jim_NewEmptyStringObj( interp );
-       for( x = 0 ; x < argc ; x++ ){
+       for ( x = 0 ; x < argc ; x++ ){
                Jim_AppendStrings( interp,
                                                   debug_string_obj,
                                                   Jim_GetString( argv[x], NULL ),
index c48939e5a6ef056c472649cffb588e8692d2eae7..23491d3f5b2c075cd932ffff2fafca990e06260e 100644 (file)
@@ -90,7 +90,7 @@ int add_default_dirs(void)
                GetModuleFileName (NULL, strExePath, MAX_PATH);
                *strrchr(strExePath, '\\')=0;
                strcat(strExePath, "/../lib/"PACKAGE);
-               for(p=strExePath; *p; p++) {
+               for (p=strExePath; *p; p++) {
                        if (*p == '\\')
                                *p = '/';
                }
index dd5c0a0e21b81133b673694debec364b92ef2615..6ebddfc78f4ca44d9228845acb98093b6f353cea 100644 (file)
@@ -1024,7 +1024,7 @@ int jtag_validate_chain(void)
 
        tap = NULL;
        total_ir_length = 0;
-       for(;;){
+       for (;;){
                tap = jtag_tap_next_enabled(tap);
                if ( tap == NULL ){
                        break;
@@ -1048,7 +1048,7 @@ int jtag_validate_chain(void)
        tap = NULL;
        chain_pos = 0;
        int val;
-       for(;;){
+       for (;;){
                tap = jtag_tap_next_enabled(tap);
                if ( tap == NULL ){
                        break;
index e35d3557ee7dac50dc7e4bb9b621b9070710bdc4..6a45d5939b73c497d9a6a2b62da27151aa182e89 100644 (file)
@@ -359,7 +359,7 @@ tap_state_t tap_state_by_name(const char *name)
 {
        tap_state_t x;
 
-       for( x = 0 ; x < TAP_NUM_STATES ; x++ ){
+       for ( x = 0 ; x < TAP_NUM_STATES ; x++ ){
                /* be nice to the human */
                if ( 0 == strcasecmp( name, tap_state_name(x) ) ){
                        return x;
@@ -403,9 +403,9 @@ tap_state_t jtag_debug_state_machine(const void *tms_buf, const void *tdi_buf,
        DEBUG_JTAG_IO("TAP/SM: TMS bits: %u (bytes: %u)", tap_bits, tap_bytes);
 
        tap_out_bits = 0;
-       for(cur_byte = 0; cur_byte < tap_bytes; cur_byte++)
+       for (cur_byte = 0; cur_byte < tap_bytes; cur_byte++)
        {
-               for(cur_bit = 0; cur_bit < 8; cur_bit++)
+               for (cur_bit = 0; cur_bit < 8; cur_bit++)
                {
                        // make sure we do not run off the end of the buffers
                        unsigned tap_bit = cur_byte * 8 + cur_bit;
index aa6eb6c0735958171fa466e4aac88b2e0be5de68..11381d68bfe27e23852ee576cf342d2dee761b4d 100644 (file)
@@ -518,7 +518,7 @@ dtc_run_download(
 
 
        /* Wait for DTC to finish running command buffer */
-       for(i = 10;;) {
+       for (i = 10;;) {
                usb_err = ep1_generic_commandl(
                        pHDev, 4,
 
@@ -711,7 +711,7 @@ dtc_queue_run(void) {
 
                        /* The rigamarole with the masks and doing it bit-by-bit is due to the fact that the scan buffer is LSb-first and the DTC code is MSb-first for hardware reasons.   It was that or craft a function to do the reversal, and that wouldn't work with bit-stuffing (supplying extra bits to use mostly byte operations), or any other scheme which would throw the byte alignment off. */
 
-                       for(
+                       for (
                                rq_p = dtc_queue.rq_head;
                                rq_p != NULL;
                                rq_p = rq_next
@@ -726,7 +726,7 @@ dtc_queue_run(void) {
 
                                        dtc_mask = 1 << (8 - 1);
 
-                                       for(
+                                       for (
                                                ;
                                                bit_cnt;
                                                bit_cnt--
@@ -764,7 +764,7 @@ dtc_queue_run(void) {
                                                dtc_mask = 1 << (bit_cnt - 1);
                                        }
 
-                                       for(
+                                       for (
                                                ;
                                                bit_cnt;
                                                bit_cnt--
@@ -834,7 +834,7 @@ tap_state_queue_run(void) {
        if (!tap_state_queue.length) return(retval);
        bits = 1;
        byte = 0;
-       for(i = tap_state_queue.length; i--;) {
+       for (i = tap_state_queue.length; i--;) {
 
                byte <<= 1;
                if (tap_state_queue.buffer & 1) {
@@ -1140,7 +1140,7 @@ rlink_scan(
                buffer[scan_size / 8] &= ((1 << ((scan_size - 1) % 8) + 1) - 1);
 
                printf("before scan:");
-               for(i = 0; i < (scan_size + 7) / 8; i++) {
+               for (i = 0; i < (scan_size + 7) / 8; i++) {
                        printf(" %02x", buffer[i]);
                }
                printf("\n");
@@ -1503,7 +1503,7 @@ int rlink_speed(int speed)
                speed = rlink_speed_table[rlink_speed_table_size - 1].prescaler;
        }
 
-       for(i = rlink_speed_table_size; i--; ) {
+       for (i = rlink_speed_table_size; i--; ) {
                if (rlink_speed_table[i].prescaler == speed) {
                        if (dtc_load_from_buffer(pHDev, rlink_speed_table[i].dtc, rlink_speed_table[i].dtc_size) != 0) {
                                LOG_ERROR("An error occurred while trying to load DTC code for speed \"%d\".\n", speed);
@@ -1534,7 +1534,7 @@ int rlink_speed_div(
 ) {
        int     i;
 
-       for(i = rlink_speed_table_size; i--; ) {
+       for (i = rlink_speed_table_size; i--; ) {
                if (rlink_speed_table[i].prescaler == speed) {
                        *khz = rlink_speed_table[i].khz;
                        return(ERROR_OK);
@@ -1558,7 +1558,7 @@ int rlink_khz(
                return ERROR_FAIL;
        }
 
-       for(i = rlink_speed_table_size; i--; ) {
+       for (i = rlink_speed_table_size; i--; ) {
                if (rlink_speed_table[i].khz <= khz) {
                        *speed = rlink_speed_table[i].prescaler;
                        return(ERROR_OK);
@@ -1630,11 +1630,11 @@ int rlink_init(void)
 
        busses = usb_get_busses();
 
-       for(bus = busses; bus; bus = bus->next)
+       for (bus = busses; bus; bus = bus->next)
        {
                struct usb_device *dev;
 
-               for(dev = bus->devices; dev; dev = dev->next)
+               for (dev = bus->devices; dev; dev = dev->next)
                {
                        if ( (dev->descriptor.idVendor == USB_IDVENDOR) && (dev->descriptor.idProduct == USB_IDPRODUCT) )
                        {
@@ -1715,7 +1715,7 @@ int rlink_init(void)
 
        /* The device starts out in an unknown state on open.  As such, result reads time out, and it's not even known whether the command was accepted.  So, for this first command, we issue it repeatedly until its response doesn't time out.  Also, if sending a command is going to time out, we'll find that out here. */
        /* It must be possible to open the device in such a way that this special magic isn't needed, but, so far, it escapes us. */
-       for(i = 0; i < 5; i++) {
+       for (i = 0; i < 5; i++) {
                j = ep1_generic_commandl(
                        pHDev, 1,
                        EP1_CMD_GET_FWREV
index c0498abfa5f805d6a66be85824002c287de236ff..d09e78123b3318dd7e1989dd81e67585a64684b6 100644 (file)
@@ -1181,7 +1181,7 @@ static int handle_irscan_command(struct command_context_s *cmd_ctx, char *cmd, c
                        const char *cpA;
                        const char *cpS;
                        cpA = args[ argc-1 ];
-                       for( endstate = 0 ; endstate < TAP_NUM_STATES ; endstate++ ){
+                       for ( endstate = 0 ; endstate < TAP_NUM_STATES ; endstate++ ){
                                cpS = tap_state_name( endstate );
                                if ( 0 == strcmp( cpA, cpS ) ){
                                        break;
index 28d1201f55c3f688437040cfb8ff44513000d860..496dfd20264615af5eb037860b9b124ff9c3ddfa 100644 (file)
@@ -157,7 +157,7 @@ static __inline__ void interface_jtag_add_dr_out_core(jtag_tap_t *target_tap,
        enum tap_state pause_state = TAP_DRSHIFT;
 
        jtag_tap_t *tap, *nextTap;
-       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);
                if (nextTap==NULL)
index 3425a4f06496dbc3ef530c366af138987959522f..8f9b774f8c404071719c66d2668a2f6da874f7b0 100644 (file)
@@ -494,7 +494,7 @@ int interface_jtag_add_ir_scan(int num_fields, const scan_field_t *fields, tap_s
        int j;
        int scan_size = 0;
        jtag_tap_t *tap, *nextTap;
-       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);
                tap_state_t end_state;
@@ -563,7 +563,7 @@ int interface_jtag_add_dr_scan(int num_fields, const scan_field_t *fields, tap_s
 
        int j;
        jtag_tap_t *tap, *nextTap;
-       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);
                int found=0;
index bf11be1a02b9f7a11b0bf0fd5d59481fd389231d..09603b38f7021dcc44f2e4f2abd2977b8a75246a 100644 (file)
@@ -2041,7 +2041,7 @@ int gdb_input_inner(connection_t *connection)
                                // binary packets spew junk into the debug log stream
                                char buf[ 50 ];
                                int x;
-                               for( x = 0 ; (x < 49) && (packet[x] != ':') ; x++ ){
+                               for ( x = 0 ; (x < 49) && (packet[x] != ':') ; x++ ){
                                        buf[x] = packet[x];
                                }
                                buf[x] = 0;
index c1b279b8b9bfd50009820bc5c596dd3a32280d66..e4259ae631475ebe9a741cbebca2d0ac4b5c8d0a 100644 (file)
@@ -763,7 +763,7 @@ int mips_m4k_read_memory(struct target_s *target, uint32_t address, uint32_t siz
                uint32_t i, t32;
                uint16_t t16;
 
-               for(i = 0; i < (count*size); i += size)
+               for (i = 0; i < (count*size); i += size)
                {
                        switch (size)
                        {
@@ -808,7 +808,7 @@ int mips_m4k_write_memory(struct target_s *target, uint32_t address, uint32_t si
                uint32_t i, t32;
                uint16_t t16;
 
-               for(i = 0; i < (count*size); i += size)
+               for (i = 0; i < (count*size); i += size)
                {
                        switch (size) 
                        {
index a427c66af50d37ca41e929f01fe56277e2574e81..159464502e0b996094d8be26c949b4d3d2893ffc 100644 (file)
@@ -3829,7 +3829,7 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                        b = 1;
                        break;
                }
-               for( x = 0 ; x < c ; x++ ){
+               for ( x = 0 ; x < c ; x++ ){
                        e = target_write_memory( target, a, b, 1, target_buf );
                        if ( e != ERROR_OK ){
                                Jim_SetResult_sprintf( interp, "Error writing @ 0x%08x: %d\n", (int)(a), e );
@@ -3895,36 +3895,36 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                        Jim_fprintf( interp, interp->cookie_stdout, "0x%08x ", (int)(a) );
                        switch ( b ){
                        case 4:
-                               for( x = 0 ; (x < 16) && (x < y) ; x += 4 ){
+                               for ( x = 0 ; (x < 16) && (x < y) ; x += 4 ){
                                        z = target_buffer_get_u32( target, &(target_buf[ x * 4 ]) );
                                        Jim_fprintf( interp, interp->cookie_stdout, "%08x ", (int)(z) );
                                }
-                               for( ; (x < 16) ; x += 4 ){
+                               for ( ; (x < 16) ; x += 4 ){
                                        Jim_fprintf( interp, interp->cookie_stdout, "         " );
                                }
                                break;
                        case 2:
-                               for( x = 0 ; (x < 16) && (x < y) ; x += 2 ){
+                               for ( x = 0 ; (x < 16) && (x < y) ; x += 2 ){
                                        z = target_buffer_get_u16( target, &(target_buf[ x * 2 ]) );
                                        Jim_fprintf( interp, interp->cookie_stdout, "%04x ", (int)(z) );
                                }
-                               for( ; (x < 16) ; x += 2 ){
+                               for ( ; (x < 16) ; x += 2 ){
                                        Jim_fprintf( interp, interp->cookie_stdout, "     " );
                                }
                                break;
                        case 1:
                        default:
-                               for( x = 0 ; (x < 16) && (x < y) ; x += 1 ){
+                               for ( x = 0 ; (x < 16) && (x < y) ; x += 1 ){
                                        z = target_buffer_get_u8( target, &(target_buf[ x * 4 ]) );
                                        Jim_fprintf( interp, interp->cookie_stdout, "%02x ", (int)(z) );
                                }
-                               for( ; (x < 16) ; x += 1 ){
+                               for ( ; (x < 16) ; x += 1 ){
                                        Jim_fprintf( interp, interp->cookie_stdout, "   " );
                                }
                                break;
                        }
                        /* ascii-ify the bytes */
-                       for( x = 0 ; x < y ; x++ ){
+                       for ( x = 0 ; x < y ; x++ ){
                                if ( (target_buf[x] >= 0x20) &&
                                        (target_buf[x] <= 0x7e) ){
                                        /* good */
@@ -4132,7 +4132,7 @@ static int target_create( Jim_GetOptInfo *goi )
        e = Jim_GetOpt_String( goi, &cp2, NULL );
        cp = cp2;
        /* now does target type exist */
-       for( x = 0 ; target_types[x] ; x++ ){
+       for ( x = 0 ; target_types[x] ; x++ ){
                if ( 0 == strcmp( cp, target_types[x]->name ) ){
                        /* found */
                        break;
@@ -4140,7 +4140,7 @@ static int target_create( Jim_GetOptInfo *goi )
        }
        if ( target_types[x] == NULL ){
                Jim_SetResult_sprintf( goi->interp, "Unknown target type %s, try one of ", cp );
-               for( x = 0 ; target_types[x] ; x++ ){
+               for ( x = 0 ; target_types[x] ; x++ ){
                        if ( target_types[x+1] ){
                                Jim_AppendStrings( goi->interp,
                                                                   Jim_GetResult(goi->interp),
@@ -4313,7 +4313,7 @@ static int jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                        return JIM_ERR;
                }
                Jim_SetResult( goi.interp, Jim_NewListObj( goi.interp, NULL, 0 ) );
-               for( x = 0 ; target_types[x] ; x++ ){
+               for ( x = 0 ; target_types[x] ; x++ ){
                        Jim_ListAppendElement( goi.interp,
                                                                   Jim_GetResult(goi.interp),
                                                                   Jim_NewStringObj( goi.interp, target_types[x]->name, -1 ) );
index 1e20afaa0f43c257873a71caa7a4eefd030452ae..e9c1d544468e9610ba080ce7818ddce6cd1973f3 100644 (file)
@@ -1783,7 +1783,7 @@ int xscale_full_context(target_t *target)
         * we can't enter User mode on an XScale (unpredictable),
         * but User shares registers with SYS
         */
-       for(i = 1; i < 7; i++)
+       for (i = 1; i < 7; i++)
        {
                int valid = 1;
 
@@ -1855,7 +1855,7 @@ int xscale_restore_context(target_t *target)
        * we can't enter User mode on an XScale (unpredictable),
        * but User shares registers with SYS
        */
-       for(i = 1; i < 7; i++)
+       for (i = 1; i < 7; i++)
        {
                int dirty = 0;
 
index f0213c3e87cb3a39d64a092a7d3d2ff8731931b9..f4c5df62970cd44f5b7dea958793c10f31137310 100644 (file)
@@ -366,7 +366,7 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha
 
                                LOG_DEBUG("%s %d", op_name, xsdrsize);
 
-                               for( attempt=0; attempt<limit;  ++attempt )
+                               for ( attempt=0; attempt<limit;  ++attempt )
                                {
                                        scan_field_t field;
 
@@ -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<limit;  ++attempt )
+                               for ( attempt=0; attempt<limit;  ++attempt )
                                {
                                        scan_field_t field;
 
index dc7f8cfd72fbfdbb4d56240bce4e95bac3d9743a..ec067af391aec7ac5250dfe7811139d7fe4b62a5 100644 (file)
@@ -11,11 +11,11 @@ int main(void)
        
        while (1)
        {
-               for(i = 0; i < 500000; i++)
+               for (i = 0; i < 500000; i++)
                        mPORTDToggleBits(BIT_0);
-               for(i = 0; i < 500000; i++)
+               for (i = 0; i < 500000; i++)
                        mPORTDToggleBits(BIT_1);
-               for(i = 0; i < 500000; i++)
+               for (i = 0; i < 500000; i++)
                        mPORTDToggleBits(BIT_2);
        }