- Replace 'if(' with 'if ('.
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 23 Jun 2009 22:35:09 +0000 (22:35 +0000)
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 23 Jun 2009 22:35:09 +0000 (22:35 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@2357 b42882b7-edfa-0310-969c-e2dbd0fdcd60

46 files changed:
src/flash/at91sam7.c
src/flash/cfi.c
src/flash/ecos.c
src/flash/flash.c
src/flash/lpc2000.c
src/flash/lpc288x.c
src/flash/mflash.c
src/flash/pic32mx.c
src/flash/stellaris.c
src/flash/stm32x.c
src/flash/str9x.c
src/flash/str9xpec.c
src/helper/command.c
src/helper/fileio.c
src/helper/ioutil.c
src/helper/jim.c
src/helper/jim.h
src/helper/log.c
src/helper/options.c
src/jtag/arm-jtag-ew.c
src/jtag/bitbang.c
src/jtag/core.c
src/jtag/dummy.c
src/jtag/interface.c
src/jtag/rlink/rlink.c
src/jtag/tcl.c
src/jtag/usbprog.c
src/jtag/vsllink.c
src/jtag/zy1000/zy1000.c
src/server/gdb_server.c
src/target/arm720t.c
src/target/arm7_9_common.c
src/target/arm7tdmi.c
src/target/arm_jtag.c
src/target/arm_simulator.c
src/target/armv7m.c
src/target/cortex_m3.c
src/target/feroceon.c
src/target/image.c
src/target/mips32_pracc.c
src/target/mips_ejtag.c
src/target/mips_m4k.c
src/target/oocd_trace.c
src/target/target.c
src/target/xscale.c
src/xsvf/xsvf.c

index cfe0a43..ca6e2c4 100644 (file)
@@ -890,7 +890,7 @@ static int at91sam7_erase(struct flash_bank_s *bank, int first, int last)
        at91sam7_read_clock_info(bank);
        at91sam7_set_flash_mode(bank, FMR_TIMING_FLASH);
 
-       if(erase_all)
+       if (erase_all)
        {
                if (at91sam7_flash_command(bank, EA, 0) != ERROR_OK) 
                {
@@ -1027,7 +1027,7 @@ static int at91sam7_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t o
                /* Write one block to the PageWriteBuffer */
                buffer_pos = (pagen-first_page)*dst_min_alignment;
                wcount = CEIL(count,4);
-               if((retval = target_write_memory(target, bank->base+pagen*dst_min_alignment, 4, wcount, buffer+buffer_pos)) != ERROR_OK)
+               if ((retval = target_write_memory(target, bank->base+pagen*dst_min_alignment, 4, wcount, buffer+buffer_pos)) != ERROR_OK)
                {
                        return retval;
                }
index 2e4839d..b14f0e9 100644 (file)
@@ -114,7 +114,7 @@ static __inline__ uint32_t flash_address(flash_bank_t *bank, int sector, uint32_
 {
        cfi_flash_bank_t *cfi_info = bank->driver_priv;
 
-       if(cfi_info->x16_as_x8) offset*=2;
+       if (cfi_info->x16_as_x8) offset*=2;
 
        /* while the sector list isn't built, only accesses to sector 0 work */
        if (sector == 0)
@@ -209,7 +209,7 @@ static uint16_t cfi_query_u16(flash_bank_t *bank, int sector, uint32_t offset)
        cfi_flash_bank_t *cfi_info = bank->driver_priv;
        uint8_t data[CFI_MAX_BUS_WIDTH * 2];
 
-       if(cfi_info->x16_as_x8)
+       if (cfi_info->x16_as_x8)
        {
                uint8_t i;
                for(i=0;i<2;i++)
@@ -231,7 +231,7 @@ static uint32_t cfi_query_u32(flash_bank_t *bank, int sector, uint32_t offset)
        cfi_flash_bank_t *cfi_info = bank->driver_priv;
        uint8_t data[CFI_MAX_BUS_WIDTH * 4];
 
-       if(cfi_info->x16_as_x8)
+       if (cfi_info->x16_as_x8)
        {
                uint8_t i;
                for(i=0;i<4;i++)
@@ -356,12 +356,12 @@ static int cfi_read_intel_pri_ext(flash_bank_t *bank)
        if ((pri_ext->pri[0] != 'P') || (pri_ext->pri[1] != 'R') || (pri_ext->pri[2] != 'I'))
        {
                cfi_command(bank, 0xf0, command);
-               if((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
                cfi_command(bank, 0xff, command);
-               if((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
@@ -422,7 +422,7 @@ static int cfi_read_spansion_pri_ext(flash_bank_t *bank)
        if ((pri_ext->pri[0] != 'P') || (pri_ext->pri[1] != 'R') || (pri_ext->pri[2] != 'I'))
        {
                cfi_command(bank, 0xf0, command);
-               if((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
@@ -495,7 +495,7 @@ static int cfi_read_atmel_pri_ext(flash_bank_t *bank)
        if ((atmel_pri_ext.pri[0] != 'P') || (atmel_pri_ext.pri[1] != 'R') || (atmel_pri_ext.pri[2] != 'I'))
        {
                cfi_command(bank, 0xf0, command);
-               if((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
@@ -691,13 +691,13 @@ static int cfi_intel_erase(struct flash_bank_s *bank, int first, int last)
        for (i = first; i <= last; i++)
        {
                cfi_command(bank, 0x20, command);
-               if((retval = target_write_memory(target, flash_address(bank, i, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, i, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
 
                cfi_command(bank, 0xd0, command);
-               if((retval = target_write_memory(target, flash_address(bank, i, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, i, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
@@ -707,7 +707,7 @@ static int cfi_intel_erase(struct flash_bank_s *bank, int first, int last)
                else
                {
                        cfi_command(bank, 0xff, command);
-                       if((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+                       if ((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -734,37 +734,37 @@ static int cfi_spansion_erase(struct flash_bank_s *bank, int first, int last)
        for (i = first; i <= last; i++)
        {
                cfi_command(bank, 0xaa, command);
-               if((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock1), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock1), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
 
                cfi_command(bank, 0x55, command);
-               if((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock2), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock2), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
 
                cfi_command(bank, 0x80, command);
-               if((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock1), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock1), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
 
                cfi_command(bank, 0xaa, command);
-               if((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock1), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock1), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
 
                cfi_command(bank, 0x55, command);
-               if((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock2), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock2), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
 
                cfi_command(bank, 0x30, command);
-               if((retval = target_write_memory(target, flash_address(bank, i, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, i, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
@@ -774,7 +774,7 @@ static int cfi_spansion_erase(struct flash_bank_s *bank, int first, int last)
                else
                {
                        cfi_command(bank, 0xf0, command);
-                       if((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+                       if ((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -845,7 +845,7 @@ static int cfi_intel_protect(struct flash_bank_s *bank, int set, int first, int
        {
                cfi_command(bank, 0x60, command);
                LOG_DEBUG("address: 0x%4.4" PRIx32 ", command: 0x%4.4" PRIx32, flash_address(bank, i, 0x0), target_buffer_get_u32(target, command));
-               if((retval = target_write_memory(target, flash_address(bank, i, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, i, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
@@ -853,7 +853,7 @@ static int cfi_intel_protect(struct flash_bank_s *bank, int set, int first, int
                {
                        cfi_command(bank, 0x01, command);
                        LOG_DEBUG("address: 0x%4.4" PRIx32 ", command: 0x%4.4" PRIx32 , flash_address(bank, i, 0x0), target_buffer_get_u32(target, command));
-                       if((retval = target_write_memory(target, flash_address(bank, i, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+                       if ((retval = target_write_memory(target, flash_address(bank, i, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -863,7 +863,7 @@ static int cfi_intel_protect(struct flash_bank_s *bank, int set, int first, int
                {
                        cfi_command(bank, 0xd0, command);
                        LOG_DEBUG("address: 0x%4.4" PRIx32 ", command: 0x%4.4" PRIx32, flash_address(bank, i, 0x0), target_buffer_get_u32(target, command));
-                       if((retval = target_write_memory(target, flash_address(bank, i, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+                       if ((retval = target_write_memory(target, flash_address(bank, i, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -881,7 +881,7 @@ static int cfi_intel_protect(struct flash_bank_s *bank, int set, int first, int
                        uint8_t block_status;
                        /* read block lock bit, to verify status */
                        cfi_command(bank, 0x90, command);
-                       if((retval = target_write_memory(target, flash_address(bank, 0, 0x55), bank->bus_width, 1, command)) != ERROR_OK)
+                       if ((retval = target_write_memory(target, flash_address(bank, 0, 0x55), bank->bus_width, 1, command)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -891,7 +891,7 @@ static int cfi_intel_protect(struct flash_bank_s *bank, int set, int first, int
                        {
                                LOG_ERROR("couldn't change block lock status (set = %i, block_status = 0x%2.2x)", set, block_status);
                                cfi_command(bank, 0x70, command);
-                               if((retval = target_write_memory(target, flash_address(bank, 0, 0x55), bank->bus_width, 1, command)) != ERROR_OK)
+                               if ((retval = target_write_memory(target, flash_address(bank, 0, 0x55), bank->bus_width, 1, command)) != ERROR_OK)
                                {
                                        return retval;
                                }
@@ -920,13 +920,13 @@ static int cfi_intel_protect(struct flash_bank_s *bank, int set, int first, int
                                cfi_intel_clear_status_register(bank);
 
                                cfi_command(bank, 0x60, command);
-                               if((retval = target_write_memory(target, flash_address(bank, i, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+                               if ((retval = target_write_memory(target, flash_address(bank, i, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                                {
                                        return retval;
                                }
 
                                cfi_command(bank, 0x01, command);
-                               if((retval = target_write_memory(target, flash_address(bank, i, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+                               if ((retval = target_write_memory(target, flash_address(bank, i, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                                {
                                        return retval;
                                }
@@ -1214,7 +1214,7 @@ static int cfi_intel_write_block(struct flash_bank_s *bank, uint8_t *buffer, uin
                uint32_t thisrun_count = (count > buffer_size) ? buffer_size : count;
                uint32_t wsm_error;
 
-               if((retval = target_write_buffer(target, source->address, thisrun_count, buffer)) != ERROR_OK)
+               if ((retval = target_write_buffer(target, source->address, thisrun_count, buffer)) != ERROR_OK)
                {
                        goto cleanup;
                }
@@ -1461,7 +1461,7 @@ static int cfi_spansion_write_block(struct flash_bank_s *bank, uint8_t *buffer,
                }
 
                /* write algorithm code to working area */
-               if((retval = target_write_buffer(target, cfi_info->write_algorithm->address,
+               if ((retval = target_write_buffer(target, cfi_info->write_algorithm->address,
                                    target_code_size, target_code)) != ERROR_OK)
                {
                        free(target_code);
@@ -1557,12 +1557,12 @@ static int cfi_intel_write_word(struct flash_bank_s *bank, uint8_t *word, uint32
 
        cfi_intel_clear_status_register(bank);
        cfi_command(bank, 0x40, command);
-       if((retval = target_write_memory(target, address, bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, address, bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
 
-       if((retval = target_write_memory(target, address, bank->bus_width, 1, word)) != ERROR_OK)
+       if ((retval = target_write_memory(target, address, bank->bus_width, 1, word)) != ERROR_OK)
        {
                return retval;
        }
@@ -1570,7 +1570,7 @@ static int cfi_intel_write_word(struct flash_bank_s *bank, uint8_t *word, uint32
        if (cfi_intel_wait_status_busy(bank, 1000 * (1 << cfi_info->word_write_timeout_max)) != 0x80)
        {
                cfi_command(bank, 0xff, command);
-               if((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
@@ -1626,14 +1626,14 @@ static int cfi_intel_write_words(struct flash_bank_s *bank, uint8_t *word, uint3
 
        /* Initiate buffer operation _*/
        cfi_command(bank, 0xE8, command);
-       if((retval = target_write_memory(target, address, bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, address, bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
        if (cfi_intel_wait_status_busy(bank, 1000 * (1 << cfi_info->buf_write_timeout_max)) != 0x80)
        {
                cfi_command(bank, 0xff, command);
-               if((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
@@ -1644,26 +1644,26 @@ static int cfi_intel_write_words(struct flash_bank_s *bank, uint8_t *word, uint3
 
        /* Write buffer wordcount-1 and data words */
        cfi_command(bank, bufferwsize-1, command);
-       if((retval = target_write_memory(target, address, bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, address, bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
 
-       if((retval = target_write_memory(target, address, bank->bus_width, bufferwsize, word)) != ERROR_OK)
+       if ((retval = target_write_memory(target, address, bank->bus_width, bufferwsize, word)) != ERROR_OK)
        {
                return retval;
        }
 
        /* Commit write operation */
        cfi_command(bank, 0xd0, command);
-       if((retval = target_write_memory(target, address, bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, address, bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
        if (cfi_intel_wait_status_busy(bank, 1000 * (1 << cfi_info->buf_write_timeout_max)) != 0x80)
        {
                cfi_command(bank, 0xff, command);
-               if((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
@@ -1684,24 +1684,24 @@ static int cfi_spansion_write_word(struct flash_bank_s *bank, uint8_t *word, uin
        uint8_t command[8];
 
        cfi_command(bank, 0xaa, command);
-       if((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock1), bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock1), bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
 
        cfi_command(bank, 0x55, command);
-       if((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock2), bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock2), bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
 
        cfi_command(bank, 0xa0, command);
-       if((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock1), bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock1), bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
 
-       if((retval = target_write_memory(target, address, bank->bus_width, 1, word)) != ERROR_OK)
+       if ((retval = target_write_memory(target, address, bank->bus_width, 1, word)) != ERROR_OK)
        {
                return retval;
        }
@@ -1709,7 +1709,7 @@ static int cfi_spansion_write_word(struct flash_bank_s *bank, uint8_t *word, uin
        if (cfi_spansion_wait_status_busy(bank, 1000 * (1 << cfi_info->word_write_timeout_max)) != ERROR_OK)
        {
                cfi_command(bank, 0xf0, command);
-               if((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
@@ -1761,39 +1761,39 @@ static int cfi_spansion_write_words(struct flash_bank_s *bank, uint8_t *word, ui
 
        // Unlock
        cfi_command(bank, 0xaa, command);
-       if((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock1), bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock1), bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
 
        cfi_command(bank, 0x55, command);
-       if((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock2), bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock2), bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
 
        // Buffer load command
        cfi_command(bank, 0x25, command);
-       if((retval = target_write_memory(target, address, bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, address, bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
 
        /* Write buffer wordcount-1 and data words */
        cfi_command(bank, bufferwsize-1, command);
-       if((retval = target_write_memory(target, address, bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, address, bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
 
-       if((retval = target_write_memory(target, address, bank->bus_width, bufferwsize, word)) != ERROR_OK)
+       if ((retval = target_write_memory(target, address, bank->bus_width, bufferwsize, word)) != ERROR_OK)
        {
                return retval;
        }
 
        /* Commit write operation */
        cfi_command(bank, 0x29, command);
-       if((retval = target_write_memory(target, address, bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, address, bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
@@ -1801,7 +1801,7 @@ static int cfi_spansion_write_words(struct flash_bank_s *bank, uint8_t *word, ui
        if (cfi_spansion_wait_status_busy(bank, 1000 * (1 << cfi_info->word_write_timeout_max)) != ERROR_OK)
        {
                cfi_command(bank, 0xf0, command);
-               if((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
@@ -1893,7 +1893,7 @@ int cfi_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint3
                for (i = 0; i < align; ++i, ++copy_p)
                {
                        uint8_t byte;
-                       if((retval = target_read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK)
+                       if ((retval = target_read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -1912,7 +1912,7 @@ int cfi_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint3
                for (; (count == 0) && (i < bank->bus_width); ++i, ++copy_p)
                {
                        uint8_t byte;
-                       if((retval = target_read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK)
+                       if ((retval = target_read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -2016,12 +2016,12 @@ int cfi_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint3
 
        /* return to read array mode, so we can read from flash again for padding */
        cfi_command(bank, 0xf0, current_word);
-       if((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, current_word)) != ERROR_OK)
+       if ((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, current_word)) != ERROR_OK)
        {
                return retval;
        }
        cfi_command(bank, 0xff, current_word);
-       if((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, current_word)) != ERROR_OK)
+       if ((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, current_word)) != ERROR_OK)
        {
                return retval;
        }
@@ -2043,7 +2043,7 @@ int cfi_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint3
                for (; i < bank->bus_width; ++i, ++copy_p)
                {
                        uint8_t byte;
-                       if((retval = target_read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK)
+                       if ((retval = target_read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -2056,7 +2056,7 @@ int cfi_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint3
 
        /* return to read array mode */
        cfi_command(bank, 0xf0, current_word);
-       if((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, current_word)) != ERROR_OK)
+       if ((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, current_word)) != ERROR_OK)
        {
                return retval;
        }
@@ -2137,17 +2137,17 @@ static int cfi_probe(struct flash_bank_s *bank)
 
        /* switch to read identifier codes mode ("AUTOSELECT") */
        cfi_command(bank, 0xaa, command);
-       if((retval = target_write_memory(target, flash_address(bank, 0, unlock1), bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, flash_address(bank, 0, unlock1), bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
        cfi_command(bank, 0x55, command);
-       if((retval = target_write_memory(target, flash_address(bank, 0, unlock2), bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, flash_address(bank, 0, unlock2), bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
        cfi_command(bank, 0x90, command);
-       if((retval = target_write_memory(target, flash_address(bank, 0, unlock1), bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, flash_address(bank, 0, unlock1), bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
@@ -2155,11 +2155,11 @@ static int cfi_probe(struct flash_bank_s *bank)
        if (bank->chip_width == 1)
        {
                uint8_t manufacturer, device_id;
-               if((retval = target_read_u8(target, flash_address(bank, 0, 0x00), &manufacturer)) != ERROR_OK)
+               if ((retval = target_read_u8(target, flash_address(bank, 0, 0x00), &manufacturer)) != ERROR_OK)
                {
                        return retval;
                }
-               if((retval = target_read_u8(target, flash_address(bank, 0, 0x01), &device_id)) != ERROR_OK)
+               if ((retval = target_read_u8(target, flash_address(bank, 0, 0x01), &device_id)) != ERROR_OK)
                {
                        return retval;
                }
@@ -2168,11 +2168,11 @@ static int cfi_probe(struct flash_bank_s *bank)
        }
        else if (bank->chip_width == 2)
        {
-               if((retval = target_read_u16(target, flash_address(bank, 0, 0x00), &cfi_info->manufacturer)) != ERROR_OK)
+               if ((retval = target_read_u16(target, flash_address(bank, 0, 0x00), &cfi_info->manufacturer)) != ERROR_OK)
                {
                        return retval;
                }
-               if((retval = target_read_u16(target, flash_address(bank, 0, 0x02), &cfi_info->device_id)) != ERROR_OK)
+               if ((retval = target_read_u16(target, flash_address(bank, 0, 0x02), &cfi_info->device_id)) != ERROR_OK)
                {
                        return retval;
                }
@@ -2181,12 +2181,12 @@ static int cfi_probe(struct flash_bank_s *bank)
        LOG_INFO("Flash Manufacturer/Device: 0x%04x 0x%04x", cfi_info->manufacturer, cfi_info->device_id);
        /* switch back to read array mode */
        cfi_command(bank, 0xf0, command);
-       if((retval = target_write_memory(target, flash_address(bank, 0, 0x00), bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, flash_address(bank, 0, 0x00), bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
        cfi_command(bank, 0xff, command);
-       if((retval = target_write_memory(target, flash_address(bank, 0, 0x00), bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, flash_address(bank, 0, 0x00), bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
@@ -2207,7 +2207,7 @@ static int cfi_probe(struct flash_bank_s *bank)
                 * SST flashes clearly violate this, and we will consider them incompatbile for now
                 */
                cfi_command(bank, 0x98, command);
-               if((retval = target_write_memory(target, flash_address(bank, 0, 0x55), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, 0, 0x55), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
@@ -2221,12 +2221,12 @@ static int cfi_probe(struct flash_bank_s *bank)
                if ((cfi_info->qry[0] != 'Q') || (cfi_info->qry[1] != 'R') || (cfi_info->qry[2] != 'Y'))
                {
                        cfi_command(bank, 0xf0, command);
-                       if((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+                       if ((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                        {
                                return retval;
                        }
                        cfi_command(bank, 0xff, command);
-                       if((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+                       if ((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -2314,12 +2314,12 @@ static int cfi_probe(struct flash_bank_s *bank)
                 * we use both reset commands, as some Intel flashes fail to recognize the 0xF0 command
                 */
                cfi_command(bank, 0xf0, command);
-               if((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
                cfi_command(bank, 0xff, command);
-               if((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
+               if ((retval = target_write_memory(target, flash_address(bank, 0, 0x0), bank->bus_width, 1, command)) != ERROR_OK)
                {
                        return retval;
                }
@@ -2417,7 +2417,7 @@ static int cfi_intel_protect_check(struct flash_bank_s *bank)
                return ERROR_FLASH_OPERATION_FAILED;
 
        cfi_command(bank, 0x90, command);
-       if((retval = target_write_memory(target, flash_address(bank, 0, 0x55), bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, flash_address(bank, 0, 0x55), bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
@@ -2446,19 +2446,19 @@ static int cfi_spansion_protect_check(struct flash_bank_s *bank)
        int i;
 
        cfi_command(bank, 0xaa, command);
-       if((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock1), bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock1), bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
 
        cfi_command(bank, 0x55, command);
-       if((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock2), bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock2), bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
 
        cfi_command(bank, 0x90, command);
-       if((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock1), bank->bus_width, 1, command)) != ERROR_OK)
+       if ((retval = target_write_memory(target, flash_address(bank, 0, pri_ext->_unlock1), bank->bus_width, 1, command)) != ERROR_OK)
        {
                return retval;
        }
index 5b7ac7c..4c90321 100644 (file)
@@ -139,7 +139,7 @@ static int ecosflash_flash_bank_command(struct command_context_s *cmd_ctx, char
        }
 
        info = malloc(sizeof(ecosflash_flash_bank_t));
-       if(info == NULL)
+       if (info == NULL)
        {
                LOG_ERROR("no memory for flash bank info");
                exit(-1);
index 6795f8d..aa3be95 100644 (file)
@@ -748,7 +748,7 @@ static int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cm
        pattern = strtoul(args[1], NULL, 0);
        count   = strtoul(args[2], NULL, 0);
 
-       if(count == 0)
+       if (count == 0)
                return ERROR_OK;
 
        switch(cmd[4])
@@ -796,7 +796,7 @@ static int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cm
                cur_size = MIN( (count*wordsize - wrote), sizeof(chunk) );
                flash_bank_t *bank;
                bank = get_flash_bank_by_addr(target, address);
-               if(bank == NULL)
+               if (bank == NULL)
                {
                        return ERROR_FAIL;
                }
@@ -826,7 +826,7 @@ static int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cm
                return retval;
        }
 
-       if(err == ERROR_OK)
+       if (err == ERROR_OK)
        {
                float speed;
                speed=wrote / 1024.0;
@@ -994,7 +994,7 @@ int flash_erase_address_range(target_t *target, uint32_t addr, uint32_t length)
                }
        }
 
-       if( first == -1 || last == -1 )
+       if ( first == -1 || last == -1 )
                return ERROR_OK;
 
        return flash_driver_erase(c, first, last);
index 7eab412..28fe087 100644 (file)
@@ -258,7 +258,7 @@ static int lpc2000_iap_call(flash_bank_t *bank, int code, uint32_t param_table[5
                /* write IAP code to working area */
                target_buffer_set_u32(target, jump_gate, ARMV4_5_BX(12));
                target_buffer_set_u32(target, jump_gate + 4, ARMV4_5_B(0xfffffe, 0));
-               if((retval = target_write_memory(target, lpc2000_info->iap_working_area->address, 4, 2, jump_gate)) != ERROR_OK)
+               if ((retval = target_write_memory(target, lpc2000_info->iap_working_area->address, 4, 2, jump_gate)) != ERROR_OK)
                {
                        return retval;
                }
index 1f0d517..e40ec44 100644 (file)
@@ -129,7 +129,7 @@ static uint32_t lpc288x_wait_status_busy(flash_bank_t *bank, int timeout)
                target_read_u32(target, F_STAT, &status);
        }while (((status & FS_DONE) == 0) && timeout);
 
-       if(timeout == 0)
+       if (timeout == 0)
        {
                LOG_DEBUG("Timedout!");
                return ERROR_FLASH_OPERATION_FAILED;
index 24eecfc..6400d3b 100644 (file)
@@ -298,7 +298,7 @@ static int mg_dsk_srst(uint8_t on)
        if ((ret = target_read_u8(target, mg_task_reg + MG_REG_DRV_CTRL, &value)) != ERROR_OK)
                return ret;
 
-       if(on) {
+       if (on) {
                value |= (mg_io_rbit_devc_srst);
        } else {
                value &= ~mg_io_rbit_devc_srst;
@@ -892,7 +892,7 @@ static int mg_pll_get_NO(unsigned char  output_div)
        int i, NO;
 
        for (i = 0, NO = 1; i < 2; ++i, output_div >>= 1)
-               if(output_div & 1)
+               if (output_div & 1)
                        NO = NO << 1;
 
        return NO;
index 5d98939..a0d6f41 100644 (file)
@@ -151,7 +151,7 @@ static uint32_t pic32mx_wait_status_busy(flash_bank_t *bank, int timeout)
                LOG_DEBUG("status: 0x%" PRIx32, status );
                alive_sleep(1);
        }
-       if(timeout <= 0)
+       if (timeout <= 0)
                LOG_DEBUG("timeout: status: 0x%" PRIx32, status );
 
        return status;
@@ -194,11 +194,11 @@ static int pic32mx_protect_check(struct flash_bank_s *bank)
        }
 
        target_read_u32(target, PIC32MX_DEVCFG0, &devcfg0);
-       if((devcfg0 & (1<<28)) == 0) /* code protect bit */
+       if ((devcfg0 & (1<<28)) == 0) /* code protect bit */
                num_pages = 0xffff;  /* All pages protected */
-       else if(bank->base == PIC32MX_KSEG1_BOOT_FLASH)
+       else if (bank->base == PIC32MX_KSEG1_BOOT_FLASH)
        {
-               if(devcfg0 & (1<<24))
+               if (devcfg0 & (1<<24))
                        num_pages = 0;       /* All pages unprotected */
                else
                        num_pages = 0xffff;  /* All pages protected */
@@ -229,25 +229,25 @@ static int pic32mx_erase(struct flash_bank_s *bank, int first, int last)
        {
                LOG_DEBUG("Erasing entire program flash");
                status = pic32mx_nvm_exec(bank, NVMCON_OP_PFM_ERASE, 50);
-               if( status & NVMCON_NVMERR )
+               if ( status & NVMCON_NVMERR )
                        return ERROR_FLASH_OPERATION_FAILED;
-               if( status & NVMCON_LVDERR )
+               if ( status & NVMCON_LVDERR )
                        return ERROR_FLASH_OPERATION_FAILED;
                return ERROR_OK;
        }
 
        for (i = first; i <= last; i++)
        {
-               if(bank->base >= PIC32MX_KSEG1_PGM_FLASH)
+               if (bank->base >= PIC32MX_KSEG1_PGM_FLASH)
                        target_write_u32(target, PIC32MX_NVMADDR, KS1Virt2Phys(bank->base + bank->sectors[i].offset));
                else
                        target_write_u32(target, PIC32MX_NVMADDR, KS0Virt2Phys(bank->base + bank->sectors[i].offset));
 
                status = pic32mx_nvm_exec(bank, NVMCON_OP_PAGE_ERASE, 10);
 
-               if( status & NVMCON_NVMERR )
+               if ( status & NVMCON_NVMERR )
                        return ERROR_FLASH_OPERATION_FAILED;
-               if( status & NVMCON_LVDERR )
+               if ( status & NVMCON_LVDERR )
                        return ERROR_FLASH_OPERATION_FAILED;
                bank->sectors[i].is_erased = 1;
        }
@@ -313,7 +313,7 @@ static int pic32mx_protect(struct flash_bank_s *bank, int set, int first, int la
                        reg = (i / pic32mx_info->ppage_size) / 8;
                        bit = (i / pic32mx_info->ppage_size) - (reg * 8);
 
-                       if( set )
+                       if ( set )
                                prot_reg[reg] &= ~(1 << bit);
                        else
                                prot_reg[reg] |= (1 << bit);
@@ -327,7 +327,7 @@ static int pic32mx_protect(struct flash_bank_s *bank, int set, int first, int la
                        reg = (i / pic32mx_info->ppage_size) / 8;
                        bit = (i / pic32mx_info->ppage_size) - (reg * 8);
 
-                       if( set )
+                       if ( set )
                                prot_reg[reg] &= ~(1 << bit);
                        else
                                prot_reg[reg] |= (1 << bit);
@@ -434,12 +434,12 @@ static int pic32mx_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint3
                }
 #endif
                status = pic32mx_write_row(bank, address, source->address);
-               if( status & NVMCON_NVMERR ) {
+               if ( status & NVMCON_NVMERR ) {
                        LOG_ERROR("Flash write error NVMERR (status=0x%08" PRIx32 ")", status);
                        retval = ERROR_FLASH_OPERATION_FAILED;
                        break;
                }
-               if( status & NVMCON_LVDERR ) {
+               if ( status & NVMCON_LVDERR ) {
                        LOG_ERROR("Flash write error LVDERR (status=0x%08" PRIx32 ")", status);
                        retval = ERROR_FLASH_OPERATION_FAILED;
                        break;
@@ -458,12 +458,12 @@ static int pic32mx_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint3
                memcpy(&value, buffer, sizeof(uint32_t));
 
                uint32_t status = pic32mx_write_word(bank, address, value);
-               if( status & NVMCON_NVMERR ) {
+               if ( status & NVMCON_NVMERR ) {
                        LOG_ERROR("Flash write error NVMERR (status=0x%08" PRIx32 ")", status);
                        retval = ERROR_FLASH_OPERATION_FAILED;
                        break;
                }
-               if( status & NVMCON_LVDERR ) {
+               if ( status & NVMCON_LVDERR ) {
                        LOG_ERROR("Flash write error LVDERR (status=0x%08" PRIx32 ")", status);
                        retval = ERROR_FLASH_OPERATION_FAILED;
                        break;
@@ -481,7 +481,7 @@ static int pic32mx_write_word(struct flash_bank_s *bank, uint32_t address, uint3
 {
        target_t *target = bank->target;
 
-       if(bank->base >= PIC32MX_KSEG1_PGM_FLASH)
+       if (bank->base >= PIC32MX_KSEG1_PGM_FLASH)
                target_write_u32(target, PIC32MX_NVMADDR, KS1Virt2Phys(address));
        else
                target_write_u32(target, PIC32MX_NVMADDR, KS0Virt2Phys(address));
@@ -499,11 +499,11 @@ static int pic32mx_write_row(struct flash_bank_s *bank, uint32_t address, uint32
 
        LOG_DEBUG("addr: 0x%08" PRIx32 " srcaddr: 0x%08" PRIx32 "", address, srcaddr);
 
-       if(address >= PIC32MX_KSEG1_PGM_FLASH)
+       if (address >= PIC32MX_KSEG1_PGM_FLASH)
                target_write_u32(target, PIC32MX_NVMADDR,    KS1Virt2Phys(address));
        else
                target_write_u32(target, PIC32MX_NVMADDR,    KS0Virt2Phys(address));
-       if(srcaddr >= PIC32MX_KSEG1_RAM)
+       if (srcaddr >= PIC32MX_KSEG1_RAM)
                target_write_u32(target, PIC32MX_NVMSRCADDR, KS1Virt2Phys(srcaddr));
        else
                target_write_u32(target, PIC32MX_NVMSRCADDR, KS0Virt2Phys(srcaddr));
@@ -564,9 +564,9 @@ static int pic32mx_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t of
                memcpy(&value, buffer + bytes_written, sizeof(uint32_t));
 
                status = pic32mx_write_word(bank, address, value);
-               if( status & NVMCON_NVMERR )
+               if ( status & NVMCON_NVMERR )
                        return ERROR_FLASH_OPERATION_FAILED;
-               if( status & NVMCON_LVDERR )
+               if ( status & NVMCON_LVDERR )
                        return ERROR_FLASH_OPERATION_FAILED;
 
                bytes_written += 4;
@@ -580,9 +580,9 @@ static int pic32mx_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t of
                memcpy(&value, buffer + bytes_written, bytes_remaining);
 
                status = pic32mx_write_word(bank, address, value);
-               if( status & NVMCON_NVMERR )
+               if ( status & NVMCON_NVMERR )
                        return ERROR_FLASH_OPERATION_FAILED;
-               if( status & NVMCON_LVDERR )
+               if ( status & NVMCON_LVDERR )
                        return ERROR_FLASH_OPERATION_FAILED;
        }
 
@@ -609,23 +609,23 @@ static int pic32mx_probe(struct flash_bank_s *bank)
                          (unsigned)((device_id>>12)&0xff), 
                          (unsigned)((device_id>>20)&0xfff) );
 
-       if(((device_id>>1)&0x7ff) != PIC32MX_MANUF_ID) {
+       if (((device_id>>1)&0x7ff) != PIC32MX_MANUF_ID) {
                LOG_WARNING( "Cannot identify target as a PIC32MX family." );
                return ERROR_FLASH_OPERATION_FAILED;
        }
 
        page_size = 4096;
-       if(bank->base == PIC32MX_KSEG1_BOOT_FLASH || bank->base == 1) {
+       if (bank->base == PIC32MX_KSEG1_BOOT_FLASH || bank->base == 1) {
                /* 0xBFC00000: Boot flash size fixed at 12k */
                num_pages = 12;
        } else {
                /* 0xBD000000: Program flash size varies with device */
                for(i=0; pic32mx_devs[i].name != NULL; i++)
-                       if(pic32mx_devs[i].devid == ((device_id >> 12) & 0xff)) {
+                       if (pic32mx_devs[i].devid == ((device_id >> 12) & 0xff)) {
                                num_pages = pic32mx_devs[i].pfm_size;
                                break;
                        }
-               if(pic32mx_devs[i].name == NULL) {
+               if (pic32mx_devs[i].name == NULL) {
                        LOG_WARNING( "Cannot identify target as a PIC32MX family." );
                        return ERROR_FLASH_OPERATION_FAILED;
                }
@@ -651,8 +651,8 @@ static int pic32mx_probe(struct flash_bank_s *bank)
        /* calculate numbers of pages */
        num_pages /= (page_size / 1024);
 
-       if(bank->base == 0) bank->base = PIC32MX_KSEG1_PGM_FLASH;
-       if(bank->base == 1) bank->base = PIC32MX_KSEG1_BOOT_FLASH;
+       if (bank->base == 0) bank->base = PIC32MX_KSEG1_PGM_FLASH;
+       if (bank->base == 1) bank->base = PIC32MX_KSEG1_BOOT_FLASH;
        bank->size = (num_pages * page_size);
        bank->num_sectors = num_pages;
        bank->chip_width = 4;
@@ -697,7 +697,7 @@ static int pic32mx_info(struct flash_bank_s *bank, char *buf, int buf_size)
 
        device_id = ejtag_info->idcode;
 
-       if(((device_id>>1)&0x7ff) != PIC32MX_MANUF_ID) {
+       if (((device_id>>1)&0x7ff) != PIC32MX_MANUF_ID) {
                snprintf(buf, buf_size, 
                                 "Cannot identify target as a PIC32MX family (manufacturer 0x%03d != 0x%03d)\n", 
                                 (unsigned)((device_id>>1)&0x7ff), 
@@ -705,11 +705,11 @@ static int pic32mx_info(struct flash_bank_s *bank, char *buf, int buf_size)
                return ERROR_FLASH_OPERATION_FAILED;
        }
        for(i=0; pic32mx_devs[i].name != NULL; i++)
-               if(pic32mx_devs[i].devid == ((device_id >> 12) & 0xff)) {
+               if (pic32mx_devs[i].devid == ((device_id >> 12) & 0xff)) {
                        printed = snprintf(buf, buf_size, "PIC32MX%s", pic32mx_devs[i].name);
                        break;
                }
-       if(pic32mx_devs[i].name == NULL) {
+       if (pic32mx_devs[i].name == NULL) {
                snprintf(buf, buf_size, "Cannot identify target as a PIC32MX family\n");
                return ERROR_FLASH_OPERATION_FAILED;
        }
@@ -847,13 +847,13 @@ static int pic32mx_chip_erase(struct flash_bank_s *bank)
 
        target_write_u32(target, PIC32MX_FLASH_CR, FLASH_LOCK);
 
-       if( status & FLASH_WRPRTERR )
+       if ( status & FLASH_WRPRTERR )
        {
                LOG_ERROR("pic32mx device protected");
                return ERROR_OK;
        }
 
-       if( status & FLASH_PGERR )
+       if ( status & FLASH_PGERR )
        {
                LOG_ERROR("pic32mx device programming failed");
                return ERROR_OK;
@@ -931,9 +931,9 @@ static int pic32mx_handle_pgm_word_command(struct command_context_s *cmd_ctx, ch
 
        res = ERROR_OK;
        status = pic32mx_write_word(bank, address, value);
-       if( status & NVMCON_NVMERR )
+       if ( status & NVMCON_NVMERR )
                res = ERROR_FLASH_OPERATION_FAILED;
-       if( status & NVMCON_LVDERR )
+       if ( status & NVMCON_LVDERR )
                res = ERROR_FLASH_OPERATION_FAILED;
 
        if (res == ERROR_OK)
index 7a77bb5..32f6433 100644 (file)
@@ -468,7 +468,7 @@ static int stellaris_read_part_info(struct flash_bank_s *bank)
                  did0, did1, stellaris_info->dc0, stellaris_info->dc1);
 
        ver = did0 >> 28;
-       if((ver != 0) && (ver != 1))
+       if ((ver != 0) && (ver != 1))
        {
                LOG_WARNING("Unknown did0 version, cannot identify target");
                return ERROR_FLASH_OPERATION_FAILED;
@@ -482,7 +482,7 @@ static int stellaris_read_part_info(struct flash_bank_s *bank)
 
        ver = did1 >> 28;
        fam = (did1 >> 24) & 0xF;
-       if(((ver != 0) && (ver != 1)) || (fam != 0))
+       if (((ver != 0) && (ver != 1)) || (fam != 0))
        {
                LOG_WARNING("Unknown did1 version/family, cannot positively identify target as a Stellaris");
        }
@@ -614,7 +614,7 @@ static int stellaris_erase(struct flash_bank_s *bank, int first, int last)
 
                /* Check acess violations */
                target_read_u32(target, FLASH_CRIS, &flash_cris);
-               if(flash_cris & (AMASK))
+               if (flash_cris & (AMASK))
                {
                        LOG_WARNING("Error erasing flash page %i,  flash_cris 0x%" PRIx32 "", banknr, flash_cris);
                        target_write_u32(target, FLASH_CRIS, 0);
@@ -691,7 +691,7 @@ static int stellaris_protect(struct flash_bank_s *bank, int set, int first, int
 
        /* Check acess violations */
        target_read_u32(target, FLASH_CRIS, &flash_cris);
-       if(flash_cris & (AMASK))
+       if (flash_cris & (AMASK))
        {
                LOG_WARNING("Error setting flash page protection,  flash_cris 0x%" PRIx32 "", flash_cris);
                target_write_u32(target, FLASH_CRIS, 0);
index a022b74..192ee26 100644 (file)
@@ -182,9 +182,9 @@ static int stm32x_erase_options(struct flash_bank_s *bank)
 
        status = stm32x_wait_status_busy(bank, 10);
 
-       if( status & FLASH_WRPRTERR )
+       if ( status & FLASH_WRPRTERR )
                return ERROR_FLASH_OPERATION_FAILED;
-       if( status & FLASH_PGERR )
+       if ( status & FLASH_PGERR )
                return ERROR_FLASH_OPERATION_FAILED;
 
        /* clear readout protection and complementary option bytes
@@ -218,9 +218,9 @@ static int stm32x_write_options(struct flash_bank_s *bank)
 
        status = stm32x_wait_status_busy(bank, 10);
 
-       if( status & FLASH_WRPRTERR )
+       if ( status & FLASH_WRPRTERR )
                return ERROR_FLASH_OPERATION_FAILED;
-       if( status & FLASH_PGERR )
+       if ( status & FLASH_PGERR )
                return ERROR_FLASH_OPERATION_FAILED;
 
        /* write protection byte 1 */
@@ -228,9 +228,9 @@ static int stm32x_write_options(struct flash_bank_s *bank)
 
        status = stm32x_wait_status_busy(bank, 10);
 
-       if( status & FLASH_WRPRTERR )
+       if ( status & FLASH_WRPRTERR )
                return ERROR_FLASH_OPERATION_FAILED;
-       if( status & FLASH_PGERR )
+       if ( status & FLASH_PGERR )
                return ERROR_FLASH_OPERATION_FAILED;
 
        /* write protection byte 2 */
@@ -238,9 +238,9 @@ static int stm32x_write_options(struct flash_bank_s *bank)
 
        status = stm32x_wait_status_busy(bank, 10);
 
-       if( status & FLASH_WRPRTERR )
+       if ( status & FLASH_WRPRTERR )
                return ERROR_FLASH_OPERATION_FAILED;
-       if( status & FLASH_PGERR )
+       if ( status & FLASH_PGERR )
                return ERROR_FLASH_OPERATION_FAILED;
 
        /* write protection byte 3 */
@@ -248,9 +248,9 @@ static int stm32x_write_options(struct flash_bank_s *bank)
 
        status = stm32x_wait_status_busy(bank, 10);
 
-       if( status & FLASH_WRPRTERR )
+       if ( status & FLASH_WRPRTERR )
                return ERROR_FLASH_OPERATION_FAILED;
-       if( status & FLASH_PGERR )
+       if ( status & FLASH_PGERR )
                return ERROR_FLASH_OPERATION_FAILED;
 
        /* write protection byte 4 */
@@ -258,9 +258,9 @@ static int stm32x_write_options(struct flash_bank_s *bank)
 
        status = stm32x_wait_status_busy(bank, 10);
 
-       if( status & FLASH_WRPRTERR )
+       if ( status & FLASH_WRPRTERR )
                return ERROR_FLASH_OPERATION_FAILED;
-       if( status & FLASH_PGERR )
+       if ( status & FLASH_PGERR )
                return ERROR_FLASH_OPERATION_FAILED;
 
        /* write readout protection bit */
@@ -268,9 +268,9 @@ static int stm32x_write_options(struct flash_bank_s *bank)
 
        status = stm32x_wait_status_busy(bank, 10);
 
-       if( status & FLASH_WRPRTERR )
+       if ( status & FLASH_WRPRTERR )
                return ERROR_FLASH_OPERATION_FAILED;
-       if( status & FLASH_PGERR )
+       if ( status & FLASH_PGERR )
                return ERROR_FLASH_OPERATION_FAILED;
 
        target_write_u32(target, STM32_FLASH_CR, FLASH_LOCK);
@@ -338,7 +338,7 @@ static int stm32x_protect_check(struct flash_bank_s *bank)
                {
                        set = 1;
 
-                       if( protection & (1 << i))
+                       if ( protection & (1 << i))
                                set = 0;
 
                        for (s = 0; s < stm32x_info->ppage_size; s++)
@@ -378,9 +378,9 @@ static int stm32x_erase(struct flash_bank_s *bank, int first, int last)
 
                status = stm32x_wait_status_busy(bank, 10);
 
-               if( status & FLASH_WRPRTERR )
+               if ( status & FLASH_WRPRTERR )
                        return ERROR_FLASH_OPERATION_FAILED;
-               if( status & FLASH_PGERR )
+               if ( status & FLASH_PGERR )
                        return ERROR_FLASH_OPERATION_FAILED;
                bank->sectors[i].is_erased = 1;
        }
@@ -445,7 +445,7 @@ static int stm32x_protect(struct flash_bank_s *bank, int set, int first, int las
                        reg = (i / stm32x_info->ppage_size) / 8;
                        bit = (i / stm32x_info->ppage_size) - (reg * 8);
 
-                       if( set )
+                       if ( set )
                                prot_reg[reg] &= ~(1 << bit);
                        else
                                prot_reg[reg] |= (1 << bit);
@@ -459,7 +459,7 @@ static int stm32x_protect(struct flash_bank_s *bank, int set, int first, int las
                        reg = (i / stm32x_info->ppage_size) / 8;
                        bit = (i / stm32x_info->ppage_size) - (reg * 8);
 
-                       if( set )
+                       if ( set )
                                prot_reg[reg] &= ~(1 << bit);
                        else
                                prot_reg[reg] |= (1 << bit);
@@ -658,12 +658,12 @@ static int stm32x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t off
 
                status = stm32x_wait_status_busy(bank, 5);
 
-               if( status & FLASH_WRPRTERR )
+               if ( status & FLASH_WRPRTERR )
                {
                        LOG_ERROR("flash memory not erased before writing");
                        return ERROR_FLASH_OPERATION_FAILED;
                }
-               if( status & FLASH_PGERR )
+               if ( status & FLASH_PGERR )
                {
                        LOG_ERROR("flash memory write protected");
                        return ERROR_FLASH_OPERATION_FAILED;
@@ -684,12 +684,12 @@ static int stm32x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t off
 
                status = stm32x_wait_status_busy(bank, 5);
 
-               if( status & FLASH_WRPRTERR )
+               if ( status & FLASH_WRPRTERR )
                {
                        LOG_ERROR("flash memory not erased before writing");
                        return ERROR_FLASH_OPERATION_FAILED;
                }
-               if( status & FLASH_PGERR )
+               if ( status & FLASH_PGERR )
                {
                        LOG_ERROR("flash memory write protected");
                        return ERROR_FLASH_OPERATION_FAILED;
@@ -1188,13 +1188,13 @@ static int stm32x_mass_erase(struct flash_bank_s *bank)
 
        target_write_u32(target, STM32_FLASH_CR, FLASH_LOCK);
 
-       if( status & FLASH_WRPRTERR )
+       if ( status & FLASH_WRPRTERR )
        {
                LOG_ERROR("stm32x device protected");
                return ERROR_OK;
        }
 
-       if( status & FLASH_PGERR )
+       if ( status & FLASH_PGERR )
        {
                LOG_ERROR("stm32x device programming failed");
                return ERROR_OK;
index 45d5ebf..587c145 100644 (file)
@@ -305,7 +305,7 @@ static int str9x_erase(struct flash_bank_s *bank, int first, int last)
                        {
                                return retval;
                        }
-                       if( status & 0x80 )
+                       if ( status & 0x80 )
                                break;
                        alive_sleep(1);
                }
@@ -327,7 +327,7 @@ static int str9x_erase(struct flash_bank_s *bank, int first, int last)
                        return retval;
                }
 
-               if( status & 0x22 )
+               if ( status & 0x22 )
                {
                        LOG_ERROR("error erasing flash bank, status: 0x%x", status);
                        return ERROR_FLASH_OPERATION_FAILED;
@@ -365,7 +365,7 @@ static int str9x_protect(struct flash_bank_s *bank,
                adr = bank->base + bank->sectors[i].offset;
 
                target_write_u16(target, adr, 0x60);
-               if( set )
+               if ( set )
                        target_write_u16(target, adr, 0x01);
                else
                        target_write_u16(target, adr, 0xD0);
@@ -578,7 +578,7 @@ static int str9x_write(struct flash_bank_s *bank,
                for (timeout=0; timeout<1000; timeout++)
                {
                        target_read_u8(target, bank_adr, &status);
-                       if( status & 0x80 )
+                       if ( status & 0x80 )
                                break;
                        alive_sleep(1);
                }
@@ -627,7 +627,7 @@ static int str9x_write(struct flash_bank_s *bank,
                for (timeout=0; timeout<1000; timeout++)
                {
                        target_read_u8(target, bank_adr, &status);
-                       if( status & 0x80 )
+                       if ( status & 0x80 )
                                break;
                        alive_sleep(1);
                }
index c735b6b..c614d76 100644 (file)
@@ -101,7 +101,7 @@ static int str9xpec_register_commands(struct command_context_s *cmd_ctx)
 
 int str9xpec_set_instr(jtag_tap_t *tap, uint32_t new_instr, tap_state_t end_state)
 {
-       if( tap == NULL ){
+       if ( tap == NULL ){
                return ERROR_TARGET_INVALID;
        }
 
@@ -575,7 +575,7 @@ static int str9xpec_protect(struct flash_bank_s *bank, int set, int first, int l
        /* last bank: 0xFF signals a full device protect */
        if (last == 0xFF)
        {
-               if( set )
+               if ( set )
                {
                        status = str9xpec_lock_device(bank);
                }
@@ -589,7 +589,7 @@ static int str9xpec_protect(struct flash_bank_s *bank, int set, int first, int l
        {
                for (i = first; i <= last; i++)
                {
-                       if( set )
+                       if ( set )
                                buf_set_u32(str9xpec_info->options, str9xpec_info->sector_bits[i], 1, 1);
                        else
                                buf_set_u32(str9xpec_info->options, str9xpec_info->sector_bits[i], 1, 0);
index bea480c..ec1d637 100644 (file)
@@ -348,7 +348,7 @@ int unregister_command(command_context_t *context, char *name)
 
 void command_output_text(command_context_t *context, const char *data)
 {
-       if( context && context->output_handler && data  ){
+       if ( context && context->output_handler && data  ){
                context->output_handler( context, data );
        }
 }
index 735c576..e40e019 100644 (file)
@@ -182,7 +182,7 @@ int fileio_read_u32(fileio_t *fileio, uint32_t *data)
 
 static inline int fileio_local_fgets(fileio_t *fileio, uint32_t size, char *buffer)
 {
-       if( fgets(buffer, size, fileio->file) == NULL)
+       if ( fgets(buffer, size, fileio->file) == NULL)
                return ERROR_FILEIO_OPERATION_FAILED;
        
        return ERROR_OK;
index 6e0fa4e..901cf2b 100644 (file)
@@ -340,19 +340,19 @@ void copyfile(char *name2, char *name1)
                        break;
                }
 
-        if( done == 0 ) break;
+        if ( done == 0 ) break;
 
                wrote = write(fd1, buf, done);
-        if( wrote != done ) SHOW_RESULT( write, wrote );
+        if ( wrote != done ) SHOW_RESULT( write, wrote );
 
-        if( wrote != done ) break;
+        if ( wrote != done ) break;
        }
 
        err = close(fd1);
-    if( err < 0 ) SHOW_RESULT( close, err );
+    if ( err < 0 ) SHOW_RESULT( close, err );
 
        err = close(fd2);
-    if( err < 0 ) SHOW_RESULT( close, err );
+    if ( err < 0 ) SHOW_RESULT( close, err );
 
 }
 
@@ -372,7 +372,7 @@ void copydir(char *name, char *destdir)
        }
 
        dirp = opendir(name);
-    if( dirp == NULL ) SHOW_RESULT( opendir, -1 );
+    if ( dirp == NULL ) SHOW_RESULT( opendir, -1 );
 
        for (;;)
        {
@@ -421,7 +421,7 @@ void copydir(char *name, char *destdir)
        }
 
        err = closedir(dirp);
-    if( err < 0 ) SHOW_RESULT( stat, err );
+    if ( err < 0 ) SHOW_RESULT( stat, err );
 }
 
 
index 6a795bb..d62346c 100644 (file)
@@ -544,7 +544,7 @@ void Jim_Panic(Jim_Interp *interp, const char *fmt, ...)
 #endif
        
        /* This may actually crash... we do it last */
-       if( interp && interp->cookie_stderr ){
+       if ( interp && interp->cookie_stderr ){
                Jim_fprintf(  interp, interp->cookie_stderr, JIM_NL "JIM INTERPRETER PANIC: ");
                Jim_vfprintf( interp, interp->cookie_stderr, fmt, ap );
                Jim_fprintf(  interp, interp->cookie_stderr, JIM_NL JIM_NL );
@@ -2064,7 +2064,7 @@ void Jim_AppendString_sprintf( Jim_Interp *interp, Jim_Obj *objPtr, const char *
        buf = jim_vasprintf( fmt, ap );
        va_end(ap);
 
-       if( buf ){
+       if ( buf ){
                Jim_AppendString( interp, objPtr, buf, -1 );
                jim_vasprintf_done(buf);
        }
@@ -2283,7 +2283,7 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
                haveprec = 0;
                prec = -1; /* not found yet */
     next_fmt:
-               if( fmtLen <= 0 ){
+               if ( fmtLen <= 0 ){
                        break;
                }
                switch( *fmt ){
@@ -2345,7 +2345,7 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
                                accum = (accum * 10) + (*fmt - '0');
                                fmt++;  fmtLen--;
                        }
-                       if( inprec ){
+                       if ( inprec ){
                                haveprec = 1;
                                prec = accum;
                        } else {
@@ -2356,24 +2356,24 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
                        /* suck up the next item as an integer */
                        fmt++;  fmtLen--;
                        objc--;
-                       if( objc <= 0 ){
+                       if ( objc <= 0 ){
                                goto not_enough_args;
                        }
-                       if( Jim_GetWide(interp,objv[0],&wideValue )== JIM_ERR ){
+                       if ( Jim_GetWide(interp,objv[0],&wideValue )== JIM_ERR ){
                                Jim_FreeNewObj(interp, resObjPtr );
                                return NULL;
                        }
-                       if( inprec ){
+                       if ( inprec ){
                                haveprec = 1;
                                prec = wideValue;
-                               if( prec < 0 ){
+                               if ( prec < 0 ){
                                        /* man 3 printf says */
                                        /* if prec is negative, it is zero */
                                        prec = 0;
                                }
                        } else {
                        width = wideValue;
-                       if( width < 0 ){
+                       if ( width < 0 ){
                                ljust = 1;
                                width = -width;
                        }
@@ -2402,32 +2402,32 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
                 */
                cp = fmt_str;
                *cp++ = '%';
-               if( altfm ){
+               if ( altfm ){
                        *cp++ = '#';
                }
-               if( forceplus ){
+               if ( forceplus ){
                        *cp++ = '+';
-               } else if( spad ){
+               } else if ( spad ){
                        /* PLUS overrides */
                        *cp++ = ' ';
                }
-               if( ljust ){
+               if ( ljust ){
                        *cp++ = '-';
                }
-               if( zpad  ){
+               if ( zpad  ){
                        *cp++ = '0';
                }
-               if( width > 0 ){
+               if ( width > 0 ){
                        sprintf( cp, "%d", width );
                        /* skip ahead */
                        cp = strchr(cp,0);
                }
                /* did we find a period? */
-               if( inprec ){
+               if ( inprec ){
                        /* then add it */
                        *cp++ = '.';
                        /* did something occur after the period? */
-                       if( haveprec ){
+                       if ( haveprec ){
                                sprintf( cp, "%d", prec );
                        }
                        cp = strchr(cp,0);
@@ -2461,7 +2461,7 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
                case 'E':
                        *cp++ = *fmt;
                        *cp   = 0;
-                       if( Jim_GetDouble( interp, objv[0], &doubleValue ) == JIM_ERR ){
+                       if ( Jim_GetDouble( interp, objv[0], &doubleValue ) == JIM_ERR ){
                                Jim_FreeNewObj( interp, resObjPtr );
                                return NULL;
                        }
@@ -2475,7 +2475,7 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
                case 'x':
                case 'X':
                        /* jim widevaluse are 64bit */
-                       if( sizeof(jim_wide) == sizeof(long long) ){
+                       if ( sizeof(jim_wide) == sizeof(long long) ){
                                *cp++ = 'l'; 
                                *cp++ = 'l';
                        } else {
@@ -2627,12 +2627,12 @@ int Jim_GetNvp(Jim_Interp *interp,
        int e;
 
        e = Jim_Nvp_name2value_obj( interp, nvp_table, objPtr, &n );
-       if( e == JIM_ERR ){
+       if ( e == JIM_ERR ){
                return e;
        }
 
        /* Success? found? */
-       if( n->name ){
+       if ( n->name ){
                /* remove const */
                *result = (Jim_Nvp *)n;
                return JIM_OK;
@@ -8104,17 +8104,17 @@ DIR *opendir(const char *name)
 {
     DIR *dir = 0;
 
-    if(name && name[0]) {
+    if (name && name[0]) {
         size_t base_length = strlen(name);
         const char *all = /* search pattern must end with suitable wildcard */
             strchr("/\\", name[base_length - 1]) ? "*" : "/*";
 
-        if((dir = (DIR *) Jim_Alloc(sizeof *dir)) != 0 &&
+        if ((dir = (DIR *) Jim_Alloc(sizeof *dir)) != 0 &&
            (dir->name = (char *) Jim_Alloc(base_length + strlen(all) + 1)) != 0)
         {
             strcat(strcpy(dir->name, name), all);
 
-            if((dir->handle = (long) _findfirst(dir->name, &dir->info)) != -1)
+            if ((dir->handle = (long) _findfirst(dir->name, &dir->info)) != -1)
                 dir->result.d_name = 0;
             else { /* rollback */
                 Jim_Free(dir->name);
@@ -8136,13 +8136,13 @@ int closedir(DIR *dir)
 {
     int result = -1;
 
-    if(dir) {
-        if(dir->handle != -1)
+    if (dir) {
+        if (dir->handle != -1)
             result = _findclose(dir->handle);
         Jim_Free(dir->name);
         Jim_Free(dir);
     }
-    if(result == -1) /* map all errors to EBADF */
+    if (result == -1) /* map all errors to EBADF */
         errno = EBADF;
     return result;
 }
@@ -8151,8 +8151,8 @@ struct dirent *readdir(DIR *dir)
 {
     struct dirent *result = 0;
 
-    if(dir && dir->handle != -1) {
-        if(!dir->result.d_name || _findnext(dir->handle, &dir->info) != -1) {
+    if (dir && dir->handle != -1) {
+        if (!dir->result.d_name || _findnext(dir->handle, &dir->info) != -1) {
             result         = &dir->result;
             result->d_name = dir->info.name;
         }
@@ -8894,7 +8894,7 @@ int Jim_Eval_Named(Jim_Interp *interp, const char *script, const char *filename,
     Jim_IncrRefCount(scriptObjPtr);
 
 
-       if( filename ){
+       if ( filename ){
                JimSetSourceInfo( interp, scriptObjPtr, filename, lineno );
        }
 
@@ -12412,7 +12412,7 @@ int Jim_fprintf( Jim_Interp *interp, void *cookie, const char *fmt, ... )
 
 int Jim_vfprintf( Jim_Interp *interp, void *cookie, const char *fmt, va_list ap )
 {
-       if( (interp == NULL) || (interp->cb_vfprintf == NULL) ){
+       if ( (interp == NULL) || (interp->cb_vfprintf == NULL) ){
                errno = ENOTSUP;
                return -1;
        }
@@ -12421,7 +12421,7 @@ int Jim_vfprintf( Jim_Interp *interp, void *cookie, const char *fmt, va_list ap
 
 size_t Jim_fwrite( Jim_Interp *interp, const void *ptr, size_t size, size_t n, void *cookie )
 {
-       if( (interp == NULL) || (interp->cb_fwrite == NULL) ){
+       if ( (interp == NULL) || (interp->cb_fwrite == NULL) ){
                errno = ENOTSUP;
                return 0;
        }
@@ -12430,7 +12430,7 @@ size_t Jim_fwrite( Jim_Interp *interp, const void *ptr, size_t size, size_t n, v
 
 size_t Jim_fread( Jim_Interp *interp, void *ptr, size_t size, size_t n, void *cookie )
 {
-       if( (interp == NULL) || (interp->cb_fread == NULL) ){
+       if ( (interp == NULL) || (interp->cb_fread == NULL) ){
                errno = ENOTSUP;
                return 0;
        }
@@ -12439,7 +12439,7 @@ size_t Jim_fread( Jim_Interp *interp, void *ptr, size_t size, size_t n, void *co
 
 int Jim_fflush( Jim_Interp *interp, void *cookie )
 {
-       if( (interp == NULL) || (interp->cb_fflush == NULL) ){
+       if ( (interp == NULL) || (interp->cb_fflush == NULL) ){
                /* pretend all is well */
                return 0;
        }
@@ -12448,7 +12448,7 @@ int Jim_fflush( Jim_Interp *interp, void *cookie )
 
 char* Jim_fgets( Jim_Interp *interp, char *s, int size, void *cookie )
 {
-       if( (interp == NULL) || (interp->cb_fgets == NULL) ){
+       if ( (interp == NULL) || (interp->cb_fgets == NULL) ){
                errno = ENOTSUP;
                return NULL;
        }
@@ -12458,7 +12458,7 @@ Jim_Nvp *
 Jim_Nvp_name2value_simple( const Jim_Nvp *p, const char *name )
 {
        while( p->name ){
-               if( 0 == strcmp( name, p->name ) ){
+               if ( 0 == strcmp( name, p->name ) ){
                        break;
                }
                p++;
@@ -12470,7 +12470,7 @@ Jim_Nvp *
 Jim_Nvp_name2value_nocase_simple( const Jim_Nvp *p, const char *name )
 {
        while( p->name ){
-               if( 0 == strcasecmp( name, p->name ) ){
+               if ( 0 == strcasecmp( name, p->name ) ){
                        break;
                }
                p++;
@@ -12499,12 +12499,12 @@ Jim_Nvp_name2value( Jim_Interp *interp,
        p = Jim_Nvp_name2value_simple( _p, name );
 
        /* result */
-       if( result ){
+       if ( result ){
                *result = (Jim_Nvp *)(p);
        }
        
        /* found? */
-       if( p->name ){
+       if ( p->name ){
                return JIM_OK;
        } else {
                return JIM_ERR;
@@ -12524,11 +12524,11 @@ Jim_Nvp_name2value_nocase( Jim_Interp *interp, const Jim_Nvp *_p, const char *na
 
        p = Jim_Nvp_name2value_nocase_simple( _p, name );
 
-       if( puthere ){
+       if ( puthere ){
                *puthere = (Jim_Nvp *)(p);
        }
        /* found */
-       if( p->name ){
+       if ( p->name ){
                return JIM_OK;
        } else {
                return JIM_ERR;
@@ -12543,7 +12543,7 @@ Jim_Nvp_value2name_obj( Jim_Interp *interp, const Jim_Nvp *p, Jim_Obj *o, Jim_Nv
        jim_wide w;
 
        e = Jim_GetWide( interp, o, &w );
-       if( e != JIM_OK ){
+       if ( e != JIM_OK ){
                return e;
        }
 
@@ -12554,7 +12554,7 @@ Jim_Nvp *
 Jim_Nvp_value2name_simple( const Jim_Nvp *p, int value )
 {
        while( p->name ){
-               if( value == p->value ){
+               if ( value == p->value ){
                        break;
                }
                p++;
@@ -12570,11 +12570,11 @@ Jim_Nvp_value2name( Jim_Interp *interp, const Jim_Nvp *_p, int value, Jim_Nvp **
 
        p = Jim_Nvp_value2name_simple( _p, value );
 
-       if( result ){
+       if ( result ){
                *result = (Jim_Nvp *)(p);
        }
 
-       if( p->name ){
+       if ( p->name ){
                return JIM_OK;
        } else {
                return JIM_ERR;
@@ -12615,16 +12615,16 @@ Jim_GetOpt_Obj( Jim_GetOptInfo *goi, Jim_Obj **puthere )
        Jim_Obj *o;
        
        o = NULL; // failure 
-       if( goi->argc ){
+       if ( goi->argc ){
                // success 
                o = goi->argv[0];
                goi->argc -= 1;
                goi->argv += 1;
        }
-       if( puthere ){
+       if ( puthere ){
                *puthere = o;
        }
-       if( o != NULL ){
+       if ( o != NULL ){
                return JIM_OK;
        } else {
                return JIM_ERR;
@@ -12640,9 +12640,9 @@ Jim_GetOpt_String( Jim_GetOptInfo *goi, char **puthere, int *len )
 
 
        r = Jim_GetOpt_Obj( goi, &o );
-       if( r == JIM_OK ){
+       if ( r == JIM_OK ){
                cp = Jim_GetString( o, len );
-               if( puthere ){
+               if ( puthere ){
                        /* remove const */
                        *puthere = (char *)(cp);
                }
@@ -12657,14 +12657,14 @@ Jim_GetOpt_Double( Jim_GetOptInfo *goi, double *puthere )
        Jim_Obj *o;
        double _safe;
        
-       if( puthere == NULL ){
+       if ( puthere == NULL ){
                puthere = &_safe;
        }
 
        r = Jim_GetOpt_Obj( goi, &o );
-       if( r == JIM_OK ){
+       if ( r == JIM_OK ){
                r = Jim_GetDouble( goi->interp, o, puthere );
-               if( r != JIM_OK ){
+               if ( r != JIM_OK ){
                        Jim_SetResult_sprintf( goi->interp,
                                                                   "not a number: %s", 
                                                                   Jim_GetString( o, NULL ) );
@@ -12680,12 +12680,12 @@ Jim_GetOpt_Wide( Jim_GetOptInfo *goi, jim_wide *puthere )
        Jim_Obj *o;
        jim_wide _safe;
 
-       if( puthere == NULL ){
+       if ( puthere == NULL ){
                puthere = &_safe;
        }
 
        r = Jim_GetOpt_Obj( goi, &o );
-       if( r == JIM_OK ){
+       if ( r == JIM_OK ){
                r = Jim_GetWide( goi->interp, o, puthere );
        }
        return r;
@@ -12699,12 +12699,12 @@ int Jim_GetOpt_Nvp( Jim_GetOptInfo *goi,
        Jim_Obj *o;
        int e;
 
-       if( puthere == NULL ){
+       if ( puthere == NULL ){
                puthere = &_safe;
        }
 
        e = Jim_GetOpt_Obj( goi, &o );
-       if( e == JIM_OK ){
+       if ( e == JIM_OK ){
                e = Jim_Nvp_name2value_obj( goi->interp,
                                                                        nvp, 
                                                                        o,
@@ -12719,7 +12719,7 @@ Jim_GetOpt_NvpUnknown( Jim_GetOptInfo *goi,
                                           const Jim_Nvp *nvptable,
                                           int hadprefix )
 {
-       if( hadprefix ){
+       if ( hadprefix ){
                Jim_SetResult_NvpUnknown( goi->interp,
                                                                  goi->argv[-2],
                                                                  goi->argv[-1],
@@ -12742,11 +12742,11 @@ Jim_GetOpt_Enum( Jim_GetOptInfo *goi,
        Jim_Obj *o;
        int e;
 
-       if( puthere == NULL ){
+       if ( puthere == NULL ){
                puthere = &_safe;
        }
        e = Jim_GetOpt_Obj( goi, &o );
-       if( e == JIM_OK ){
+       if ( e == JIM_OK ){
                e = Jim_GetEnum( goi->interp,
                                                 o,
                                                 lookup,
@@ -12768,7 +12768,7 @@ Jim_SetResult_sprintf( Jim_Interp *interp, const char *fmt,... )
        va_start(ap,fmt);
        buf = jim_vasprintf( fmt, ap );
        va_end(ap);
-       if( buf ){
+       if ( buf ){
                Jim_SetResultString( interp, buf, -1 );
                jim_vasprintf_done(buf);
        }
@@ -12782,7 +12782,7 @@ Jim_SetResult_NvpUnknown( Jim_Interp *interp,
                                                  Jim_Obj *param_value,
                                                  const Jim_Nvp *nvp )
 {
-       if( param_name ){
+       if ( param_name ){
                Jim_SetResult_sprintf( interp,
                                                           "%s: Unknown: %s, try one of: ",
                                                           Jim_GetString( param_name, NULL ),
@@ -12796,7 +12796,7 @@ Jim_SetResult_NvpUnknown( Jim_Interp *interp,
                const char *a;
                const char *b;
 
-               if( (nvp+1)->name ){
+               if ( (nvp+1)->name ){
                        a = nvp->name;
                        b = ", ";
                } else {
@@ -12818,7 +12818,7 @@ Jim_Debug_ArgvString( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
 {
        int x;
 
-       if( debug_string_obj ){
+       if ( debug_string_obj ){
                Jim_FreeObj( interp, debug_string_obj );
        }
 
index f8c189a..0b7f45b 100644 (file)
@@ -987,7 +987,7 @@ typedef struct jim_getopt {
  *
  *   while( goi.argc ){
  *         e = Jim_GetOpt_Nvp( &goi, nvp_options, &n );
- *         if( e != JIM_OK ){
+ *         if ( e != JIM_OK ){
  *               Jim_GetOpt_NvpUnknown( &goi, nvp_options, 0 );
  *               return e;
  *         }
@@ -997,7 +997,7 @@ typedef struct jim_getopt {
  *             printf("Option ALIVE specified\n");
  *             break;
  *         case FIRST:
- *             if( goi.argc < 1 ){
+ *             if ( goi.argc < 1 ){
  *                     .. not enough args error ..
  *             }
  *             Jim_GetOpt_String( &goi, &cp, NULL );
@@ -1008,7 +1008,7 @@ typedef struct jim_getopt {
  *             break;
  *         case POLITICS:
  *             e = Jim_GetOpt_Nvp( &goi, nvp_politics, &n );
- *             if( e != JIM_OK ){
+ *             if ( e != JIM_OK ){
  *                 Jim_GetOpt_NvpUnknown( &goi, nvp_politics, 1 );
  *                 return e;
  *             }
@@ -1105,7 +1105,7 @@ JIM_STATIC int JIM_API( Jim_GetOpt_Nvp)( Jim_GetOptInfo *goi, const Jim_Nvp *loo
  *  while( goi.argc ){
  *     // Get the next option 
  *     e = Jim_GetOpt_Nvp( &goi, cmd_options, &n );
- *     if( e != JIM_OK ){
+ *     if ( e != JIM_OK ){
  *          // option was not recognized
  *          // pass 'hadprefix=0' because there is no prefix
  *          Jim_GetOpt_NvpUnknown( &goi, cmd_options, 0 );
@@ -1116,7 +1116,7 @@ JIM_STATIC int JIM_API( Jim_GetOpt_Nvp)( Jim_GetOptInfo *goi, const Jim_Nvp *loo
  *     case OPT_SEX:
  *          // handle:  --sex male|female|lots|needmore
  *          e = Jim_GetOpt_Nvp( &goi, &nvp_sex, &n );
- *          if( e != JIM_OK ){
+ *          if ( e != JIM_OK ){
  *               Jim_GetOpt_NvpUnknown( &ogi, nvp_sex, 1 );
  *               return e;
  *          }
index 3acca9a..ac494da 100644 (file)
@@ -109,7 +109,7 @@ static void log_puts(enum log_levels level, const char *file, int line, const ch
 #endif
                                        string);
                }
-               else if(server_use_pipes == 0)
+               else if (server_use_pipes == 0)
                {
                        /* if we are using gdb through pipes then we do not want any output
                         * to the pipe otherwise we get repeated strings */
index 8242a8d..c48939e 100644 (file)
@@ -91,7 +91,7 @@ int add_default_dirs(void)
                *strrchr(strExePath, '\\')=0;
                strcat(strExePath, "/../lib/"PACKAGE);
                for(p=strExePath; *p; p++) {
-                       if(*p == '\\')
+                       if (*p == '\\')
                                *p = '/';
                }
                add_script_search_dir(strExePath);
index 202bb39..0cc3065 100644 (file)
@@ -220,7 +220,7 @@ static int armjtagew_speed(int speed)
        usb_out_buffer[0] = CMD_GET_TCK_FREQUENCY;
     result = armjtagew_usb_message(armjtagew_jtag_handle, 1, 4);
        speed_real = (int)buf_get_u32(usb_in_buffer,0,32);
-       if(result < 0)
+       if (result < 0)
        {
         LOG_ERROR("ARM-JTAG-EW getting speed failed (%d)", result);
         return ERROR_JTAG_DEVICE_ERROR;
@@ -672,7 +672,7 @@ static int armjtagew_tap_execute(void)
                        int stat;
 
                        stat = (int)buf_get_u32(usb_in_buffer + byte_length, 0, 32);
-                       if(stat) {
+                       if (stat) {
                                LOG_ERROR("armjtagew_tap_execute, emulator returned error code %d for a CMD_TAP_SHIFT command", stat);
                                return ERROR_JTAG_QUEUE_FAILED;
                        }
index 0acfc6f..f39859a 100644 (file)
@@ -247,7 +247,7 @@ int bitbang_execute_queue(void)
         */
        retval = ERROR_OK;
 
-       if(bitbang_interface->blink)
+       if (bitbang_interface->blink)
                bitbang_interface->blink(1);
 
        while (cmd)
@@ -318,7 +318,7 @@ int bitbang_execute_queue(void)
                }
                cmd = cmd->next;
        }
-       if(bitbang_interface->blink)
+       if (bitbang_interface->blink)
                bitbang_interface->blink(0);
 
        return retval;
index 5bf7295..ad3fb72 100644 (file)
@@ -510,11 +510,11 @@ int jtag_add_statemove(tap_state_t goal_state)
 
        if (goal_state==cur_state )
                ;       /* nothing to do */
-       else if( goal_state==TAP_RESET )
+       else if ( goal_state==TAP_RESET )
        {
                jtag_add_tlr();
        }
-       else if( tap_is_state_stable(cur_state) && tap_is_state_stable(goal_state) )
+       else if ( tap_is_state_stable(cur_state) && tap_is_state_stable(goal_state) )
        {
                unsigned tms_bits  = tap_get_tms_path(cur_state, goal_state);
                unsigned tms_count = tap_get_tms_path_len(cur_state, goal_state);
@@ -531,7 +531,7 @@ int jtag_add_statemove(tap_state_t goal_state)
 
                jtag_add_pathmove(tms_count, moves);
        }
-       else if( tap_state_transition(cur_state, true)  == goal_state
+       else if ( tap_state_transition(cur_state, true)  == goal_state
                ||   tap_state_transition(cur_state, false) == goal_state )
        {
                jtag_add_pathmove(1, &goal_state);
@@ -1026,7 +1026,7 @@ int jtag_validate_chain(void)
        total_ir_length = 0;
        for(;;){
                tap = jtag_tap_next_enabled(tap);
-               if( tap == NULL ){
+               if ( tap == NULL ){
                        break;
                }
                total_ir_length += tap->ir_length;
@@ -1050,7 +1050,7 @@ int jtag_validate_chain(void)
        int val;
        for(;;){
                tap = jtag_tap_next_enabled(tap);
-               if( tap == NULL ){
+               if ( tap == NULL ){
                        break;
                }
 
@@ -1130,7 +1130,7 @@ int jtag_interface_init(struct command_context_s *cmd_ctx)
                LOG_ERROR("JTAG interface has to be specified, see \"interface\" command");
                return ERROR_JTAG_INVALID_INTERFACE;
        }
-       if(hasKHz)
+       if (hasKHz)
        {
                jtag_interface->khz(jtag_get_speed_khz(), &jtag_speed);
                hasKHz = false;
@@ -1151,7 +1151,7 @@ static int jtag_init_inner(struct command_context_s *cmd_ctx)
        LOG_DEBUG("Init JTAG chain");
 
        tap = jtag_tap_next_enabled(NULL);
-       if( tap == NULL ){
+       if ( tap == NULL ){
                LOG_ERROR("There are no enabled taps?");
                return ERROR_JTAG_INIT_FAILED;
        }
index e055f63..6d738ee 100644 (file)
@@ -85,16 +85,16 @@ static int dummy_read(void)
 static void dummy_write(int tck, int tms, int tdi)
 {
        /* TAP standard: "state transitions occur on rising edge of clock" */
-       if( tck != dummy_clock )
+       if ( tck != dummy_clock )
        {
-               if( tck )
+               if ( tck )
                {
                        tap_state_t old_state = dummy_state;
                        dummy_state = tap_state_transition( old_state, tms );
 
-                       if( old_state != dummy_state )
+                       if ( old_state != dummy_state )
                        {
-                               if( clock_count )
+                               if ( clock_count )
                                {
                                        LOG_DEBUG("dummy_tap: %d stable clocks", clock_count);
                                        clock_count = 0;
@@ -103,7 +103,7 @@ static void dummy_write(int tck, int tms, int tdi)
                                LOG_DEBUG("dummy_tap: %s", tap_state_name(dummy_state) );
 
 #if defined(DEBUG)
-                               if(dummy_state == TAP_DRCAPTURE)
+                               if (dummy_state == TAP_DRCAPTURE)
                                        dummy_data = 0x01255043;
 #endif
                        }
index 14c626e..9e8c4e4 100644 (file)
@@ -361,7 +361,7 @@ tap_state_t tap_state_by_name(const char *name)
 
        for( x = 0 ; x < TAP_NUM_STATES ; x++ ){
                /* be nice to the human */
-               if( 0 == strcasecmp( name, tap_state_name(x) ) ){
+               if ( 0 == strcasecmp( name, tap_state_name(x) ) ){
                        return x;
                }
        }
index 9817038..5ded30b 100644 (file)
@@ -121,7 +121,7 @@ ep1_generic_commandl(
        va_list         ap;
        int             usb_ret;
 
-       if(length > sizeof(usb_buffer)) {
+       if (length > sizeof(usb_buffer)) {
                length = sizeof(usb_buffer);
        }
 
@@ -176,7 +176,7 @@ ep1_memory_read(
        count = 0;
 
        while(remain) {
-               if(remain > sizeof(usb_buffer)) {
+               if (remain > sizeof(usb_buffer)) {
                        length = sizeof(usb_buffer);
                } else {
                        length = remain;
@@ -192,7 +192,7 @@ ep1_memory_read(
                        USB_TIMEOUT_MS
                );
 
-               if(usb_ret < sizeof(usb_buffer)) {
+               if (usb_ret < sizeof(usb_buffer)) {
                        break;
                }
 
@@ -202,7 +202,7 @@ ep1_memory_read(
                        USB_TIMEOUT_MS
                );
 
-               if(usb_ret < length) {
+               if (usb_ret < length) {
                        break;
                }
 
@@ -237,7 +237,7 @@ ep1_memory_write(
        count = 0;
 
        while(remain) {
-               if(remain > (sizeof(usb_buffer) - 4)) {
+               if (remain > (sizeof(usb_buffer) - 4)) {
                        length = (sizeof(usb_buffer) - 4);
                } else {
                        length = remain;
@@ -263,7 +263,7 @@ ep1_memory_write(
                        USB_TIMEOUT_MS
                );
 
-               if((size_t)usb_ret < sizeof(usb_buffer)) {
+               if ((size_t)usb_ret < sizeof(usb_buffer)) {
                        break;
                }
 
@@ -291,7 +291,7 @@ ep1_memory_writel(
        va_list         ap;
        size_t          remain;
 
-       if(length > sizeof(buffer)) {
+       if (length > sizeof(buffer)) {
                length = sizeof(buffer);
        }
 
@@ -346,10 +346,10 @@ dtc_load_from_buffer(
                pHDev, 1,
                EP1_CMD_DTC_STOP
        );
-       if(usb_err < 0) return(usb_err);
+       if (usb_err < 0) return(usb_err);
 
        while(length) {
-               if(length < sizeof(*header)) {
+               if (length < sizeof(*header)) {
                        LOG_ERROR("Malformed DTC image\n");
                        exit(1);
                }
@@ -358,7 +358,7 @@ dtc_load_from_buffer(
                buffer += sizeof(*header);
                length -= sizeof(*header);
 
-               if(length < (size_t)header->length + 1) {
+               if (length < (size_t)header->length + 1) {
                        LOG_ERROR("Malformed DTC image\n");
                        exit(1);
                }
@@ -369,7 +369,7 @@ dtc_load_from_buffer(
 
                        case DTCLOAD_ENTRY:
                                /* store entry addresses somewhere */
-                               if(!strncmp("download", (char *)buffer + 1, 8)) {
+                               if (!strncmp("download", (char *)buffer + 1, 8)) {
                                        dtc_entry_download = buffer[0];
                                }
                                break;
@@ -381,7 +381,7 @@ dtc_load_from_buffer(
                                        DTC_LOAD_BUFFER,
                                        header->length + 1, buffer
                                );
-                               if(usb_err < 0) return(usb_err);
+                               if (usb_err < 0) return(usb_err);
 
                                /* Load it into the DTC. */
                                usb_err = ep1_generic_commandl(
@@ -390,7 +390,7 @@ dtc_load_from_buffer(
                                                (DTC_LOAD_BUFFER >> 8),
                                                DTC_LOAD_BUFFER
                                );
-                               if(usb_err < 0) return(usb_err);
+                               if (usb_err < 0) return(usb_err);
 
                                break;
 
@@ -401,7 +401,7 @@ dtc_load_from_buffer(
                                                buffer[0],
                                        EP1_CMD_DTC_WAIT
                                );
-                               if(usb_err < 0) return(usb_err);
+                               if (usb_err < 0) return(usb_err);
 
                                break;
 
@@ -415,7 +415,7 @@ dtc_load_from_buffer(
                                        ST7_USB_BUF_EP0OUT + lut_start,
                                        header->length + 1, buffer
                                );
-                               if(usb_err < 0) return(usb_err);
+                               if (usb_err < 0) return(usb_err);
                                break;
 
                        default:
@@ -453,7 +453,7 @@ dtc_start_download(void) {
                        ST7_EP2TXR,
                        1
        );
-       if(usb_err < 0) return(usb_err);
+       if (usb_err < 0) return(usb_err);
 
        /* read back ep2txr */
        usb_err = usb_bulk_read(
@@ -461,7 +461,7 @@ dtc_start_download(void) {
                (char *)&ep2txr, 1,
                USB_TIMEOUT_MS
        );
-       if(usb_err < 0) return(usb_err);
+       if (usb_err < 0) return(usb_err);
 
        usb_err = ep1_generic_commandl(
                pHDev, 13,
@@ -480,7 +480,7 @@ dtc_start_download(void) {
                        dtc_entry_download,
                EP1_CMD_DTC_GET_CACHED_STATUS
        );
-       if(usb_err < 0) return(usb_err);
+       if (usb_err < 0) return(usb_err);
 
        /* wait for completion */
        usb_err = usb_bulk_read(
@@ -514,7 +514,7 @@ dtc_run_download(
                (char *)command_buffer, USB_EP2BANK_SIZE,
                USB_TIMEOUT_MS
        );
-       if(usb_err < 0) return(usb_err);
+       if (usb_err < 0) return(usb_err);
 
 
        /* Wait for DTC to finish running command buffer */
@@ -527,7 +527,7 @@ dtc_run_download(
                                DTC_STATUS_POLL_BYTE,
                                1
                );
-               if(usb_err < 0) return(usb_err);
+               if (usb_err < 0) return(usb_err);
 
                usb_err = usb_bulk_read(
                        pHDev,
@@ -535,11 +535,11 @@ dtc_run_download(
                        (char *)ep2_buffer, 1,
                        USB_TIMEOUT_MS
                );
-               if(usb_err < 0) return(usb_err);
+               if (usb_err < 0) return(usb_err);
 
-               if(ep2_buffer[0] & 0x01) break;
+               if (ep2_buffer[0] & 0x01) break;
 
-               if(!--i) {
+               if (!--i) {
                        LOG_ERROR("%s, %d: too many retries waiting for DTC status\n",
                                __FILE__, __LINE__
                        );
@@ -548,8 +548,8 @@ dtc_run_download(
        }
 
 
-       if(!reply_buffer) reply_buffer_size = 0;
-       if(reply_buffer_size) {
+       if (!reply_buffer) reply_buffer_size = 0;
+       if (reply_buffer_size) {
                usb_err = usb_bulk_read(
                        pHDev,
                        USB_EP2IN_ADDR,
@@ -557,7 +557,7 @@ dtc_run_download(
                        USB_TIMEOUT_MS
                );
 
-               if(usb_err < (int)sizeof(ep2_buffer)) {
+               if (usb_err < (int)sizeof(ep2_buffer)) {
                        LOG_ERROR("%s, %d: Read of endpoint 2 returned %d\n",
                                __FILE__, __LINE__, usb_err
                        );
@@ -643,7 +643,7 @@ dtc_queue_enqueue_reply(
        dtc_reply_queue_entry_t *rq_entry;
 
        rq_entry = malloc(sizeof(dtc_reply_queue_entry_t));
-       if(rq_entry != NULL) {
+       if (rq_entry != NULL) {
                rq_entry->scan.type = type;
                rq_entry->scan.buffer = buffer;
                rq_entry->scan.size = size;
@@ -652,7 +652,7 @@ dtc_queue_enqueue_reply(
                rq_entry->cmd = cmd;
                rq_entry->next = NULL;
 
-               if(dtc_queue.rq_head == NULL)
+               if (dtc_queue.rq_head == NULL)
                        dtc_queue.rq_head = rq_entry;
                else
                        dtc_queue.rq_tail->next = rq_entry;
@@ -683,17 +683,17 @@ dtc_queue_run(void) {
 
        retval = ERROR_OK;
 
-       if(dtc_queue.cmd_index < 1) return(retval);
+       if (dtc_queue.cmd_index < 1) return(retval);
 
        dtc_queue.cmd_buffer[dtc_queue.cmd_index++] = DTC_CMD_STOP;
 
        /* run the cmd */
-       if(dtc_queue.rq_head == NULL) {
+       if (dtc_queue.rq_head == NULL) {
                usb_err = dtc_run_download(pHDev,
                        dtc_queue.cmd_buffer, dtc_queue.cmd_index,
                        NULL, 0
                );
-               if(usb_err < 0) {
+               if (usb_err < 0) {
                        LOG_ERROR("dtc_run_download: %s\n", usb_strerror());
                        exit(1);
                }
@@ -702,7 +702,7 @@ dtc_queue_run(void) {
                        dtc_queue.cmd_buffer, dtc_queue.cmd_index,
                        reply_buffer, dtc_queue.reply_index
                );
-               if(usb_err < 0) {
+               if (usb_err < 0) {
                        LOG_ERROR("dtc_run_download: %s\n", usb_strerror());
                        exit(1);
                } else {
@@ -721,7 +721,7 @@ dtc_queue_run(void) {
 
 
                                bit_cnt = rq_p->scan.length;
-                               if(bit_cnt >= 8) {
+                               if (bit_cnt >= 8) {
                                        /* bytes */
 
                                        dtc_mask = 1 << (8 - 1);
@@ -731,20 +731,20 @@ dtc_queue_run(void) {
                                                bit_cnt;
                                                bit_cnt--
                                        ) {
-                                               if(*dtc_p & dtc_mask) {
+                                               if (*dtc_p & dtc_mask) {
                                                        *tdo_p |= tdo_mask;
                                                } else {
                                                        *tdo_p &=~ tdo_mask;
                                                }
 
                                                dtc_mask >>= 1;
-                                               if(dtc_mask == 0) {
+                                               if (dtc_mask == 0) {
                                                        dtc_p++;
                                                        dtc_mask = 1 << (8 - 1);
                                                }
 
                                                tdo_mask <<= 1;
-                                               if(tdo_mask == 0) {
+                                               if (tdo_mask == 0) {
                                                        tdo_p++;
                                                        tdo_mask = 1;
                                                }
@@ -753,7 +753,7 @@ dtc_queue_run(void) {
                                        /*  extra bits or last bit */
 
                                        x = *dtc_p++;
-                                       if((
+                                       if ((
                                                rq_p->scan.type == SCAN_IN
                                        ) && (
                                                rq_p->scan.offset != rq_p->scan.size - 1
@@ -769,7 +769,7 @@ dtc_queue_run(void) {
                                                bit_cnt;
                                                bit_cnt--
                                        ) {
-                                               if(x & dtc_mask) {
+                                               if (x & dtc_mask) {
                                                        *tdo_p |= tdo_mask;
                                                } else {
                                                        *tdo_p &=~ tdo_mask;
@@ -778,7 +778,7 @@ dtc_queue_run(void) {
                                                dtc_mask >>= 1;
 
                                                tdo_mask <<= 1;
-                                               if(tdo_mask == 0) {
+                                               if (tdo_mask == 0) {
                                                        tdo_p++;
                                                        tdo_mask = 1;
                                                }
@@ -786,9 +786,9 @@ dtc_queue_run(void) {
                                        }
                                }
 
-                               if((rq_p->scan.offset + rq_p->scan.length) >= rq_p->scan.size) {
+                               if ((rq_p->scan.offset + rq_p->scan.length) >= rq_p->scan.size) {
                                        /* feed scan buffer back into openocd and free it */
-                                       if(jtag_read_buffer(rq_p->scan.buffer, rq_p->cmd->cmd.scan) != ERROR_OK) {
+                                       if (jtag_read_buffer(rq_p->scan.buffer, rq_p->cmd->cmd.scan) != ERROR_OK) {
                                                 retval = ERROR_JTAG_QUEUE_FAILED;
                                        }
                                        free(rq_p->scan.buffer);
@@ -831,27 +831,27 @@ tap_state_queue_run(void) {
        int     retval;
 
        retval = 0;
-       if(!tap_state_queue.length) return(retval);
+       if (!tap_state_queue.length) return(retval);
        bits = 1;
        byte = 0;
        for(i = tap_state_queue.length; i--;) {
 
                byte <<= 1;
-               if(tap_state_queue.buffer & 1) {
+               if (tap_state_queue.buffer & 1) {
                        byte |= 1;
                }
-               if((bits >= 8) || !i) {
+               if ((bits >= 8) || !i) {
                        byte <<= (8 - bits);
 
                        /* make sure there's room for stop, byte op, and one byte */
-                       if(dtc_queue.cmd_index >= (sizeof(dtc_queue.cmd_buffer) - (1 + 1 + 1))) {
+                       if (dtc_queue.cmd_index >= (sizeof(dtc_queue.cmd_buffer) - (1 + 1 + 1))) {
                                dtc_queue.cmd_buffer[dtc_queue.cmd_index++] =
                                        DTC_CMD_STOP;
                                dtc_queue_run();
                        }
 
 #ifdef USE_HARDWARE_SHIFTER_FOR_TMS
-                       if(bits == 8) {
+                       if (bits == 8) {
                                dtc_queue.cmd_buffer[dtc_queue.cmd_index++] =
                                        DTC_CMD_SHIFT_TMS_BYTES(1);
                        } else {
@@ -885,12 +885,12 @@ tap_state_queue_append(
 ) {
        int     retval;
 
-       if(tap_state_queue.length >= sizeof(tap_state_queue.buffer) * 8) {
+       if (tap_state_queue.length >= sizeof(tap_state_queue.buffer) * 8) {
                retval = tap_state_queue_run();
-               if(retval != 0) return(retval);
+               if (retval != 0) return(retval);
        }
 
-       if(tms) {
+       if (tms) {
                tap_state_queue.buffer |= (1 << tap_state_queue.length);
        }
        tap_state_queue.length++;
@@ -1005,7 +1005,7 @@ void rlink_reset(int trst, int srst)
                        ST7_PADR,
                        1
        );
-       if(usb_err < 0) {
+       if (usb_err < 0) {
                LOG_ERROR("%s", usb_strerror());
                exit(1);
        }
@@ -1015,12 +1015,12 @@ void rlink_reset(int trst, int srst)
                (char *)&bitmap, 1,
                USB_TIMEOUT_MS
        );
-       if(usb_err < 1) {
+       if (usb_err < 1) {
                LOG_ERROR("%s", usb_strerror());
                exit(1);
        }
 
-       if(trst) {
+       if (trst) {
                bitmap &= ~ST7_PA_NTRST;
        } else {
                bitmap |= ST7_PA_NTRST;
@@ -1040,7 +1040,7 @@ void rlink_reset(int trst, int srst)
                        ST7_PBDDR,
                        1
        );
-       if(usb_err < 0) {
+       if (usb_err < 0) {
                LOG_ERROR("%s", usb_strerror());
                exit(1);
        }
@@ -1050,12 +1050,12 @@ void rlink_reset(int trst, int srst)
                (char *)&bitmap, 1,
                USB_TIMEOUT_MS
        );
-       if(usb_err < 1) {
+       if (usb_err < 1) {
                LOG_ERROR("%s", usb_strerror());
                exit(1);
        }
 
-       if(srst) {
+       if (srst) {
                bitmap |= ST7_PB_NSRST;
        } else {
                bitmap &= ~ST7_PB_NSRST;
@@ -1071,7 +1071,7 @@ void rlink_reset(int trst, int srst)
                        bitmap,
                EP1_CMD_DTC_GET_CACHED_STATUS
        );
-       if(usb_err < 0) {
+       if (usb_err < 0) {
                LOG_ERROR("%s", usb_strerror());
                exit(1);
        }
@@ -1081,7 +1081,7 @@ void rlink_reset(int trst, int srst)
                (char *)&bitmap, 1,
                USB_TIMEOUT_MS
        );
-       if(usb_err < 1) {
+       if (usb_err < 1) {
                LOG_ERROR("%s", usb_strerror());
                exit(1);
        }
@@ -1108,7 +1108,7 @@ rlink_scan(
        uint8_t                 tdi_mask, *tdi_p;
        uint8_t                 dtc_mask;
 
-       if(scan_size < 1) {
+       if (scan_size < 1) {
                LOG_ERROR("scan_size cannot be less than 1 bit\n");
                exit(1);
        }
@@ -1156,11 +1156,11 @@ rlink_scan(
        tdi_p = buffer;
        tdi_mask = 1;
 
-       if(extra_bits && (type == SCAN_OUT)) {
+       if (extra_bits && (type == SCAN_OUT)) {
                /* Schedule any extra bits into the DTC command buffer, padding as needed */
                /* For SCAN_OUT, this comes before the full bytes so the (leading) padding bits will fall off the end */
                /* make sure there's room for stop, byte op, and one byte */
-               if(
+               if (
                        (dtc_queue.cmd_index >= sizeof(dtc_queue.cmd_buffer) - (1 + 1 + 1))
                ) {
                        dtc_queue_run();
@@ -1170,14 +1170,14 @@ rlink_scan(
                dtc_mask = 1 << (extra_bits - 1);
 
                while(extra_bits--) {
-                       if(*tdi_p & tdi_mask) {
+                       if (*tdi_p & tdi_mask) {
                                x |= dtc_mask;
                        }
 
                        dtc_mask >>= 1;
 
                        tdi_mask <<= 1;
-                       if(tdi_mask == 0) {
+                       if (tdi_mask == 0) {
                                tdi_p++;
                                tdi_mask = 1;
                        }
@@ -1191,7 +1191,7 @@ rlink_scan(
 
        /* Loop scheduling full bytes into the DTC command buffer */
        while(byte_bits) {
-               if(type == SCAN_IN) {
+               if (type == SCAN_IN) {
                        /* make sure there's room for stop and byte op */
                        x = (dtc_queue.cmd_index >= sizeof(dtc_queue.cmd_buffer) - (1 + 1));
                } else {
@@ -1199,36 +1199,36 @@ rlink_scan(
                        x = (dtc_queue.cmd_index >= sizeof(dtc_queue.cmd_buffer) - (1 + 1 + 1));
                }
 
-               if(type != SCAN_OUT) {
+               if (type != SCAN_OUT) {
                        /* make sure there's room for at least one reply byte */
                        x |= (dtc_queue.reply_index >= USB_EP2IN_SIZE - (1));
                }
 
-               if(x) {
+               if (x) {
                        dtc_queue_run();
                }
 
                chunk_bits = byte_bits;
                /* we can only use up to 16 bytes at a time */
-               if(chunk_bits > (16 * 8)) chunk_bits = (16 * 8);
+               if (chunk_bits > (16 * 8)) chunk_bits = (16 * 8);
 
-               if(type != SCAN_IN) {
+               if (type != SCAN_IN) {
                        /* how much is there room for, considering stop and byte op? */
                        x = (sizeof(dtc_queue.cmd_buffer) - (dtc_queue.cmd_index + 1 + 1)) * 8;
-                       if(chunk_bits > x) chunk_bits = x;
+                       if (chunk_bits > x) chunk_bits = x;
                }
 
-               if(type != SCAN_OUT) {
+               if (type != SCAN_OUT) {
                        /* how much is there room for in the reply buffer? */
                        x = (USB_EP2IN_SIZE - dtc_queue.reply_index) * 8;
-                       if(chunk_bits > x) chunk_bits = x;
+                       if (chunk_bits > x) chunk_bits = x;
                }
 
                /* so the loop will end */
                byte_bits -= chunk_bits;
 
-               if(type != SCAN_OUT) {
-                       if(dtc_queue_enqueue_reply(
+               if (type != SCAN_OUT) {
+                       if (dtc_queue_enqueue_reply(
                                type, buffer, scan_size, tdi_bit_offset,
                                chunk_bits,
                                cmd
@@ -1256,17 +1256,17 @@ rlink_scan(
                }
                dtc_queue.cmd_buffer[dtc_queue.cmd_index++] = x;
 
-               if(type != SCAN_IN) {
+               if (type != SCAN_IN) {
                        x = 0;
                        dtc_mask = 1 << (8 - 1);
 
                        while(chunk_bits--) {
-                               if(*tdi_p & tdi_mask) {
+                               if (*tdi_p & tdi_mask) {
                                        x |= dtc_mask;
                                }
 
                                dtc_mask >>= 1;
-                               if(dtc_mask == 0) {
+                               if (dtc_mask == 0) {
                                        dtc_queue.cmd_buffer[dtc_queue.cmd_index++] = x;
                                        dtc_queue.reply_index++;
                                        x = 0;
@@ -1274,7 +1274,7 @@ rlink_scan(
                                }
 
                                tdi_mask <<= 1;
-                               if(tdi_mask == 0) {
+                               if (tdi_mask == 0) {
                                        tdi_p++;
                                        tdi_mask = 1;
                                }
@@ -1282,10 +1282,10 @@ rlink_scan(
                }
        }
 
-       if(extra_bits && (type != SCAN_OUT)) {
+       if (extra_bits && (type != SCAN_OUT)) {
                /* Schedule any extra bits into the DTC command buffer */
                /* make sure there's room for stop, byte op, and one byte */
-               if(
+               if (
                        (dtc_queue.cmd_index >= sizeof(dtc_queue.cmd_buffer) - (1 + 1 + 1))
                        ||
                        (dtc_queue.reply_index >= USB_EP2IN_SIZE - (1))
@@ -1293,7 +1293,7 @@ rlink_scan(
                        dtc_queue_run();
                }
 
-               if(dtc_queue_enqueue_reply(
+               if (dtc_queue_enqueue_reply(
                        type, buffer, scan_size, tdi_bit_offset,
                        extra_bits,
                        cmd
@@ -1304,7 +1304,7 @@ rlink_scan(
 
                tdi_bit_offset += extra_bits;
 
-               if(type == SCAN_IN) {
+               if (type == SCAN_IN) {
                        dtc_queue.cmd_buffer[dtc_queue.cmd_index++] =
                                DTC_CMD_SHIFT_TDO_BYTES(1);
 
@@ -1316,14 +1316,14 @@ rlink_scan(
                        dtc_mask = 1 << (8 - 1);
 
                        while(extra_bits--) {
-                               if(*tdi_p & tdi_mask) {
+                               if (*tdi_p & tdi_mask) {
                                        x |= dtc_mask;
                                }
 
                                dtc_mask >>= 1;
 
                                tdi_mask <<= 1;
-                               if(tdi_mask == 0) {
+                               if (tdi_mask == 0) {
                                        tdi_p++;
                                        tdi_mask = 1;
                                }
@@ -1338,7 +1338,7 @@ rlink_scan(
        /* Schedule the last bit into the DTC command buffer */
        {
                /* make sure there's room for stop, and bit pair command */
-               if(
+               if (
                        (dtc_queue.cmd_index >= sizeof(dtc_queue.cmd_buffer) - (1 + 1))
                        ||
                        (dtc_queue.reply_index >= USB_EP2IN_SIZE - (1))
@@ -1346,12 +1346,12 @@ rlink_scan(
                        dtc_queue_run();
                }
 
-               if(type == SCAN_OUT) {
+               if (type == SCAN_OUT) {
                        dtc_queue.cmd_buffer[dtc_queue.cmd_index++] =
                                DTC_CMD_SHIFT_TMS_TDI_BIT_PAIR(1, (*tdi_p & tdi_mask), 0);
 
                } else {
-                       if(dtc_queue_enqueue_reply(
+                       if (dtc_queue_enqueue_reply(
                                type, buffer, scan_size, tdi_bit_offset,
                                1,
                                cmd
@@ -1455,7 +1455,7 @@ int rlink_execute_queue(void)
                                        rlink_end_state(cmd->cmd.scan->end_state);
                                scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer);
                                type = jtag_scan_type(cmd->cmd.scan);
-                               if(rlink_scan(cmd, type, buffer, scan_size) != ERROR_OK) {
+                               if (rlink_scan(cmd, type, buffer, scan_size) != ERROR_OK) {
                                        retval = ERROR_FAIL;
                                }
                                break;
@@ -1475,7 +1475,7 @@ int rlink_execute_queue(void)
        /* Flush the DTC queue to make sure any pending reads have been done before exiting this function */
        tap_state_queue_run();
        tmp_retval = dtc_queue_run();
-       if(tmp_retval != ERROR_OK) {
+       if (tmp_retval != ERROR_OK) {
                retval = tmp_retval;
        }
 
@@ -1498,19 +1498,19 @@ int rlink_speed(int speed)
 {
        int             i;
 
-       if(speed == 0) {
+       if (speed == 0) {
                /* fastest speed */
                speed = rlink_speed_table[rlink_speed_table_size - 1].prescaler;
        }
 
        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) {
+               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);
                                exit(1);
                        }
 
-                       if(dtc_start_download() < 0) {
+                       if (dtc_start_download() < 0) {
                                LOG_ERROR("%s, %d: starting DTC: %s",
                                        __FILE__, __LINE__,
                                        usb_strerror()
@@ -1535,7 +1535,7 @@ int rlink_speed_div(
        int     i;
 
        for(i = rlink_speed_table_size; i--; ) {
-               if(rlink_speed_table[i].prescaler == speed) {
+               if (rlink_speed_table[i].prescaler == speed) {
                        *khz = rlink_speed_table[i].khz;
                        return(ERROR_OK);
                }
@@ -1553,13 +1553,13 @@ int rlink_khz(
 ) {
        int     i;
 
-       if(khz == 0) {
+       if (khz == 0) {
                LOG_ERROR("RCLK not supported");
                return ERROR_FAIL;
        }
 
        for(i = rlink_speed_table_size; i--; ) {
-               if(rlink_speed_table[i].khz <= khz) {
+               if (rlink_speed_table[i].khz <= khz) {
                        *speed = rlink_speed_table[i].prescaler;
                        return(ERROR_OK);
                }
@@ -1580,7 +1580,7 @@ handle_dtc_directory_command(
        char **args,
        int argc
 ) {
-       if(argc != 1) {
+       if (argc != 1) {
                LOG_ERROR("expected exactly one argument to rlink_dtc_directory <directory-path>");
                return(ERROR_INVALID_ARGUMENTS);
        }
@@ -1636,26 +1636,26 @@ int rlink_init(void)
 
                for(dev = bus->devices; dev; dev = dev->next)
                {
-                       if( (dev->descriptor.idVendor == USB_IDVENDOR) && (dev->descriptor.idProduct == USB_IDPRODUCT) )
+                       if ( (dev->descriptor.idVendor == USB_IDVENDOR) && (dev->descriptor.idProduct == USB_IDPRODUCT) )
                        {
                                found = 1;
                                LOG_DEBUG("Found device on bus.\n");
 
                                do
                                {
-                                       if( dev->descriptor.bNumConfigurations > 1 )
+                                       if ( dev->descriptor.bNumConfigurations > 1 )
                                        {
                                                LOG_ERROR("Whoops! NumConfigurations is not 1, don't know what to do...\n");
                                                break;
                                        }
-                                       if( dev->config->bNumInterfaces > 1 )
+                                       if ( dev->config->bNumInterfaces > 1 )
                                        {
                                                LOG_ERROR("Whoops! NumInterfaces is not 1, don't know what to do...\n");
                                                break;
                                        }
 
                                        pHDev=usb_open(dev);
-                                       if( !pHDev )
+                                       if ( !pHDev )
                                                LOG_ERROR ("Failed to open device.\n");
                                        else
                                        {
@@ -1668,12 +1668,12 @@ int rlink_init(void)
                                                do
                                                {
                                                        i = usb_claim_interface(pHDev,0);
-                                                       if(i)
+                                                       if (i)
                                                        {
                                                                LOG_ERROR("usb_claim_interface: %s", usb_strerror());
 #ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP
                                                                j = usb_detach_kernel_driver_np(pHDev, 0);
-                                                               if(j)
+                                                               if (j)
                                                                        LOG_ERROR("detach kernel driver: %s", usb_strerror());
 #endif
                                                        }
@@ -1684,9 +1684,9 @@ int rlink_init(void)
                                                        }
                                                } while(--retries);
 
-                                               if(!i)
+                                               if (!i)
                                                {
-                                                       if( usb_set_altinterface(pHDev,0) )
+                                                       if ( usb_set_altinterface(pHDev,0) )
                                                        {
                                                                LOG_ERROR("Failed to set interface.\n");
                                                                break;
@@ -1700,13 +1700,13 @@ int rlink_init(void)
                }
        }
 
-       if( !found )
+       if ( !found )
        {
                LOG_ERROR("No device found on bus.\n");
                exit(1);
        }
 
-       if( !success )
+       if ( !success )
        {
                LOG_ERROR("Initialisation failed.");
                exit(1);
@@ -1720,7 +1720,7 @@ int rlink_init(void)
                        pHDev, 1,
                        EP1_CMD_GET_FWREV
                );
-               if(j < USB_EP1OUT_SIZE) {
+               if (j < USB_EP1OUT_SIZE) {
                        LOG_ERROR("USB write error: %s", usb_strerror());
                        return(ERROR_FAIL);
                }
@@ -1729,16 +1729,16 @@ int rlink_init(void)
                        (char *)reply_buffer, sizeof(reply_buffer),
                        200
                );
-               if(j != -ETIMEDOUT) break;
+               if (j != -ETIMEDOUT) break;
        }
 
-       if(j < (int)sizeof(reply_buffer)) {
+       if (j < (int)sizeof(reply_buffer)) {
                LOG_ERROR("USB read error: %s", usb_strerror());
                return(ERROR_FAIL);
        }
        LOG_DEBUG(INTERFACE_NAME" firmware version: %d.%d.%d\n", reply_buffer[0], reply_buffer[1], reply_buffer[2]);
 
-       if((reply_buffer[0] != 0) || (reply_buffer[1] != 0) || (reply_buffer[2] != 3)) {
+       if ((reply_buffer[0] != 0) || (reply_buffer[1] != 0) || (reply_buffer[2] != 3)) {
                LOG_WARNING("The rlink device is not of the version that the developers have played with.  It may or may not work.\n");
        }
 
@@ -1769,7 +1769,7 @@ int rlink_init(void)
                USB_TIMEOUT_MS
        );
 
-       if((reply_buffer[0] & ST7_PE_ADAPTER_SENSE_IN) != 0) {
+       if ((reply_buffer[0] & ST7_PE_ADAPTER_SENSE_IN) != 0) {
                LOG_WARNING("target detection problem\n");
        }
 
@@ -1795,7 +1795,7 @@ int rlink_init(void)
        );
 
 
-       if((reply_buffer[0] & ST7_PE_ADAPTER_SENSE_IN) == 0) {
+       if ((reply_buffer[0] & ST7_PE_ADAPTER_SENSE_IN) == 0) {
                LOG_WARNING("target not plugged in\n");
        }
 
index a6c4ded..13a4da6 100644 (file)
@@ -340,7 +340,7 @@ static int jim_newtap_cmd( Jim_GetOptInfo *goi )
        /*
         * we expect CHIP + TAP + OPTIONS
         * */
-       if( goi->argc < 3 ){
+       if ( goi->argc < 3 ){
                Jim_SetResult_sprintf(goi->interp, "Missing CHIP TAP OPTIONS ....");
                return JIM_ERR;
        }
@@ -369,7 +369,7 @@ static int jim_newtap_cmd( Jim_GetOptInfo *goi )
 
        while( goi->argc ){
                e = Jim_GetOpt_Nvp( goi, opts, &n );
-               if( e != JIM_OK ){
+               if ( e != JIM_OK ){
                        Jim_GetOpt_NvpUnknown( goi, opts, 0 );
                        return e;
                }
@@ -386,7 +386,7 @@ static int jim_newtap_cmd( Jim_GetOptInfo *goi )
                        uint32_t *new_expected_ids;
 
                        e = Jim_GetOpt_Wide( goi, &w );
-                       if( e != JIM_OK) {
+                       if ( e != JIM_OK) {
                                Jim_SetResult_sprintf(goi->interp, "option: %s bad parameter", n->name);
                                return e;
                        }
@@ -410,7 +410,7 @@ static int jim_newtap_cmd( Jim_GetOptInfo *goi )
                case NTAP_OPT_IRMASK:
                case NTAP_OPT_IRCAPTURE:
                        e = Jim_GetOpt_Wide( goi, &w );
-                       if( e != JIM_OK ){
+                       if ( e != JIM_OK ){
                                Jim_SetResult_sprintf( goi->interp, "option: %s bad parameter", n->name );
                                return e;
                        }
@@ -535,7 +535,7 @@ static int jim_jtag_command( Jim_Interp *interp, int argc, Jim_Obj *const *argv
        Jim_GetOpt_Setup( &goi, interp, argc-1, argv+1 );
 
        e = Jim_GetOpt_Nvp( &goi, jtag_cmds, &n );
-       if( e != JIM_OK ){
+       if ( e != JIM_OK ){
                Jim_GetOpt_NvpUnknown( &goi, jtag_cmds, 0 );
                return e;
        }
@@ -545,19 +545,19 @@ static int jim_jtag_command( Jim_Interp *interp, int argc, Jim_Obj *const *argv
                /* return the name of the interface */
                /* TCL code might need to know the exact type... */
                /* FUTURE: we allow this as a means to "set" the interface. */
-               if( goi.argc != 0 ){
+               if ( goi.argc != 0 ){
                        Jim_WrongNumArgs( goi.interp, 1, goi.argv-1, "(no params)");
                        return JIM_ERR;
                }
                Jim_SetResultString( goi.interp, jtag_interface->name, -1 );
                return JIM_OK;
        case JTAG_CMD_INIT_RESET:
-               if( goi.argc != 0 ){
+               if ( goi.argc != 0 ){
                        Jim_WrongNumArgs( goi.interp, 1, goi.argv-1, "(no params)");
                        return JIM_ERR;
                }
                e = jtag_init_reset(context);
-               if( e != ERROR_OK ){
+               if ( e != ERROR_OK ){
                        Jim_SetResult_sprintf( goi.interp, "error: %d", e);
                        return JIM_ERR;
                }
@@ -568,7 +568,7 @@ static int jim_jtag_command( Jim_Interp *interp, int argc, Jim_Obj *const *argv
        case JTAG_CMD_TAPISENABLED:
        case JTAG_CMD_TAPENABLE:
        case JTAG_CMD_TAPDISABLE:
-               if( goi.argc != 1 ){
+               if ( goi.argc != 1 ){
                        Jim_SetResultString( goi.interp, "Too many parameters",-1 );
                        return JIM_ERR;
                }
@@ -619,7 +619,7 @@ static int jim_jtag_command( Jim_Interp *interp, int argc, Jim_Obj *const *argv
                break;
 
        case JTAG_CMD_CGET:
-               if( goi.argc < 2 ){
+               if ( goi.argc < 2 ){
                        Jim_WrongNumArgs( goi.interp, 0, NULL, "?tap-name? -option ...");
                        return JIM_ERR;
                }
@@ -629,7 +629,7 @@ static int jim_jtag_command( Jim_Interp *interp, int argc, Jim_Obj *const *argv
 
                        Jim_GetOpt_Obj(&goi, &o);
                        t = jtag_tap_by_jim_obj( goi.interp, o );
-                       if( t == NULL ){
+                       if ( t == NULL ){
                                return JIM_ERR;
                        }
 
@@ -639,7 +639,7 @@ static int jim_jtag_command( Jim_Interp *interp, int argc, Jim_Obj *const *argv
                break;
 
        case JTAG_CMD_CONFIGURE:
-               if( goi.argc < 3 ){
+               if ( goi.argc < 3 ){
                        Jim_WrongNumArgs( goi.interp, 0, NULL, "?tap-name? -option ?VALUE? ...");
                        return JIM_ERR;
                }
@@ -649,7 +649,7 @@ static int jim_jtag_command( Jim_Interp *interp, int argc, Jim_Obj *const *argv
 
                        Jim_GetOpt_Obj(&goi, &o);
                        t = jtag_tap_by_jim_obj( goi.interp, o );
-                       if( t == NULL ){
+                       if ( t == NULL ){
                                return JIM_ERR;
                        }
 
@@ -806,7 +806,7 @@ static int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *c
         * argv[ 3] = not actually used by anything but in the docs
         */
 
-       if( argc < 4 ){
+       if ( argc < 4 ){
                command_print( cmd_ctx, "OLD DEPRECATED SYNTAX: Please use the NEW syntax");
                return ERROR_OK;
        }
@@ -847,7 +847,7 @@ static int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *c
                         Jim_GetString( newargs[9], NULL ) );
 
        e = jim_jtag_command( interp, 10, newargs );
-       if( e != JIM_OK ){
+       if ( e != JIM_OK ){
                command_print( cmd_ctx, "%s", Jim_GetString( Jim_GetResult(interp), NULL ) );
        }
        return e;
@@ -1174,20 +1174,20 @@ static int handle_irscan_command(struct command_context_s *cmd_ctx, char *cmd, c
         */
        endstate = TAP_IDLE;
 
-       if( argc >= 4 ){
+       if ( argc >= 4 ){
                /* have at least one pair of numbers. */
                /* is last pair the magic text? */
-               if( 0 == strcmp( "-endstate", args[ argc - 2 ] ) ){
+               if ( 0 == strcmp( "-endstate", args[ argc - 2 ] ) ){
                        const char *cpA;
                        const char *cpS;
                        cpA = args[ argc-1 ];
                        for( endstate = 0 ; endstate < TAP_NUM_STATES ; endstate++ ){
                                cpS = tap_state_name( endstate );
-                               if( 0 == strcmp( cpA, cpS ) ){
+                               if ( 0 == strcmp( cpA, cpS ) ){
                                        break;
                                }
                        }
-                       if( endstate >= TAP_NUM_STATES ){
+                       if ( endstate >= TAP_NUM_STATES ){
                                return ERROR_COMMAND_SYNTAX_ERROR;
                        } else {
                                if (!scan_is_safe(endstate))
@@ -1281,7 +1281,7 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args
 
                e = Jim_GetLong(interp, args[i], &bits);
                /* If valid - try next arg */
-               if( e == JIM_OK ){
+               if ( e == JIM_OK ){
                        continue;
                }
 
@@ -1299,13 +1299,13 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args
                /* get arg as a string. */
                cp = Jim_GetString( args[i], NULL );
                /* is it the magic? */
-               if( 0 == strcmp( "-endstate", cp ) ){
+               if ( 0 == strcmp( "-endstate", cp ) ){
                        /* is the statename valid? */
                        cp = Jim_GetString( args[i+1], NULL );
 
                        /* see if it is a valid state name */
                        endstate = tap_state_by_name(cp);
-                       if( endstate < 0 ){
+                       if ( endstate < 0 ){
                                /* update the error message */
                                Jim_SetResult_sprintf(interp,"endstate: %s invalid", cp );
                        } else {
@@ -1321,13 +1321,13 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args
                }
 
                /* Still an error? */
-               if( e != JIM_OK ){
+               if ( e != JIM_OK ){
                        return e; /* too bad */
                }
        } /* validate args */
 
        tap = jtag_tap_by_jim_obj( interp, args[1] );
-       if( tap == NULL ){
+       if ( tap == NULL ){
                return JIM_ERR;
        }
 
@@ -1401,7 +1401,7 @@ static int Jim_Command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *ar
                const char *cp;
                cp = Jim_GetString( args[i+1], NULL );
                states[i] = tap_state_by_name(cp);
-               if( states[i] < 0 )
+               if ( states[i] < 0 )
                {
                        /* update the error message */
                        Jim_SetResult_sprintf(interp,"endstate: %s invalid", cp );
index 5d9c71b..ed6472b 100644 (file)
@@ -591,7 +591,7 @@ static void usbprog_jtag_write_tdi(struct usbprog_jtag *usbprog_jtag, char * buf
                {
                        send_bits = size;
                        loops = size/8;
-                       /* if(loops==0) */
+                       /* if (loops==0) */
                        loops++;
                        size = 0;
                }
index a5d001a..0b52ab1 100644 (file)
@@ -1201,12 +1201,12 @@ static void vsllink_scan_normal(bool ir_scan, enum scan_type type, uint8_t *buff
                {
                        // already in IRSHIFT or DRSHIFT state
                        // merge tms data in the last tms shift command into next scan command
-                       if(*vsllink_tms_cmd_pos < 1)
+                       if (*vsllink_tms_cmd_pos < 1)
                        {
                                LOG_ERROR("There MUST be some bugs in the driver");
                                exit(-1);
                        }
-                       else if(*vsllink_tms_cmd_pos < 2)
+                       else if (*vsllink_tms_cmd_pos < 2)
                        {
                                tms_tmp = vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx];
                                vsllink_usb_out_buffer_idx--;
@@ -1603,7 +1603,7 @@ static int vsllink_tap_execute_normal(void)
 
        if (vsllink_tms_data_len > 0)
        {
-               if((tap_get_state() != TAP_RESET) && (tap_get_state() != TAP_IDLE) && (tap_get_state() != TAP_IRPAUSE) && (tap_get_state() != TAP_DRPAUSE))
+               if ((tap_get_state() != TAP_RESET) && (tap_get_state() != TAP_IDLE) && (tap_get_state() != TAP_IRPAUSE) && (tap_get_state() != TAP_DRPAUSE))
                {
                        LOG_WARNING("%s is not in RESET or IDLE or PAUSR state", tap_state_name(tap_get_state()));
                }
index f4fee3a..3425a4f 100644 (file)
@@ -127,7 +127,7 @@ jtag_interface_t zy1000_interface =
 void zy1000_reset(int trst, int srst)
 {
        LOG_DEBUG("zy1000 trst=%d, srst=%d", trst, srst);
-       if(!srst)
+       if (!srst)
        {
                ZY1000_POKE(ZY1000_JTAG_BASE+0x14, 0x00000001);
        }
@@ -139,7 +139,7 @@ void zy1000_reset(int trst, int srst)
                ZY1000_POKE(ZY1000_JTAG_BASE+0x10, 0x00000001);
        }
 
-       if(!trst)
+       if (!trst)
        {
                ZY1000_POKE(ZY1000_JTAG_BASE+0x14, 0x00000002);
        }
@@ -188,7 +188,7 @@ void zy1000_reset(int trst, int srst)
 
 int zy1000_speed(int speed)
 {
-       if(speed == 0)
+       if (speed == 0)
        {
                /*0 means RCLK*/
                speed = 0;
@@ -197,7 +197,7 @@ int zy1000_speed(int speed)
        }
        else
        {
-               if(speed > 8190 || speed < 2)
+               if (speed > 8190 || speed < 2)
                {
                        LOG_USER("valid ZY1000 jtag_speed=[8190,2]. Divisor is 64MHz / even values between 8190-2, i.e. min 7814Hz, max 32MHz");
                        return ERROR_INVALID_ARGUMENTS;
index 8f02435..2720068 100644 (file)
@@ -319,7 +319,7 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
                        break;
                if ((retval = gdb_get_char(connection, &reply)) != ERROR_OK)
                        return retval;
-               if( reply == '$' ){
+               if ( reply == '$' ){
                        /* fix a problem with some IAR tools */
                        gdb_putback_char( connection, reply );
                        LOG_DEBUG("Unexpected start of new packet");
@@ -349,7 +349,7 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
                        local_buffer[len++] = '#';
                        local_buffer[len++] = DIGITS[(my_checksum >> 4) & 0xf];
                        local_buffer[len++] = DIGITS[my_checksum & 0xf];
-                       if((retval = gdb_write(connection, local_buffer, len)) != ERROR_OK)
+                       if ((retval = gdb_write(connection, local_buffer, len)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -361,15 +361,15 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
                        local_buffer[1] = '#';
                        local_buffer[2] = DIGITS[(my_checksum >> 4) & 0xf];
                        local_buffer[3] = DIGITS[my_checksum & 0xf];
-                       if((retval = gdb_write(connection, local_buffer, 1)) != ERROR_OK)
+                       if ((retval = gdb_write(connection, local_buffer, 1)) != ERROR_OK)
                        {
                                return retval;
                        }
-                       if((retval = gdb_write(connection, buffer, len)) != ERROR_OK)
+                       if ((retval = gdb_write(connection, buffer, len)) != ERROR_OK)
                        {
                                return retval;
                        }
-                       if((retval = gdb_write(connection, local_buffer+1, 3)) != ERROR_OK)
+                       if ((retval = gdb_write(connection, local_buffer+1, 3)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -402,7 +402,7 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
                                log_remove_callback(gdb_log_callback, connection);
                                LOG_WARNING("negative reply, retrying");
                        }
-                       else if( reply == '$' ){
+                       else if ( reply == '$' ){
                                LOG_ERROR("GDB missing ack(1) - assumed good");
                                gdb_putback_char( connection, reply );
                                return ERROR_OK;
@@ -413,7 +413,7 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
                                return ERROR_SERVER_REMOTE_CLOSED;
                        }
                }
-               else if( reply == '$' ){
+               else if ( reply == '$' ){
                        LOG_ERROR("GDB missing ack(2) - assumed good");
                        gdb_putback_char( connection, reply );
                        return ERROR_OK;
@@ -720,7 +720,7 @@ int gdb_target_callback_event_handler(struct target_s *target, enum target_event
                        break;
                case TARGET_EVENT_GDB_FLASH_ERASE_START:
                        target_handle_event( target, TARGET_EVENT_OLD_gdb_program_config );
-                       if((retval = jtag_execute_queue()) != ERROR_OK)
+                       if ((retval = jtag_execute_queue()) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -1918,7 +1918,7 @@ int gdb_v_packet(connection_t *connection, target_t *target, char *packet, int p
                }
 
                /* create new section with content from packet buffer */
-               if((retval = image_add_section(gdb_connection->vflash_image, addr, length, 0x0, (uint8_t*)parse)) != ERROR_OK)
+               if ((retval = image_add_section(gdb_connection->vflash_image, addr, length, 0x0, (uint8_t*)parse)) != ERROR_OK)
                {
                        return retval;
                }
@@ -2036,8 +2036,8 @@ int gdb_input_inner(connection_t *connection)
                /* terminate with zero */
                packet[packet_size] = 0;
 
-               if( LOG_LEVEL_IS( LOG_LVL_DEBUG ) ){
-                       if( packet[0] == 'X' ){
+               if ( LOG_LEVEL_IS( LOG_LVL_DEBUG ) ){
+                       if ( packet[0] == 'X' ){
                                // binary packets spew junk into the debug log stream
                                char buf[ 50 ];
                                int x;
index afa5599..cdc5fd7 100644 (file)
@@ -97,11 +97,11 @@ int arm720t_scan_cp15(target_t *target, uint32_t out, uint32_t *in, int instruct
        buf_set_u32(out_buf, 0, 32, flip_u32(out, 32));
 
        jtag_set_end_state(TAP_DRPAUSE);
-       if((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK)
+       if ((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK)
        {
                return retval;
        }
-       if((retval = arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL)) != ERROR_OK)
+       if ((retval = arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL)) != ERROR_OK)
        {
                return retval;
        }
@@ -130,7 +130,7 @@ int arm720t_scan_cp15(target_t *target, uint32_t out, uint32_t *in, int instruct
                jtag_add_runtest(0, jtag_get_end_state());
 
 #ifdef _DEBUG_INSTRUCTION_EXECUTION_
-       if((retval = jtag_execute_queue()) != ERROR_OK)
+       if ((retval = jtag_execute_queue()) != ERROR_OK)
        {
                return retval;
        }
index 58c16d9..48ba007 100644 (file)
@@ -469,7 +469,7 @@ int arm7_9_remove_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
        armv4_5_common_t *armv4_5 = target->arch_info;
        arm7_9_common_t *arm7_9 = armv4_5->arch_info;
 
-       if((retval = arm7_9_unset_breakpoint(target, breakpoint)) != ERROR_OK)
+       if ((retval = arm7_9_unset_breakpoint(target, breakpoint)) != ERROR_OK)
        {
                return retval;
        }
@@ -481,7 +481,7 @@ int arm7_9_remove_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
        if (arm7_9->breakpoint_count==0)
        {
                /* 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)
                {
                        return retval;
                }
@@ -526,12 +526,12 @@ int arm7_9_set_watchpoint(struct target_s *target, watchpoint_t *watchpoint)
                embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_ADDR_VALUE], watchpoint->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_DATA_MASK], watchpoint->mask);
-               if( watchpoint->mask != 0xffffffffu )
+               if ( watchpoint->mask != 0xffffffffu )
                        embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_DATA_VALUE], watchpoint->value);
                embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_MASK], 0xff & ~EICE_W_CTRL_nOPC & ~rw_mask);
                embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_VALUE], EICE_W_CTRL_ENABLE | EICE_W_CTRL_nOPC | (watchpoint->rw & 1));
 
-               if((retval = jtag_execute_queue()) != ERROR_OK)
+               if ((retval = jtag_execute_queue()) != ERROR_OK)
                {
                        return retval;
                }
@@ -543,12 +543,12 @@ int arm7_9_set_watchpoint(struct target_s *target, watchpoint_t *watchpoint)
                embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_ADDR_VALUE], watchpoint->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_DATA_MASK], watchpoint->mask);
-               if( watchpoint->mask != 0xffffffffu )
+               if ( watchpoint->mask != 0xffffffffu )
                        embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_DATA_VALUE], watchpoint->value);
                embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_CONTROL_MASK], 0xff & ~EICE_W_CTRL_nOPC & ~rw_mask);
                embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_CONTROL_VALUE], EICE_W_CTRL_ENABLE | EICE_W_CTRL_nOPC | (watchpoint->rw & 1));
 
-               if((retval = jtag_execute_queue()) != ERROR_OK)
+               if ((retval = jtag_execute_queue()) != ERROR_OK)
                {
                        return retval;
                }
@@ -593,7 +593,7 @@ int arm7_9_unset_watchpoint(struct target_s *target, watchpoint_t *watchpoint)
        if (watchpoint->set == 1)
        {
                embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_VALUE], 0x0);
-               if((retval = jtag_execute_queue()) != ERROR_OK)
+               if ((retval = jtag_execute_queue()) != ERROR_OK)
                {
                        return retval;
                }
@@ -602,7 +602,7 @@ int arm7_9_unset_watchpoint(struct target_s *target, watchpoint_t *watchpoint)
        else if (watchpoint->set == 2)
        {
                embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_CONTROL_VALUE], 0x0);
-               if((retval = jtag_execute_queue()) != ERROR_OK)
+               if ((retval = jtag_execute_queue()) != ERROR_OK)
                {
                        return retval;
                }
@@ -663,7 +663,7 @@ int arm7_9_remove_watchpoint(struct target_s *target, watchpoint_t *watchpoint)
 
        if (watchpoint->set)
        {
-               if((retval = arm7_9_unset_watchpoint(target, watchpoint)) != ERROR_OK)
+               if ((retval = arm7_9_unset_watchpoint(target, watchpoint)) != ERROR_OK)
                {
                        return retval;
                }
@@ -1942,7 +1942,7 @@ void arm7_9_enable_eice_step(target_t *target, uint32_t next_pc)
        uint32_t current_pc;
        current_pc = buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32);
 
-       if(next_pc != current_pc)
+       if (next_pc != current_pc)
        {
                /* setup an inverse breakpoint on the current PC
                * - comparator 1 matches the current address
@@ -2297,7 +2297,7 @@ int arm7_9_read_memory(struct target_s *target, uint32_t address, uint32_t size,
                                                retval = arm7_9_execute_fast_sys_speed(target);
                                        else
                                                retval = arm7_9_execute_sys_speed(target);
-                                       if(retval != ERROR_OK)
+                                       if (retval != ERROR_OK)
                                        {
                                                return retval;
                                        }
@@ -2335,7 +2335,7 @@ int arm7_9_read_memory(struct target_s *target, uint32_t address, uint32_t size,
                                                retval = arm7_9_execute_fast_sys_speed(target);
                                        else
                                                retval = arm7_9_execute_sys_speed(target);
-                                       if(retval != ERROR_OK)
+                                       if (retval != ERROR_OK)
                                        {
                                                return retval;
                                        }
@@ -2451,7 +2451,7 @@ int arm7_9_write_memory(struct target_s *target, uint32_t address, uint32_t size
                                        retval = arm7_9_execute_fast_sys_speed(target);
                                else
                                        retval = arm7_9_execute_sys_speed(target);
-                               if(retval != ERROR_OK)
+                               if (retval != ERROR_OK)
                                {
                                        return retval;
                                }
@@ -2487,7 +2487,7 @@ int arm7_9_write_memory(struct target_s *target, uint32_t address, uint32_t size
                                                retval = arm7_9_execute_fast_sys_speed(target);
                                        else
                                                retval = arm7_9_execute_sys_speed(target);
-                                       if(retval != ERROR_OK)
+                                       if (retval != ERROR_OK)
                                        {
                                                return retval;
                                        }
@@ -2522,7 +2522,7 @@ int arm7_9_write_memory(struct target_s *target, uint32_t address, uint32_t size
                                                retval = arm7_9_execute_fast_sys_speed(target);
                                        else
                                                retval = arm7_9_execute_sys_speed(target);
-                                       if(retval != ERROR_OK)
+                                       if (retval != ERROR_OK)
                                        {
                                                return retval;
                                        }
@@ -2608,7 +2608,7 @@ static int arm7_9_dcc_completion(struct target_s *target, uint32_t exit_point, i
                }
        }
 
-       if((retval = target_halt(target))!= ERROR_OK)
+       if ((retval = target_halt(target))!= ERROR_OK)
        {
                return retval;
        }
@@ -3087,7 +3087,7 @@ int arm7_9_init_arch_info(target_t *target, arm7_9_common_t *arm7_9)
 
        arm7_9->common_magic = ARM7_9_COMMON_MAGIC;
 
-       if((retval = arm_jtag_setup_connection(&arm7_9->jtag_info)) != ERROR_OK)
+       if ((retval = arm_jtag_setup_connection(&arm7_9->jtag_info)) != ERROR_OK)
        {
                return retval;
        }
@@ -3120,12 +3120,12 @@ int arm7_9_init_arch_info(target_t *target, arm7_9_common_t *arm7_9)
        armv4_5->write_core_reg = arm7_9_write_core_reg;
        armv4_5->full_context = arm7_9_full_context;
 
-       if((retval = armv4_5_init_arch_info(target, armv4_5)) != ERROR_OK)
+       if ((retval = armv4_5_init_arch_info(target, armv4_5)) != ERROR_OK)
        {
                return retval;
        }
 
-       if((retval = target_register_timer_callback(arm7_9_handle_target_request, 1, 1, target)) != ERROR_OK)
+       if ((retval = target_register_timer_callback(arm7_9_handle_target_request, 1, 1, target)) != ERROR_OK)
        {
                return retval;
        }
index 02886c3..32f1830 100644 (file)
@@ -110,14 +110,14 @@ int arm7tdmi_examine_debug_reason(target_t *target)
                fields[1].out_value = NULL;
                fields[1].in_value = databus;
 
-               if((retval = arm_jtag_scann(&arm7_9->jtag_info, 0x1)) != ERROR_OK)
+               if ((retval = arm_jtag_scann(&arm7_9->jtag_info, 0x1)) != ERROR_OK)
                {
                        return retval;
                }
                arm_jtag_set_instr(&arm7_9->jtag_info, arm7_9->jtag_info.intest_instr, NULL);
 
                jtag_add_dr_scan(2, fields, jtag_set_end_state(TAP_DRPAUSE));
-               if((retval = jtag_execute_queue()) != ERROR_OK)
+               if ((retval = jtag_execute_queue()) != ERROR_OK)
                {
                        return retval;
                }
@@ -171,7 +171,7 @@ int arm7tdmi_clock_data_in(arm_jtag_t *jtag_info, uint32_t *in)
        scan_field_t fields[2];
 
        jtag_set_end_state(TAP_DRPAUSE);
-       if((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK)
+       if ((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK)
        {
                return retval;
        }
@@ -195,7 +195,7 @@ int arm7tdmi_clock_data_in(arm_jtag_t *jtag_info, uint32_t *in)
 
 #ifdef _DEBUG_INSTRUCTION_EXECUTION_
 {
-               if((retval = jtag_execute_queue()) != ERROR_OK)
+               if ((retval = jtag_execute_queue()) != ERROR_OK)
                {
                        return retval;
                }
@@ -262,7 +262,7 @@ int arm7tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, void *in, int size,
        scan_field_t fields[2];
 
        jtag_set_end_state(TAP_DRPAUSE);
-       if((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK)
+       if ((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK)
        {
                return retval;
        }
@@ -286,7 +286,7 @@ int arm7tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, void *in, int size,
 
 #ifdef _DEBUG_INSTRUCTION_EXECUTION_
 {
-               if((retval = jtag_execute_queue()) != ERROR_OK)
+               if ((retval = jtag_execute_queue()) != ERROR_OK)
                {
                        return retval;
                }
index f38b7c5..2db49e5 100644 (file)
@@ -69,7 +69,7 @@ int arm_jtag_set_instr(arm_jtag_t *jtag_info, uint32_t new_instr,  void *no_veri
 int arm_jtag_scann(arm_jtag_t *jtag_info, uint32_t new_scan_chain)
 {
        int retval = ERROR_OK;
-       if(jtag_info->cur_scan_chain != new_scan_chain)
+       if (jtag_info->cur_scan_chain != new_scan_chain)
        {
                uint32_t values[1];
                int num_bits[1];
@@ -77,7 +77,7 @@ int arm_jtag_scann(arm_jtag_t *jtag_info, uint32_t new_scan_chain)
                values[0]=new_scan_chain;
                num_bits[0]=jtag_info->scann_size;
 
-               if((retval = arm_jtag_set_instr(jtag_info, jtag_info->scann_instr, NULL)) != ERROR_OK)
+               if ((retval = arm_jtag_set_instr(jtag_info, jtag_info->scann_instr, NULL)) != ERROR_OK)
                {
                        return retval;
                }
index afea204..6de9e51 100644 (file)
@@ -280,11 +280,11 @@ int arm_simulate_step(target_t *target, uint32_t *dry_run_pc)
                uint32_t opcode;
                
                /* get current instruction, and identify it */
-               if((retval = target_read_u32(target, current_pc, &opcode)) != ERROR_OK)
+               if ((retval = target_read_u32(target, current_pc, &opcode)) != ERROR_OK)
                {
                        return retval;
                }
-               if((retval = arm_evaluate_opcode(opcode, current_pc, &instruction)) != ERROR_OK)
+               if ((retval = arm_evaluate_opcode(opcode, current_pc, &instruction)) != ERROR_OK)
                {
                        return retval;
                }
@@ -309,11 +309,11 @@ int arm_simulate_step(target_t *target, uint32_t *dry_run_pc)
        {
                uint16_t opcode;
                
-               if((retval = target_read_u16(target, current_pc, &opcode)) != ERROR_OK)
+               if ((retval = target_read_u16(target, current_pc, &opcode)) != ERROR_OK)
                {
                        return retval;
                }
-               if((retval = thumb_evaluate_opcode(opcode, current_pc, &instruction)) != ERROR_OK)
+               if ((retval = thumb_evaluate_opcode(opcode, current_pc, &instruction)) != ERROR_OK)
                {
                        return retval;
                        }
@@ -350,7 +350,7 @@ int arm_simulate_step(target_t *target, uint32_t *dry_run_pc)
                else
                {
                        target = buf_get_u32(ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, instruction.info.b_bl_bx_blx.reg_operand).value, 0, 32); 
-                       if(instruction.info.b_bl_bx_blx.reg_operand == 15)
+                       if (instruction.info.b_bl_bx_blx.reg_operand == 15)
                        {
                                target += 2 * instruction_size;
                        }
@@ -545,9 +545,9 @@ int arm_simulate_step(target_t *target, uint32_t *dry_run_pc)
                         load_address = Rn;
                }
                
-               if((!dry_run_pc) || (instruction.info.load_store.Rd == 15))
+               if ((!dry_run_pc) || (instruction.info.load_store.Rd == 15))
                {
-                       if((retval = target_read_u32(target, load_address, &load_value)) != ERROR_OK)
+                       if ((retval = target_read_u32(target, load_address, &load_value)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -614,7 +614,7 @@ int arm_simulate_step(target_t *target, uint32_t *dry_run_pc)
                {
                        if (instruction.info.load_store_multiple.register_list & (1 << i))
                        {
-                               if((!dry_run_pc) || (i == 15))
+                               if ((!dry_run_pc) || (i == 15))
                                {
                                        target_read_u32(target, Rn, &load_values[i]);
                                }
index b5d358c..eef9b50 100644 (file)
@@ -295,7 +295,7 @@ static int armv7m_run_and_wait(struct target_s *target, uint32_t entry_point, in
        int retval;
        /* This code relies on the target specific  resume() and  poll()->debug_entry()
         * sequence to write register values to the processor and the read them back */
-       if((retval = target_resume(target, 0, entry_point, 1, 1)) != ERROR_OK)
+       if ((retval = target_resume(target, 0, entry_point, 1, 1)) != ERROR_OK)
        {
                return retval;
        }
@@ -409,7 +409,7 @@ int armv7m_run_algorithm(struct target_s *target, int num_mem_params, mem_param_
        for (i = 0; i < num_mem_params; i++)
        {
                if (mem_params[i].direction != PARAM_OUT)
-                       if((retval = target_read_buffer(target, mem_params[i].address, mem_params[i].size, mem_params[i].value)) != ERROR_OK)
+                       if ((retval = target_read_buffer(target, mem_params[i].address, mem_params[i].size, mem_params[i].value)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -600,7 +600,7 @@ int armv7m_checksum_memory(struct target_s *target, uint32_t address, uint32_t c
 
        /* convert flash writing code into a buffer in target endianness */
        for (i = 0; i < (sizeof(cortex_m3_crc_code)/sizeof(uint16_t)); i++)
-               if((retval = target_write_u16(target, crc_algorithm->address + i*sizeof(uint16_t), cortex_m3_crc_code[i])) != ERROR_OK)
+               if ((retval = target_write_u16(target, crc_algorithm->address + i*sizeof(uint16_t), cortex_m3_crc_code[i])) != ERROR_OK)
                {
                        return retval;
                }
index 7bdd122..1ffa604 100644 (file)
@@ -932,11 +932,11 @@ int cortex_m3_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
        {
                uint8_t code[4];
                buf_set_u32(code, 0, 32, ARMV7M_T_BKPT(0x11));
-               if((retval = target_read_memory(target, breakpoint->address & 0xFFFFFFFE, breakpoint->length, 1, breakpoint->orig_instr)) != ERROR_OK)
+               if ((retval = target_read_memory(target, breakpoint->address & 0xFFFFFFFE, breakpoint->length, 1, breakpoint->orig_instr)) != ERROR_OK)
                {
                        return retval;
                }
-               if((retval = target_write_memory(target, breakpoint->address & 0xFFFFFFFE, breakpoint->length, 1, code)) != ERROR_OK)
+               if ((retval = target_write_memory(target, breakpoint->address & 0xFFFFFFFE, breakpoint->length, 1, code)) != ERROR_OK)
                {
                        return retval;
                }
@@ -977,14 +977,14 @@ int cortex_m3_unset_breakpoint(struct target_s *target, breakpoint_t *breakpoint
                /* restore original instruction (kept in target endianness) */
                if (breakpoint->length == 4)
                {
-                       if((retval = target_write_memory(target, breakpoint->address & 0xFFFFFFFE, 4, 1, breakpoint->orig_instr)) != ERROR_OK)
+                       if ((retval = target_write_memory(target, breakpoint->address & 0xFFFFFFFE, 4, 1, breakpoint->orig_instr)) != ERROR_OK)
                        {
                                return retval;
                        }
                }
                else
                {
-                       if((retval = target_write_memory(target, breakpoint->address & 0xFFFFFFFE, 2, 1, breakpoint->orig_instr)) != ERROR_OK)
+                       if ((retval = target_write_memory(target, breakpoint->address & 0xFFFFFFFE, 2, 1, breakpoint->orig_instr)) != ERROR_OK)
                        {
                                return retval;
                        }
index 66cf005..0dc26dc 100644 (file)
@@ -566,7 +566,7 @@ int feroceon_bulk_write_memory(target_t *target, uint32_t address, uint32_t coun
                        target_buffer_set_u32(target, dcc_code_buf + i*4, dcc_code[i]);
 
                /* write DCC code to working area */
-               if((retval = target_write_memory(target, arm7_9->dcc_working_area->address, 4, dcc_size/4, dcc_code_buf)) != ERROR_OK)
+               if ((retval = target_write_memory(target, arm7_9->dcc_working_area->address, 4, dcc_size/4, dcc_code_buf)) != ERROR_OK)
                {
                        return retval;
                }
index f463ae6..c6f3df5 100644 (file)
@@ -345,7 +345,7 @@ static int image_elf_read_headers(image_t *image)
 
        elf->header = malloc(sizeof(Elf32_Ehdr));
 
-       if(elf->header == NULL)
+       if (elf->header == NULL)
        {
                LOG_ERROR("insufficient memory to perform operation ");
                return ERROR_FILEIO_OPERATION_FAILED;
@@ -395,7 +395,7 @@ static int image_elf_read_headers(image_t *image)
        }
 
        elf->segments = malloc(elf->segment_count*sizeof(Elf32_Phdr));
-       if(elf->segments == NULL)
+       if (elf->segments == NULL)
        {
                LOG_ERROR("insufficient memory to perform operation ");
                return ERROR_FILEIO_OPERATION_FAILED;
@@ -636,7 +636,7 @@ static int image_mot_buffer_complete(image_t *image)
                cal_checksum += (uint8_t)checksum;
                bytes_read += 2;
 
-               if( cal_checksum != 0xFF )
+               if ( cal_checksum != 0xFF )
                {
                        /* checksum failed */
                        LOG_ERROR("incorrect record checksum found in S19 file");
index 61a0ae5..4e032f6 100644 (file)
@@ -278,7 +278,7 @@ int mips32_pracc_read_mem(mips_ejtag_t *ejtag_info, uint32_t addr, int size, int
                case 2:
                        return mips32_pracc_read_mem16(ejtag_info, addr, count, (uint16_t*)buf);
                case 4:
-                       if(count==1)
+                       if (count==1)
                                return mips32_pracc_read_u32(ejtag_info, addr, (uint32_t*)buf);
                        else
                                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:
                        return mips32_pracc_write_mem16(ejtag_info, addr, count,(uint16_t*)buf);
                case 4:
-                       if(count==1)
+                       if (count==1)
                                return mips32_pracc_write_u32(ejtag_info, addr, (uint32_t*)buf);
                        else
                                return mips32_pracc_write_mem32(ejtag_info, addr, count, (uint32_t*)buf);
index eebd5fb..5985cfd 100644 (file)
@@ -212,7 +212,7 @@ int mips_ejtag_enter_debug(mips_ejtag_t *ejtag_info)
        ejtag_ctrl = ejtag_info->ejtag_ctrl;
        mips_ejtag_drscan_32(ejtag_info, &ejtag_ctrl);
        LOG_DEBUG("ejtag_ctrl: 0x%8.8" PRIx32 "", ejtag_ctrl);
-       if((ejtag_ctrl & EJTAG_CTRL_BRKST) == 0)
+       if ((ejtag_ctrl & EJTAG_CTRL_BRKST) == 0)
                LOG_DEBUG("Failed to enter Debug Mode!");
 
        return ERROR_OK;
@@ -294,7 +294,7 @@ int mips_ejtag_init(mips_ejtag_t *ejtag_info)
                ejtag_info->impcode & (1<<0)  ? " MIPS64": " MIPS32"
        );
 
-       if((ejtag_info->impcode & (1<<14)) == 0)
+       if ((ejtag_info->impcode & (1<<14)) == 0)
                LOG_DEBUG("EJTAG: DMA Access Mode Support Enabled");
 
        /* set initial state for ejtag control reg */
index 6eb6ad8..be88df8 100644 (file)
@@ -531,7 +531,7 @@ int mips_m4k_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
                {
                        uint32_t verify = 0xffffffff;
                        
-                       if((retval = target_read_memory(target, breakpoint->address, breakpoint->length, 1, breakpoint->orig_instr)) != ERROR_OK)
+                       if ((retval = target_read_memory(target, breakpoint->address, breakpoint->length, 1, breakpoint->orig_instr)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -554,7 +554,7 @@ int mips_m4k_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
                {
                        uint16_t verify = 0xffff;
                        
-                       if((retval = target_read_memory(target, breakpoint->address, breakpoint->length, 1, breakpoint->orig_instr)) != ERROR_OK)
+                       if ((retval = target_read_memory(target, breakpoint->address, breakpoint->length, 1, breakpoint->orig_instr)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -619,7 +619,7 @@ int mips_m4k_unset_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
                        }
                        if (current_instr == MIPS32_SDBBP)
                        {
-                               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;
                                }
@@ -637,7 +637,7 @@ int mips_m4k_unset_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
                        
                        if (current_instr == MIPS16_SDBBP)
                        {
-                               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;
                                }
@@ -750,7 +750,7 @@ int mips_m4k_read_memory(struct target_s *target, uint32_t address, uint32_t siz
 
        /* if noDMA off, use DMAACC mode for memory read */
        int retval;
-       if(ejtag_info->impcode & EJTAG_IMP_NODMA)
+       if (ejtag_info->impcode & EJTAG_IMP_NODMA)
                retval = mips32_pracc_read_mem(ejtag_info, address, size, count, (void *)buffer);
        else
                retval = mips32_dmaacc_read_mem(ejtag_info, address, size, count, (void *)buffer);
@@ -825,7 +825,7 @@ int mips_m4k_write_memory(struct target_s *target, uint32_t address, uint32_t si
        }          
 
        /* if noDMA off, use DMAACC mode for memory write */
-       if(ejtag_info->impcode & EJTAG_IMP_NODMA)
+       if (ejtag_info->impcode & EJTAG_IMP_NODMA)
                return mips32_pracc_write_mem(ejtag_info, address, size, count, (void *)buffer);
        else
                return mips32_dmaacc_write_mem(ejtag_info, address, size, count, (void *)buffer);
index f7af10d..3edfdc0 100644 (file)
@@ -104,7 +104,7 @@ static int oocd_trace_init(etm_context_t *etm_ctx)
 
        oocd_trace->tty_fd = open(oocd_trace->tty, O_RDWR | O_NOCTTY | O_NONBLOCK);
 
-       if(oocd_trace->tty_fd < 0)
+       if (oocd_trace->tty_fd < 0)
        {
                LOG_ERROR("can't open tty");
                return ERROR_ETM_CAPTURE_INIT_FAILED;
index b7917ca..3505f9c 100644 (file)
@@ -144,7 +144,7 @@ const char *target_strerror_safe( int err )
        const Jim_Nvp *n;
 
        n = Jim_Nvp_value2name_simple( nvp_error_target, err );
-       if( n->name == NULL ){
+       if ( n->name == NULL ){
                return "unknown";
        } else {
                return n->name;
@@ -245,7 +245,7 @@ static int max_target_number(void)
        x = -1;
        t = all_targets;
        while( t ){
-               if( x < t->target_number ){
+               if ( x < t->target_number ){
                        x = (t->target_number)+1;
                }
                t = t->next;
@@ -263,7 +263,7 @@ static int new_target_number(void)
        x = -1;
        t = all_targets;
        while(t){
-               if( x < t->target_number ){
+               if ( x < t->target_number ){
                        x = t->target_number;
                }
                t = t->next;
@@ -353,7 +353,7 @@ static target_t *get_target_by_num(int num)
        target_t *target = all_targets;
 
        while (target){
-               if( target->target_number == num ){
+               if ( target->target_number == num ){
                        return target;
                }
                target = target->next;
@@ -429,7 +429,7 @@ int target_process_reset(struct command_context_s *cmd_ctx, enum target_reset_mo
        int retval;
        Jim_Nvp *n;
        n = Jim_Nvp_value2name_simple( nvp_reset_modes, reset_mode );
-       if( n->name == NULL ){
+       if ( n->name == NULL ){
                LOG_ERROR("invalid reset mode");
                return ERROR_FAIL;
        }
@@ -446,7 +446,7 @@ int target_process_reset(struct command_context_s *cmd_ctx, enum target_reset_mo
 
        target_continuous_poll = save_poll;
 
-       if(retval != JIM_OK) {
+       if (retval != JIM_OK) {
                Jim_PrintErrorMessage(interp);
                return ERROR_FAIL;
        }
@@ -685,9 +685,9 @@ int target_init(struct command_context_s *cmd_ctx)
 
        if (all_targets)
        {
-               if((retval = target_register_user_commands(cmd_ctx)) != ERROR_OK)
+               if ((retval = target_register_user_commands(cmd_ctx)) != ERROR_OK)
                        return retval;
-               if((retval = target_register_timer_callback(handle_target, 100, 1, NULL)) != ERROR_OK)
+               if ((retval = target_register_timer_callback(handle_target, 100, 1, NULL)) != ERROR_OK)
                        return retval;
        }
 
@@ -983,7 +983,7 @@ int target_alloc_working_area(struct target_s *target, uint32_t size, working_ar
                {
                        int retval;
                        new_wa->backup = malloc(new_wa->size);
-                       if((retval = target_read_memory(target, new_wa->address, 4, new_wa->size / 4, new_wa->backup)) != ERROR_OK)
+                       if ((retval = target_read_memory(target, new_wa->address, 4, new_wa->size / 4, new_wa->backup)) != ERROR_OK)
                        {
                                free(new_wa->backup);
                                free(new_wa);
@@ -1017,7 +1017,7 @@ int target_free_working_area_restore(struct target_s *target, working_area_t *ar
        if (restore&&target->backup_working_area)
        {
                int retval;
-               if((retval = target_write_memory(target, area->address, 4, area->size / 4, area->backup)) != ERROR_OK)
+               if ((retval = target_write_memory(target, area->address, 4, area->size / 4, area->backup)) != ERROR_OK)
                        return retval;
        }
 
@@ -1504,9 +1504,9 @@ int target_register_user_commands(struct command_context_s *cmd_ctx)
        register_command(cmd_ctx,  NULL, "verify_image", handle_verify_image_command, COMMAND_EXEC, "verify_image <file> [offset] [type]");
        register_command(cmd_ctx,  NULL, "test_image", handle_test_image_command, COMMAND_EXEC, "test_image <file> [offset] [type]");
 
-       if((retval = target_request_register_commands(cmd_ctx)) != ERROR_OK)
+       if ((retval = target_request_register_commands(cmd_ctx)) != ERROR_OK)
                return retval;
-       if((retval = trace_register_commands(cmd_ctx)) != ERROR_OK)
+       if ((retval = trace_register_commands(cmd_ctx)) != ERROR_OK)
                return retval;
 
        return retval;
@@ -1703,7 +1703,7 @@ int handle_target(void *priv)
                if (!powerDropout && !srstAsserted)
                {
                        /* polling may fail silently until the target has been examined */
-                       if((retval = target_poll(target)) != ERROR_OK)
+                       if ((retval = target_poll(target)) != ERROR_OK)
                                return retval;
                }
        }
@@ -1983,7 +1983,7 @@ static int handle_reset_command(struct command_context_s *cmd_ctx, char *cmd, ch
        {
                const Jim_Nvp *n;
                n = Jim_Nvp_name2value_simple( nvp_reset_modes, args[0] );
-               if( (n->name == NULL) || (n->value == RESET_UNKNOWN) ){
+               if ( (n->name == NULL) || (n->value == RESET_UNKNOWN) ){
                        return ERROR_COMMAND_SYNTAX_ERROR;
                }
                reset_mode = n->value;
@@ -2308,7 +2308,7 @@ static int handle_load_image_command(struct command_context_s *cmd_ctx, char *cm
                free(buffer);
        }
 
-       if((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK)
+       if ((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK)
        {
                image_close(&image);
                return retvaltemp;
@@ -2384,10 +2384,10 @@ static int handle_dump_image_command(struct command_context_s *cmd_ctx, char *cm
                address += this_run_size;
        }
 
-       if((retvaltemp = fileio_close(&fileio)) != ERROR_OK)
+       if ((retvaltemp = fileio_close(&fileio)) != ERROR_OK)
                return retvaltemp;
 
-       if((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK)
+       if ((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK)
                return retvaltemp;
 
        if (retval==ERROR_OK)
@@ -2476,13 +2476,13 @@ static int handle_verify_image_command_internal(struct command_context_s *cmd_ct
                        image_calculate_checksum( buffer, buf_cnt, &checksum );
 
                        retval = target_checksum_memory(target, image.sections[i].base_address, buf_cnt, &mem_checksum);
-                       if( retval != ERROR_OK )
+                       if ( retval != ERROR_OK )
                        {
                                free(buffer);
                                break;
                        }
 
-                       if( checksum != mem_checksum )
+                       if ( checksum != mem_checksum )
                        {
                                /* failed crc checksum, fall back to a binary compare */
                                uint8_t *data;
@@ -2538,7 +2538,7 @@ static int handle_verify_image_command_internal(struct command_context_s *cmd_ct
        }
 done:
 
-       if((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK)
+       if ((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK)
        {
                image_close(&image);
                return retvaltemp;
@@ -2938,7 +2938,7 @@ static int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd,
                } else if (target->state == TARGET_RUNNING)
                {
                        /* We want to quickly sample the PC. */
-                       if((retval = target_halt(target)) != ERROR_OK)
+                       if ((retval = target_halt(target)) != ERROR_OK)
                        {
                                free(samples);
                                return retval;
@@ -2958,7 +2958,7 @@ static int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd,
                if ((numSamples>=maxSample) || ((now.tv_sec >= timeout.tv_sec) && (now.tv_usec >= timeout.tv_usec)))
                {
                        command_print(cmd_ctx, "Profiling completed. %d samples.", numSamples);
-                       if((retval = target_poll(target)) != ERROR_OK)
+                       if ((retval = target_poll(target)) != ERROR_OK)
                        {
                                free(samples);
                                return retval;
@@ -2967,7 +2967,7 @@ static int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd,
                        {
                                target_resume(target, 1, 0, 0, 0); /* current pc, addr = 0, do not handle breakpoints, not debugging */
                        }
-                       if((retval = target_poll(target)) != ERROR_OK)
+                       if ((retval = target_poll(target)) != ERROR_OK)
                        {
                                free(samples);
                                return retval;
@@ -3379,7 +3379,7 @@ void target_handle_event( target_t *target, enum target_event e )
 
        done = 0;
        while( teap ){
-               if( teap->event == e ){
+               if ( teap->event == e ){
                        done = 1;
                        LOG_DEBUG( "target: (%d) %s (%s) event: %d (%s) action: %s\n",
                                           target->target_number,
@@ -3395,7 +3395,7 @@ void target_handle_event( target_t *target, enum target_event e )
                }
                teap = teap->next;
        }
-       if( !done ){
+       if ( !done ){
                LOG_DEBUG( "event: %d %s - no action",
                                   e,
                                   Jim_Nvp_value2name_simple( nvp_target_event, e )->name );
@@ -3441,34 +3441,34 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target )
                Jim_SetEmptyResult( goi->interp );
                /* Jim_GetOpt_Debug( goi ); */
 
-               if( target->type->target_jim_configure ){
+               if ( target->type->target_jim_configure ){
                        /* target defines a configure function */
                        /* target gets first dibs on parameters */
                        e = (*(target->type->target_jim_configure))( target, goi );
-                       if( e == JIM_OK ){
+                       if ( e == JIM_OK ){
                                /* more? */
                                continue;
                        }
-                       if( e == JIM_ERR ){
+                       if ( e == JIM_ERR ){
                                /* An error */
                                return e;
                        }
                        /* otherwise we 'continue' below */
                }
                e = Jim_GetOpt_Nvp( goi, nvp_config_opts, &n );
-               if( e != JIM_OK ){
+               if ( e != JIM_OK ){
                        Jim_GetOpt_NvpUnknown( goi, nvp_config_opts, 0 );
                        return e;
                }
                switch( n->value ){
                case TCFG_TYPE:
                        /* not setable */
-                       if( goi->isconfigure ){
+                       if ( goi->isconfigure ){
                                Jim_SetResult_sprintf( goi->interp, "not setable: %s", n->name );
                                return JIM_ERR;
                        } else {
                        no_params:
-                               if( goi->argc != 0 ){
+                               if ( goi->argc != 0 ){
                                        Jim_WrongNumArgs( goi->interp, goi->argc, goi->argv, "NO PARAMS");
                                        return JIM_ERR;
                                }
@@ -3477,24 +3477,24 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target )
                        /* loop for more */
                        break;
                case TCFG_EVENT:
-                       if( goi->argc == 0 ){
+                       if ( goi->argc == 0 ){
                                Jim_WrongNumArgs( goi->interp, goi->argc, goi->argv, "-event ?event-name? ...");
                                return JIM_ERR;
                        }
 
                        e = Jim_GetOpt_Nvp( goi, nvp_target_event, &n );
-                       if( e != JIM_OK ){
+                       if ( e != JIM_OK ){
                                Jim_GetOpt_NvpUnknown( goi, nvp_target_event, 1 );
                                return e;
                        }
 
-                       if( goi->isconfigure ){
-                               if( goi->argc != 1 ){
+                       if ( goi->isconfigure ){
+                               if ( goi->argc != 1 ){
                                        Jim_WrongNumArgs( goi->interp, goi->argc, goi->argv, "-event ?event-name? ?EVENT-BODY?");
                                        return JIM_ERR;
                                }
                        } else {
-                               if( goi->argc != 0 ){
+                               if ( goi->argc != 0 ){
                                        Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event ?event-name?");
                                        return JIM_ERR;
                                }
@@ -3506,20 +3506,20 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target )
                                teap = target->event_action;
                                /* replace existing? */
                                while( teap ){
-                                       if( teap->event == (enum target_event)n->value ){
+                                       if ( teap->event == (enum target_event)n->value ){
                                                break;
                                        }
                                        teap = teap->next;
                                }
 
-                               if( goi->isconfigure ){
-                                       if( teap == NULL ){
+                               if ( goi->isconfigure ){
+                                       if ( teap == NULL ){
                                                /* create new */
                                                teap = calloc( 1, sizeof(*teap) );
                                        }
                                        teap->event = n->value;
                                        Jim_GetOpt_Obj( goi, &o );
-                                       if( teap->body ){
+                                       if ( teap->body ){
                                                Jim_DecrRefCount( interp, teap->body );
                                        }
                                        teap->body  = Jim_DuplicateObj( goi->interp, o );
@@ -3541,7 +3541,7 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target )
                                        Jim_SetEmptyResult(goi->interp);
                                } else {
                                        /* get */
-                                       if( teap == NULL ){
+                                       if ( teap == NULL ){
                                                Jim_SetEmptyResult( goi->interp );
                                        } else {
                                                Jim_SetResult( goi->interp, Jim_DuplicateObj( goi->interp, teap->body ) );
@@ -3552,15 +3552,15 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target )
                        break;
 
                case TCFG_WORK_AREA_VIRT:
-                       if( goi->isconfigure ){
+                       if ( goi->isconfigure ){
                                target_free_all_working_areas(target);
                                e = Jim_GetOpt_Wide( goi, &w );
-                               if( e != JIM_OK ){
+                               if ( e != JIM_OK ){
                                        return e;
                                }
                                target->working_area_virt = w;
                        } else {
-                               if( goi->argc != 0 ){
+                               if ( goi->argc != 0 ){
                                        goto no_params;
                                }
                        }
@@ -3569,15 +3569,15 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target )
                        break;
 
                case TCFG_WORK_AREA_PHYS:
-                       if( goi->isconfigure ){
+                       if ( goi->isconfigure ){
                                target_free_all_working_areas(target);
                                e = Jim_GetOpt_Wide( goi, &w );
-                               if( e != JIM_OK ){
+                               if ( e != JIM_OK ){
                                        return e;
                                }
                                target->working_area_phys = w;
                        } else {
-                               if( goi->argc != 0 ){
+                               if ( goi->argc != 0 ){
                                        goto no_params;
                                }
                        }
@@ -3586,15 +3586,15 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target )
                        break;
 
                case TCFG_WORK_AREA_SIZE:
-                       if( goi->isconfigure ){
+                       if ( goi->isconfigure ){
                                target_free_all_working_areas(target);
                                e = Jim_GetOpt_Wide( goi, &w );
-                               if( e != JIM_OK ){
+                               if ( e != JIM_OK ){
                                        return e;
                                }
                                target->working_area_size = w;
                        } else {
-                               if( goi->argc != 0 ){
+                               if ( goi->argc != 0 ){
                                        goto no_params;
                                }
                        }
@@ -3603,16 +3603,16 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target )
                        break;
 
                case TCFG_WORK_AREA_BACKUP:
-                       if( goi->isconfigure ){
+                       if ( goi->isconfigure ){
                                target_free_all_working_areas(target);
                                e = Jim_GetOpt_Wide( goi, &w );
-                               if( e != JIM_OK ){
+                               if ( e != JIM_OK ){
                                        return e;
                                }
                                /* make this exactly 1 or 0 */
                                target->backup_working_area = (!!w);
                        } else {
-                               if( goi->argc != 0 ){
+                               if ( goi->argc != 0 ){
                                        goto no_params;
                                }
                        }
@@ -3621,20 +3621,20 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target )
                        break;
 
                case TCFG_ENDIAN:
-                       if( goi->isconfigure ){
+                       if ( goi->isconfigure ){
                                e = Jim_GetOpt_Nvp( goi, nvp_target_endian, &n );
-                               if( e != JIM_OK ){
+                               if ( e != JIM_OK ){
                                        Jim_GetOpt_NvpUnknown( goi, nvp_target_endian, 1 );
                                        return e;
                                }
                                target->endianness = n->value;
                        } else {
-                               if( goi->argc != 0 ){
+                               if ( goi->argc != 0 ){
                                        goto no_params;
                                }
                        }
                        n = Jim_Nvp_value2name_simple( nvp_target_endian, target->endianness );
-                       if( n->name == NULL ){
+                       if ( n->name == NULL ){
                                target->endianness = TARGET_LITTLE_ENDIAN;
                                n = Jim_Nvp_value2name_simple( nvp_target_endian, target->endianness );
                        }
@@ -3643,20 +3643,20 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target )
                        break;
 
                case TCFG_VARIANT:
-                       if( goi->isconfigure ){
-                               if( goi->argc < 1 ){
+                       if ( goi->isconfigure ){
+                               if ( goi->argc < 1 ){
                                        Jim_SetResult_sprintf( goi->interp,
                                                                                   "%s ?STRING?",
                                                                                   n->name );
                                        return JIM_ERR;
                                }
-                               if( target->variant ){
+                               if ( target->variant ){
                                        free((void *)(target->variant));
                                }
                                e = Jim_GetOpt_String( goi, &cp, NULL );
                                target->variant = strdup(cp);
                        } else {
-                               if( goi->argc != 0 ){
+                               if ( goi->argc != 0 ){
                                        goto no_params;
                                }
                        }
@@ -3664,22 +3664,22 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target )
                        /* loop for more */
                        break;
                case TCFG_CHAIN_POSITION:
-                       if( goi->isconfigure ){
+                       if ( goi->isconfigure ){
                                Jim_Obj *o;
                                jtag_tap_t *tap;
                                target_free_all_working_areas(target);
                                e = Jim_GetOpt_Obj( goi, &o );
-                               if( e != JIM_OK ){
+                               if ( e != JIM_OK ){
                                        return e;
                                }
                                tap = jtag_tap_by_jim_obj( goi->interp, o );
-                               if( tap == NULL ){
+                               if ( tap == NULL ){
                                        return JIM_ERR;
                                }
                                /* make this exactly 1 or 0 */
                                target->tap = tap;
                        } else {
-                               if( goi->argc != 0 ){
+                               if ( goi->argc != 0 ){
                                        goto no_params;
                                }
                        }
@@ -3756,7 +3756,7 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
 
        /* commands here are in an NVP table */
        e = Jim_GetOpt_Nvp( &goi, target_options, &n );
-       if( e != JIM_OK ){
+       if ( e != JIM_OK ){
                Jim_GetOpt_NvpUnknown( &goi, target_options, 0 );
                return e;
        }
@@ -3765,7 +3765,7 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
 
        switch( n->value ){
        case TS_CMD_CONFIGURE:
-               if( goi.argc < 2 ){
+               if ( goi.argc < 2 ){
                        Jim_WrongNumArgs( goi.interp, goi.argc, goi.argv, "missing: -option VALUE ...");
                        return JIM_ERR;
                }
@@ -3773,7 +3773,7 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                return target_configure( &goi, target );
        case TS_CMD_CGET:
                // some things take params
-               if( goi.argc < 1 ){
+               if ( goi.argc < 1 ){
                        Jim_WrongNumArgs( goi.interp, 0, goi.argv, "missing: ?-option?");
                        return JIM_ERR;
                }
@@ -3789,7 +3789,7 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                 * argv[3] = optional count.
                 */
 
-               if( (goi.argc == 2) || (goi.argc == 3) ){
+               if ( (goi.argc == 2) || (goi.argc == 3) ){
                        /* all is well */
                } else {
                mwx_error:
@@ -3798,17 +3798,17 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                }
 
                e = Jim_GetOpt_Wide( &goi, &a );
-               if( e != JIM_OK ){
+               if ( e != JIM_OK ){
                        goto mwx_error;
                }
 
                e = Jim_GetOpt_Wide( &goi, &b );
-               if( e != JIM_OK ){
+               if ( e != JIM_OK ){
                        goto mwx_error;
                }
                if (goi.argc == 3) {
                        e = Jim_GetOpt_Wide( &goi, &c );
-                       if( e != JIM_OK ){
+                       if ( e != JIM_OK ){
                                goto mwx_error;
                        }
                } else {
@@ -3831,7 +3831,7 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                }
                for( x = 0 ; x < c ; x++ ){
                        e = target_write_memory( target, a, b, 1, target_buf );
-                       if( e != ERROR_OK ){
+                       if ( e != ERROR_OK ){
                                Jim_SetResult_sprintf( interp, "Error writing @ 0x%08x: %d\n", (int)(a), e );
                                return JIM_ERR;
                        }
@@ -3849,17 +3849,17 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                 * argv[1] = address
                 * argv[2] = optional count
                 */
-               if( (goi.argc == 2) || (goi.argc == 3) ){
+               if ( (goi.argc == 2) || (goi.argc == 3) ){
                        Jim_SetResult_sprintf( goi.interp, "expected: %s ADDR [COUNT]", n->name );
                        return JIM_ERR;
                }
                e = Jim_GetOpt_Wide( &goi, &a );
-               if( e != JIM_OK ){
+               if ( e != JIM_OK ){
                        return JIM_ERR;
                }
-               if( goi.argc ){
+               if ( goi.argc ){
                        e = Jim_GetOpt_Wide( &goi, &c );
-                       if( e != JIM_OK ){
+                       if ( e != JIM_OK ){
                                return JIM_ERR;
                        }
                } else {
@@ -3883,11 +3883,11 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                /* count is now in 'BYTES' */
                while( c > 0 ){
                        y = c;
-                       if( y > 16 ){
+                       if ( y > 16 ){
                                y = 16;
                        }
                        e = target_read_memory( target, a, b, y / b, target_buf );
-                       if( e != ERROR_OK ){
+                       if ( e != ERROR_OK ){
                                Jim_SetResult_sprintf( interp, "error reading target @ 0x%08lx", (int)(a) );
                                return JIM_ERR;
                        }
@@ -3925,7 +3925,7 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                        }
                        /* ascii-ify the bytes */
                        for( x = 0 ; x < y ; x++ ){
-                               if( (target_buf[x] >= 0x20) &&
+                               if ( (target_buf[x] >= 0x20) &&
                                        (target_buf[x] <= 0x7e) ){
                                        /* good */
                                } else {
@@ -3954,31 +3954,31 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                return target_array2mem( goi.interp, target, goi.argc, goi.argv );
                break;
        case TS_CMD_EXAMINE:
-               if( goi.argc ){
+               if ( goi.argc ){
                        Jim_WrongNumArgs( goi.interp, 2, argv, "[no parameters]");
                        return JIM_ERR;
                }
                if (!target->tap->enabled)
                        goto err_tap_disabled;
                e = target->type->examine( target );
-               if( e != ERROR_OK ){
+               if ( e != ERROR_OK ){
                        Jim_SetResult_sprintf( interp, "examine-fails: %d", e );
                        return JIM_ERR;
                }
                return JIM_OK;
        case TS_CMD_POLL:
-               if( goi.argc ){
+               if ( goi.argc ){
                        Jim_WrongNumArgs( goi.interp, 2, argv, "[no parameters]");
                        return JIM_ERR;
                }
                if (!target->tap->enabled)
                        goto err_tap_disabled;
-               if( !(target_was_examined(target)) ){
+               if ( !(target_was_examined(target)) ){
                        e = ERROR_TARGET_NOT_EXAMINED;
                } else {
                        e = target->type->poll( target );
                }
-               if( e != ERROR_OK ){
+               if ( e != ERROR_OK ){
                        Jim_SetResult_sprintf( interp, "poll-fails: %d", e );
                        return JIM_ERR;
                } else {
@@ -3986,18 +3986,18 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                }
                break;
        case TS_CMD_RESET:
-               if( goi.argc != 2 ){
+               if ( goi.argc != 2 ){
                        Jim_WrongNumArgs( interp, 2, argv, "t|f|assert|deassert BOOL");
                        return JIM_ERR;
                }
                e = Jim_GetOpt_Nvp( &goi, nvp_assert, &n );
-               if( e != JIM_OK ){
+               if ( e != JIM_OK ){
                        Jim_GetOpt_NvpUnknown( &goi, nvp_assert, 1 );
                        return e;
                }
                /* the halt or not param */
                e = Jim_GetOpt_Wide( &goi, &a);
-               if( e != JIM_OK ){
+               if ( e != JIM_OK ){
                        return e;
                }
                if (!target->tap->enabled)
@@ -4008,14 +4008,14 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                target_free_all_working_areas_restore(target, 0);
 
                /* do the assert */
-               if( n->value == NVP_ASSERT ){
+               if ( n->value == NVP_ASSERT ){
                        target->type->assert_reset( target );
                } else {
                        target->type->deassert_reset( target );
                }
                return JIM_OK;
        case TS_CMD_HALT:
-               if( goi.argc ){
+               if ( goi.argc ){
                        Jim_WrongNumArgs( goi.interp, 0, argv, "halt [no parameters]");
                        return JIM_ERR;
                }
@@ -4025,23 +4025,23 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                return JIM_OK;
        case TS_CMD_WAITSTATE:
                /* params:  <name>  statename timeoutmsecs */
-               if( goi.argc != 2 ){
+               if ( goi.argc != 2 ){
                        Jim_SetResult_sprintf( goi.interp, "%s STATENAME TIMEOUTMSECS", n->name );
                        return JIM_ERR;
                }
                e = Jim_GetOpt_Nvp( &goi, nvp_target_state, &n );
-               if( e != JIM_OK ){
+               if ( e != JIM_OK ){
                        Jim_GetOpt_NvpUnknown( &goi, nvp_target_state,1 );
                        return e;
                }
                e = Jim_GetOpt_Wide( &goi, &a );
-               if( e != JIM_OK ){
+               if ( e != JIM_OK ){
                        return e;
                }
                if (!target->tap->enabled)
                        goto err_tap_disabled;
                e = target_wait_state( target, n->value, a );
-               if( e != ERROR_OK ){
+               if ( e != ERROR_OK ){
                        Jim_SetResult_sprintf( goi.interp,
                                                                   "target: %s wait %s fails (%d) %s",
                                                                   target->cmd_name,
@@ -4074,7 +4074,7 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                        return JIM_OK;
                }
        case TS_CMD_CURSTATE:
-               if( goi.argc != 0 ){
+               if ( goi.argc != 0 ){
                        Jim_WrongNumArgs( goi.interp, 0, argv, "[no parameters]");
                        return JIM_ERR;
                }
@@ -4082,12 +4082,12 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                                                         Jim_Nvp_value2name_simple(nvp_target_state,target->state)->name,-1);
                return JIM_OK;
        case TS_CMD_INVOKE_EVENT:
-               if( goi.argc != 1 ){
+               if ( goi.argc != 1 ){
                        Jim_SetResult_sprintf( goi.interp, "%s ?EVENTNAME?",n->name);
                        return JIM_ERR;
                }
                e = Jim_GetOpt_Nvp( &goi, nvp_target_event, &n );
-               if( e != JIM_OK ){
+               if ( e != JIM_OK ){
                        Jim_GetOpt_NvpUnknown( &goi, nvp_target_event, 1 );
                        return e;
                }
@@ -4113,7 +4113,7 @@ static int target_create( Jim_GetOptInfo *goi )
        struct command_context_s *cmd_ctx;
 
        cmd_ctx = Jim_GetAssocData(goi->interp, "context");
-       if( goi->argc < 3 ){
+       if ( goi->argc < 3 ){
                Jim_WrongNumArgs( goi->interp, 1, goi->argv, "?name? ?type? ..options...");
                return JIM_ERR;
        }
@@ -4122,7 +4122,7 @@ static int target_create( Jim_GetOptInfo *goi )
        Jim_GetOpt_Obj( goi, &new_cmd );
        /* does this command exist? */
        cmd = Jim_GetCommand( goi->interp, new_cmd, JIM_ERRMSG );
-       if( cmd ){
+       if ( cmd ){
                cp = Jim_GetString( new_cmd, NULL );
                Jim_SetResult_sprintf(goi->interp, "Command/target: %s Exists", cp);
                return JIM_ERR;
@@ -4133,15 +4133,15 @@ static int target_create( Jim_GetOptInfo *goi )
        cp = cp2;
        /* now does target type exist */
        for( x = 0 ; target_types[x] ; x++ ){
-               if( 0 == strcmp( cp, target_types[x]->name ) ){
+               if ( 0 == strcmp( cp, target_types[x]->name ) ){
                        /* found */
                        break;
                }
        }
-       if( target_types[x] == NULL ){
+       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++ ){
-                       if( target_types[x+1] ){
+                       if ( target_types[x+1] ){
                                Jim_AppendStrings( goi->interp,
                                                                   Jim_GetResult(goi->interp),
                                                                   target_types[x]->name,
@@ -4209,13 +4209,13 @@ static int target_create( Jim_GetOptInfo *goi )
                e=JIM_ERR;
        }
 
-       if( e != JIM_OK ){
+       if ( e != JIM_OK ){
                free( target->type );
                free( target );
                return e;
        }
 
-       if( target->endianness == TARGET_ENDIAN_UNKNOWN ){
+       if ( target->endianness == TARGET_ENDIAN_UNKNOWN ){
                /* default endian to little if not specified */
                target->endianness = TARGET_LITTLE_ENDIAN;
        }
@@ -4225,10 +4225,10 @@ static int target_create( Jim_GetOptInfo *goi )
                target->variant = strdup("");
 
        /* create the target specific commands */
-       if( target->type->register_commands ){
+       if ( target->type->register_commands ){
                (*(target->type->register_commands))( cmd_ctx );
        }
-       if( target->type->target_create ){
+       if ( target->type->target_create ){
                (*(target->type->target_create))( target, goi->interp );
        }
 
@@ -4285,14 +4285,14 @@ static int jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
 
        Jim_GetOpt_Setup( &goi, interp, argc-1, argv+1 );
 
-       if( goi.argc == 0 ){
+       if ( goi.argc == 0 ){
                Jim_WrongNumArgs(interp, 1, argv, "missing: command ...");
                return JIM_ERR;
        }
 
        /* Jim_GetOpt_Debug( &goi ); */
        r = Jim_GetOpt_Enum( &goi, target_cmds, &x   );
-       if( r != JIM_OK ){
+       if ( r != JIM_OK ){
                return r;
        }
 
@@ -4301,14 +4301,14 @@ static int jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                Jim_Panic(goi.interp,"Why am I here?");
                return JIM_ERR;
        case TG_CMD_CURRENT:
-               if( goi.argc != 0 ){
+               if ( goi.argc != 0 ){
                        Jim_WrongNumArgs( goi.interp, 1, goi.argv, "Too many parameters");
                        return JIM_ERR;
                }
                Jim_SetResultString( goi.interp, get_current_target( cmd_ctx )->cmd_name, -1 );
                return JIM_OK;
        case TG_CMD_TYPES:
-               if( goi.argc != 0 ){
+               if ( goi.argc != 0 ){
                        Jim_WrongNumArgs( goi.interp, 1, goi.argv, "Too many parameters" );
                        return JIM_ERR;
                }
@@ -4320,7 +4320,7 @@ static int jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                }
                return JIM_OK;
        case TG_CMD_NAMES:
-               if( goi.argc != 0 ){
+               if ( goi.argc != 0 ){
                        Jim_WrongNumArgs( goi.interp, 1, goi.argv, "Too many parameters" );
                        return JIM_ERR;
                }
@@ -4334,25 +4334,25 @@ static int jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                }
                return JIM_OK;
        case TG_CMD_CREATE:
-               if( goi.argc < 3 ){
+               if ( goi.argc < 3 ){
                        Jim_WrongNumArgs( goi.interp, goi.argc, goi.argv, "?name  ... config options ...");
                        return JIM_ERR;
                }
                return target_create( &goi );
                break;
        case TG_CMD_NUMBER:
-               if( goi.argc != 1 ){
+               if ( goi.argc != 1 ){
                        Jim_SetResult_sprintf( goi.interp, "expected: target number ?NUMBER?");
                        return JIM_ERR;
                }
                e = Jim_GetOpt_Wide( &goi, &w );
-               if( e != JIM_OK ){
+               if ( e != JIM_OK ){
                        return JIM_ERR;
                }
                {
                        target_t *t;
                        t = get_target_by_num(w);
-                       if( t == NULL ){
+                       if ( t == NULL ){
                                Jim_SetResult_sprintf( goi.interp,"Target: number %d does not exist", (int)(w));
                                return JIM_ERR;
                        }
@@ -4360,7 +4360,7 @@ static int jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
                        return JIM_OK;
                }
        case TG_CMD_COUNT:
-               if( goi.argc != 0 ){
+               if ( goi.argc != 0 ){
                        Jim_WrongNumArgs( goi.interp, 0, goi.argv, "<no parameters>");
                        return JIM_ERR;
                }
index 058e8d7..6c04b97 100644 (file)
@@ -2189,12 +2189,12 @@ int xscale_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
                if (breakpoint->length == 4)
                {
                        /* keep the original instruction in target endianness */
-                       if((retval = target_read_memory(target, breakpoint->address, 4, 1, breakpoint->orig_instr)) != ERROR_OK)
+                       if ((retval = target_read_memory(target, breakpoint->address, 4, 1, breakpoint->orig_instr)) != ERROR_OK)
                        {
                                return retval;
                        }
                        /* write the original instruction in target endianness (arm7_9->arm_bkpt is host endian) */
-                       if((retval = target_write_u32(target, breakpoint->address, xscale->arm_bkpt)) != ERROR_OK)
+                       if ((retval = target_write_u32(target, breakpoint->address, xscale->arm_bkpt)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -2202,12 +2202,12 @@ int xscale_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
                else
                {
                        /* keep the original instruction in target endianness */
-                       if((retval = target_read_memory(target, breakpoint->address, 2, 1, breakpoint->orig_instr)) != ERROR_OK)
+                       if ((retval = target_read_memory(target, breakpoint->address, 2, 1, breakpoint->orig_instr)) != ERROR_OK)
                        {
                                return retval;
                        }
                        /* write the original instruction in target endianness (arm7_9->arm_bkpt is host endian) */
-                       if((retval = target_write_u32(target, breakpoint->address, xscale->thumb_bkpt)) != ERROR_OK)
+                       if ((retval = target_write_u32(target, breakpoint->address, xscale->thumb_bkpt)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -2286,14 +2286,14 @@ int xscale_unset_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
                /* restore original instruction (kept in target endianness) */
                if (breakpoint->length == 4)
                {
-                       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;
                        }
                }
                else
                {
-                       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;
                        }
@@ -3606,7 +3606,7 @@ int xscale_handle_cp15(command_context_t *cmd_ctx, char *cmd, char **args, int a
        }
        uint32_t reg_no = 0;
        reg_t *reg = NULL;
-       if(argc > 0)
+       if (argc > 0)
        {
                reg_no = strtoul(args[0], NULL, 0);
                /*translate from xscale cp15 register no to openocd register*/
@@ -3643,7 +3643,7 @@ int xscale_handle_cp15(command_context_t *cmd_ctx, char *cmd, char **args, int a
                reg = &xscale->reg_cache->reg_list[reg_no];
 
        }
-       if(argc == 1)
+       if (argc == 1)
        {
                uint32_t value;
 
@@ -3652,7 +3652,7 @@ int xscale_handle_cp15(command_context_t *cmd_ctx, char *cmd, char **args, int a
                value = buf_get_u32(reg->value, 0, 32);
                command_print(cmd_ctx, "%s (/%i): 0x%" PRIx32 "", reg->name, (int)(reg->size), value);
        }
-       else if(argc == 2)
+       else if (argc == 2)
        {
 
                uint32_t value = strtoul(args[1], NULL, 0);
index 4df4df9..6356843 100644 (file)
@@ -327,9 +327,9 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha
                                xsdrsize = be_to_h_u32(xsdrsize_buf);
                                LOG_DEBUG("XSDRSIZE %d", xsdrsize);
 
-                               if( dr_out_buf ) free(dr_out_buf);
-                               if( dr_in_buf)   free(dr_in_buf);
-                               if( dr_in_mask)  free(dr_in_mask);
+                               if ( dr_out_buf ) free(dr_out_buf);
+                               if ( dr_in_buf)   free(dr_in_buf);
+                               if ( dr_in_mask)  free(dr_in_mask);
 
                                dr_out_buf = malloc((xsdrsize + 7) / 8);
                                dr_in_buf = malloc((xsdrsize + 7) / 8);
@@ -354,7 +354,7 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha
 
                                if (opcode == XSDRTDO)
                                {
-                                       if(xsvf_read_buffer(xsdrsize, xsvf_fd, dr_in_buf)  != ERROR_OK )
+                                       if (xsvf_read_buffer(xsdrsize, xsvf_fd, dr_in_buf)  != ERROR_OK )
                                        {
                                                do_abort = 1;
                                                break;
@@ -370,7 +370,7 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha
                                {
                                        scan_field_t field;
 
-                                       if( attempt>0 )
+                                       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
@@ -505,7 +505,7 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha
                                        the XSTATE.
                                */
 
-                               if( jtag_add_statemove( mystate ) != ERROR_OK )
+                               if ( jtag_add_statemove( mystate ) != ERROR_OK )
                                {
                                        /*      For special states known as stable states
                                                (Test-Logic-Reset, Run-Test/Idle, Pause-DR, Pause- IR),
@@ -538,9 +538,9 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha
                        }
 
                        /* see page 22 of XSVF spec */
-                       if( uc == 0 )
+                       if ( uc == 0 )
                                xendir = TAP_IDLE;
-                       else if( uc == 1 )
+                       else if ( uc == 1 )
                                xendir = TAP_IRPAUSE;
                        else
                        {
@@ -561,9 +561,9 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha
                        }
 
                        /* see page 22 of XSVF spec */
-                       if( uc == 0 )
+                       if ( uc == 0 )
                                xenddr = TAP_IDLE;
-                       else if( uc == 1 )
+                       else if ( uc == 1 )
                                xenddr = TAP_DRPAUSE;
                        else
                        {
@@ -583,7 +583,7 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha
                                int bitcount;
                                tap_state_t my_end_state = xruntest ? TAP_IDLE : xendir;
 
-                               if( opcode == XSIR )
+                               if ( opcode == XSIR )
                                {
                                        /* one byte bitcount */
                                        if (read(xsvf_fd, short_buf, 1) < 0)
@@ -642,7 +642,7 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha
 
                                        /* LOG_DEBUG("FLUSHING QUEUE"); */
                                        result = jtag_execute_queue();
-                                       if(result != ERROR_OK)
+                                       if (result != ERROR_OK)
                                        {
                                                tdo_mismatch = 1;
                                        }
@@ -864,7 +864,7 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha
 
                                        /* LOG_DEBUG("FLUSHING QUEUE"); */
                                        result = jtag_execute_queue();
-                                       if(result == ERROR_OK)
+                                       if (result == ERROR_OK)
                                        {
                                                matched = 1;
                                                break;