]> git.sur5r.net Git - openocd/commitdiff
- Fixes '=' whitespace
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 23 Jun 2009 22:42:54 +0000 (22:42 +0000)
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 23 Jun 2009 22:42:54 +0000 (22:42 +0000)
- Replace ')\(=\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\(=\)(' with '\1 \2 ('.
- Replace '\(\w\)\(=\)\(\w\)' with '\1 \2 \3'.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2372 b42882b7-edfa-0310-969c-e2dbd0fdcd60

73 files changed:
src/ecosboard.c
src/flash/at91sam7.c
src/flash/cfi.c
src/flash/ecos.c
src/flash/flash.c
src/flash/flash.h
src/flash/lpc2000.c
src/flash/mflash.c
src/flash/ocl.c
src/flash/ocl/at91sam7x/main.c
src/flash/ocl/at91sam7x/samflash.c
src/flash/pic32mx.c
src/flash/stm32x.c
src/flash/str9x.c
src/flash/tms470.c
src/helper/binarybuffer.h
src/helper/command.c
src/helper/configuration.c
src/helper/ioutil.c
src/helper/jim.c
src/helper/jim.h
src/helper/log.c
src/helper/options.c
src/helper/time_support.c
src/jtag/bitbang.c
src/jtag/commands.c
src/jtag/commands.h
src/jtag/core.c
src/jtag/driver.c
src/jtag/dummy.c
src/jtag/ft2232.c
src/jtag/gw16012.c
src/jtag/interface.h
src/jtag/jlink.c
src/jtag/minidummy/minidummy.c
src/jtag/parport.c
src/jtag/presto.c
src/jtag/rlink/rlink.c
src/jtag/tcl.c
src/jtag/usbprog.c
src/jtag/zy1000/jtag_minidriver.h
src/jtag/zy1000/zy1000.c
src/openocd.c
src/pld/virtex2.c
src/server/gdb_server.c
src/server/httpd.c
src/server/server.c
src/server/telnet_server.c
src/target/arm11_dbgtap.c
src/target/arm720t.c
src/target/arm7_9_common.c
src/target/arm7tdmi.c
src/target/arm920t.c
src/target/arm926ejs.c
src/target/arm9tdmi.c
src/target/arm_adi_v5.c
src/target/arm_jtag.h
src/target/armv4_5.c
src/target/armv4_5.h
src/target/armv7m.c
src/target/cortex_m3.c
src/target/embeddedice.c
src/target/etb.c
src/target/etm.c
src/target/image.c
src/target/mips32_dmaacc.c
src/target/mips32_pracc.c
src/target/mips_m4k.c
src/target/target.c
src/target/target.h
src/target/xscale.c
src/xsvf/xsvf.c
testing/examples/cortex/test.c

index d6bb0a4016a5cac3d3e7da1f5cbd6d26d0cece99..df92ce8c1400401aae9c853d501c4b3b5e107c1e 100644 (file)
@@ -975,13 +975,13 @@ int main(int argc, char *argv[])
        }
 
        mkdir(zylin_config_dir, 0777);
-       char *dirname=alloc_printf("%s/target", zylin_config_dir);
+       char *dirname = alloc_printf("%s/target", zylin_config_dir);
        mkdir(dirname, 0777);
        free(dirname);
-       dirname=alloc_printf("%s/board", zylin_config_dir);
+       dirname = alloc_printf("%s/board", zylin_config_dir);
        mkdir(dirname, 0777);
        free(dirname);
-       dirname=alloc_printf("%s/event", zylin_config_dir);
+       dirname = alloc_printf("%s/event", zylin_config_dir);
        mkdir(dirname, 0777);
        free(dirname);
 
@@ -1036,7 +1036,7 @@ int main(int argc, char *argv[])
        if (logAllToSerial)
        {
                diag_printf(
-                                "%s/logserial=1 => sending log output to serial port using \"debug_level 3\" as default.\n", zylin_config_dir);
+                                "%s/logserial = 1 => sending log output to serial port using \"debug_level 3\" as default.\n", zylin_config_dir);
                command_run_line(cmd_ctx, "debug_level 3");
        }
 
index 8b51b95bdf5ce2864c4e6a4fba28ccb185fb0b54..6fb3440d23524905a31b817269c4bde2ca87fc5e 100644 (file)
@@ -232,10 +232,10 @@ static void at91sam7_set_flash_mode(flash_bank_t *bank, int mode)
                if (fmcn > 0xFF)
                        fmcn = 0xFF;
 
-               /* Only allow fmcn=0 if clock period is > 30 us = 33kHz. */
+               /* Only allow fmcn = 0 if clock period is > 30 us = 33kHz. */
                if (at91sam7_info->mck_freq <= 33333ul)
                        fmcn = 0;
-               /* Only allow fws=0 if clock frequency is < 30 MHz. */
+               /* Only allow fws = 0 if clock frequency is < 30 MHz. */
                if (at91sam7_info->mck_freq > 30000000ul)
                        fws = 1;
 
@@ -550,7 +550,7 @@ static int at91sam7_read_part_info(struct flash_bank_s *bank)
        /* calculate bank size  */
        bank_size = sectors_num * pages_per_sector * page_size;
 
-       for (bnk=0; bnk<banks_num; bnk++)
+       for (bnk = 0; bnk<banks_num; bnk++)
        {
                if (bnk > 0)
                {
@@ -575,7 +575,7 @@ static int at91sam7_read_part_info(struct flash_bank_s *bank)
 
                /* allocate sectors */
                t_bank->sectors = malloc(sectors_num * sizeof(flash_sector_t));
-               for (sec=0; sec<sectors_num; sec++)
+               for (sec = 0; sec<sectors_num; sec++)
                {
                        t_bank->sectors[sec].offset = sec * pages_per_sector * page_size;
                        t_bank->sectors[sec].size = pages_per_sector * page_size;
@@ -639,7 +639,7 @@ static int at91sam7_erase_check(struct flash_bank_s *bank)
        at91sam7_set_flash_mode(bank, FMR_TIMING_FLASH);
 
        fast_check = 1;
-       for (nSector=0; nSector<bank->num_sectors; nSector++)
+       for (nSector = 0; nSector<bank->num_sectors; nSector++)
        {
                retval = target_blank_check_memory(target, bank->base+bank->sectors[nSector].offset,
                        bank->sectors[nSector].size, &blank);
@@ -662,7 +662,7 @@ static int at91sam7_erase_check(struct flash_bank_s *bank)
        LOG_USER("Running slow fallback erase check - add working memory");
 
        buffer = malloc(bank->sectors[0].size);
-       for (nSector=0; nSector<bank->num_sectors; nSector++)
+       for (nSector = 0; nSector<bank->num_sectors; nSector++)
        {
                bank->sectors[nSector].is_erased = 1;
                retval = target_read_memory(target, bank->base+bank->sectors[nSector].offset, 4,
@@ -670,7 +670,7 @@ static int at91sam7_erase_check(struct flash_bank_s *bank)
                if (retval != ERROR_OK)
                        return retval;
 
-               for (nByte=0; nByte<bank->sectors[nSector].size; nByte++)
+               for (nByte = 0; nByte<bank->sectors[nSector].size; nByte++)
                {
                        if (buffer[nByte] != 0xFF)
                        {
@@ -705,7 +705,7 @@ static int at91sam7_protect_check(struct flash_bank_s *bank)
        at91sam7_info->lockbits = (status >> 16);
 
        at91sam7_info->num_lockbits_on = 0;
-       for (lock_pos=0; lock_pos<bank->num_sectors; lock_pos++)
+       for (lock_pos = 0; lock_pos<bank->num_sectors; lock_pos++)
        {
                if ( ((status >> (16+lock_pos))&(0x0001)) == 1)
                {
@@ -723,7 +723,7 @@ static int at91sam7_protect_check(struct flash_bank_s *bank)
        at91sam7_info->nvmbits = (status >> 8)&0xFF;
 
        at91sam7_info->num_nvmbits_on = 0;
-       for (gpnvm_pos=0; gpnvm_pos<at91sam7_info->num_nvmbits; gpnvm_pos++)
+       for (gpnvm_pos = 0; gpnvm_pos<at91sam7_info->num_nvmbits; gpnvm_pos++)
        {
                if ( ((status >> (8+gpnvm_pos))&(0x01)) == 1)
                {
@@ -809,7 +809,7 @@ static int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char *
        /* calculate bank size  */
        bank_size = num_sectors * pages_per_sector * page_size;
 
-       for (bnk=0; bnk<banks_num; bnk++)
+       for (bnk = 0; bnk<banks_num; bnk++)
        {
                if (bnk > 0)
                {
@@ -834,7 +834,7 @@ static int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char *
 
                /* allocate sectors */
                t_bank->sectors = malloc(num_sectors * sizeof(flash_sector_t));
-               for (sec=0; sec<num_sectors; sec++)
+               for (sec = 0; sec<num_sectors; sec++)
                {
                        t_bank->sectors[sec].offset = sec * pages_per_sector * page_size;
                        t_bank->sectors[sec].size = pages_per_sector * page_size;
@@ -902,7 +902,7 @@ static int at91sam7_erase(struct flash_bank_s *bank, int first, int last)
                /* allocate and clean buffer  */
                nbytes = (last - first + 1) * bank->sectors[first].size;
                buffer = malloc(nbytes * sizeof(uint8_t));
-               for (pos=0; pos<nbytes; pos++)
+               for (pos = 0; pos<nbytes; pos++)
                {
                        buffer[pos] = 0xFF;
                }
@@ -916,7 +916,7 @@ static int at91sam7_erase(struct flash_bank_s *bank, int first, int last)
        }
 
        /* mark erased sectors */
-       for (sec=first; sec <= last; sec++)
+       for (sec = first; sec <= last; sec++)
        {
                bank->sectors[sec].is_erased = 1;
        }
@@ -952,7 +952,7 @@ static int at91sam7_protect(struct flash_bank_s *bank, int set, int first, int l
        at91sam7_read_clock_info(bank);
        at91sam7_set_flash_mode(bank, FMR_TIMING_NVBITS);
 
-       for (sector=first; sector <= last; sector++)
+       for (sector = first; sector <= last; sector++)
        {
                if (set)
                        cmd = SLB;
@@ -1016,7 +1016,7 @@ static int at91sam7_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t o
        at91sam7_read_clock_info(bank);
        at91sam7_set_flash_mode(bank, FMR_TIMING_FLASH);
 
-       for (pagen=first_page; pagen<last_page; pagen++)
+       for (pagen = first_page; pagen<last_page; pagen++)
        {
                if (bytes_remaining<dst_min_alignment)
                        count = bytes_remaining;
index 4cd5f4dc9eccef2e6a0836d4b5d722a391638114..1f6043e4447237bd0190b74e68c993b37fb2ac5a 100644 (file)
@@ -212,7 +212,7 @@ static uint16_t cfi_query_u16(flash_bank_t *bank, int sector, uint32_t offset)
        if (cfi_info->x16_as_x8)
        {
                uint8_t i;
-               for (i=0;i<2;i++)
+               for (i = 0;i<2;i++)
                        target_read_memory(target, flash_address(bank, sector, offset+i), bank->bus_width, 1,
                                &data[i*bank->bus_width] );
        }
@@ -234,7 +234,7 @@ static uint32_t cfi_query_u32(flash_bank_t *bank, int sector, uint32_t offset)
        if (cfi_info->x16_as_x8)
        {
                uint8_t i;
-               for (i=0;i<4;i++)
+               for (i = 0;i<4;i++)
                        target_read_memory(target, flash_address(bank, sector, offset+i), bank->bus_width, 1,
                                &data[i*bank->bus_width] );
        }
@@ -1011,7 +1011,7 @@ static void cfi_add_byte(struct flash_bank_s *bank, uint8_t *word, uint8_t byte)
 static void cfi_fix_code_endian(target_t *target, uint8_t *dest, const uint32_t *src, uint32_t count)
 {
        uint32_t i;
-       for (i=0; i< count; i++)
+       for (i = 0; i< count; i++)
        {
                target_buffer_set_u32(target, dest, *src);
                dest += 4;
@@ -1452,7 +1452,7 @@ static int cfi_spansion_write_block(struct flash_bank_s *bank, uint8_t *buffer,
                cfi_fix_code_endian(target, target_code, src, target_code_size / 4);
 
                /* allocate working area */
-               retval=target_alloc_working_area(target, target_code_size,
+               retval = target_alloc_working_area(target, target_code_size,
                                &cfi_info->write_algorithm);
                if (retval != ERROR_OK)
                {
@@ -1987,7 +1987,7 @@ int cfi_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint3
                                                buffer += buffersize;
                                                write_p += buffersize;
                                                count -= buffersize;
-                                               fallback=0;
+                                               fallback = 0;
                                        }
                                }
                                /* try the slow way? */
index ec3b3c13edfcdaa747541304afe175b6f5d6eba1..686a63fbdc33a9be418cf54dc3d5f0419e16e1ee 100644 (file)
@@ -66,7 +66,7 @@ typedef struct ecosflash_flash_bank_s
        uint32_t start_address;
 } ecosflash_flash_bank_t;
 
-static const int sectorSize=0x10000;
+static const int sectorSize = 0x10000;
 
 char *
 flash_errmsg(int err);
@@ -145,7 +145,7 @@ static int ecosflash_flash_bank_command(struct command_context_s *cmd_ctx, char
                exit(-1);
        }
        bank->driver_priv = info;
-       info->driverPath=strdup(args[6]);
+       info->driverPath = strdup(args[6]);
 
        /* eCos flash sector sizes are not exposed to OpenOCD, use 0x10000 as
         * a way to improve impeadance matach between OpenOCD and eCos flash
@@ -153,7 +153,7 @@ static int ecosflash_flash_bank_command(struct command_context_s *cmd_ctx, char
         */
        int i = 0;
        uint32_t offset = 0;
-       bank->num_sectors=bank->size/sectorSize;
+       bank->num_sectors = bank->size/sectorSize;
        bank->sectors = malloc(sizeof(flash_sector_t) * bank->num_sectors);
        for (i = 0; i < bank->num_sectors; i++)
        {
@@ -181,15 +181,15 @@ static int loadDriver(ecosflash_flash_bank_t *info)
 
        image.base_address_set = 0;
        image.start_address_set = 0;
-       target_t *target=info->target;
+       target_t *target = info->target;
        int retval;
 
-       if ((retval=image_open(&image, info->driverPath, NULL)) != ERROR_OK)
+       if ((retval = image_open(&image, info->driverPath, NULL)) != ERROR_OK)
        {
                return retval;
        }
 
-       info->start_address=image.start_address;
+       info->start_address = image.start_address;
 
        image_size = 0x0;
        int i;
@@ -215,12 +215,12 @@ static int loadDriver(ecosflash_flash_bank_t *info)
        return ERROR_OK;
 }
 
-static int const OFFSET_ERASE=0x0;
-static int const OFFSET_ERASE_SIZE=0x8;
-static int const OFFSET_FLASH=0xc;
-static int const OFFSET_FLASH_SIZE=0x8;
-static int const OFFSET_GET_WORKAREA=0x18;
-static int const OFFSET_GET_WORKAREA_SIZE=0x4;
+static int const OFFSET_ERASE = 0x0;
+static int const OFFSET_ERASE_SIZE = 0x8;
+static int const OFFSET_FLASH = 0xc;
+static int const OFFSET_FLASH_SIZE = 0x8;
+static int const OFFSET_GET_WORKAREA = 0x18;
+static int const OFFSET_GET_WORKAREA_SIZE = 0x4;
 
 static int runCode(ecosflash_flash_bank_t *info,
                uint32_t codeStart, uint32_t codeStop, uint32_t r0, uint32_t r1, uint32_t r2,
@@ -228,7 +228,7 @@ static int runCode(ecosflash_flash_bank_t *info,
                /* timeout in ms */
                int timeout)
 {
-       target_t *target=info->target;
+       target_t *target = info->target;
 
        reg_param_t reg_params[3];
        armv4_5_algorithm_t armv4_5_info;
@@ -254,7 +254,7 @@ static int runCode(ecosflash_flash_bank_t *info,
                return retval;
        }
 
-       *result=buf_get_u32(reg_params[0].value, 0, 32);
+       *result = buf_get_u32(reg_params[0].value, 0, 32);
 
        destroy_reg_param(&reg_params[0]);
        destroy_reg_param(&reg_params[1]);
@@ -268,12 +268,12 @@ static int eCosBoard_erase(ecosflash_flash_bank_t *info, uint32_t address, uint3
        int retval;
        int timeout = (len / 20480 + 1) * 1000; /*asume 20 KB/s*/
 
-       retval=loadDriver(info);
+       retval = loadDriver(info);
        if (retval != ERROR_OK)
                return retval;
 
        uint32_t flashErr;
-       retval=runCode(info,
+       retval = runCode(info,
                        info->start_address+OFFSET_ERASE,
                        info->start_address+OFFSET_ERASE+OFFSET_ERASE_SIZE,
                        address,
@@ -296,17 +296,17 @@ static int eCosBoard_erase(ecosflash_flash_bank_t *info, uint32_t address, uint3
 
 static int eCosBoard_flash(ecosflash_flash_bank_t *info, void *data, uint32_t address, uint32_t len)
 {
-       target_t *target=info->target;
-       const int chunk=8192;
-       int retval=ERROR_OK;
+       target_t *target = info->target;
+       const int chunk = 8192;
+       int retval = ERROR_OK;
        int timeout = (chunk / 20480 + 1) * 1000; /*asume 20 KB/s + 1 second*/
 
-       retval=loadDriver(info);
+       retval = loadDriver(info);
        if (retval != ERROR_OK)
                return retval;
 
        uint32_t buffer;
-       retval=runCode(info,
+       retval = runCode(info,
                        info->start_address+OFFSET_GET_WORKAREA,
                        info->start_address+OFFSET_GET_WORKAREA+OFFSET_GET_WORKAREA_SIZE,
                        0,
@@ -319,21 +319,21 @@ static int eCosBoard_flash(ecosflash_flash_bank_t *info, void *data, uint32_t ad
 
 
        uint32_t i;
-       for (i=0; i<len; i += chunk)
+       for (i = 0; i<len; i += chunk)
        {
-               int t=len-i;
+               int t = len-i;
                if (t>chunk)
                {
-                       t=chunk;
+                       t = chunk;
                }
 
                int retval;
-               retval=target_write_buffer(target, buffer, t, ((uint8_t *)data)+i);
+               retval = target_write_buffer(target, buffer, t, ((uint8_t *)data)+i);
                if (retval != ERROR_OK)
                        return retval;
 
                uint32_t flashErr;
-               retval=runCode(info,
+               retval = runCode(info,
                                info->start_address+OFFSET_FLASH,
                                info->start_address+OFFSET_FLASH+OFFSET_FLASH_SIZE,
                                buffer,
@@ -408,7 +408,7 @@ static uint32_t ecosflash_address(struct flash_bank_s *bank, uint32_t address)
 
 static int ecosflash_erase(struct flash_bank_s *bank, int first, int last)
 {
-       struct flash_bank_s *c=bank;
+       struct flash_bank_s *c = bank;
        ecosflash_flash_bank_t *info = bank->driver_priv;
        return eCosBoard_erase(info, c->base+first*sectorSize, sectorSize*(last-first+1));
 }
@@ -421,7 +421,7 @@ static int ecosflash_protect(struct flash_bank_s *bank, int set, int first, int
 static int ecosflash_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
 {
        ecosflash_flash_bank_t *info = bank->driver_priv;
-       struct flash_bank_s *c=bank;
+       struct flash_bank_s *c = bank;
        return eCosBoard_flash(info, buffer, c->base+offset, count);
 }
 
index 3b8a883c72cf1002cccf2ad35d487442c80a53eb..61dc4a6a65d6437b2c23ee717e2dd762dc55f15a 100644 (file)
@@ -89,7 +89,7 @@ static int flash_driver_write(struct flash_bank_s *bank, uint8_t *buffer, uint32
 {
        int retval;
 
-       retval=bank->driver->write(bank, buffer, offset, count);
+       retval = bank->driver->write(bank, buffer, offset, count);
        if (retval != ERROR_OK)
        {
                LOG_ERROR("error writing to flash at address 0x%08" PRIx32 " at offset 0x%8.8" PRIx32 " (%d)", 
@@ -103,7 +103,7 @@ static int flash_driver_erase(struct flash_bank_s *bank, int first, int last)
 {
        int retval;
 
-       retval=bank->driver->erase(bank, first, last);
+       retval = bank->driver->erase(bank, first, last);
        if (retval != ERROR_OK)
        {
                LOG_ERROR("failed erasing sectors %d to %d (%d)", first, last, retval);
@@ -116,7 +116,7 @@ int flash_driver_protect(struct flash_bank_s *bank, int set, int first, int last
 {
        int retval;
 
-       retval=bank->driver->protect(bank, set, first, last);
+       retval = bank->driver->protect(bank, set, first, last);
        if (retval != ERROR_OK)
        {
                LOG_ERROR("failed setting protection for areas %d to %d (%d)", first, last, retval);
@@ -142,10 +142,10 @@ static int jim_flash_banks(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                return JIM_ERR;
        }
 
-       Jim_Obj *list=Jim_NewListObj(interp, NULL, 0);
+       Jim_Obj *list = Jim_NewListObj(interp, NULL, 0);
        for (p = flash_banks; p; p = p->next)
        {
-               Jim_Obj *elem=Jim_NewListObj(interp, NULL, 0);
+               Jim_Obj *elem = Jim_NewListObj(interp, NULL, 0);
 
                Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "name", -1));
                Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, p->driver->name, -1));
@@ -291,7 +291,7 @@ static int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cm
                        c->sectors = NULL;
                        c->next = NULL;
 
-                       if ((retval=flash_drivers[i]->flash_bank_command(cmd_ctx, cmd, args, argc, c)) != ERROR_OK)
+                       if ((retval = flash_drivers[i]->flash_bank_command(cmd_ctx, cmd, args, argc, c)) != ERROR_OK)
                        {
                                LOG_ERROR("'%s' driver rejected flash bank at 0x%8.8" PRIx32 , args[0], c->base);
                                free(c);
@@ -754,13 +754,13 @@ static int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cm
        switch (cmd[4])
        {
        case 'w':
-               wordsize=4;
+               wordsize = 4;
                break;
        case 'h':
-               wordsize=2;
+               wordsize = 2;
                break;
        case 'b':
-               wordsize=1;
+               wordsize = 1;
                break;
        default:
                return ERROR_COMMAND_SYNTAX_ERROR;
@@ -791,7 +791,7 @@ static int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cm
 
        duration_start_measure(&duration);
 
-       for (wrote=0; wrote<(count*wordsize); wrote += cur_size)
+       for (wrote = 0; wrote<(count*wordsize); wrote += cur_size)
        {
                cur_size = MIN( (count*wordsize - wrote), sizeof(chunk) );
                flash_bank_t *bank;
@@ -809,7 +809,7 @@ static int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cm
                        return err;
 
                unsigned i;
-               for (i=0; i<cur_size; i++)
+               for (i = 0; i<cur_size; i++)
                {
                        if (readback[i]!=chunk[i])
                        {
@@ -829,7 +829,7 @@ static int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cm
        if (err == ERROR_OK)
        {
                float speed;
-               speed=wrote / 1024.0;
+               speed = wrote / 1024.0;
                speed/=((float)duration.duration.tv_sec + ((float)duration.duration.tv_usec / 1000000.0));
                command_print(cmd_ctx, 
                                          "wrote %" PRId32 " bytes to 0x%8.8" PRIx32 " in %s (%f kb/s)",
@@ -1003,7 +1003,7 @@ int flash_erase_address_range(target_t *target, uint32_t addr, uint32_t length)
 /* write (optional verify) an image to flash memory of the given target */
 int flash_write(target_t *target, image_t *image, uint32_t *written, int erase)
 {
-       int retval=ERROR_OK;
+       int retval = ERROR_OK;
 
        int section;
        uint32_t section_offset;
index 56aeb3bfa0f12173a942360270fafdd07f497a84..25328099d4f6c897abfc6b00abb0ef517117cc49 100644 (file)
@@ -45,13 +45,13 @@ typedef struct flash_sector_s
        /// Number of bytes in this flash sector.
        uint32_t size;
        /**
-        * Indication of erasure status: 0=not erased, 1=erased,
-        * other=unknown.  Set by @c flash_driver_s::erase_check.
+        * Indication of erasure status: 0 = not erased, 1 = erased,
+        * other = unknown.  Set by @c flash_driver_s::erase_check.
         */
        int is_erased;
        /**
-        * Indication of protection status: 0=unprotected/unlocked,
-        * 1=protected/locked, other=unknown.  Set by
+        * Indication of protection status: 0 = unprotected/unlocked,
+        * 1 = protected/locked, other = unknown.  Set by
         * @c flash_driver_s::protect_check.
         */
        int is_protected;
index d352d26a8977f62a0ef143dadcf1d16d92c736f5..69bb6c575893c94680c3da85b09771b4008bb0b6 100644 (file)
@@ -525,7 +525,7 @@ static int lpc2000_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t of
                checksum = 0 - checksum;
                LOG_DEBUG("checksum: 0x%8.8" PRIx32, checksum);
 
-               uint32_t original_value=buf_get_u32(buffer + (5 * 4), 0, 32);
+               uint32_t original_value = buf_get_u32(buffer + (5 * 4), 0, 32);
                if (original_value != checksum)
                {
                        LOG_WARNING("Verification will fail since checksum in image(0x%8.8" PRIx32 ") written to flash was different from calculated vector checksum(0x%8.8" PRIx32 ").",
index b26e62b78cbe5468706d379d9818e6aa3e99fcaf..328e9578934cb16f8f9d87ce9c9ca24590090dca 100644 (file)
@@ -217,7 +217,7 @@ static int mg_dsk_wait(mg_io_type_wait wait, uint32_t time)
        uint32_t mg_task_reg = mflash_bank->base + MG_REG_OFFSET;
        duration_t duration;
        int ret;
-       long long t=0;
+       long long t = 0;
 
        duration_start_measure(&duration);
 
@@ -277,7 +277,7 @@ static int mg_dsk_wait(mg_io_type_wait wait, uint32_t time)
 
                duration_stop_measure(&duration, NULL);
 
-               t=duration.duration.tv_usec/1000;
+               t = duration.duration.tv_usec/1000;
                t += duration.duration.tv_sec*1000;
 
                if (t > time)
@@ -871,7 +871,7 @@ static int mg_pll_get_M(unsigned short feedback_div)
 {
        int i, M;
 
-       for (i = 1, M=0; i < 512; i <<= 1, feedback_div >>= 1)
+       for (i = 1, M = 0; i < 512; i <<= 1, feedback_div >>= 1)
                M += (feedback_div & 1) * i;
 
        return M + 2;
index e6a342e71ac93d04f064ebacd5f63226b167f97f..17b57a87d094233e61554bf19b30bbaa77789f9e 100644 (file)
@@ -200,7 +200,7 @@ static int ocl_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset
                chksum = OCL_CHKS_INIT;
 
                /* copy data to DCC buffer in proper byte order and properly aligned */
-               for (i=0; i<runlen; i++)
+               for (i = 0; i<runlen; i++)
                {
                        switch (byteofs++)
                        {
@@ -332,7 +332,7 @@ static int ocl_probe(struct flash_bank_s *bank)
                return ERROR_FLASH_BANK_INVALID;
        }
        sectsize = bank->size / bank->num_sectors;
-       for (i=0; i<bank->num_sectors; i++)
+       for (i = 0; i<bank->num_sectors; i++)
        {
                bank->sectors[i].offset = i * sectsize;
                bank->sectors[i].size = sectsize;
index b49a5b894a162869f34fa34855131f027d1feab2..c65a171da2aea08e61adbf699d34f0f93c81754c 100644 (file)
@@ -39,19 +39,19 @@ void cmd_flash(uint32 cmd)
        int pagenum;
        int result;
 
-       adr=dcc_rd();
-       len=cmd&0xffff;
-       ofs=adr%flash_page_size;
-       bi_start=ofs/4;
-       bi_end=(ofs+len+3)/4;
+       adr = dcc_rd();
+       len = cmd&0xffff;
+       ofs = adr%flash_page_size;
+       bi_start = ofs/4;
+       bi_end = (ofs+len+3)/4;
 
        if (bi_end>BUFSIZE) {
                dcc_wr(OCL_BUFF_OVER);
                return;
        }
 
-       chksum=OCL_CHKS_INIT;
-       for (bi=0; bi<bi_end; bi++) chksum^=buffer[bi]=dcc_rd();
+       chksum = OCL_CHKS_INIT;
+       for (bi = 0; bi<bi_end; bi++) chksum^=buffer[bi]=dcc_rd();
 
        if (dcc_rd() != chksum) {
                dcc_wr(OCL_CHKS_FAIL);
@@ -59,18 +59,18 @@ void cmd_flash(uint32 cmd)
        }
 
        /* fill in unused positions with unprogrammed values */
-       for (bi=0; bi<bi_start; bi++) buffer[bi]=0xffffffff;
-       for (bi=bi_end; bi%flash_page_size; bi++) buffer[bi]=0xffffffff;
+       for (bi = 0; bi<bi_start; bi++) buffer[bi]=0xffffffff;
+       for (bi = bi_end; bi%flash_page_size; bi++) buffer[bi]=0xffffffff;
 
-       result=0;
-       pagenum=adr/flash_page_size;
-       for (bi=0; bi<bi_end; bi += flash_page_size/4) {
-               result=flash_page_program(buffer+bi, pagenum++);
+       result = 0;
+       pagenum = adr/flash_page_size;
+       for (bi = 0; bi<bi_end; bi += flash_page_size/4) {
+               result = flash_page_program(buffer+bi, pagenum++);
                if (result) break;
        }
 
        /* verify written data */
-       if (!result) result=flash_verify(adr, len, ((uint8 *)buffer)+ofs);
+       if (!result) result = flash_verify(adr, len, ((uint8 *)buffer)+ofs);
 
        dcc_wr(OCL_CMD_DONE|result);
 }
@@ -81,7 +81,7 @@ int main (void)
        uint32 cmd;
 
        for (;;) {
-               cmd=dcc_rd();
+               cmd = dcc_rd();
                switch (cmd&OCL_CMD_MASK) {
                        case OCL_PROBE:
                                dcc_wr(OCL_CMD_DONE|flash_init());
index a534f6d8de1dc270efa879609a583cf1ea4cc5f5..678d5393096b6310bef1c17be5307f586c594eb6 100644 (file)
 #include "samflash.h"
 
 
-unsigned int flash_page_count=1024;
-unsigned int flash_page_size=256;
+unsigned int flash_page_count = 1024;
+unsigned int flash_page_size = 256;
 
 /* pages per lock bit */
-unsigned int flash_lock_pages=1024/16;
+unsigned int flash_lock_pages = 1024/16;
 
 
 /* detect chip and set loader parameters */
@@ -32,38 +32,38 @@ int flash_init(void)
 {
        unsigned int nvpsiz;
 
-       nvpsiz=(inr(DBGU_CIDR) >> 8)&0xf;
+       nvpsiz = (inr(DBGU_CIDR) >> 8)&0xf;
 
        switch (nvpsiz) {
                case 3:
                        /* AT91SAM7x32 */
-                       flash_page_count=256;
-                       flash_page_size=128;
-                       flash_lock_pages=256/8;
+                       flash_page_count = 256;
+                       flash_page_size = 128;
+                       flash_lock_pages = 256/8;
                        break;
                case 5:
                        /* AT91SAM7x64 */
-                       flash_page_count=512;
-                       flash_page_size=128;
-                       flash_lock_pages=512/16;
+                       flash_page_count = 512;
+                       flash_page_size = 128;
+                       flash_lock_pages = 512/16;
                        break;
                case 7:
                        /* AT91SAM7x128*/
-                       flash_page_count=512;
-                       flash_page_size=256;
-                       flash_lock_pages=512/8;
+                       flash_page_count = 512;
+                       flash_page_size = 256;
+                       flash_lock_pages = 512/8;
                        break;
                case 9:
                        /* AT91SAM7x256 */
-                       flash_page_count=1024;
-                       flash_page_size=256;
-                       flash_lock_pages=1024/16;
+                       flash_page_count = 1024;
+                       flash_page_size = 256;
+                       flash_lock_pages = 1024/16;
                        break;
                case 10:
                        /* AT91SAM7x512 */
-                       flash_page_count=2048;
-                       flash_page_size=256;
-                       flash_lock_pages=2048/32;
+                       flash_page_count = 2048;
+                       flash_page_size = 256;
+                       flash_lock_pages = 2048/32;
                        break;
                default:
                        return FLASH_STAT_INITE;
@@ -82,19 +82,19 @@ int flash_page_program(uint32 *data, int page_num)
        uint32 *data_ptr;
 
        /* select proper controller */
-       if (page_num >= 1024) efc_ofs=0x10;
-       else efc_ofs=0;
+       if (page_num >= 1024) efc_ofs = 0x10;
+       else efc_ofs = 0;
 
        /* wait until FLASH is ready, just for sure */
        while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0);
 
        /* calculate page address, only lower 8 bits are used to address the latch,
                 but the upper part of address is needed for writing to proper EFC */
-       flash_ptr=(uint32 *)(FLASH_AREA_ADDR+(page_num*flash_page_size));
-       data_ptr=data;
+       flash_ptr = (uint32 *)(FLASH_AREA_ADDR+(page_num*flash_page_size));
+       data_ptr = data;
 
        /* copy data to latch */
-       for (i=flash_page_size/4; i; i--) {
+       for (i = flash_page_size/4; i; i--) {
                /* we do not use memcpy to be sure that only 32 bit access is used */
                *(flash_ptr++)=*(data_ptr++);
        }
@@ -111,10 +111,10 @@ int flash_page_program(uint32 *data, int page_num)
 
 #if 0
        /* verify written data */
-       flash_ptr=(uint32 *)(FLASH_AREA_ADDR+(page_num*flash_page_size));
-       data_ptr=data;
+       flash_ptr = (uint32 *)(FLASH_AREA_ADDR+(page_num*flash_page_size));
+       data_ptr = data;
 
-       for (i=flash_page_size/4; i; i--) {
+       for (i = flash_page_size/4; i; i--) {
                if (*(flash_ptr++)!=*(data_ptr++)) return FLASH_STAT_VERIFE;
        }
 #endif
@@ -128,8 +128,8 @@ int flash_erase_plane(int efc_ofs)
        unsigned int lockbits;
        int page_num;
 
-       page_num=0;
-       lockbits=inr(MC_FSR+efc_ofs) >> 16;
+       page_num = 0;
+       lockbits = inr(MC_FSR+efc_ofs) >> 16;
        while (lockbits) {
                if (lockbits&1) {
 
@@ -175,10 +175,10 @@ int flash_erase_all(void)
 {
        int result;
        
-       if ((result=flash_erase_plane(0)) != FLASH_STAT_OK) return result;
+       if ((result = flash_erase_plane(0)) != FLASH_STAT_OK) return result;
 
        /* the second flash controller, if any */
-       if (flash_page_count>1024) result=flash_erase_plane(0x10);
+       if (flash_page_count>1024) result = flash_erase_plane(0x10);
 
        return result;
 }
@@ -188,7 +188,7 @@ int flash_verify(uint32 adr, unsigned int len, uint8 *src)
 {
        unsigned char *flash_ptr;
 
-       flash_ptr=(uint8 *)FLASH_AREA_ADDR+adr;
+       flash_ptr = (uint8 *)FLASH_AREA_ADDR+adr;
        for ( ;len; len--) {
                if (*(flash_ptr++)!=*(src++)) return FLASH_STAT_VERIFE;
        }
index 7009995aa737f7e51ce632bb72c19e9462050d40..5112482c19f0140e38c3c454674057f2938de1b7 100644 (file)
@@ -388,7 +388,7 @@ static int pic32mx_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint3
                return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
        };
 
-       if ((retval=target_write_buffer(target, pic32mx_info->write_algorithm->address, sizeof(pic32mx_flash_write_code), pic32mx_flash_write_code)) != ERROR_OK)
+       if ((retval = target_write_buffer(target, pic32mx_info->write_algorithm->address, sizeof(pic32mx_flash_write_code), pic32mx_flash_write_code)) != ERROR_OK)
                return retval;
 #endif
 
@@ -435,12 +435,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 ) {
-                       LOG_ERROR("Flash write error NVMERR (status=0x%08" PRIx32 ")", status);
+                       LOG_ERROR("Flash write error NVMERR (status = 0x%08" PRIx32 ")", status);
                        retval = ERROR_FLASH_OPERATION_FAILED;
                        break;
                }
                if ( status & NVMCON_LVDERR ) {
-                       LOG_ERROR("Flash write error LVDERR (status=0x%08" PRIx32 ")", status);
+                       LOG_ERROR("Flash write error LVDERR (status = 0x%08" PRIx32 ")", status);
                        retval = ERROR_FLASH_OPERATION_FAILED;
                        break;
                }
@@ -459,12 +459,12 @@ static int pic32mx_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint3
 
                uint32_t status = pic32mx_write_word(bank, address, value);
                if ( status & NVMCON_NVMERR ) {
-                       LOG_ERROR("Flash write error NVMERR (status=0x%08" PRIx32 ")", status);
+                       LOG_ERROR("Flash write error NVMERR (status = 0x%08" PRIx32 ")", status);
                        retval = ERROR_FLASH_OPERATION_FAILED;
                        break;
                }
                if ( status & NVMCON_LVDERR ) {
-                       LOG_ERROR("Flash write error LVDERR (status=0x%08" PRIx32 ")", status);
+                       LOG_ERROR("Flash write error LVDERR (status = 0x%08" PRIx32 ")", status);
                        retval = ERROR_FLASH_OPERATION_FAILED;
                        break;
                }
@@ -620,7 +620,7 @@ static int pic32mx_probe(struct flash_bank_s *bank)
                num_pages = 12;
        } else {
                /* 0xBD000000: Program flash size varies with device */
-               for (i=0; pic32mx_devs[i].name != NULL; i++)
+               for (i = 0; pic32mx_devs[i].name != NULL; i++)
                        if (pic32mx_devs[i].devid == ((device_id >> 12) & 0xff)) {
                                num_pages = pic32mx_devs[i].pfm_size;
                                break;
@@ -704,7 +704,7 @@ static int pic32mx_info(struct flash_bank_s *bank, char *buf, int buf_size)
                                 PIC32MX_MANUF_ID);
                return ERROR_FLASH_OPERATION_FAILED;
        }
-       for (i=0; pic32mx_devs[i].name != NULL; i++)
+       for (i = 0; pic32mx_devs[i].name != NULL; i++)
                if (pic32mx_devs[i].devid == ((device_id >> 12) & 0xff)) {
                        printed = snprintf(buf, buf_size, "PIC32MX%s", pic32mx_devs[i].name);
                        break;
@@ -939,7 +939,7 @@ static int pic32mx_handle_pgm_word_command(struct command_context_s *cmd_ctx, ch
        if (res == ERROR_OK)
                command_print(cmd_ctx, "pic32mx pgm word complete");
        else
-               command_print(cmd_ctx, "pic32mx pgm word failed (status=0x%x)", status);
+               command_print(cmd_ctx, "pic32mx pgm word failed (status = 0x%x)", status);
 
        return ERROR_OK;
 }
index cc69dd161848cd162ece3e4b4bb600bd83217bf7..b48ff937de5c0223b85a63e01010e2cfddb07ec7 100644 (file)
@@ -517,7 +517,7 @@ static int stm32x_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32
                return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
        };
 
-       if ((retval=target_write_buffer(target, stm32x_info->write_algorithm->address, sizeof(stm32x_flash_write_code), stm32x_flash_write_code)) != ERROR_OK)
+       if ((retval = target_write_buffer(target, stm32x_info->write_algorithm->address, sizeof(stm32x_flash_write_code), stm32x_flash_write_code)) != ERROR_OK)
                return retval;
 
        /* memory buffer */
index 73c86da72b67508c2e2524951b3f708f13c9d86c..880dac4da58a67c8defee238bcf764aa44637a55 100644 (file)
@@ -198,11 +198,11 @@ static int str9x_protect_check(struct flash_bank_s *bank)
                if (str9x_info->bank1)
                {
                        adr = bank1start + 0x18;
-                       if ((retval=target_write_u16(target, adr, 0x90)) != ERROR_OK)
+                       if ((retval = target_write_u16(target, adr, 0x90)) != ERROR_OK)
                        {
                                return retval;
                        }
-                       if ((retval=target_read_u16(target, adr, &hstatus)) != ERROR_OK)
+                       if ((retval = target_read_u16(target, adr, &hstatus)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -211,11 +211,11 @@ static int str9x_protect_check(struct flash_bank_s *bank)
                else
                {
                        adr = bank1start + 0x14;
-                       if ((retval=target_write_u16(target, adr, 0x90)) != ERROR_OK)
+                       if ((retval = target_write_u16(target, adr, 0x90)) != ERROR_OK)
                        {
                                return retval;
                        }
-                       if ((retval=target_read_u32(target, adr, &status)) != ERROR_OK)
+                       if ((retval = target_read_u32(target, adr, &status)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -224,11 +224,11 @@ static int str9x_protect_check(struct flash_bank_s *bank)
        else
        {
                adr = bank1start + 0x10;
-               if ((retval=target_write_u16(target, adr, 0x90)) != ERROR_OK)
+               if ((retval = target_write_u16(target, adr, 0x90)) != ERROR_OK)
                {
                        return retval;
                }
-               if ((retval=target_read_u16(target, adr, &hstatus)) != ERROR_OK)
+               if ((retval = target_read_u16(target, adr, &hstatus)) != ERROR_OK)
                {
                        return retval;
                }
@@ -236,7 +236,7 @@ static int str9x_protect_check(struct flash_bank_s *bank)
        }
 
        /* read array command */
-       if ((retval=target_write_u16(target, adr, 0xFF)) != ERROR_OK)
+       if ((retval = target_write_u16(target, adr, 0xFF)) != ERROR_OK)
        {
                return retval;
        }
@@ -284,24 +284,24 @@ static int str9x_erase(struct flash_bank_s *bank, int first, int last)
                adr = bank->base + bank->sectors[i].offset;
 
                /* erase sectors */
-               if ((retval=target_write_u16(target, adr, erase_cmd)) != ERROR_OK)
+               if ((retval = target_write_u16(target, adr, erase_cmd)) != ERROR_OK)
                {
                        return retval;
                }
-               if ((retval=target_write_u16(target, adr, 0xD0)) != ERROR_OK)
+               if ((retval = target_write_u16(target, adr, 0xD0)) != ERROR_OK)
                {
                        return retval;
                }
 
                /* get status */
-               if ((retval=target_write_u16(target, adr, 0x70)) != ERROR_OK)
+               if ((retval = target_write_u16(target, adr, 0x70)) != ERROR_OK)
                {
                        return retval;
                }
 
                int timeout;
-               for (timeout=0; timeout<1000; timeout++) {
-                       if ((retval=target_read_u8(target, adr, &status)) != ERROR_OK)
+               for (timeout = 0; timeout<1000; timeout++) {
+                       if ((retval = target_read_u8(target, adr, &status)) != ERROR_OK)
                        {
                                return retval;
                        }
@@ -316,13 +316,13 @@ static int str9x_erase(struct flash_bank_s *bank, int first, int last)
                }
 
                /* clear status, also clear read array */
-               if ((retval=target_write_u16(target, adr, 0x50)) != ERROR_OK)
+               if ((retval = target_write_u16(target, adr, 0x50)) != ERROR_OK)
                {
                        return retval;
                }
 
                /* read array command */
-               if ((retval=target_write_u16(target, adr, 0xFF)) != ERROR_OK)
+               if ((retval = target_write_u16(target, adr, 0xFF)) != ERROR_OK)
                {
                        return retval;
                }
@@ -575,7 +575,7 @@ static int str9x_write(struct flash_bank_s *bank,
                target_write_u16(target, bank_adr, 0x70);
 
                int timeout;
-               for (timeout=0; timeout<1000; timeout++)
+               for (timeout = 0; timeout<1000; timeout++)
                {
                        target_read_u8(target, bank_adr, &status);
                        if ( status & 0x80 )
@@ -624,7 +624,7 @@ static int str9x_write(struct flash_bank_s *bank,
                target_write_u16(target, bank_adr, 0x70);
 
                int timeout;
-               for (timeout=0; timeout<1000; timeout++)
+               for (timeout = 0; timeout<1000; timeout++)
                {
                        target_read_u8(target, bank_adr, &status);
                        if ( status & 0x80 )
index 060830c51cdadf2eb59375497575617cb6f09085..5ed3658811e107a3399601306569e5ee23c613b7 100644 (file)
@@ -150,7 +150,7 @@ static int tms470_read_part_info(struct flash_bank_s *bank)
        /* read and parse the device identification register */
        target_read_u32(target, 0xFFFFFFF0, &device_ident_reg);
 
-       LOG_INFO("device_ident_reg=0x%08" PRIx32 "", device_ident_reg);
+       LOG_INFO("device_ident_reg = 0x%08" PRIx32 "", device_ident_reg);
 
        if ((device_ident_reg & 7) == 0)
        {
@@ -432,7 +432,7 @@ static int tms470_check_flash_unlocked(target_t * target)
        uint32_t fmbbusy;
 
        target_read_u32(target, 0xFFE89C08, &fmbbusy);
-       LOG_INFO("tms470 fmbbusy=0x%08" PRIx32 " -> %s", fmbbusy, fmbbusy & 0x8000 ? "unlocked" : "LOCKED");
+       LOG_INFO("tms470 fmbbusy = 0x%08" PRIx32 " -> %s", fmbbusy, fmbbusy & 0x8000 ? "unlocked" : "LOCKED");
        return fmbbusy & 0x8000 ? ERROR_OK : ERROR_FLASH_OPERATION_FAILED;
 }
 
@@ -482,7 +482,7 @@ static int tms470_try_flash_keys(target_t * target, const uint32_t * key_set)
                         */
                        target_read_u32(target, 0x00001FF0 + 4 * i, &tmp);
 
-                       LOG_INFO("tms470 writing fmpkey=0x%08" PRIx32 "", key_set[i]);
+                       LOG_INFO("tms470 writing fmpkey = 0x%08" PRIx32 "", key_set[i]);
                        target_write_u32(target, 0xFFE89C0C, key_set[i]);
                }
 
@@ -570,7 +570,7 @@ static int tms470_flash_initialize_internal_state_machine(struct flash_bank_s *b
        fmmac2 &= ~0x0007;
        fmmac2 |= (tms470_info->ordinal & 7);
        target_write_u32(target, 0xFFE8BC04, fmmac2);
-       LOG_DEBUG("set fmmac2=0x%04" PRIx32 "", fmmac2);
+       LOG_DEBUG("set fmmac2 = 0x%04" PRIx32 "", fmmac2);
 
        /*
         * Disable level 1 sector protection by setting bit 15 of FMMAC1.
@@ -578,25 +578,25 @@ static int tms470_flash_initialize_internal_state_machine(struct flash_bank_s *b
        target_read_u32(target, 0xFFE8BC00, &fmmac1);
        fmmac1 |= 0x8000;
        target_write_u32(target, 0xFFE8BC00, fmmac1);
-       LOG_DEBUG("set fmmac1=0x%04" PRIx32 "", fmmac1);
+       LOG_DEBUG("set fmmac1 = 0x%04" PRIx32 "", fmmac1);
 
        /*
-        * FMTCREG=0x2fc0;
+        * FMTCREG = 0x2fc0;
         */
        target_write_u32(target, 0xFFE8BC10, 0x2fc0);
-       LOG_DEBUG("set fmtcreg=0x2fc0");
+       LOG_DEBUG("set fmtcreg = 0x2fc0");
 
        /*
-        * MAXPP=50
+        * MAXPP = 50
         */
        target_write_u32(target, 0xFFE8A07C, 50);
-       LOG_DEBUG("set fmmaxpp=50");
+       LOG_DEBUG("set fmmaxpp = 50");
 
        /*
-        * MAXCP=0xf000+2000
+        * MAXCP = 0xf000+2000
         */
        target_write_u32(target, 0xFFE8A084, 0xf000 + 2000);
-       LOG_DEBUG("set fmmaxcp=0x%04x", 0xf000 + 2000);
+       LOG_DEBUG("set fmmaxcp = 0x%04x", 0xf000 + 2000);
 
        /*
         * configure VHV
@@ -606,22 +606,22 @@ static int tms470_flash_initialize_internal_state_machine(struct flash_bank_s *b
        {
                fmmaxep = 0xf000 + 4095;
                target_write_u32(target, 0xFFE8A80C, 0x9964);
-               LOG_DEBUG("set fmptr3=0x9964");
+               LOG_DEBUG("set fmptr3 = 0x9964");
        }
        else
        {
                fmmaxep = 0xa000 + 4095;
                target_write_u32(target, 0xFFE8A80C, 0x9b64);
-               LOG_DEBUG("set fmptr3=0x9b64");
+               LOG_DEBUG("set fmptr3 = 0x9b64");
        }
        target_write_u32(target, 0xFFE8A080, fmmaxep);
-       LOG_DEBUG("set fmmaxep=0x%04" PRIx32 "", fmmaxep);
+       LOG_DEBUG("set fmmaxep = 0x%04" PRIx32 "", fmmaxep);
 
        /*
-        * FMPTR4=0xa000
+        * FMPTR4 = 0xa000
         */
        target_write_u32(target, 0xFFE8A810, 0xa000);
-       LOG_DEBUG("set fmptr4=0xa000");
+       LOG_DEBUG("set fmptr4 = 0xa000");
 
        /*
         * FMPESETUP, delay parameter selected based on clock frequency.
@@ -635,56 +635,56 @@ static int tms470_flash_initialize_internal_state_machine(struct flash_bank_s *b
        sysclk = (plldis ? 1 : (glbctrl & 0x08) ? 4 : 8) * oscMHz / (1 + (glbctrl & 7));
        delay = (sysclk > 10) ? (sysclk + 1) / 2 : 5;
        target_write_u32(target, 0xFFE8A018, (delay << 4) | (delay << 8));
-       LOG_DEBUG("set fmpsetup=0x%04" PRIx32 "", (delay << 4) | (delay << 8));
+       LOG_DEBUG("set fmpsetup = 0x%04" PRIx32 "", (delay << 4) | (delay << 8));
 
        /*
         * FMPVEVACCESS, based on delay.
         */
        k = delay | (delay << 8);
        target_write_u32(target, 0xFFE8A05C, k);
-       LOG_DEBUG("set fmpvevaccess=0x%04" PRIx32 "", k);
+       LOG_DEBUG("set fmpvevaccess = 0x%04" PRIx32 "", k);
 
        /*
         * FMPCHOLD, FMPVEVHOLD, FMPVEVSETUP, based on delay.
         */
        k <<= 1;
        target_write_u32(target, 0xFFE8A034, k);
-       LOG_DEBUG("set fmpchold=0x%04" PRIx32 "", k);
+       LOG_DEBUG("set fmpchold = 0x%04" PRIx32 "", k);
        target_write_u32(target, 0xFFE8A040, k);
-       LOG_DEBUG("set fmpvevhold=0x%04" PRIx32 "", k);
+       LOG_DEBUG("set fmpvevhold = 0x%04" PRIx32 "", k);
        target_write_u32(target, 0xFFE8A024, k);
-       LOG_DEBUG("set fmpvevsetup=0x%04" PRIx32 "", k);
+       LOG_DEBUG("set fmpvevsetup = 0x%04" PRIx32 "", k);
 
        /*
         * FMCVACCESS, based on delay.
         */
        k = delay * 16;
        target_write_u32(target, 0xFFE8A060, k);
-       LOG_DEBUG("set fmcvaccess=0x%04" PRIx32 "", k);
+       LOG_DEBUG("set fmcvaccess = 0x%04" PRIx32 "", k);
 
        /*
         * FMCSETUP, based on delay.
         */
        k = 0x3000 | delay * 20;
        target_write_u32(target, 0xFFE8A020, k);
-       LOG_DEBUG("set fmcsetup=0x%04" PRIx32 "", k);
+       LOG_DEBUG("set fmcsetup = 0x%04" PRIx32 "", k);
 
        /*
         * FMEHOLD, based on delay.
         */
        k = (delay * 20) << 2;
        target_write_u32(target, 0xFFE8A038, k);
-       LOG_DEBUG("set fmehold=0x%04" PRIx32 "", k);
+       LOG_DEBUG("set fmehold = 0x%04" PRIx32 "", k);
 
        /*
         * PWIDTH, CWIDTH, EWIDTH, based on delay.
         */
        target_write_u32(target, 0xFFE8A050, delay * 8);
-       LOG_DEBUG("set fmpwidth=0x%04" PRIx32 "", delay * 8);
+       LOG_DEBUG("set fmpwidth = 0x%04" PRIx32 "", delay * 8);
        target_write_u32(target, 0xFFE8A058, delay * 1000);
-       LOG_DEBUG("set fmcwidth=0x%04" PRIx32 "", delay * 1000);
+       LOG_DEBUG("set fmcwidth = 0x%04" PRIx32 "", delay * 1000);
        target_write_u32(target, 0xFFE8A054, delay * 5400);
-       LOG_DEBUG("set fmewidth=0x%04" PRIx32 "", delay * 5400);
+       LOG_DEBUG("set fmewidth = 0x%04" PRIx32 "", delay * 5400);
 
        return result;
 }
@@ -698,7 +698,7 @@ int tms470_flash_status(struct flash_bank_s *bank)
        uint32_t fmmstat;
 
        target_read_u32(target, 0xFFE8BC0C, &fmmstat);
-       LOG_DEBUG("set fmmstat=0x%04" PRIx32 "", fmmstat);
+       LOG_DEBUG("set fmmstat = 0x%04" PRIx32 "", fmmstat);
 
        if (fmmstat & 0x0080)
        {
@@ -760,12 +760,12 @@ static int tms470_erase_sector(struct flash_bank_s *bank, int sector)
         */
        target_read_u32(target, 0xFFFFFFDC, &glbctrl);
        target_write_u32(target, 0xFFFFFFDC, glbctrl | 0x10);
-       LOG_DEBUG("set glbctrl=0x%08" PRIx32 "", glbctrl | 0x10);
+       LOG_DEBUG("set glbctrl = 0x%08" PRIx32 "", glbctrl | 0x10);
 
        /* Force normal read mode. */
        target_read_u32(target, 0xFFE89C00, &orig_fmregopt);
        target_write_u32(target, 0xFFE89C00, 0);
-       LOG_DEBUG("set fmregopt=0x%08x", 0);
+       LOG_DEBUG("set fmregopt = 0x%08x", 0);
 
        (void)tms470_flash_initialize_internal_state_machine(bank);
 
@@ -777,13 +777,13 @@ static int tms470_erase_sector(struct flash_bank_s *bank, int sector)
        {
                target_read_u32(target, 0xFFE88008, &fmbsea);
                target_write_u32(target, 0xFFE88008, fmbsea | (1 << sector));
-               LOG_DEBUG("set fmbsea=0x%04" PRIx32 "", fmbsea | (1 << sector));
+               LOG_DEBUG("set fmbsea = 0x%04" PRIx32 "", fmbsea | (1 << sector));
        }
        else
        {
                target_read_u32(target, 0xFFE8800C, &fmbseb);
                target_write_u32(target, 0xFFE8800C, fmbseb | (1 << (sector - 16)));
-               LOG_DEBUG("set fmbseb=0x%04" PRIx32 "", fmbseb | (1 << (sector - 16)));
+               LOG_DEBUG("set fmbseb = 0x%04" PRIx32 "", fmbseb | (1 << (sector - 16)));
        }
        bank->sectors[sector].is_protected = 0;
 
@@ -816,19 +816,19 @@ static int tms470_erase_sector(struct flash_bank_s *bank, int sector)
        if (sector < 16)
        {
                target_write_u32(target, 0xFFE88008, fmbsea);
-               LOG_DEBUG("set fmbsea=0x%04" PRIx32 "", fmbsea);
+               LOG_DEBUG("set fmbsea = 0x%04" PRIx32 "", fmbsea);
                bank->sectors[sector].is_protected = fmbsea & (1 << sector) ? 0 : 1;
        }
        else
        {
                target_write_u32(target, 0xFFE8800C, fmbseb);
-               LOG_DEBUG("set fmbseb=0x%04" PRIx32 "", fmbseb);
+               LOG_DEBUG("set fmbseb = 0x%04" PRIx32 "", fmbseb);
                bank->sectors[sector].is_protected = fmbseb & (1 << (sector - 16)) ? 0 : 1;
        }
        target_write_u32(target, 0xFFE89C00, orig_fmregopt);
-       LOG_DEBUG("set fmregopt=0x%08" PRIx32 "", orig_fmregopt);
+       LOG_DEBUG("set fmregopt = 0x%08" PRIx32 "", orig_fmregopt);
        target_write_u32(target, 0xFFFFFFDC, glbctrl);
-       LOG_DEBUG("set glbctrl=0x%08" PRIx32 "", glbctrl);
+       LOG_DEBUG("set glbctrl = 0x%08" PRIx32 "", glbctrl);
 
        if (result == ERROR_OK)
        {
@@ -1028,7 +1028,7 @@ static int tms470_write(struct flash_bank_s *bank, uint8_t * buffer, uint32_t of
 
                        if (fmmstat & 0x3ff)
                        {
-                               LOG_ERROR("fmstat=0x%04" PRIx32 "", fmmstat);
+                               LOG_ERROR("fmstat = 0x%04" PRIx32 "", fmmstat);
                                LOG_ERROR("Could not program word 0x%04x at address 0x%08" PRIx32 ".", word, addr);
                                result = ERROR_FLASH_OPERATION_FAILED;
                                break;
@@ -1105,7 +1105,7 @@ static int tms470_erase_check(struct flash_bank_s *bank)
        target_read_u32(target, 0xFFE8BC04, &fmmac2);
        target_write_u32(target, 0xFFE8BC04, (fmmac2 & ~7) | tms470_info->ordinal);
 
-       /* TCR=0 */
+       /* TCR = 0 */
        target_write_u32(target, 0xFFE8BC10, 0x2fc0);
 
        /* clear TEZ in fmbrdy */
index d07a15a148c619d1df3bd23d4fb92c48a5233e3a..a49d5d53223441752008c44d9d30b50a664d6ab0 100644 (file)
@@ -42,7 +42,7 @@ static inline void buf_set_u32(uint8_t* buffer, unsigned int first, unsigned int
        {
                unsigned int i;
                
-               for (i=first; i<first+num; i++)
+               for (i = first; i<first+num; i++)
                {
                        if (((value >> (i-first))&1) == 1)
                                buffer[i/8] |= 1 << (i%8);
@@ -61,7 +61,7 @@ static inline uint32_t buf_get_u32(const uint8_t* buffer, unsigned int first, un
                uint32_t result = 0;
                unsigned int i;
                
-               for (i=first; i<first+num; i++)
+               for (i = first; i<first+num; i++)
                {
                        if (((buffer[i/8]>>(i%8))&1) == 1)
                                result |= 1 << (i-first);
index e83910541180c886ab59641b4a8aa0c697a65e81..231c2999e5f9a19ebfb59ba1fb3c025e166786bf 100644 (file)
@@ -54,7 +54,7 @@ int run_command(command_context_t *context, command_t *c, char *words[], int num
 
 static void tcl_output(void *privData, const char *file, int line, const char *function, const char *string)
 {
-       Jim_Obj *tclOutput=(Jim_Obj *)privData;
+       Jim_Obj *tclOutput = (Jim_Obj *)privData;
 
        Jim_AppendString(interp, tclOutput, string, strlen(string));
 }
@@ -108,7 +108,7 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
        for (i = 0; i < argc; i++)
        {
                int len;
-               const char *w=Jim_GetString(argv[i], &len);
+               const char *w = Jim_GetString(argv[i], &len);
                if (*w=='#')
                {
                        /* hit an end of line comment */
@@ -228,26 +228,26 @@ command_t* register_command(command_context_t *context, command_t *parent, char
        /* maximum of two levels :-) */
        if (c->parent != NULL)
        {
-               t1=c->parent->name;
+               t1 = c->parent->name;
                t2="_";
        }
-       t3=c->name;
-       const char *full_name=alloc_printf("ocd_%s%s%s", t1, t2, t3);
+       t3 = c->name;
+       const char *full_name = alloc_printf("ocd_%s%s%s", t1, t2, t3);
        Jim_CreateCommand(interp, full_name, script_command, c, NULL);
        free((void *)full_name);
 
        /* we now need to add an overrideable proc */
-       const char *override_name=alloc_printf("proc %s%s%s {args} {if {[catch {eval ocd_%s%s%s $args}]==0} {return \"\"} else { return -code error }", t1, t2, t3, t1, t2, t3);
+       const char *override_name = alloc_printf("proc %s%s%s {args} {if {[catch {eval ocd_%s%s%s $args}]==0} {return \"\"} else { return -code error }", t1, t2, t3, t1, t2, t3);
        Jim_Eval_Named(interp, override_name, __THIS__FILE__, __LINE__ );
        free((void *)override_name);
 
        /* accumulate help text in Tcl helptext list.  */
-       Jim_Obj *helptext=Jim_GetGlobalVariableStr(interp, "ocd_helptext", JIM_ERRMSG);
+       Jim_Obj *helptext = Jim_GetGlobalVariableStr(interp, "ocd_helptext", JIM_ERRMSG);
        if (Jim_IsShared(helptext))
                helptext = Jim_DuplicateObj(interp, helptext);
-       Jim_Obj *cmd_entry=Jim_NewListObj(interp, NULL, 0);
+       Jim_Obj *cmd_entry = Jim_NewListObj(interp, NULL, 0);
 
-       Jim_Obj *cmd_list=Jim_NewListObj(interp, NULL, 0);
+       Jim_Obj *cmd_list = Jim_NewListObj(interp, NULL, 0);
 
        /* maximum of two levels :-) */
        if (c->parent != NULL)
@@ -404,7 +404,7 @@ void command_print(command_context_t *context, const char *format, ...)
 
 int run_command(command_context_t *context, command_t *c, char *words[], int num_words)
 {
-       int start_word=0;
+       int start_word = 0;
        if (!((context->mode == COMMAND_CONFIG) || (c->mode == COMMAND_ANY) || (c->mode == context->mode) ))
        {
                /* Config commands can not run after the config stage */
@@ -422,10 +422,10 @@ int run_command(command_context_t *context, command_t *c, char *words[], int num
                /* maximum of two levels :-) */
                if (c->parent != NULL)
                {
-                       t1=c->parent->name;
+                       t1 = c->parent->name;
                        t2=" ";
                }
-               t3=c->name;
+               t3 = c->name;
                command_run_linef(context, "help {%s%s%s}", t1, t2, t3);
        }
        else if (retval == ERROR_COMMAND_CLOSE_CONNECTION)
@@ -450,7 +450,7 @@ int command_run_line(command_context_t *context, char *line)
         * results
         */
        /* run the line thru a script engine */
-       int retval=ERROR_FAIL;
+       int retval = ERROR_FAIL;
        int retcode;
        /* Beware! This code needs to be reentrant. It is also possible
         * for OpenOCD commands to be invoked directly from Tcl. This would
@@ -508,21 +508,21 @@ int command_run_line(command_context_t *context, char *line)
                        }
                        LOG_USER_N("%s", "\n");
                }
-               retval=ERROR_OK;
+               retval = ERROR_OK;
        }
        return retval;
 }
 
 int command_run_linef(command_context_t *context, const char *format, ...)
 {
-       int retval=ERROR_FAIL;
+       int retval = ERROR_FAIL;
        char *string;
        va_list ap;
        va_start(ap, format);
        string = alloc_vprintf(format, ap);
        if (string != NULL)
        {
-               retval=command_run_line(context, string);
+               retval = command_run_line(context, string);
        }
        va_end(ap);
        return retval;
@@ -837,13 +837,13 @@ void register_jim(struct command_context_s *cmd_ctx, const char *name, int (*cmd
 
        /* FIX!!! it would be prettier to invoke add_help_text...
         * accumulate help text in Tcl helptext list.  */
-       Jim_Obj *helptext=Jim_GetGlobalVariableStr(interp, "ocd_helptext", JIM_ERRMSG);
+       Jim_Obj *helptext = Jim_GetGlobalVariableStr(interp, "ocd_helptext", JIM_ERRMSG);
        if (Jim_IsShared(helptext))
                helptext = Jim_DuplicateObj(interp, helptext);
 
-       Jim_Obj *cmd_entry=Jim_NewListObj(interp, NULL, 0);
+       Jim_Obj *cmd_entry = Jim_NewListObj(interp, NULL, 0);
 
-       Jim_Obj *cmd_list=Jim_NewListObj(interp, NULL, 0);
+       Jim_Obj *cmd_list = Jim_NewListObj(interp, NULL, 0);
        Jim_ListAppendElement(interp, cmd_list, Jim_NewStringObj(interp, name, -1));
 
        Jim_ListAppendElement(interp, cmd_entry, cmd_list);
@@ -854,7 +854,7 @@ void register_jim(struct command_context_s *cmd_ctx, const char *name, int (*cmd
 /* return global variable long value or 0 upon failure */
 long jim_global_long(const char *variable)
 {
-       Jim_Obj *objPtr=Jim_GetGlobalVariableStr(interp, variable, JIM_ERRMSG);
+       Jim_Obj *objPtr = Jim_GetGlobalVariableStr(interp, variable, JIM_ERRMSG);
        long t;
        if (Jim_GetLong(interp, objPtr, &t) == JIM_OK)
        {
index 95b4c7e0ce3edaef4c2c5dae80fd635ac51e4541..9485a7eb037f1d268b1b48810f3ed08af267ccec 100644 (file)
@@ -93,7 +93,7 @@ FILE *open_file_from_path (char *file, char *mode)
                return fopen(file, mode);
        } else
        {
-               char *full_path=find_file(file);
+               char *full_path = find_file(file);
                if (full_path == NULL)
                        return NULL;
                FILE *fp = NULL;
@@ -115,7 +115,7 @@ int parse_config_file(struct command_context_s *cmd_ctx)
 
        while (*cfg)
        {
-               retval=command_run_line(cmd_ctx, *cfg);
+               retval = command_run_line(cmd_ctx, *cfg);
                if (retval != ERROR_OK)
                        return retval;
                cfg++;
index 8f02e2eb3b6bdc2e69109325e3bef10f28ae5101..390d50e9ee1d1348ad8ff1767cc3c7ffc3ed1e33 100644 (file)
@@ -215,7 +215,7 @@ int handle_append_command(struct command_context_s *cmd_ctx, char *cmd,
                return ERROR_INVALID_ARGUMENTS;
        }
 
-       int retval=ERROR_FAIL;
+       int retval = ERROR_FAIL;
        FILE *config_file = NULL;
        config_file = fopen(args[0], "a");
        if (config_file != NULL)
@@ -235,7 +235,7 @@ int handle_append_command(struct command_context_s *cmd_ctx, char *cmd,
                }
                if ((i == argc) && (fwrite("\n", 1, 1, config_file) == 1))
                {
-                       retval=ERROR_OK;
+                       retval = ERROR_OK;
                }
                fclose(config_file);
        }
index 8e063608305eaa61ff5635441b0afd9f6256ab08..7c459d57bbeec0c1a0f171685bd3ae11ac8de78e 100644 (file)
@@ -504,7 +504,7 @@ static jim_wide JimPowWide(jim_wide b, jim_wide e)
 {
     jim_wide i, res = 1;
     if ((b == 0 && e != 0) || (e<0)) return 0;
-    for (i=0; i<e; i++) {res *= b;}
+    for (i = 0; i<e; i++) {res *= b;}
     return res;
 }
 
@@ -569,7 +569,7 @@ void *Jim_Alloc(int size)
 {
        /* We allocate zero length arrayes, etc. to use a single orthogonal codepath */
        if (size == 0)
-               size=1;
+               size = 1;
     void *p = malloc(size);
     if (p == NULL)
         Jim_Panic(NULL,"malloc: Out of memory");
@@ -584,7 +584,7 @@ void *Jim_Realloc(void *ptr, int size)
 {
        /* We allocate zero length arrayes, etc. to use a single orthogonal codepath */
        if (size == 0)
-               size=1;
+               size = 1;
     void *p = realloc(ptr, size);
     if (p == NULL)
         Jim_Panic(NULL,"realloc: Out of memory");
@@ -2521,8 +2521,8 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
 Jim_Obj *Jim_FormatString(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
         int objc, Jim_Obj *const *objv)
 {
-       char *sprintf_buf=malloc(JIM_MAX_FMT);
-       Jim_Obj *t=Jim_FormatString_Inner(interp, fmtObjPtr, objc, objv, sprintf_buf);
+       char *sprintf_buf = malloc(JIM_MAX_FMT);
+       Jim_Obj *t = Jim_FormatString_Inner(interp, fmtObjPtr, objc, objv, sprintf_buf);
        free(sprintf_buf);
        return t; 
 }
@@ -5366,7 +5366,7 @@ void ListInsertElements(Jim_Obj *listPtr, int index, int elemc,
     }
     point = listPtr->internalRep.listValue.ele + index;
     memmove(point+elemc, point, (currentLen-index) * sizeof(Jim_Obj*));
-    for (i=0; i < elemc; ++i) {
+    for (i = 0; i < elemc; ++i) {
         point[i] = elemVec[i];
         Jim_IncrRefCount(point[i]);
     }
@@ -7335,7 +7335,7 @@ static int SetScanFmtFromAny(Jim_Interp *interp, Jim_Obj *objPtr)
 
     Jim_FreeIntRep(interp, objPtr);
     /* Count how many conversions could take place maximally */
-    for (i=0, maxCount=0; i < maxFmtLen; ++i)
+    for (i = 0, maxCount = 0; i < maxFmtLen; ++i)
         if (fmt[i] == '%')
             ++maxCount;
     /* Calculate an approximation of the memory necessary */
@@ -7356,8 +7356,8 @@ static int SetScanFmtFromAny(Jim_Interp *interp, Jim_Obj *objPtr)
     buffer = fmtObj->stringRep + maxFmtLen + 1;
     objPtr->internalRep.ptr = fmtObj;
     objPtr->typePtr = &scanFmtStringObjType;
-    for (i=0, curr=0; fmt < fmtEnd; ++fmt) {
-        int width=0, skip;
+    for (i = 0, curr = 0; fmt < fmtEnd; ++fmt) {
+        int width = 0, skip;
         ScanFmtPartDescr *descr = &fmtObj->descr[curr];
         fmtObj->count++;
         descr->width = 0;                   /* Assume width unspecified */ 
@@ -7401,7 +7401,7 @@ static int SetScanFmtFromAny(Jim_Interp *interp, Jim_Obj *objPtr)
                     return JIM_ERR;
                 }
                 /* Look if this position was already used */
-                for (prev=0; prev < curr; ++prev) {
+                for (prev = 0; prev < curr; ++prev) {
                     if (fmtObj->descr[prev].pos == -1) continue;
                     if (fmtObj->descr[prev].pos == descr->pos) {
                         fmtObj->error = "same \"%n$\" conversion specifier "
@@ -7442,7 +7442,7 @@ static int SetScanFmtFromAny(Jim_Interp *interp, Jim_Obj *objPtr)
             /* In case a range fence was given "backwards", swap it */
             while (swapped) {
                 swapped = 0;
-                for (j=beg+1; j < end-1; ++j) {
+                for (j = beg+1; j < end-1; ++j) {
                     if (buffer[j] == '-' && buffer[j-1] > buffer[j+1]) {
                         char tmp = buffer[j-1];
                         buffer[j-1] = buffer[j+1];
@@ -7550,7 +7550,7 @@ JimScanAString(Jim_Interp *interp, const char *sdescr, const char *str)
             if (sdescr[1] == '-' && sdescr[2] != 0) {
                 /* Handle range definitions */
                 int i;
-                for (i=sdescr[0]; i <= sdescr[2]; ++i)
+                for (i = sdescr[0]; i <= sdescr[2]; ++i)
                     JimSetBit(charset, (char)i);
                 sdescr += 3;
             } else {
@@ -7559,7 +7559,7 @@ JimScanAString(Jim_Interp *interp, const char *sdescr, const char *str)
             }
         }
         /* Negate the charset if there was a NOT given */
-        for (i=0; notFlag && i < sizeof(charset); ++i)
+        for (i = 0; notFlag && i < sizeof(charset); ++i)
             charset[i] = ~charset[i];
     } 
     /* And after all the mess above, the real work begin ... */
@@ -7600,7 +7600,7 @@ static int ScanOneEntry(Jim_Interp *interp, const char *str, long pos,
     if (descr->prefix) {
         /* There was a prefix given before the conversion, skip it and adjust
          * the string-to-be-parsed accordingly */
-        for (i=0; str[pos] && descr->prefix[i]; ++i) {
+        for (i = 0; str[pos] && descr->prefix[i]; ++i) {
             /* If prefix require, skip WS */
             if (isspace((int)descr->prefix[i]))
                 while (str[pos] && isspace((int)str[pos])) ++pos;
@@ -7757,12 +7757,12 @@ Jim_Obj *Jim_ScanString(Jim_Interp *interp, Jim_Obj *strObjPtr,
     /* Create a list and fill it with empty strings up to max specified XPG3 */
     resultList = Jim_NewListObj(interp, 0, 0);
     if (fmtObj->maxPos > 0) {
-        for (i=0; i < fmtObj->maxPos; ++i)
+        for (i = 0; i < fmtObj->maxPos; ++i)
             Jim_ListAppendElement(interp, resultList, emptyStr);
         JimListGetElements(interp, resultList, &resultc, &resultVec);
     }
     /* Now handle every partial format description */
-    for (i=0, pos=0; i < fmtObj->count; ++i) {
+    for (i = 0, pos = 0; i < fmtObj->count; ++i) {
         ScanFmtPartDescr *descr = &(fmtObj->descr[i]);
         Jim_Obj *value = 0;
         /* Only last type may be "literal" w/o conversion - skip it! */
@@ -8960,8 +8960,8 @@ int Jim_EvalFile(Jim_Interp *interp, const char *filename)
     Jim_Obj *scriptObjPtr;
     
     if ((fp = fopen(filename, "r")) == NULL) {
-       const int cwd_len=2048;
-               char *cwd=malloc(cwd_len);
+       const int cwd_len = 2048;
+               char *cwd = malloc(cwd_len);
         Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
        if (!getcwd( cwd, cwd_len )) strcpy(cwd, "unknown");
         Jim_AppendStrings(interp, Jim_GetResult(interp),
@@ -10203,7 +10203,7 @@ static int JimForeachMapHelper(Jim_Interp *interp, int argc,
     /* Initialize iterators and remember max nbr elements each list */
     memset(listsIdx, 0, nbrOfLists * sizeof(int));
     /* Remember lengths of all lists and calculate how much rounds to loop */
-    for (i=0; i < nbrOfLists*2; i += 2) {
+    for (i = 0; i < nbrOfLists*2; i += 2) {
         div_t cnt;
         int count;
         Jim_ListLength(interp, argv[i+1], &listsEnd[i]);
@@ -10218,7 +10218,7 @@ static int JimForeachMapHelper(Jim_Interp *interp, int argc,
             nbrOfLoops = count;
     }
     for (; nbrOfLoops-- > 0; ) {
-        for (i=0; i < nbrOfLists; ++i) {
+        for (i = 0; i < nbrOfLists; ++i) {
             int varIdx = 0, var = i * 2;
             while (varIdx < listsEnd[var]) {
                 Jim_Obj *varName, *ele;
@@ -10340,11 +10340,11 @@ enum {SWITCH_EXACT, SWITCH_GLOB, SWITCH_RE, SWITCH_CMD, SWITCH_UNKNOWN};
 static int Jim_SwitchCoreCommand(Jim_Interp *interp, int argc, 
         Jim_Obj *const *argv)
 {
-    int retcode = JIM_ERR, matchOpt = SWITCH_EXACT, opt=1, patCount, i;
+    int retcode = JIM_ERR, matchOpt = SWITCH_EXACT, opt = 1, patCount, i;
     Jim_Obj *command = 0, *const *caseList = 0, *strObj;
     Jim_Obj *script = 0;
     if (argc < 3) goto wrongnumargs;
-    for (opt=1; opt < argc; ++opt) {
+    for (opt = 1; opt < argc; ++opt) {
         const char *option = Jim_GetString(argv[opt], 0);
         if (*option != '-') break;
         else if (strncmp(option, "--", 2) == 0) { ++opt; break; }
@@ -10372,7 +10372,7 @@ static int Jim_SwitchCoreCommand(Jim_Interp *interp, int argc,
     } else
         caseList = &argv[opt];
     if (patCount == 0 || patCount % 2 != 0) goto wrongnumargs;
-    for (i=0; script == 0 && i < patCount; i += 2) {
+    for (i = 0; script == 0 && i < patCount; i += 2) {
         Jim_Obj *patObj = caseList[i];
         if (!Jim_CompareStringImmediate(interp, patObj, "default")
             || i < (patCount-2)) {
index 3d3346c259902db3b7384631872f6dfd783e16b8..97846f14d953f0e4b85a8efb751a62b82ee829d3 100644 (file)
@@ -575,7 +575,7 @@ typedef struct Jim_Reference {
  * known string, or there may be multiple strings (aliases) that mean then same
  * thing.
  *
- * An NVP Table is terminated with ".name=NULL".
+ * An NVP Table is terminated with ".name = NULL".
  *
  * During the 'name2value' operation, if no matching string is found
  * the pointer to the terminal element (with p->name == NULL) is returned.
@@ -966,7 +966,7 @@ JIM_STATIC const char *JIM_API( Jim_Debug_ArgvString )( Jim_Interp *interp, int
  * Usefull when dealing with command options.
  * that may come in any order...
  *
- * Does not support "-foo=123" type options.
+ * Does not support "-foo = 123" type options.
  * Only supports tcl type options, like "-foo 123"
  */
 
@@ -1097,7 +1097,7 @@ JIM_STATIC int JIM_API( Jim_GetOpt_Nvp)( Jim_GetOptInfo *goi, const Jim_Nvp *loo
  *
  * This function assumes the previous option argv[-1] is the unknown string.
  *
- * If this option had some prefix, then pass "hadprefix=1" else pass "hadprefix=0"
+ * If this option had some prefix, then pass "hadprefix = 1" else pass "hadprefix = 0"
  *
  * Example:
  * \code
@@ -1107,7 +1107,7 @@ JIM_STATIC int JIM_API( Jim_GetOpt_Nvp)( Jim_GetOptInfo *goi, const Jim_Nvp *loo
  *     e = Jim_GetOpt_Nvp( &goi, cmd_options, &n );
  *     if ( e != JIM_OK ){
  *          // option was not recognized
- *          // pass 'hadprefix=0' because there is no prefix
+ *          // pass 'hadprefix = 0' because there is no prefix
  *          Jim_GetOpt_NvpUnknown( &goi, cmd_options, 0 );
  *          return e;
  *     }
index 0e04af6f6bb88b7151e75b96dcdadb88344521e1..68b29a203b5cda1f27f2e4d9287551db332731b0 100644 (file)
@@ -94,7 +94,7 @@ static void log_puts(enum log_levels level, const char *file, int line, const ch
                if (debug_level >= LOG_LVL_DEBUG)
                {
                        /* print with count and time information */
-                       int t=(int)(timeval_ms()-start);
+                       int t = (int)(timeval_ms()-start);
 #ifdef _DEBUG_FREE_SPACE_
                        struct mallinfo info;
                        info = mallinfo();
@@ -136,9 +136,9 @@ static void log_puts(enum log_levels level, const char *file, int line, const ch
                /* DANGER!!!! the log callback can remove itself!!!! */
                while (cb)
                {
-                       next=cb->next;
+                       next = cb->next;
                        cb->fn(cb->priv, file, line, function, string);
-                       cb=next;
+                       cb = next;
                }
        }
 }
@@ -259,7 +259,7 @@ int log_init(struct command_context_s *cmd_ctx)
                log_output = stderr;
        }
 
-       start=last_time=timeval_ms();
+       start = last_time = timeval_ms();
 
        return ERROR_OK;
 }
@@ -383,7 +383,7 @@ char *alloc_printf(const char *format, ...)
  */
 void keep_alive()
 {
-       current_time=timeval_ms();
+       current_time = timeval_ms();
        if (current_time-last_time>1000)
        {
                extern int gdb_actual_connections;
@@ -413,28 +413,28 @@ void keep_alive()
                 * These functions should be invoked at a well defined spot in server.c
                 */
 
-               last_time=current_time;
+               last_time = current_time;
        }
 }
 
 /* reset keep alive timer without sending message */
 void kept_alive()
 {
-       current_time=timeval_ms();
-       last_time=current_time;
+       current_time = timeval_ms();
+       last_time = current_time;
 }
 
 /* if we sleep for extended periods of time, we must invoke keep_alive() intermittantly */
 void alive_sleep(int ms)
 {
        int i;
-       int napTime=10;
-       for (i=0; i<ms; i += napTime)
+       int napTime = 10;
+       for (i = 0; i<ms; i += napTime)
        {
-               int sleep_a_bit=ms-i;
+               int sleep_a_bit = ms-i;
                if (sleep_a_bit>napTime)
                {
-                       sleep_a_bit=napTime;
+                       sleep_a_bit = napTime;
                }
                usleep(sleep_a_bit*1000);
                keep_alive();
@@ -444,7 +444,7 @@ void alive_sleep(int ms)
 void busy_sleep(int ms)
 {
        long long then;
-       then=timeval_ms();
+       then = timeval_ms();
        while ((timeval_ms()-then)<ms)
        {
                /* busy wait */
index 23491d3f5b2c075cd932ffff2fafca990e06260e..92557ba3bdc27cc09dac23cd7239b6f61b46f909 100644 (file)
@@ -70,7 +70,7 @@ int add_default_dirs(void)
                /* Either this code will *always* work or it will SEGFAULT giving
                 * excellent information on the culprit. 
                 */
-               *strrchr(strExePath, '\\')=0;
+               *strrchr(strExePath, '\\') = 0;
                strcat(strExePath, "\\..");
                add_script_search_dir(strExePath);
        }
@@ -88,9 +88,9 @@ int add_default_dirs(void)
                char strExePath [MAX_PATH];
                char *p;
                GetModuleFileName (NULL, strExePath, MAX_PATH);
-               *strrchr(strExePath, '\\')=0;
+               *strrchr(strExePath, '\\') = 0;
                strcat(strExePath, "/../lib/"PACKAGE);
-               for (p=strExePath; *p; p++) {
+               for (p = strExePath; *p; p++) {
                        if (*p == '\\')
                                *p = '/';
                }
index 922d411d7561f8671645c3310468f105da953133..ef93e56d86bbc5a52396c1b1845fd17c84574834 100644 (file)
@@ -99,7 +99,7 @@ int duration_stop_measure(duration_t *duration, char **text)
        if (text)
        {
                float t;
-               t=duration->duration.tv_sec;
+               t = duration->duration.tv_sec;
                t += (float)duration->duration.tv_usec/1000000.0;
                *text = malloc(100);
                snprintf(*text, 100, "%fs", t);
@@ -111,7 +111,7 @@ int duration_stop_measure(duration_t *duration, char **text)
 long long timeval_ms()
 {
        struct timeval now; 
-       long long t=0;
+       long long t = 0;
        gettimeofday(&now, NULL);
        
        t += now.tv_usec/1000;
index cb0d73d6d8e1cc0bac17e732eced6766a7aa3abe..8fbe83deeb68aca2571fe5802ea50eddb832deea 100644 (file)
@@ -47,7 +47,7 @@ bitbang_interface_t *bitbang_interface;
  *
  * If someone can submit a patch with an explanation it will be greatly
  * appreciated, but as far as I can tell (ØH) DCLK is generated upon
- * clk=0 in TAP_IDLE. Good luck deducing that from the ARM documentation!
+ * clk = 0 in TAP_IDLE. Good luck deducing that from the ARM documentation!
  * The ARM documentation uses the term "DCLK is asserted while in the TAP_IDLE
  * state". With hardware there is no such thing as *while* in a state. There
  * are only edges. So clk => 0 is in fact a very subtle state transition that
@@ -76,7 +76,7 @@ static void bitbang_end_state(tap_state_t state)
 
 static void bitbang_state_move(int skip)
 {
-       int i=0, tms=0;
+       int i = 0, tms = 0;
        uint8_t tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state());
        int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state());
 
@@ -188,24 +188,24 @@ static void bitbang_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int
 
        for (bit_cnt = 0; bit_cnt < scan_size; bit_cnt++)
        {
-               int val=0;
-               int tms=(bit_cnt == scan_size-1) ? 1 : 0;
+               int val = 0;
+               int tms = (bit_cnt == scan_size-1) ? 1 : 0;
                int tdi;
-               int bytec=bit_cnt/8;
-               int bcval=1 << (bit_cnt % 8);
+               int bytec = bit_cnt/8;
+               int bcval = 1 << (bit_cnt % 8);
 
                /* if we're just reading the scan, but don't care about the output
                 * default to outputting 'low', this also makes valgrind traces more readable,
                 * as it removes the dependency on an uninitialised value
                 */
-               tdi=0;
+               tdi = 0;
                if ((type != SCAN_IN) && (buffer[bytec] & bcval))
-                       tdi=1;
+                       tdi = 1;
 
                bitbang_interface->write(0, tms, tdi);
 
                if (type != SCAN_OUT)
-                       val=bitbang_interface->read();
+                       val = bitbang_interface->read();
 
                bitbang_interface->write(1, tms, tdi);
 
index b7b411b1017c48f83dc307c2f5807198f3af8f84..71fa827d38bc687bc5a670bfd22ccdce145381ad 100644 (file)
@@ -117,7 +117,7 @@ void* cmd_queue_alloc(size_t size)
        offset = (*p_page)->used;
        (*p_page)->used += size;
 
-       t=(uint8_t *)((*p_page)->address);
+       t = (uint8_t *)((*p_page)->address);
        return t + offset;
 }
 
index 35f0dd90536a81bb30e7f4bffbc3a8454c48f801..5a76a8fb0e7f1a9c4d32ab6e219394565adb6ef8 100644 (file)
@@ -90,9 +90,9 @@ typedef struct stableclocks_command_s
 
 typedef struct reset_command_s
 {
-       /// Set TRST output: 0=deassert, 1=assert, -1=no change
+       /// Set TRST output: 0 = deassert, 1 = assert, -1 = no change
        int trst;
-       /// Set SRST output: 0=deassert, 1=assert, -1=no change
+       /// Set SRST output: 0 = deassert, 1 = assert, -1 = no change
        int srst;
 } reset_command_t;
 
index 34ad11b075d1171253979585169dd630b6e4649d..4e41eb17063b432d10d136036305c807f4952334 100644 (file)
@@ -333,8 +333,8 @@ void jtag_add_ir_scan(int in_num_fields, scan_field_t *in_fields, tap_state_t st
                        /* if we are to run a verification of the ir scan, we need to get the input back.
                         * We may have to allocate space if the caller didn't ask for the input back.
                         */
-                       in_fields[j].check_value=in_fields[j].tap->expected;
-                       in_fields[j].check_mask=in_fields[j].tap->expected_mask;
+                       in_fields[j].check_value = in_fields[j].tap->expected;
+                       in_fields[j].check_mask = in_fields[j].tap->expected_mask;
                }
                jtag_add_scan_check(jtag_add_ir_scan_noverify, in_num_fields, in_fields, state);
        } else
@@ -754,7 +754,7 @@ void jtag_check_value_mask(scan_field_t *field, uint8_t *value, uint8_t *mask)
 
        jtag_execute_queue_noclear();
 
-       int retval=jtag_check_value_inner(field->in_value, value, mask, field->num_bits);
+       int retval = jtag_check_value_inner(field->in_value, value, mask, field->num_bits);
        jtag_set_error(retval);
 }
 
@@ -1157,7 +1157,7 @@ static int jtag_init_inner(struct command_context_s *cmd_ctx)
        }
 
        jtag_add_tlr();
-       if ((retval=jtag_execute_queue()) != ERROR_OK)
+       if ((retval = jtag_execute_queue()) != ERROR_OK)
                return retval;
 
        /* examine chain first, as this could discover the real chain layout */
@@ -1192,7 +1192,7 @@ int jtag_init_reset(struct command_context_s *cmd_ctx)
 {
        int retval;
 
-       if ((retval=jtag_interface_init(cmd_ctx)) != ERROR_OK)
+       if ((retval = jtag_interface_init(cmd_ctx)) != ERROR_OK)
                return retval;
 
        LOG_DEBUG("Trying to bring the JTAG controller to life by asserting TRST / RESET");
@@ -1236,7 +1236,7 @@ int jtag_init_reset(struct command_context_s *cmd_ctx)
 int jtag_init(struct command_context_s *cmd_ctx)
 {
        int retval;
-       if ((retval=jtag_interface_init(cmd_ctx)) != ERROR_OK)
+       if ((retval = jtag_interface_init(cmd_ctx)) != ERROR_OK)
                return retval;
        if (jtag_init_inner(cmd_ctx) == ERROR_OK)
        {
index c3d63067d985b582469ea46228010e0c8761fdde..1555561d6c3629c9be53f5e3c7011f0e6bb1aa54 100644 (file)
@@ -467,23 +467,23 @@ int interface_jtag_add_sleep(uint32_t us)
 /* add callback to end of queue */
 void interface_jtag_add_callback4(jtag_callback_t callback, jtag_callback_data_t data0, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3)
 {
-       struct jtag_callback_entry *entry=cmd_queue_alloc(sizeof(struct jtag_callback_entry));
+       struct jtag_callback_entry *entry = cmd_queue_alloc(sizeof(struct jtag_callback_entry));
 
-       entry->next=NULL;
-       entry->callback=callback;
-       entry->data0=data0;
-       entry->data1=data1;
-       entry->data2=data2;
-       entry->data3=data3;
+       entry->next = NULL;
+       entry->callback = callback;
+       entry->data0 = data0;
+       entry->data1 = data1;
+       entry->data2 = data2;
+       entry->data3 = data3;
 
        if (jtag_callback_queue_head == NULL)
        {
-               jtag_callback_queue_head=entry;
-               jtag_callback_queue_tail=entry;
+               jtag_callback_queue_head = entry;
+               jtag_callback_queue_tail = entry;
        } else
        {
-               jtag_callback_queue_tail->next=entry;
-               jtag_callback_queue_tail=entry;
+               jtag_callback_queue_tail->next = entry;
+               jtag_callback_queue_tail = entry;
        }
 }
 
@@ -493,9 +493,9 @@ int interface_jtag_execute_queue(void)
        if (retval == ERROR_OK)
        {
                struct jtag_callback_entry *entry;
-               for (entry=jtag_callback_queue_head; entry != NULL; entry=entry->next)
+               for (entry = jtag_callback_queue_head; entry != NULL; entry = entry->next)
                {
-                       retval=entry->callback(entry->data0, entry->data1, entry->data2, entry->data3);
+                       retval = entry->callback(entry->data0, entry->data1, entry->data2, entry->data3);
                        if (retval != ERROR_OK)
                                break;
                }
index 497e5a64402052df204ff9373d89cee45144208a..75630d966a32102e11ac9b07470c46a2bb40d33f 100644 (file)
@@ -133,11 +133,11 @@ static int dummy_khz(int khz, int *jtag_speed)
 {
        if (khz == 0)
        {
-               *jtag_speed=0;
+               *jtag_speed = 0;
        }
        else
        {
-               *jtag_speed=64000/khz;
+               *jtag_speed = 64000/khz;
        }
        return ERROR_OK;
 }
@@ -150,7 +150,7 @@ static int dummy_speed_div(int speed, int *khz)
        }
        else
        {
-               *khz=64000/speed;
+               *khz = 64000/speed;
        }
 
        return ERROR_OK;
index 07b4bec4f97ddeadc7c43831e05fc36db9c043e1..80de04f9ecfef2078b69356ab5ede7b6419fad2d 100644 (file)
@@ -257,7 +257,7 @@ static void clock_tms(uint8_t mpsse_cmd, int tms_bits, int tms_count, bool tdi_b
 
        assert(tms_count > 0);
 
-//     LOG_DEBUG("mpsse cmd=%02x, tms_bits=0x%08x, bit_count=%d", mpsse_cmd, tms_bits, tms_count);
+//     LOG_DEBUG("mpsse cmd=%02x, tms_bits = 0x%08x, bit_count=%d", mpsse_cmd, tms_bits, tms_count);
 
        for (tms_byte = tms_ndx = i = 0;   i < tms_count;   ++i, tms_bits>>=1)
        {
@@ -470,7 +470,7 @@ static int ft2232_speed(int speed)
        ft2232_adaptive_clocking(speed);
 
        buf[0] = 0x86;                  /* command "set divisor" */
-       buf[1] = speed & 0xff;          /* valueL (0=6MHz, 1=3MHz, 2=2.0MHz, ...*/
+       buf[1] = speed & 0xff;          /* valueL (0 = 6MHz, 1 = 3MHz, 2 = 2.0MHz, ...*/
        buf[2] = (speed >> 8) & 0xff;   /* valueH */
 
        LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
@@ -623,8 +623,8 @@ static int ft2232_send_and_recv(jtag_command_t* first, jtag_command_t* last)
        int             scan_size;
        enum scan_type  type;
        int             retval;
-       uint32_t             bytes_written=0;
-       uint32_t             bytes_read=0;
+       uint32_t             bytes_written = 0;
+       uint32_t             bytes_read = 0;
 
 #ifdef _DEBUG_USB_IO_
        struct timeval  start, inter, inter2, end;
@@ -2194,8 +2194,8 @@ static int usbjtag_init(void)
 
        /* initialize low byte for jtag */
        buf[0] = 0x80;          /* command "set data bits low byte" */
-       buf[1] = low_output;    /* value (TMS=1,TCK=0, TDI=0, xRST high) */
-       buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in */
+       buf[1] = low_output;    /* value (TMS = 1,TCK = 0, TDI = 0, xRST high) */
+       buf[2] = low_direction; /* dir (output = 1), TCK/TDI/TMS = out, TDO = in */
        LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
 
        if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
@@ -2218,8 +2218,8 @@ static int axm0432_jtag_init(void)
 
        /* initialize low byte for jtag */
        buf[0] = 0x80;          /* command "set data bits low byte" */
-       buf[1] = low_output;    /* value (TMS=1,TCK=0, TDI=0, nOE=0) */
-       buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */
+       buf[1] = low_output;    /* value (TMS = 1,TCK = 0, TDI = 0, nOE = 0) */
+       buf[2] = low_direction; /* dir (output = 1), TCK/TDI/TMS = out, TDO = in, nOE = out */
        LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
 
        if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
@@ -2289,8 +2289,8 @@ static int jtagkey_init(void)
 
        /* initialize low byte for jtag */
        buf[0] = 0x80;          /* command "set data bits low byte" */
-       buf[1] = low_output;    /* value (TMS=1,TCK=0, TDI=0, nOE=0) */
-       buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */
+       buf[1] = low_output;    /* value (TMS = 1,TCK = 0, TDI = 0, nOE = 0) */
+       buf[2] = low_direction; /* dir (output = 1), TCK/TDI/TMS = out, TDO = in, nOE = out */
        LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
 
        if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
@@ -2372,8 +2372,8 @@ static int olimex_jtag_init(void)
 
        /* initialize low byte for jtag */
        buf[0] = 0x80;          /* command "set data bits low byte" */
-       buf[1] = low_output;    /* value (TMS=1,TCK=0, TDI=0, nOE=0) */
-       buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */
+       buf[1] = low_output;    /* value (TMS = 1,TCK = 0, TDI = 0, nOE = 0) */
+       buf[2] = low_direction; /* dir (output = 1), TCK/TDI/TMS = out, TDO = in, nOE = out */
        LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
 
        if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
@@ -2440,8 +2440,8 @@ static int flyswatter_init(void)
 
        /* initialize low byte for jtag */
        buf[0] = 0x80;          /* command "set data bits low byte" */
-       buf[1] = low_output;    /* value (TMS=1,TCK=0, TDI=0, nOE=0) */
-       buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE[12]=out, n[ST]srst=out */
+       buf[1] = low_output;    /* value (TMS = 1,TCK = 0, TDI = 0, nOE = 0) */
+       buf[2] = low_direction; /* dir (output = 1), TCK/TDI/TMS = out, TDO = in, nOE[12]=out, n[ST]srst = out */
        LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
 
        if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
@@ -2487,8 +2487,8 @@ static int turtle_init(void)
 
        /* initialize low byte for jtag */
        buf[0] = 0x80;          /* command "set data bits low byte" */
-       buf[1] = low_output;    /* value (TMS=1,TCK=0, TDI=0, nOE=0) */
-       buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */
+       buf[1] = low_output;    /* value (TMS = 1,TCK = 0, TDI = 0, nOE = 0) */
+       buf[2] = low_direction; /* dir (output = 1), TCK/TDI/TMS = out, TDO = in, nOE = out */
        LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
 
        if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
@@ -2528,8 +2528,8 @@ static int comstick_init(void)
 
        /* initialize low byte for jtag */
        buf[0] = 0x80;          /* command "set data bits low byte" */
-       buf[1] = low_output;    /* value (TMS=1,TCK=0, TDI=0, nOE=0) */
-       buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */
+       buf[1] = low_output;    /* value (TMS = 1,TCK = 0, TDI = 0, nOE = 0) */
+       buf[2] = low_direction; /* dir (output = 1), TCK/TDI/TMS = out, TDO = in, nOE = out */
        LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
 
        if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
@@ -2572,8 +2572,8 @@ static int stm32stick_init(void)
 
        /* initialize low byte for jtag */
        buf[0] = 0x80;          /* command "set data bits low byte" */
-       buf[1] = low_output;    /* value (TMS=1,TCK=0, TDI=0, nOE=0) */
-       buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */
+       buf[1] = low_output;    /* value (TMS = 1,TCK = 0, TDI = 0, nOE = 0) */
+       buf[2] = low_direction; /* dir (output = 1), TCK/TDI/TMS = out, TDO = in, nOE = out */
        LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
 
        if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
@@ -2616,8 +2616,8 @@ static int sheevaplug_init(void)
 
        /* initialize low byte for jtag */
        buf[0] = 0x80; /* command "set data bits low byte" */
-       buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */
-       buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in */
+       buf[1] = low_output; /* value (TMS = 1,TCK = 0, TDI = 0, nOE = 0) */
+       buf[2] = low_direction; /* dir (output = 1), TCK/TDI/TMS = out, TDO = in */
        LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
 
        if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
@@ -2667,8 +2667,8 @@ static int cortino_jtag_init(void)
 
        /* initialize low byte for jtag */
        buf[0] = 0x80;          /* command "set data bits low byte" */
-       buf[1] = low_output;    /* value (TMS=1,TCK=0, TDI=0, nOE=0) */
-       buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in, nOE=out */
+       buf[1] = low_output;    /* value (TMS = 1,TCK = 0, TDI = 0, nOE = 0) */
+       buf[2] = low_direction; /* dir (output = 1), TCK/TDI/TMS = out, TDO = in, nOE = out */
        LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
 
        if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
index 6991a66c9e4f8354ebb502f7daef40eb68f58965..51958db41913f50d246c3f2d28a2bb7afb5642ed 100644 (file)
@@ -196,7 +196,7 @@ static void gw16012_end_state(tap_state_t state)
 
 static void gw16012_state_move(void)
 {
-       int i=0, tms=0;
+       int i = 0, tms = 0;
        uint8_t tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state());
        int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state());
 
index 83ff6fa4fb940a2e4e76a0612181a6aa5662936c..1fdd8879116590f335e74a192fc4d080276fcc7f 100644 (file)
@@ -228,7 +228,7 @@ typedef struct jtag_interface_s
        int (*quit)(void);
 
        /**
-        * Returns JTAG maxium speed for KHz. 0=RTCK. The function returns
+        * Returns JTAG maxium speed for KHz. 0 = RTCK. The function returns
         *  a failure if it can't support the KHz/RTCK.
         *
         *  WARNING!!!! if RTCK is *slow* then think carefully about
index 0b39acfe799f89fdba79117da8c5877536d6f5a3..bab1a31ce6d2eb7e8b2d0c40b1d4cef16dc75251 100644 (file)
@@ -669,7 +669,7 @@ static int jlink_handle_jlink_hw_jtag_command(struct command_context_s *cmd_ctx,
 /* J-Link tap functions */
 
 
-static unsigned tap_length=0;
+static unsigned tap_length = 0;
 static uint8_t tms_buffer[JLINK_TAP_BUFFER_SIZE];
 static uint8_t tdi_buffer[JLINK_TAP_BUFFER_SIZE];
 static uint8_t tdo_buffer[JLINK_TAP_BUFFER_SIZE];
@@ -931,13 +931,13 @@ static int jlink_usb_message(jlink_jtag_t *jlink_jtag, int out_length, int in_le
                result2 = jlink_usb_read_emu_result(jlink_jtag);
                if (1 != result2)
                {
-                       LOG_ERROR("jlink_usb_read_emu_result retried requested=1, result=%d, in_length=%i", result2,in_length);
+                       LOG_ERROR("jlink_usb_read_emu_result retried requested = 1, result=%d, in_length=%i", result2,in_length);
                        /* Try again once, should only happen if (in_length%64 == 0) */
                        result2 = jlink_usb_read_emu_result(jlink_jtag);
                        if (1 != result2)
                        {
                                LOG_ERROR("jlink_usb_read_emu_result failed "
-                                       "(requested=1, result=%d)", result2);
+                                       "(requested = 1, result=%d)", result2);
                                return ERROR_JTAG_DEVICE_ERROR;
                        }
                }
index 7a7e937166001eb7c051037ec8f35d0a458c3fe9..3c554129aa17107bf16ac574f5667988f9d26508 100644 (file)
@@ -145,7 +145,7 @@ int interface_jtag_add_pathmove(int num_states, const tap_state_t *path)
 
        state_count = 0;
 
-       tap_state_t cur_state=cmd_queue_cur_state;
+       tap_state_t cur_state = cmd_queue_cur_state;
 
        while (num_states)
        {
index c12125c15e9b41bc7d1e03b7a931b76c76c4ac1f..5e329d42f23403edd9d213dab78453dd4062846f 100644 (file)
@@ -344,7 +344,7 @@ static int parport_init(void)
        LOG_DEBUG("...open");
 
 #if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
-       i=ioctl(device_handle, PPCLAIM);
+       i = ioctl(device_handle, PPCLAIM);
        if (i<0)
        {
                LOG_ERROR("cannot claim device");
index 1d03bdd12db80022bcfbe6af8a51755a39f73a2c..b1ca3bdd56d56349dce54c17d9635547b1fb2122 100644 (file)
@@ -292,7 +292,7 @@ static int presto_open_ftd2xx(char *req_serial)
 
                presto_data = 0;
                for (i = 0; i < 4 * 62; i++)
-                       if ((presto->status=FT_Write(presto->handle, &presto_data, 1, &ftbytes)) != FT_OK)
+                       if ((presto->status = FT_Write(presto->handle, &presto_data, 1, &ftbytes)) != FT_OK)
                                return ERROR_JTAG_DEVICE_ERROR;
 
                usleep(100000);
@@ -407,21 +407,21 @@ static int presto_open_libftdi(char *req_serial)
 
 static int presto_open(char *req_serial)
 {
-       presto->buff_out_pos=0;
-       presto->buff_in_pos=0;
-       presto->buff_in_len=0;
-       presto->buff_in_exp=0;
+       presto->buff_out_pos = 0;
+       presto->buff_in_pos = 0;
+       presto->buff_in_len = 0;
+       presto->buff_in_exp = 0;
 
-       presto->total_out=0;
-       presto->total_in=0;
+       presto->total_out = 0;
+       presto->total_in = 0;
 
-       presto->jtag_tms=0;
-       presto->jtag_tck=0;
-       presto->jtag_rst=0;
-       presto->jtag_tdi_data=0;
-       presto->jtag_tdi_count=0;
+       presto->jtag_tms = 0;
+       presto->jtag_tck = 0;
+       presto->jtag_rst = 0;
+       presto->jtag_tdi_data = 0;
+       presto->jtag_tdi_count = 0;
 
-       presto->jtag_speed=0;
+       presto->jtag_speed = 0;
 
 #if BUILD_PRESTO_FTD2XX == 1
        return presto_open_ftd2xx(req_serial);
@@ -625,14 +625,14 @@ static int presto_bitq_out(int tms, int tdi, int tdo_req)
        }
 
        /* delay with TCK low */
-       for (i=presto->jtag_speed; i>1; i--)
+       for (i = presto->jtag_speed; i>1; i--)
                presto_sendbyte(cmd);
 
        cmd |= 0x04;
        presto_sendbyte(cmd | (tdo_req ? 0x10 : 0));
 
        /* delay with TCK high */
-       for (i=presto->jtag_speed; i>1; i--)
+       for (i = presto->jtag_speed; i>1; i--)
                presto_sendbyte(cmd);
 
        presto->jtag_tck = 1;
@@ -707,7 +707,7 @@ static int presto_jtag_khz(int khz, int *jtag_speed)
 {
        if (khz < 0)
        {
-               *jtag_speed=0;
+               *jtag_speed = 0;
                return ERROR_INVALID_ARGUMENTS;
        }
 
@@ -721,7 +721,7 @@ static int presto_jtag_speed_div(int speed, int *khz)
 {
        if ((speed < 0) || (speed > 1000))
        {
-               *khz=0;
+               *khz = 0;
                return ERROR_INVALID_ARGUMENTS;
        }
 
index 11381d68bfe27e23852ee576cf342d2dee761b4d..2f14e86fc540bd5389f4bfce614dd06a7317f3ca 100644 (file)
@@ -915,7 +915,7 @@ void rlink_end_state(tap_state_t state)
 static
 void rlink_state_move(void) {
 
-       int i=0, tms=0;
+       int i = 0, tms = 0;
        uint8_t tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state());
        int tms_count = tap_get_tms_path_len(tap_get_state(), tap_get_end_state());
 
@@ -1131,7 +1131,7 @@ rlink_scan(
 
 
 #if 0
-       printf("scan_size = %d, type=0x%x\n", scan_size, type);
+       printf("scan_size = %d, type = 0x%x\n", scan_size, type);
        {
                int   i;
 
@@ -1620,8 +1620,8 @@ int rlink_init(void)
        struct usb_bus *busses;
        struct usb_bus *bus;
        int i, j, retries;
-       int found=0;
-       int success=0;
+       int found = 0;
+       int success = 0;
        uint8_t reply_buffer[USB_EP1IN_SIZE];
 
        usb_init();
@@ -1654,7 +1654,7 @@ int rlink_init(void)
                                                break;
                                        }
 
-                                       pHDev=usb_open(dev);
+                                       pHDev = usb_open(dev);
                                        if ( !pHDev )
                                                LOG_ERROR ("Failed to open device.\n");
                                        else
@@ -1692,7 +1692,7 @@ int rlink_init(void)
                                                                break;
                                                        }
                                                        else
-                                                               success=1;
+                                                               success = 1;
                                                }
                                        }
                                } while (0);
index 88f335a6b5536d88a9bb5fa2bad397ea28c1c31e..64396df9aed1c07c6ab9760c92643562d8daa36f 100644 (file)
@@ -721,13 +721,13 @@ static int default_speed_div(int speed, int *khz)
 
 static int default_power_dropout(int *dropout)
 {
-       *dropout=0; /* by default we can't detect power dropout */
+       *dropout = 0; /* by default we can't detect power dropout */
        return ERROR_OK;
 }
 
 static int default_srst_asserted(int *srst_asserted)
 {
-       *srst_asserted=0; /* by default we can't detect srst asserted */
+       *srst_asserted = 0; /* by default we can't detect srst asserted */
        return ERROR_OK;
 }
 
@@ -1331,7 +1331,7 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args
                return JIM_ERR;
        }
 
-       num_fields=(argc-2)/2;
+       num_fields = (argc-2)/2;
        fields = malloc(sizeof(scan_field_t) * num_fields);
        for (i = 2; i < argc; i += 2)
        {
@@ -1359,7 +1359,7 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args
                return JIM_ERR;
        }
 
-       field_count=0;
+       field_count = 0;
        Jim_Obj *list = Jim_NewListObj(interp, NULL, 0);
        for (i = 2; i < argc; i += 2)
        {
@@ -1396,7 +1396,7 @@ static int Jim_Command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *ar
        script_debug(interp, "pathmove", argc, args);
 
        int i;
-       for (i=0; i<argc-1; i++)
+       for (i = 0; i<argc-1; i++)
        {
                const char *cp;
                cp = Jim_GetString( args[i+1], NULL );
index ba91b14e9f8e846baa0cfaf71ecda12cc1b1b476..5abdf3243d44816c89912091b1595dda92a90823 100644 (file)
@@ -370,7 +370,7 @@ static void usbprog_scan(bool ir_scan, enum scan_type type, uint8_t *buffer, int
 
 static void usbprog_write(int tck, int tms, int tdi)
 {
-       unsigned char output_value=0x00;
+       unsigned char output_value = 0x00;
 
        if (tms)
                output_value |= (1 << TMS_BIT);
index 9f24dd661fa024ee422d334443b439a9a9ed7ea1..9606a2dd9f93bdb6a09f51451f076ecf6e7c42f8 100644 (file)
@@ -28,7 +28,7 @@
 #if 0
 int  diag_printf( const char *fmt, ... );
 #define ZY1000_POKE(a, b) HAL_WRITE_UINT32(a, b); diag_printf("poke 0x%08x,0x%08x\n", a, b)
-#define ZY1000_PEEK(a, b) HAL_READ_UINT32(a, b); diag_printf("peek 0x%08x=0x%08x\n", a, b)
+#define ZY1000_PEEK(a, b) HAL_READ_UINT32(a, b); diag_printf("peek 0x%08x = 0x%08x\n", a, b)
 #else
 #define ZY1000_POKE(a, b) HAL_WRITE_UINT32(a, b)
 #define ZY1000_PEEK(a, b) HAL_READ_UINT32(a, b)
@@ -62,15 +62,15 @@ static void sampleShiftRegister(void)
 static void setCurrentState(enum tap_state state)
 {
        cyg_uint32 a;
-       a=state;
-       int repeat=0;
+       a = state;
+       int repeat = 0;
        if (state == TAP_RESET)
        {
                // The FPGA nor we know the current state of the CPU TAP
                // controller. This will move it to TAP for sure.
                //
                // 5 should be enough here, 7 is what OpenOCD uses
-               repeat=7;
+               repeat = 7;
        }
        waitQueue();
        sampleShiftRegister();
@@ -85,8 +85,8 @@ static void setCurrentState(enum tap_state state)
 static __inline__ void shiftValueInner(const enum tap_state state, const enum tap_state endState, int repeat, cyg_uint32 value)
 {
        cyg_uint32 a,b;
-       a=state;
-       b=endState;
+       a = state;
+       b = endState;
        waitQueue();
        sampleShiftRegister();
        ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value);
@@ -96,13 +96,13 @@ static __inline__ void shiftValueInner(const enum tap_state state, const enum ta
        {
                int i;
                setCurrentState(state);
-               for (i=0; i<repeat; i++)
+               for (i = 0; i<repeat; i++)
                {
                        int tms;
-                       tms=0;
+                       tms = 0;
                        if ((i == repeat-1) && (state != endState))
                        {
-                               tms=1;
+                               tms = 1;
                        }
                        /* shift out value */
                        waitIdle();
@@ -128,7 +128,7 @@ static __inline__ void shiftValueInner(const enum tap_state state, const enum ta
        {
                int i;
                /* sample shift register for every bit. */
-               for (i=0; i<repeat-1; i++)
+               for (i = 0; i<repeat-1; i++)
                {
                        sampleShiftRegister();
                        ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value >> i);
@@ -157,9 +157,9 @@ static __inline__ void interface_jtag_add_dr_out_core(jtag_tap_t *target_tap,
        enum tap_state pause_state = TAP_DRSHIFT;
 
        jtag_tap_t *tap, *nextTap;
-       for (tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap=nextTap)
+       for (tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap = nextTap)
        {
-               nextTap=jtag_tap_next_enabled(tap);
+               nextTap = jtag_tap_next_enabled(tap);
                if (nextTap == NULL)
                {
                        pause_state = end_state;
@@ -167,7 +167,7 @@ static __inline__ void interface_jtag_add_dr_out_core(jtag_tap_t *target_tap,
                if (tap == target_tap)
                {
                        int j;
-                       for (j=0; j<(num_fields-1); j++)
+                       for (j = 0; j<(num_fields-1); j++)
                        {
                                shiftValueInner(TAP_DRSHIFT, TAP_DRSHIFT, num_bits[j], value[j]);
                        }
@@ -187,7 +187,7 @@ static __inline__ void interface_jtag_add_dr_out(jtag_tap_t *target_tap,
                enum tap_state end_state)
 {
 
-       int singletap=(jtag_tap_next_enabled(jtag_tap_next_enabled(NULL)) == NULL);
+       int singletap = (jtag_tap_next_enabled(jtag_tap_next_enabled(NULL)) == NULL);
        if ((singletap) && (num_fields == 3))
        {
                /* used by embeddedice_write_reg_inner() */
index 079e1b99ef78a8967504540d6ee4e44508d293bf..c5239ee8c33f46922a0cc4f33811ecc0a5e0e5e9 100644 (file)
@@ -51,11 +51,11 @@ static int zy1000_khz(int khz, int *jtag_speed)
 {
        if (khz == 0)
        {
-               *jtag_speed=0;
+               *jtag_speed = 0;
        }
        else
        {
-               *jtag_speed=64000/khz;
+               *jtag_speed = 64000/khz;
        }
        return ERROR_OK;
 }
@@ -68,7 +68,7 @@ static int zy1000_speed_div(int speed, int *khz)
        }
        else
        {
-               *khz=64000/speed;
+               *khz = 64000/speed;
        }
 
        return ERROR_OK;
@@ -99,13 +99,13 @@ static bool readSRST(void)
 
 static int zy1000_srst_asserted(int *srst_asserted)
 {
-       *srst_asserted=readSRST();
+       *srst_asserted = readSRST();
        return ERROR_OK;
 }
 
 static int zy1000_power_dropout(int *dropout)
 {
-       *dropout=readPowerDropout();
+       *dropout = readPowerDropout();
        return ERROR_OK;
 }
 
@@ -164,7 +164,7 @@ void zy1000_reset(int trst, int srst)
        if (!srst)
        {
                int i;
-               for (i=0; i<1000; i++)
+               for (i = 0; i<1000; i++)
                {
                        // We don't want to sense our own reset, so we clear here.
                        // There is of course a timing hole where we could loose
@@ -260,11 +260,11 @@ static int jim_zy1000_version(Jim_Interp *interp, int argc, Jim_Obj *const *argv
        if ((argc < 1) || (argc > 2))
                return JIM_ERR;
        char buff[128];
-       const char *version_str=NULL;
+       const char *version_str = NULL;
 
        if (argc == 1)
        {
-               version_str=ZYLIN_OPENOCD_VERSION;
+               version_str = ZYLIN_OPENOCD_VERSION;
        } else
        {
                const char *str = Jim_GetString(argv[1], NULL);
@@ -273,15 +273,15 @@ static int jim_zy1000_version(Jim_Interp *interp, int argc, Jim_Obj *const *argv
                        int revision;
                        revision = atol(ZYLIN_OPENOCD+strlen("XRevision: "));
                        sprintf(buff, "%d", revision);
-                       version_str=buff;
+                       version_str = buff;
                }
                else if (strcmp("zy1000", str) == 0)
                {
-                       version_str=ZYLIN_VERSION;
+                       version_str = ZYLIN_VERSION;
                }
                else if (strcmp("date", str) == 0)
                {
-                       version_str=ZYLIN_DATE;
+                       version_str = ZYLIN_DATE;
                }
                else
                {
@@ -402,8 +402,8 @@ static void shiftValueInnerFlip(const tap_state_t state, const tap_state_t endSt
 {
        VERBOSE(LOG_INFO("shiftValueInner %s %s %d %08x (flipped)", tap_state_name(state), tap_state_name(endState), repeat, value));
        cyg_uint32 a,b;
-       a=state;
-       b=endState;
+       a = state;
+       b = endState;
        ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value);
        ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (1 << 15)|(repeat << 8)|(a << 4)|b);
        VERBOSE(getShiftValueFlip());
@@ -422,40 +422,40 @@ static __inline void scanFields(int num_fields, const scan_field_t *fields, tap_
        {
                cyg_uint32 value;
 
-               uint8_t *inBuffer=NULL;
+               uint8_t *inBuffer = NULL;
 
 
                // figure out where to store the input data
-               int num_bits=fields[i].num_bits;
+               int num_bits = fields[i].num_bits;
                if (fields[i].in_value != NULL)
                {
-                       inBuffer=fields[i].in_value;
+                       inBuffer = fields[i].in_value;
                }
 
                // here we shuffle N bits out/in
-               j=0;
+               j = 0;
                while (j<num_bits)
                {
                        tap_state_t pause_state;
                        int l;
-                       k=num_bits-j;
-                       pause_state=(shiftState == TAP_DRSHIFT)?TAP_DRSHIFT:TAP_IRSHIFT;
+                       k = num_bits-j;
+                       pause_state = (shiftState == TAP_DRSHIFT)?TAP_DRSHIFT:TAP_IRSHIFT;
                        if (k>32)
                        {
-                               k=32;
+                               k = 32;
                                /* we have more to shift out */
                        } else if (i == num_fields-1)
                        {
                                /* this was the last to shift out this time */
-                               pause_state=end_state;
+                               pause_state = end_state;
                        }
 
                        // we have (num_bits+7)/8 bytes of bits to toggle out.
                        // bits are pushed out LSB to MSB
-                       value=0;
+                       value = 0;
                        if (fields[i].out_value != NULL)
                        {
-                               for (l=0; l<k; l += 8)
+                               for (l = 0; l<k; l += 8)
                                {
                                        value|=fields[i].out_value[(j+l)/8]<<l;
                                }
@@ -468,11 +468,11 @@ static __inline void scanFields(int num_fields, const scan_field_t *fields, tap_
                        if (inBuffer != NULL)
                        {
                                // data in, LSB to MSB
-                               value=getShiftValue();
+                               value = getShiftValue();
                                // we're shifting in data to MSB, shift data to be aligned for returning the value
                                value >>= 32-k;
 
-                               for (l=0; l<k; l += 8)
+                               for (l = 0; l<k; l += 8)
                                {
                                        inBuffer[(j+l)/8]=(value >> l)&0xff;
                                }
@@ -494,9 +494,9 @@ int interface_jtag_add_ir_scan(int num_fields, const scan_field_t *fields, tap_s
        int j;
        int scan_size = 0;
        jtag_tap_t *tap, *nextTap;
-       for (tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap=nextTap)
+       for (tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap = nextTap)
        {
-               nextTap=jtag_tap_next_enabled(tap);
+               nextTap = jtag_tap_next_enabled(tap);
                tap_state_t end_state;
                if (nextTap == NULL)
                {
@@ -511,7 +511,7 @@ int interface_jtag_add_ir_scan(int num_fields, const scan_field_t *fields, tap_s
                scan_size = tap->ir_length;
 
                /* search the list */
-               for (j=0; j < num_fields; j++)
+               for (j = 0; j < num_fields; j++)
                {
                        if (tap == fields[j].tap)
                        {
@@ -563,10 +563,10 @@ int interface_jtag_add_dr_scan(int num_fields, const scan_field_t *fields, tap_s
 
        int j;
        jtag_tap_t *tap, *nextTap;
-       for (tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap=nextTap)
+       for (tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap = nextTap)
        {
-               nextTap=jtag_tap_next_enabled(tap);
-               int found=0;
+               nextTap = jtag_tap_next_enabled(tap);
+               int found = 0;
                tap_state_t end_state;
                if (nextTap == NULL)
                {
@@ -576,7 +576,7 @@ int interface_jtag_add_dr_scan(int num_fields, const scan_field_t *fields, tap_s
                        end_state = TAP_DRSHIFT;
                }
 
-               for (j=0; j < num_fields; j++)
+               for (j = 0; j < num_fields; j++)
                {
                        if (tap == fields[j].tap)
                        {
@@ -634,13 +634,13 @@ static int zy1000_jtag_add_clocks(int num_cycles, tap_state_t state, tap_state_t
 
        /* execute num_cycles, 32 at the time. */
        int i;
-       for (i=0; i<num_cycles; i += 32)
+       for (i = 0; i<num_cycles; i += 32)
        {
                int num;
-               num=32;
+               num = 32;
                if (num_cycles-i<num)
                {
-                       num=num_cycles-i;
+                       num = num_cycles-i;
                }
                shiftValueInner(clockstate, clockstate, num, 0);
        }
@@ -649,7 +649,7 @@ static int zy1000_jtag_add_clocks(int num_cycles, tap_state_t state, tap_state_t
        /* finish in end_state */
        setCurrentState(state);
 #else
-       tap_state_t t=TAP_IDLE;
+       tap_state_t t = TAP_IDLE;
        /* test manual drive code on any target */
        int tms;
        uint8_t tms_scan = tap_get_tms_path(t, state);
@@ -695,7 +695,7 @@ int interface_jtag_add_pathmove(int num_states, const tap_state_t *path)
 
        state_count = 0;
 
-       tap_state_t cur_state=cmd_queue_cur_state;
+       tap_state_t cur_state = cmd_queue_cur_state;
 
        while (num_states)
        {
@@ -730,8 +730,8 @@ int interface_jtag_add_pathmove(int num_states, const tap_state_t *path)
 
 void embeddedice_write_dcc(jtag_tap_t *tap, int reg_addr, uint8_t *buffer, int little, int count)
 {
-//     static int const reg_addr=0x5;
-       tap_state_t end_state=jtag_get_end_state();
+//     static int const reg_addr = 0x5;
+       tap_state_t end_state = jtag_get_end_state();
        if (jtag_tap_next_enabled(jtag_tap_next_enabled(NULL)) == NULL)
        {
                /* better performance via code duplication */
index 87eac70666984be3f8b9c72ebe4c0ef7c88ff30e..c490b9c1c7d1d6432f73ca8393cd478e4a44621c 100644 (file)
@@ -87,10 +87,10 @@ static int log_target_callback_event_handler(struct target_s *target, enum targe
        switch (event)
        {
                case TARGET_EVENT_GDB_START:
-                       target->display=0;
+                       target->display = 0;
                        break;
                case TARGET_EVENT_GDB_END:
-                       target->display=1;
+                       target->display = 1;
                        break;
                case TARGET_EVENT_HALTED:
                        if (target->display)
@@ -116,11 +116,11 @@ static int handle_init_command(struct command_context_s *cmd_ctx, char *cmd, cha
                return ERROR_COMMAND_SYNTAX_ERROR;
 
        int retval;
-       static int initialized=0;
+       static int initialized = 0;
        if (initialized)
                return ERROR_OK;
 
-       initialized=1;
+       initialized = 1;
 
        atexit(exit_handler);
 
@@ -128,7 +128,7 @@ static int handle_init_command(struct command_context_s *cmd_ctx, char *cmd, cha
                return ERROR_FAIL;
        LOG_DEBUG("target init complete");
 
-       if ((retval=jtag_interface_init(cmd_ctx)) != ERROR_OK)
+       if ((retval = jtag_interface_init(cmd_ctx)) != ERROR_OK)
        {
                /* we must be able to set up the jtag interface */
                return retval;
index 8407d59e902266db1b9120fa316802db24558299..91427a05c91ac173ab5233b40de8c1d39796cb84 100644 (file)
@@ -90,7 +90,7 @@ static int virtex2_send_32(struct pld_device_s *pld_device,
 
 static __inline__ void virtexflip32(jtag_callback_data_t arg)
 {
-  uint8_t *in=(uint8_t *)arg;
+  uint8_t *in = (uint8_t *)arg;
        *((uint32_t *)in) = flip_u32(le_to_h_u32(in), 32);
 }
 
index cc4c6751d43ad25f67f1526c36f305ba3727539c..4cf187576758639d0a3ab7a975dc7f2715867019 100644 (file)
@@ -107,7 +107,7 @@ int check_pending(connection_t *connection, int timeout_s, int *got_data)
        int t;
        if (got_data == NULL)
                got_data=&t;
-       *got_data=0;
+       *got_data = 0;
 
        if (gdb_con->buf_cnt>0)
        {
@@ -133,14 +133,14 @@ int check_pending(connection_t *connection, int timeout_s, int *got_data)
                        return ERROR_OK;
                }
        }
-       *got_data=FD_ISSET(connection->fd, &read_fds) != 0;
+       *got_data = FD_ISSET(connection->fd, &read_fds) != 0;
        return ERROR_OK;
 }
 
 int gdb_get_char(connection_t *connection, int* next_char)
 {
        gdb_connection_t *gdb_con = connection->priv;
-       int retval=ERROR_OK;
+       int retval = ERROR_OK;
 
 #ifdef _DEBUG_GDB_IO_
        char *debug_buffer;
@@ -313,7 +313,7 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
        int gotdata;
        for (;;)
        {
-               if ((retval=check_pending(connection, 0, &gotdata)) != ERROR_OK)
+               if ((retval = check_pending(connection, 0, &gotdata)) != ERROR_OK)
                        return retval;
                if (!gotdata)
                        break;
@@ -409,7 +409,7 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
                        } else {
 
                                LOG_ERROR("unknown character(1) 0x%2.2x in reply, dropping connection", reply);
-                               gdb_con->closed=1;
+                               gdb_con->closed = 1;
                                return ERROR_SERVER_REMOTE_CLOSED;
                        }
                }
@@ -421,7 +421,7 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
                else
                {
                        LOG_ERROR("unknown character(2) 0x%2.2x in reply, dropping connection", reply);
-                       gdb_con->closed=1;
+                       gdb_con->closed = 1;
                        return ERROR_SERVER_REMOTE_CLOSED;
                }
        }
@@ -547,7 +547,7 @@ static __inline__ int fetch_packet(connection_t *connection, int *checksum_ok, i
 
        if (!noack)
        {
-               *checksum_ok=(my_checksum == strtoul(checksum, NULL, 16));
+               *checksum_ok = (my_checksum == strtoul(checksum, NULL, 16));
        }
 
        return ERROR_OK;
@@ -600,11 +600,11 @@ int gdb_get_packet_inner(connection_t *connection, char *buffer, int *len)
                 */
                if (gdb_con->noack_mode)
                {
-                       if ((retval=fetch_packet(connection, &checksum_ok, 1, len, buffer)) != ERROR_OK)
+                       if ((retval = fetch_packet(connection, &checksum_ok, 1, len, buffer)) != ERROR_OK)
                                return retval;
                } else
                {
-                       if ((retval=fetch_packet(connection, &checksum_ok, 0, len, buffer)) != ERROR_OK)
+                       if ((retval = fetch_packet(connection, &checksum_ok, 0, len, buffer)) != ERROR_OK)
                                return retval;
                }
 
@@ -649,7 +649,7 @@ int gdb_output_con(connection_t *connection, const char* line)
                return ERROR_GDB_BUFFER_TOO_SMALL;
 
        hex_buffer[0] = 'O';
-       for (i=0; i<bin_size; i++)
+       for (i = 0; i<bin_size; i++)
                snprintf(hex_buffer + 1 + i*2, 3, "%2.2x", line[i]);
        hex_buffer[bin_size*2+1] = 0;
 
@@ -904,7 +904,7 @@ static int hextoint(char c)
        {
                return c-'0';
        }
-       c=toupper(c);
+       c = toupper(c);
        if (c>='A'&&c<='F')
        {
                return c-'A'+10;
@@ -1199,7 +1199,7 @@ int gdb_read_memory_packet(connection_t *connection, target_t *target, char *pac
                 * gained by involving the user in this problem that hopefully will get resolved
                 * eventually
                 *
-                * http://sourceware.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=2395
+                * http://sourceware.org/cgi-bin/gnatsweb.pl?cmd = view%20audit-trail&database = gdb&pr = 2395
                 *
                 * For now, the default is to fix up things to make current GDB versions work.
                 * This can be overwritten using the gdb_report_data_abort <'enable'|'disable'> command.
@@ -1268,7 +1268,7 @@ int gdb_write_memory_packet(connection_t *connection, target_t *target, char *pa
 
        LOG_DEBUG("addr: 0x%8.8" PRIx32 ", len: 0x%8.8" PRIx32 "", addr, len);
 
-       for (i=0; i<len; i++)
+       for (i = 0; i<len; i++)
        {
                uint32_t tmp;
                sscanf(separator + 2*i, "%2" SCNx32 , &tmp);
@@ -1343,7 +1343,7 @@ int gdb_step_continue_packet(connection_t *connection, target_t *target, char *p
 {
        int current = 0;
        uint32_t address = 0x0;
-       int retval=ERROR_OK;
+       int retval = ERROR_OK;
 
        LOG_DEBUG("-");
 
@@ -1361,7 +1361,7 @@ int gdb_step_continue_packet(connection_t *connection, target_t *target, char *p
        {
                LOG_DEBUG("continue");
                target_handle_event( target, TARGET_EVENT_OLD_pre_resume );
-               retval=target_resume(target, current, address, 0, 0); /* resume at current address, don't handle breakpoints, not debugging */
+               retval = target_resume(target, current, address, 0, 0); /* resume at current address, don't handle breakpoints, not debugging */
        }
        else if (packet[0] == 's')
        {
@@ -1399,7 +1399,7 @@ int gdb_breakpoint_watchpoint_packet(connection_t *connection, target_t *target,
 
        if (gdb_breakpoint_override && ((bp_type == BKPT_SOFT)||(bp_type == BKPT_HARD)))
        {
-               bp_type=gdb_breakpoint_override_type;
+               bp_type = gdb_breakpoint_override_type;
        }
 
        if (*separator != ',')
@@ -1584,7 +1584,7 @@ int gdb_query_packet(connection_t *connection, target_t *target, char *packet, i
                        char *cmd;
                        int i;
                        cmd = malloc((packet_size - 6)/2 + 1);
-                       for (i=0; i < (packet_size - 6)/2; i++)
+                       for (i = 0; i < (packet_size - 6)/2; i++)
                        {
                                uint32_t tmp;
                                sscanf(packet + 6 + 2*i, "%2" SCNx32 , &tmp);
@@ -1699,10 +1699,10 @@ int gdb_query_packet(connection_t *connection, target_t *target, char *packet, i
                read/write) by default for GDB.
                GDB does not have a concept of non-cacheable read/write memory.
                 */
-               flash_bank_t **banks=malloc(sizeof(flash_bank_t *)*flash_get_bank_count());
+               flash_bank_t **banks = malloc(sizeof(flash_bank_t *)*flash_get_bank_count());
                int i;
 
-               for (i=0; i<flash_get_bank_count(); i++)
+               for (i = 0; i<flash_get_bank_count(); i++)
                {
                        p = get_flash_bank_by_num(i);
                        if (p == NULL)
@@ -1717,8 +1717,8 @@ int gdb_query_packet(connection_t *connection, target_t *target, char *packet, i
 
                qsort(banks, flash_get_bank_count(), sizeof(flash_bank_t *), compare_bank);
 
-               uint32_t ram_start=0;
-               for (i=0; i<flash_get_bank_count(); i++)
+               uint32_t ram_start = 0;
+               for (i = 0; i<flash_get_bank_count(); i++)
                {
                        p = banks[i];
 
@@ -1736,7 +1736,7 @@ int gdb_query_packet(connection_t *connection, target_t *target, char *packet, i
                                "<property name=\"blocksize\">0x%x</property>\n" \
                                "</memory>\n", \
                                p->base, p->size, blocksize);
-                       ram_start=p->base+p->size;
+                       ram_start = p->base+p->size;
                }
                if (ram_start != 0)
                {
@@ -2018,7 +2018,7 @@ int gdb_input_inner(connection_t *connection)
 {
        gdb_service_t *gdb_service = connection->service->priv;
        target_t *target = gdb_service->target;
-       char *packet=gdb_packet_buffer;
+       char *packet = gdb_packet_buffer;
        int packet_size;
        int retval;
        gdb_connection_t *gdb_con = connection->priv;
@@ -2108,7 +2108,7 @@ int gdb_input_inner(connection_t *connection)
                                                        gdb_con->frontend_state = TARGET_RUNNING;
                                                        log_add_callback(gdb_log_callback, connection);
                                                        target_call_event_callbacks(target, TARGET_EVENT_GDB_START);
-                                                       int retval=gdb_step_continue_packet(connection, target, packet, packet_size);
+                                                       int retval = gdb_step_continue_packet(connection, target, packet, packet_size);
                                                        if (retval != ERROR_OK)
                                                        {
                                                                /* we'll never receive a halted condition... issue a false one.. */
@@ -2354,10 +2354,10 @@ int handle_gdb_breakpoint_override_command(struct command_context_s *cmd_ctx, ch
                gdb_breakpoint_override = 1;
                if (strcmp(args[0], "hard") == 0)
                {
-                       gdb_breakpoint_override_type=BKPT_HARD;
+                       gdb_breakpoint_override_type = BKPT_HARD;
                } else if (strcmp(args[0], "soft") == 0)
                {
-                       gdb_breakpoint_override_type=BKPT_SOFT;
+                       gdb_breakpoint_override_type = BKPT_SOFT;
                } else if (strcmp(args[0], "disable") == 0)
                {
                        gdb_breakpoint_override = 0;
index c19dc2b35c487febf4b90788e4179918dad9326a..e77721689c5da29d6042f03f709542d5d39127ae 100644 (file)
@@ -402,7 +402,7 @@ static int ahc_echo(void * cls, struct MHD_Connection * connection,
        if (!*url)
                url="index.tcl";
 
-       const char *file_name=alloc_printf("%s/%s", httpd_dir, url);
+       const char *file_name = alloc_printf("%s/%s", httpd_dir, url);
        int result = handle_request(connection, file_name);
        free((void *)file_name);
        return result;
index bca9774f56176fe0352d43164c8028558cd7e6f9..a93d6ada4c8b4d11deb30831255731d43b5d30cc 100644 (file)
@@ -51,7 +51,7 @@ int add_connection(service_t *service, command_context_t *cmd_ctx)
        socklen_t address_size;
        connection_t *c, **p;
        int retval;
-       int flag=1;
+       int flag = 1;
        
        c = malloc(sizeof(connection_t));
        c->fd = -1;
@@ -70,7 +70,7 @@ int add_connection(service_t *service, command_context_t *cmd_ctx)
                
                /* This increases performance dramatically for e.g. GDB load which
                 * does not have a sliding window protocol. */
-               retval=setsockopt(c->fd,        /* socket affected */
+               retval = setsockopt(c->fd,      /* socket affected */
                                IPPROTO_TCP,            /* set option at TCP level */
                                TCP_NODELAY,            /* name of option */
                                (char *)&flag,          /* the cast is historical cruft */
@@ -183,7 +183,7 @@ int add_service(char *name, enum connection_type type, unsigned short port, int
                }
                
 #ifndef _WIN32
-               int segsize=65536;
+               int segsize = 65536;
                setsockopt(c->fd, IPPROTO_TCP, TCP_MAXSEG,  &segsize, sizeof(int));
 #endif
                int window_size = 128 * 1024;   
index 4355f8a6cae600cf96cfe2fff83ad862f2839112..82b7330e90509451ba7a4a24869d438340848454 100644 (file)
@@ -130,7 +130,7 @@ void telnet_log_callback(void *priv, const char *file, int line,
        /* put the command line to its previous state */
        telnet_prompt(connection);
        telnet_write(connection, t_con->line, t_con->line_size);
-       for (i=t_con->line_size; i>t_con->line_cursor; i--)
+       for (i = t_con->line_size; i>t_con->line_cursor; i--)
                telnet_write(connection, "\b", 1);
 }
 
index 6a5b7ba289da05ed73a5e571d82fb8dd7a91f736..e69d598847d9065870e2506b3e0c0fe2dcaa8b03 100644 (file)
@@ -237,7 +237,7 @@ int arm11_read_DSCR(arm11_common_t * arm11, uint32_t *value)
 
        arm11->last_dscr = dscr;
 
-       *value=dscr;
+       *value = dscr;
 
        return ERROR_OK;
 }
index d709bacc1a37e770c60d99958328516b9ffb58a0..efca08ddab91bd27d5d2a765ef6ddcc5667036bc 100644 (file)
@@ -373,9 +373,9 @@ int arm720t_soft_reset_halt(struct target_s *target)
                return retval;
        }
 
-       long long then=timeval_ms();
+       long long then = timeval_ms();
        int timeout;
-       while (!(timeout=((timeval_ms()-then)>1000)))
+       while (!(timeout = ((timeval_ms()-then)>1000)))
        {
                if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) == 0)
                {
index 2b2787476ae84d6da0cf41c3f486ee54faf65b16..c4b7c6a16c26ef52c40de8346ee4741254d5b08e 100644 (file)
@@ -118,11 +118,11 @@ static int arm7_9_set_software_breakpoints(arm7_9_common_t *arm7_9)
        /* pick a breakpoint unit */
        if (!arm7_9->wp0_used)
        {
-               arm7_9->sw_breakpoints_added=1;
+               arm7_9->sw_breakpoints_added = 1;
                arm7_9->wp0_used = 3;
        } else if (!arm7_9->wp1_used)
        {
-               arm7_9->sw_breakpoints_added=2;
+               arm7_9->sw_breakpoints_added = 2;
                arm7_9->wp1_used = 3;
        }
        else
@@ -218,7 +218,7 @@ int arm7_9_set_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;
-       int retval=ERROR_OK;
+       int retval = ERROR_OK;
 
        if (target->state != TARGET_HALTED)
        {
@@ -259,11 +259,11 @@ int arm7_9_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
                        return ERROR_OK;
                }
 
-               retval=jtag_execute_queue();
+               retval = jtag_execute_queue();
        }
        else if (breakpoint->type == BKPT_SOFT)
        {
-               if ((retval=arm7_9_set_software_breakpoints(arm7_9)) != ERROR_OK)
+               if ((retval = arm7_9_set_software_breakpoints(arm7_9)) != ERROR_OK)
                        return retval;
 
                /* did we already set this breakpoint? */
@@ -700,9 +700,9 @@ int arm7_9_execute_sys_speed(struct target_s *target)
        }
        arm_jtag_set_instr(jtag_info, 0x4, NULL);
 
-       long long then=timeval_ms();
+       long long then = timeval_ms();
        int timeout;
-       while (!(timeout=((timeval_ms()-then)>1000)))
+       while (!(timeout = ((timeval_ms()-then)>1000)))
        {
                /* read debug status register */
                embeddedice_read_reg(dbg_stat);
@@ -738,7 +738,7 @@ int arm7_9_execute_sys_speed(struct target_s *target)
  */
 int arm7_9_execute_fast_sys_speed(struct target_s *target)
 {
-       static int set=0;
+       static int set = 0;
        static uint8_t check_value[4], check_mask[4];
 
        armv4_5_common_t *armv4_5 = target->arch_info;
@@ -764,7 +764,7 @@ int arm7_9_execute_fast_sys_speed(struct target_s *target)
                 * */
                buf_set_u32(check_value, 0, 32, 0x9);
                buf_set_u32(check_mask, 0, 32, 0x9);
-               set=1;
+               set = 1;
        }
 
        /* read debug status register */
@@ -900,7 +900,7 @@ int arm7_9_poll(target_t *target)
                }
                if ((target->state == TARGET_RUNNING) || (target->state == TARGET_RESET))
                {
-                       int check_pc=0;
+                       int check_pc = 0;
                        if (target->state == TARGET_RESET)
                        {
                                if (target->reset_halt)
@@ -1042,7 +1042,7 @@ int arm7_9_assert_reset(target_t *target)
  */
 int arm7_9_deassert_reset(target_t *target)
 {
-       int retval=ERROR_OK;
+       int retval = ERROR_OK;
        LOG_DEBUG("target->state: %s",
                Jim_Nvp_value2name_simple( nvp_target_state,target->state)->name);
 
@@ -1057,12 +1057,12 @@ int arm7_9_deassert_reset(target_t *target)
                if ((retval = target_examine_one(target)) != ERROR_OK)
                        return retval;
 
-               if ((retval=target_poll(target)) != ERROR_OK)
+               if ((retval = target_poll(target)) != ERROR_OK)
                {
                        return retval;
                }
 
-               if ((retval=target_halt(target)) != ERROR_OK)
+               if ((retval = target_halt(target)) != ERROR_OK)
                {
                        return retval;
                }
@@ -1147,17 +1147,17 @@ int arm7_9_soft_reset_halt(struct target_s *target)
        int i;
        int retval;
 
-       if ((retval=target_halt(target)) != ERROR_OK)
+       if ((retval = target_halt(target)) != ERROR_OK)
                return retval;
 
-       long long then=timeval_ms();
+       long long then = timeval_ms();
        int timeout;
-       while (!(timeout=((timeval_ms()-then)>1000)))
+       while (!(timeout = ((timeval_ms()-then)>1000)))
        {
                if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) != 0)
                        break;
                embeddedice_read_reg(dbg_stat);
-               if ((retval=jtag_execute_queue()) != ERROR_OK)
+               if ((retval = jtag_execute_queue()) != ERROR_OK)
                        return retval;
                if (debug_level >= 3)
                {
@@ -1428,7 +1428,7 @@ int arm7_9_debug_entry(target_t *target)
        if (armv4_5_mode_to_number(armv4_5->core_mode)==-1)
                return ERROR_FAIL;
 
-       for (i=0; i <= 15; i++)
+       for (i = 0; i <= 15; i++)
        {
                LOG_DEBUG("r%i: 0x%8.8" PRIx32 "", i, context[i]);
                buf_set_u32(ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, i).value, 0, 32, context[i]);
@@ -2240,7 +2240,7 @@ int arm7_9_read_memory(struct target_s *target, uint32_t address, uint32_t size,
        reg[0] = address;
        arm7_9->write_core_regs(target, 0x1, reg);
 
-       int j=0;
+       int j = 0;
 
        switch (size)
        {
@@ -2362,7 +2362,7 @@ int arm7_9_read_memory(struct target_s *target, uint32_t address, uint32_t size,
        if (armv4_5_mode_to_number(armv4_5->core_mode)==-1)
                return ERROR_FAIL;
 
-       for (i=0; i <= last_reg; i++)
+       for (i = 0; i <= last_reg; i++)
                ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, i).dirty = ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, i).valid;
 
        arm7_9->read_xpsr(target, &cpsr, 0);
@@ -2545,7 +2545,7 @@ int arm7_9_write_memory(struct target_s *target, uint32_t address, uint32_t size
        if (armv4_5_mode_to_number(armv4_5->core_mode)==-1)
                return ERROR_FAIL;
 
-       for (i=0; i <= last_reg; i++)
+       for (i = 0; i <= last_reg; i++)
                ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, i).dirty = ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, i).valid;
 
        arm7_9->read_xpsr(target, &cpsr, 0);
@@ -2576,12 +2576,12 @@ static int arm7_9_dcc_completion(struct target_s *target, uint32_t exit_point, i
        armv4_5_common_t *armv4_5 = target->arch_info;
        arm7_9_common_t *arm7_9 = armv4_5->arch_info;
 
-       if ((retval=target_wait_state(target, TARGET_DEBUG_RUNNING, 500)) != ERROR_OK)
+       if ((retval = target_wait_state(target, TARGET_DEBUG_RUNNING, 500)) != ERROR_OK)
                return retval;
 
-       int little=target->endianness == TARGET_LITTLE_ENDIAN;
-       int count=dcc_count;
-       uint8_t *buffer=dcc_buffer;
+       int little = target->endianness == TARGET_LITTLE_ENDIAN;
+       int count = dcc_count;
+       uint8_t *buffer = dcc_buffer;
        if (count>2)
        {
                /* Handle first & last using standard embeddedice_write_reg and the middle ones w/the
@@ -2669,18 +2669,18 @@ int arm7_9_bulk_write_memory(target_t *target, uint32_t address, uint32_t count,
 
        buf_set_u32(reg_params[0].value, 0, 32, address);
 
-       dcc_count=count;
-       dcc_buffer=buffer;
+       dcc_count = count;
+       dcc_buffer = buffer;
        retval = armv4_5_run_algorithm_inner(target, 0, NULL, 1, reg_params,
                        arm7_9->dcc_working_area->address, arm7_9->dcc_working_area->address+6*4, 20*1000, &armv4_5_info, arm7_9_dcc_completion);
 
        if (retval == ERROR_OK)
        {
-               uint32_t endaddress=buf_get_u32(reg_params[0].value, 0, 32);
+               uint32_t endaddress = buf_get_u32(reg_params[0].value, 0, 32);
                if (endaddress != (address+count*4))
                {
                        LOG_ERROR("DCC write failed, expected end address 0x%08" PRIx32 " got 0x%0" PRIx32 "", (address+count*4), endaddress);
-                       retval=ERROR_FAIL;
+                       retval = ERROR_FAIL;
                }
        }
 
@@ -2734,7 +2734,7 @@ int arm7_9_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(arm7_9_crc_code)/sizeof(uint32_t)); i++)
        {
-               if ((retval=target_write_u32(target, crc_algorithm->address + i*sizeof(uint32_t), arm7_9_crc_code[i])) != ERROR_OK)
+               if ((retval = target_write_u32(target, crc_algorithm->address + i*sizeof(uint32_t), arm7_9_crc_code[i])) != ERROR_OK)
                {
                        return retval;
                }
index 541bede73d12d510a00f9636d3b0f380f6d1f237..03c49663c6653affae294c7eb5e8a43683b78454 100644 (file)
@@ -216,9 +216,9 @@ int arm7tdmi_clock_data_in(arm_jtag_t *jtag_info, uint32_t *in)
 
 void arm_endianness(uint8_t *tmp, void *in, int size, int be, int flip)
 {
-       uint32_t readback=le_to_h_u32(tmp);
+       uint32_t readback = le_to_h_u32(tmp);
        if (flip)
-               readback=flip_u32(readback, 32);
+               readback = flip_u32(readback, 32);
        switch (size)
        {
                case 4:
@@ -247,7 +247,7 @@ void arm_endianness(uint8_t *tmp, void *in, int size, int be, int flip)
 
 static int arm7endianness(jtag_callback_data_t arg, jtag_callback_data_t size, jtag_callback_data_t be, jtag_callback_data_t captured)
 {
-  uint8_t *in=(uint8_t *)arg;
+  uint8_t *in = (uint8_t *)arg;
        arm_endianness((uint8_t *)captured, in, (int)size, (int)be, 1);
        return ERROR_OK;
 }
@@ -724,7 +724,7 @@ int arm7tdmi_examine(struct target_s *target)
        {
                /* get pointers to arch-specific information */
                reg_cache_t **cache_p = register_get_last_cache_p(&target->reg_cache);
-               reg_cache_t *t=embeddedice_build_reg_cache(target, arm7_9);
+               reg_cache_t *t = embeddedice_build_reg_cache(target, arm7_9);
                if (t == NULL)
                        return ERROR_FAIL;
 
@@ -739,13 +739,13 @@ int arm7tdmi_examine(struct target_s *target)
                }
                target_set_examined(target);
        }
-       if ((retval=embeddedice_setup(target)) != ERROR_OK)
+       if ((retval = embeddedice_setup(target)) != ERROR_OK)
                return retval;
-       if ((retval=arm7_9_setup(target)) != ERROR_OK)
+       if ((retval = arm7_9_setup(target)) != ERROR_OK)
                return retval;
        if (arm7_9->etm_ctx)
        {
-               if ((retval=etm_setup(target)) != ERROR_OK)
+               if ((retval = etm_setup(target)) != ERROR_OK)
                        return retval;
        }
        return ERROR_OK;
index bf099e9dea1dd0d35e997f888a766769839267b3..10428a65c9e1db7a5a5bb628a85bb9c6c98d690d 100644 (file)
@@ -572,9 +572,9 @@ int arm920t_soft_reset_halt(struct target_s *target)
                return retval;
        }
 
-       long long then=timeval_ms();
+       long long then = timeval_ms();
        int timeout;
-       while (!(timeout=((timeval_ms()-then)>1000)))
+       while (!(timeout = ((timeval_ms()-then)>1000)))
        {
                if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) == 0)
                {
index 5ffdeaff8bed99bd5cef5f69ab4ae37337cff3c4..0d6f0172d9d0c57aef70ce9a9e5bf890c6a0a183 100644 (file)
@@ -317,7 +317,7 @@ int arm926ejs_examine_debug_reason(target_t *target)
                         * openocd development mailing list if you have hardware
                         * to donate to look into this problem....
                         */
-                       LOG_ERROR("mystery debug reason MOE=0xc. Try issuing a resume + halt.");
+                       LOG_ERROR("mystery debug reason MOE = 0xc. Try issuing a resume + halt.");
                        target->debug_reason = DBG_REASON_DBGRQ;
                        retval = ERROR_TARGET_FAILURE;
                        break;
@@ -572,9 +572,9 @@ int arm926ejs_soft_reset_halt(struct target_s *target)
                return retval;
        }
 
-       long long then=timeval_ms();
+       long long then = timeval_ms();
        int timeout;
-       while (!(timeout=((timeval_ms()-then)>1000)))
+       while (!(timeout = ((timeval_ms()-then)>1000)))
        {
                if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) == 0)
                {
index 577a42521fef2414933b32e778d71bd2abc221f3..fac0c8db7254f210f404f35e0efd86fe647a561d 100644 (file)
@@ -203,7 +203,7 @@ int arm9tdmi_clock_out(arm_jtag_t *jtag_info, uint32_t instr, uint32_t out, uint
 
        if (in)
        {
-               fields[0].in_value=(uint8_t *)in;
+               fields[0].in_value = (uint8_t *)in;
                jtag_add_dr_scan(3, fields, jtag_get_end_state());
 
                jtag_add_callback(arm_le_to_h_u32, (jtag_callback_data_t)in);
@@ -294,7 +294,7 @@ extern void arm_endianness(uint8_t *tmp, void *in, int size, int be, int flip);
 
 static int arm9endianness(jtag_callback_data_t arg, jtag_callback_data_t size, jtag_callback_data_t be, jtag_callback_data_t captured)
 {
-  uint8_t *in=(uint8_t *)arg;
+  uint8_t *in = (uint8_t *)arg;
        arm_endianness((uint8_t *)captured, in, (int)size, (int)be, 0);
        return ERROR_OK;
 }
@@ -817,7 +817,7 @@ int arm9tdmi_examine(struct target_s *target)
                reg_cache_t **cache_p = register_get_last_cache_p(&target->reg_cache);
                reg_cache_t *t;
                /* one extra register (vector catch) */
-               t=embeddedice_build_reg_cache(target, arm7_9);
+               t = embeddedice_build_reg_cache(target, arm7_9);
                if (t == NULL)
                        return ERROR_FAIL;
                (*cache_p) = t;
@@ -831,13 +831,13 @@ int arm9tdmi_examine(struct target_s *target)
                }
                target_set_examined(target);
        }
-       if ((retval=embeddedice_setup(target)) != ERROR_OK)
+       if ((retval = embeddedice_setup(target)) != ERROR_OK)
                return retval;
-       if ((retval=arm7_9_setup(target)) != ERROR_OK)
+       if ((retval = arm7_9_setup(target)) != ERROR_OK)
                return retval;
        if (arm7_9->etm_ctx)
        {
-               if ((retval=etm_setup(target)) != ERROR_OK)
+               if ((retval = etm_setup(target)) != ERROR_OK)
                        return retval;
        }
        return ERROR_OK;
index aac0a1736fb0edc32ba0131cd2ea3b56c13bc99a..57f6603b84cb7d5d230891f5e75906d49406cec0 100644 (file)
@@ -152,7 +152,7 @@ int scan_inout_check(swjdp_common_t *swjdp, uint8_t instr, uint8_t reg_addr, uin
                adi_jtag_dp_scan(swjdp, DAP_IR_DPACC, DP_RDBUFF, DPAP_READ, 0, invalue, &swjdp->ack);
        }
 
-       /* In TRANS_MODE_ATOMIC all DAP_IR_APACC transactions wait for ack=OK/FAULT and the check CTRL_STAT */
+       /* In TRANS_MODE_ATOMIC all DAP_IR_APACC transactions wait for ack = OK/FAULT and the check CTRL_STAT */
        if ((instr == DAP_IR_APACC) && (swjdp->trans_mode == TRANS_MODE_ATOMIC))
        {
                return swjdp_transaction_endcheck(swjdp);
@@ -170,7 +170,7 @@ int scan_inout_check_u32(swjdp_common_t *swjdp, uint8_t instr, uint8_t reg_addr,
                adi_jtag_dp_scan_u32(swjdp, DAP_IR_DPACC, DP_RDBUFF, DPAP_READ, 0, invalue, &swjdp->ack);
        }
 
-       /* In TRANS_MODE_ATOMIC all DAP_IR_APACC transactions wait for ack=OK/FAULT and then check CTRL_STAT */
+       /* In TRANS_MODE_ATOMIC all DAP_IR_APACC transactions wait for ack = OK/FAULT and then check CTRL_STAT */
        if ((instr == DAP_IR_APACC) && (swjdp->trans_mode == TRANS_MODE_ATOMIC))
        {
                return swjdp_transaction_endcheck(swjdp);
@@ -195,7 +195,7 @@ int swjdp_transaction_endcheck(swjdp_common_t *swjdp)
 
        https://lists.berlios.de/pipermail/openocd-development/2008-September/003107.html
        */
-       if ((retval=jtag_execute_queue()) != ERROR_OK)
+       if ((retval = jtag_execute_queue()) != ERROR_OK)
        {
                LOG_ERROR("BUG: Why does this fail the first time????");
        }
@@ -203,14 +203,14 @@ int swjdp_transaction_endcheck(swjdp_common_t *swjdp)
 #endif
 
        scan_inout_check_u32(swjdp, DAP_IR_DPACC, DP_CTRL_STAT, DPAP_READ, 0, &ctrlstat);
-       if ((retval=jtag_execute_queue()) != ERROR_OK)
+       if ((retval = jtag_execute_queue()) != ERROR_OK)
                return retval;
 
        swjdp->ack = swjdp->ack & 0x7;
 
        if (swjdp->ack != 2)
        {
-               long long then=timeval_ms();
+               long long then = timeval_ms();
                while (swjdp->ack != 2)
                {
                        if (swjdp->ack == 1)
@@ -228,7 +228,7 @@ int swjdp_transaction_endcheck(swjdp_common_t *swjdp)
                        }
 
                        scan_inout_check_u32(swjdp, DAP_IR_DPACC, DP_CTRL_STAT, DPAP_READ, 0, &ctrlstat);
-                       if ((retval=jtag_execute_queue()) != ERROR_OK)
+                       if ((retval = jtag_execute_queue()) != ERROR_OK)
                                return retval;
                        swjdp->ack = swjdp->ack & 0x7;
                }
@@ -261,19 +261,19 @@ int swjdp_transaction_endcheck(swjdp_common_t *swjdp)
                        /* Clear Sticky Error Bits */
                        scan_inout_check_u32(swjdp, DAP_IR_DPACC, DP_CTRL_STAT, DPAP_WRITE, swjdp->dp_ctrl_stat | SSTICKYORUN | SSTICKYERR, NULL);
                        scan_inout_check_u32(swjdp, DAP_IR_DPACC, DP_CTRL_STAT, DPAP_READ, 0, &ctrlstat);
-                       if ((retval=jtag_execute_queue()) != ERROR_OK)
+                       if ((retval = jtag_execute_queue()) != ERROR_OK)
                                return retval;
 
                        LOG_DEBUG("swjdp: status 0x%" PRIx32 "", ctrlstat);
 
                        dap_ap_read_reg_u32(swjdp, AP_REG_CSW, &mem_ap_csw);
                        dap_ap_read_reg_u32(swjdp, AP_REG_TAR, &mem_ap_tar);
-                       if ((retval=jtag_execute_queue()) != ERROR_OK)
+                       if ((retval = jtag_execute_queue()) != ERROR_OK)
                                return retval;
                        LOG_ERROR("Read MEM_AP_CSW 0x%" PRIx32 ", MEM_AP_TAR 0x%" PRIx32 "", mem_ap_csw, mem_ap_tar);
 
                }
-               if ((retval=jtag_execute_queue()) != ERROR_OK)
+               if ((retval = jtag_execute_queue()) != ERROR_OK)
                        return retval;
                return ERROR_JTAG_DEVICE_ERROR;
        }
@@ -971,7 +971,7 @@ int ahbap_debugport_init(swjdp_common_t *swjdp)
 
        dap_dp_write_reg(swjdp, swjdp->dp_ctrl_stat, DP_CTRL_STAT);
        dap_dp_read_reg(swjdp, &ctrlstat, DP_CTRL_STAT);
-       if ((retval=jtag_execute_queue()) != ERROR_OK)
+       if ((retval = jtag_execute_queue()) != ERROR_OK)
                return retval;
 
        /* Check that we have debug power domains activated */
@@ -979,7 +979,7 @@ int ahbap_debugport_init(swjdp_common_t *swjdp)
        {
                LOG_DEBUG("swjdp: wait CDBGPWRUPACK");
                dap_dp_read_reg(swjdp, &ctrlstat, DP_CTRL_STAT);
-               if ((retval=jtag_execute_queue()) != ERROR_OK)
+               if ((retval = jtag_execute_queue()) != ERROR_OK)
                        return retval;
                alive_sleep(10);
        }
@@ -988,7 +988,7 @@ int ahbap_debugport_init(swjdp_common_t *swjdp)
        {
                LOG_DEBUG("swjdp: wait CSYSPWRUPACK");
                dap_dp_read_reg(swjdp, &ctrlstat, DP_CTRL_STAT);
-               if ((retval=jtag_execute_queue()) != ERROR_OK)
+               if ((retval = jtag_execute_queue()) != ERROR_OK)
                        return retval;
                alive_sleep(10);
        }
index e562ac175b8321d4bf6a4367f87a8250c47ed5c8..bcde47e2957e86cc5e5c19aef5d10203909ac3aa 100644 (file)
@@ -60,14 +60,14 @@ int arm_jtag_buf_to_8(uint8_t *in_buf, void *priv, struct scan_field_s *field);
 /* use this as a static so we can inline it in -O3 and refer to it via a pointer  */
 static __inline__ void arm7flip32(jtag_callback_data_t arg)
 {
-  uint8_t *in=(uint8_t *)arg;
-  *((uint32_t *)in)=flip_u32(le_to_h_u32(in), 32);
+  uint8_t *in = (uint8_t *)arg;
+  *((uint32_t *)in) = flip_u32(le_to_h_u32(in), 32);
 }
 
 static __inline__ void arm_le_to_h_u32(jtag_callback_data_t arg)
 {
-  uint8_t *in=(uint8_t *)arg;
-  *((uint32_t *)in)=le_to_h_u32(in);
+  uint8_t *in = (uint8_t *)arg;
+  *((uint32_t *)in) = le_to_h_u32(in);
 }
 
 
index b88cdc8c638c0c305cb034e61d0d4afeb875a7dd..f5e906a8f16ca005c93d8b6426a7ccff038d5d8a 100644 (file)
@@ -501,9 +501,9 @@ static int armv4_5_run_algorithm_completion(struct target_s *target, uint32_t ex
        }
        if (target->state != TARGET_HALTED)
        {
-               if ((retval=target_halt(target)) != ERROR_OK)
+               if ((retval = target_halt(target)) != ERROR_OK)
                        return retval;
-               if ((retval=target_wait_state(target, TARGET_HALTED, 500)) != ERROR_OK)
+               if ((retval = target_wait_state(target, TARGET_HALTED, 500)) != ERROR_OK)
                {
                        return retval;
                }
@@ -614,7 +614,7 @@ int armv4_5_run_algorithm_inner(struct target_s *target, int num_mem_params, mem
                return retval;
        }
        int retvaltemp;
-       retval=run_it(target, exit_point, timeout_ms, arch_info);
+       retval = run_it(target, exit_point, timeout_ms, arch_info);
 
        breakpoint_remove(target, exit_point);
 
index d37f70977f1831457bd1ed457a9defccfd2d4417..8e9710a87633a9d83e78a32f7bad090e7c133aab 100644 (file)
@@ -154,7 +154,7 @@ extern int armv4_5_invalidate_core_regs(target_t *target);
  * Rn: base register
  * List: for each bit in list: store register
  * S: in priviledged mode: store user-mode registers
- * W=1: update the base register. W=0: leave the base register untouched
+ * W = 1: update the base register. W = 0: leave the base register untouched
  */
 #define ARMV4_5_STMIA(Rn, List, S, W)  (0xe8800000 | ((S) << 22) | ((W) << 21) | ((Rn) << 16) | (List))
 
@@ -162,7 +162,7 @@ extern int armv4_5_invalidate_core_regs(target_t *target);
  * Rn: base register
  * List: for each bit in list: store register
  * S: in priviledged mode: store user-mode registers
- * W=1: update the base register. W=0: leave the base register untouched
+ * W = 1: update the base register. W = 0: leave the base register untouched
  */
 #define ARMV4_5_LDMIA(Rn, List, S, W)  (0xe8900000 | ((S) << 22) | ((W) << 21) | ((Rn) << 16) | (List))
 
@@ -170,7 +170,7 @@ extern int armv4_5_invalidate_core_regs(target_t *target);
 #define ARMV4_5_NOP                                    (0xe1a08008)
 
 /* Move PSR to general purpose register
- * R=1: SPSR R=0: CPSR
+ * R = 1: SPSR R = 0: CPSR
  * Rn: target register
  */
 #define ARMV4_5_MRS(Rn, R)                     (0xe10f0000 | ((R) << 22) | ((Rn) << 12))
@@ -188,7 +188,7 @@ extern int armv4_5_invalidate_core_regs(target_t *target);
 #define ARMV4_5_LDR(Rd, Rn)                    (0xe5900000 | ((Rd) << 12) | ((Rn) << 16))
 
 /* Move general purpose register to PSR
- * R=1: SPSR R=0: CPSR
+ * R = 1: SPSR R = 0: CPSR
  * Field: Field mask
  * 1: control field 2: extension field 4: status field 8: flags field
  * Rm: source register
index 3e59040c5c3d73c6b2e68ee21e6af84ac80b25a4..3f162f5824b0eb06a18705e4e38d92e5a328c7e1 100644 (file)
@@ -304,9 +304,9 @@ static int armv7m_run_and_wait(struct target_s *target, uint32_t entry_point, in
        /* If the target fails to halt due to the breakpoint, force a halt */
        if (retval != ERROR_OK || target->state != TARGET_HALTED)
        {
-               if ((retval=target_halt(target)) != ERROR_OK)
+               if ((retval = target_halt(target)) != ERROR_OK)
                        return retval;
-               if ((retval=target_wait_state(target, TARGET_HALTED, 500)) != ERROR_OK)
+               if ((retval = target_wait_state(target, TARGET_HALTED, 500)) != ERROR_OK)
                {
                        return retval;
                }
@@ -356,7 +356,7 @@ int armv7m_run_algorithm(struct target_s *target, int num_mem_params, mem_param_
 
        for (i = 0; i < num_mem_params; i++)
        {
-               if ((retval=target_write_buffer(target, mem_params[i].address, mem_params[i].size, mem_params[i].value)) != ERROR_OK)
+               if ((retval = target_write_buffer(target, mem_params[i].address, mem_params[i].size, mem_params[i].value)) != ERROR_OK)
                        return retval;
        }
 
index 6079b9ebdeb0f6a920eb9ee2f582512874efd363..c1ebae3f10eede1c4f39aa7005dd2a3a0d73a9af 100644 (file)
@@ -694,7 +694,7 @@ int cortex_m3_resume(struct target_s *target, int current, uint32_t address, int
        return ERROR_OK;
 }
 
-/* int irqstepcount=0; */
+/* int irqstepcount = 0; */
 int cortex_m3_step(struct target_s *target, int current, uint32_t address, int handle_breakpoints)
 {
        /* get pointers to arch-specific information */
@@ -886,7 +886,7 @@ void cortex_m3_enable_breakpoints(struct target_s *target)
 int cortex_m3_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
 {
        int retval;
-       int fp_num=0;
+       int fp_num = 0;
        uint32_t hilo;
 
        /* get pointers to arch-specific information */
@@ -1075,7 +1075,7 @@ int cortex_m3_remove_breakpoint(struct target_s *target, breakpoint_t *breakpoin
 
 int cortex_m3_set_watchpoint(struct target_s *target, watchpoint_t *watchpoint)
 {
-       int dwt_num=0;
+       int dwt_num = 0;
        uint32_t mask, temp;
 
        /* get pointers to arch-specific information */
@@ -1285,7 +1285,7 @@ int cortex_m3_store_core_reg_u32(struct target_s *target, enum armv7m_regtype ty
         * in "thumb" mode, or an INVSTATE exception will occur. This is a
         * hack to deal with the fact that gdb will sometimes "forge"
         * return addresses, and doesn't set the LSB correctly (i.e., when
-        * printing expressions containing function calls, it sets LR=0.) */
+        * printing expressions containing function calls, it sets LR = 0.) */
 
        if (num == 14)
                value |= 0x01;
index 92e322bd02f7c82b054b322c185564521b8e2596..5f99120b9a9bebc6d3737cf4a9295c4ef145c995 100644 (file)
@@ -125,7 +125,7 @@ reg_cache_t* embeddedice_build_reg_cache(target_t *target, arm7_9_common_t *arm7
 
        /* identify EmbeddedICE version by reading DCC control register */
        embeddedice_read_reg(&reg_list[EICE_COMMS_CTRL]);
-       if ((retval=jtag_execute_queue()) != ERROR_OK)
+       if ((retval = jtag_execute_queue()) != ERROR_OK)
        {
                for (i = 0; i < num_regs; i++)
                {
@@ -204,7 +204,7 @@ int embeddedice_setup(target_t *target)
                reg_t *dbg_ctrl = &arm7_9->eice_cache->reg_list[EICE_DBG_CTRL];
 
                embeddedice_read_reg(dbg_ctrl);
-               if ((retval=jtag_execute_queue()) != ERROR_OK)
+               if ((retval = jtag_execute_queue()) != ERROR_OK)
                        return retval;
                buf_set_u32(dbg_ctrl->value, 4, 1, 0);
                embeddedice_set_reg_w_exec(dbg_ctrl, dbg_ctrl->value);
index 41f2f5c582c4b4d77dd083ae8980dfef0cec7a43..979d7a70db87bc824e159628d0d5ae74531faa40 100644 (file)
@@ -160,8 +160,8 @@ static int etb_get_reg(reg_t *reg)
 
 static void etb_getbuf(jtag_callback_data_t arg)
 {
-  uint8_t *in=(uint8_t *)arg;
-       *((uint32_t *)in)=buf_get_u32(in, 0, 32);
+  uint8_t *in = (uint8_t *)arg;
+       *((uint32_t *)in) = buf_get_u32(in, 0, 32);
 }
 
 
index 342ff9186224a229fb2959939d0f36a5e44cba21..44ae9304adc7d6e9b59c0de9498291103b6a8e6b 100644 (file)
@@ -282,10 +282,10 @@ int etm_setup(target_t *target)
        buf_set_u32(etm_ctrl_reg->value, 0, etm_ctrl_reg->size, etm_ctrl_value);
        etm_store_reg(etm_ctrl_reg);
 
-       if ((retval=jtag_execute_queue()) != ERROR_OK)
+       if ((retval = jtag_execute_queue()) != ERROR_OK)
                return retval;
 
-       if ((retval=etm_ctx->capture_driver->init(etm_ctx)) != ERROR_OK)
+       if ((retval = etm_ctx->capture_driver->init(etm_ctx)) != ERROR_OK)
        {
                LOG_ERROR("ETM capture driver initialization failed");
                return retval;
@@ -1266,12 +1266,12 @@ static int handle_etm_config_command(struct command_context_s *cmd_ctx, char *cm
                return ERROR_FAIL;
        }
 
-       for (i=0; etm_capture_drivers[i]; i++)
+       for (i = 0; etm_capture_drivers[i]; i++)
        {
                if (strcmp(args[4], etm_capture_drivers[i]->name) == 0)
                {
                        int retval;
-                       if ((retval=etm_capture_drivers[i]->register_commands(cmd_ctx)) != ERROR_OK)
+                       if ((retval = etm_capture_drivers[i]->register_commands(cmd_ctx)) != ERROR_OK)
                        {
                                free(etm_ctx);
                                return retval;
index d8c0cfc4ff30128fb3879bf53a1691d189eae10d..5cc7b0d8e653179642185eccc193608be5e5fc35 100644 (file)
@@ -59,7 +59,7 @@ static int autodetect_image_type(image_t *image, char *url)
        {
                if (read_bytes != 9)
                {
-                       retval=ERROR_FILEIO_OPERATION_FAILED;
+                       retval = ERROR_FILEIO_OPERATION_FAILED;
                }
        }
        fileio_close(&fileio);
@@ -414,12 +414,12 @@ static int image_elf_read_headers(image_t *image)
 
        /* count useful segments (loadable), ignore BSS section */
        image->num_sections = 0;
-       for (i=0;i<elf->segment_count;i++)
+       for (i = 0;i<elf->segment_count;i++)
                if ((field32(elf, elf->segments[i].p_type) == PT_LOAD) && (field32(elf, elf->segments[i].p_filesz) != 0))
                        image->num_sections++;
        /* alloc and fill sections array with loadable segments */
        image->sections = malloc(image->num_sections * sizeof(image_section_t));
-       for (i=0,j=0;i<elf->segment_count;i++)
+       for (i = 0,j = 0;i<elf->segment_count;i++)
        {
                if ((field32(elf, elf->segments[i].p_type) == PT_LOAD) && (field32(elf, elf->segments[i].p_filesz) != 0))
                {
@@ -446,7 +446,7 @@ static int image_elf_read_section(image_t *image, int section, uint32_t offset,
 
        *size_read = 0;
 
-       LOG_DEBUG("load segment %d at 0x%" PRIx32 " (sz=0x%" PRIx32 ")",section,offset,size);
+       LOG_DEBUG("load segment %d at 0x%" PRIx32 " (sz = 0x%" PRIx32 ")",section,offset,size);
 
        /* read initialized data in current segment if any */
        if (offset<field32(elf,segment->p_filesz))
@@ -762,15 +762,15 @@ int image_open(image_t *image, char *url, char *type_string)
        {
                /* relocate */
                int section;
-               for (section=0; section < image->num_sections; section++)
+               for (section = 0; section < image->num_sections; section++)
                {
                        image->sections[section].base_address += image->base_address;
                }
                /* we're done relocating. The two statements below are mainly
                 * for documenation purposes: stop anyone from empirically
                 * thinking they should use these values henceforth. */
-               image->base_address=0;
-               image->base_address_set=0;
+               image->base_address = 0;
+               image->base_address_set = 0;
        }
 
        return retval;
@@ -1017,10 +1017,10 @@ int image_calculate_checksum(uint8_t* buffer, uint32_t nbytes, uint32_t* checksu
 
        while (nbytes>0)
        {
-               int run=nbytes;
+               int run = nbytes;
                if (run>32768)
                {
-                       run=32768;
+                       run = 32768;
                }
                nbytes -= run;
                while (run--)
index cd73d6e28097227a85b206062db4ee9030a7d2b5..ab082cf2107b79519a52a8c97f2c607029f3c932 100644 (file)
@@ -369,7 +369,7 @@ int mips32_dmaacc_read_mem32(mips_ejtag_t *ejtag_info, uint32_t addr, int count,
        int i;
        int     retval;
 
-       for (i=0; i<count; i++) {
+       for (i = 0; i<count; i++) {
                if ((retval = ejtag_dma_read(ejtag_info, addr+i*sizeof(*buf), &buf[i])) != ERROR_OK)
                        return retval;
        }
@@ -382,7 +382,7 @@ int mips32_dmaacc_read_mem16(mips_ejtag_t *ejtag_info, uint32_t addr, int count,
        int i;
        int retval;
 
-       for (i=0; i<count; i++) {
+       for (i = 0; i<count; i++) {
                if ((retval = ejtag_dma_read_h(ejtag_info, addr+i*sizeof(*buf), &buf[i])) != ERROR_OK)
                        return retval;
        }
@@ -395,7 +395,7 @@ int mips32_dmaacc_read_mem8(mips_ejtag_t *ejtag_info, uint32_t addr, int count,
        int i;
        int retval;
 
-       for (i=0; i<count; i++) {
+       for (i = 0; i<count; i++) {
                if ((retval = ejtag_dma_read_b(ejtag_info, addr+i*sizeof(*buf), &buf[i])) != ERROR_OK)
                        return retval;
        }
@@ -423,7 +423,7 @@ int mips32_dmaacc_write_mem32(mips_ejtag_t *ejtag_info, uint32_t addr, int count
        int i;
        int retval;
 
-       for (i=0; i<count; i++) {
+       for (i = 0; i<count; i++) {
                if ((retval = ejtag_dma_write(ejtag_info, addr+i*sizeof(*buf), buf[i])) != ERROR_OK)
                        return retval;
        }
@@ -436,7 +436,7 @@ int mips32_dmaacc_write_mem16(mips_ejtag_t *ejtag_info, uint32_t addr, int count
        int i;
        int retval;
 
-       for (i=0; i<count; i++) {
+       for (i = 0; i<count; i++) {
                if ((retval = ejtag_dma_write_h(ejtag_info, addr+i*sizeof(*buf), buf[i])) != ERROR_OK)
                        return retval;
        }
@@ -449,7 +449,7 @@ int mips32_dmaacc_write_mem8(mips_ejtag_t *ejtag_info, uint32_t addr, int count,
        int i;
        int retval;
 
-       for (i=0; i<count; i++) {
+       for (i = 0; i<count; i++) {
                if ((retval = ejtag_dma_write_b(ejtag_info, addr+i*sizeof(*buf), buf[i])) != ERROR_OK)
                        return retval;
        }
index 21a788f6452a48f9ae9f48fc5fce41b909979a66..b727e12ae4b987cdf9b68b062edb9e37ade48b13 100644 (file)
@@ -301,9 +301,9 @@ int mips32_pracc_read_mem32(mips_ejtag_t *ejtag_info, uint32_t addr, int count,
                        
                MIPS32_LUI(8,UPPER16(MIPS32_PRACC_PARAM_IN)),           /* $8 = MIPS32_PRACC_PARAM_IN */
                MIPS32_ORI(8,8,LOWER16(MIPS32_PRACC_PARAM_IN)),
-               MIPS32_LW(9,0,8),                                                                       /* $9=mem[$8]; read addr */
-               MIPS32_LW(10,4,8),                                                                      /* $10=mem[$8+4]; read count */
-               MIPS32_LUI(11,UPPER16(MIPS32_PRACC_PARAM_OUT)),         /* $11=MIPS32_PRACC_PARAM_OUT */
+               MIPS32_LW(9,0,8),                                                                       /* $9 = mem[$8]; read addr */
+               MIPS32_LW(10,4,8),                                                                      /* $10 = mem[$8+4]; read count */
+               MIPS32_LUI(11,UPPER16(MIPS32_PRACC_PARAM_OUT)),         /* $11 = MIPS32_PRACC_PARAM_OUT */
                MIPS32_ORI(11,11,LOWER16(MIPS32_PRACC_PARAM_OUT)),
                MIPS32_NOP,
                                                                                                                        /* loop: */
@@ -409,9 +409,9 @@ int mips32_pracc_read_mem16(mips_ejtag_t *ejtag_info, uint32_t addr, int count,
                        
                MIPS32_LUI(8,UPPER16(MIPS32_PRACC_PARAM_IN)),           /* $8 = MIPS32_PRACC_PARAM_IN */
                MIPS32_ORI(8,8,LOWER16(MIPS32_PRACC_PARAM_IN)),
-               MIPS32_LW(9,0,8),                                                                       /* $9=mem[$8]; read addr */
-               MIPS32_LW(10,4,8),                                                                      /* $10=mem[$8+4]; read count */
-               MIPS32_LUI(11,UPPER16(MIPS32_PRACC_PARAM_OUT)),         /* $11=MIPS32_PRACC_PARAM_OUT */
+               MIPS32_LW(9,0,8),                                                                       /* $9 = mem[$8]; read addr */
+               MIPS32_LW(10,4,8),                                                                      /* $10 = mem[$8+4]; read count */
+               MIPS32_LUI(11,UPPER16(MIPS32_PRACC_PARAM_OUT)),         /* $11 = MIPS32_PRACC_PARAM_OUT */
                MIPS32_ORI(11,11,LOWER16(MIPS32_PRACC_PARAM_OUT)),
                MIPS32_NOP,
                                                                                                                        /* loop: */
@@ -488,9 +488,9 @@ int mips32_pracc_read_mem8(mips_ejtag_t *ejtag_info, uint32_t addr, int count, u
                        
                MIPS32_LUI(8,UPPER16(MIPS32_PRACC_PARAM_IN)),           /* $8 = MIPS32_PRACC_PARAM_IN */
                MIPS32_ORI(8,8,LOWER16(MIPS32_PRACC_PARAM_IN)),
-               MIPS32_LW(9,0,8),                                                                       /* $9=mem[$8]; read addr */
-               MIPS32_LW(10,4,8),                                                                      /* $10=mem[$8+4]; read count */
-               MIPS32_LUI(11,UPPER16(MIPS32_PRACC_PARAM_OUT)),         /* $11=MIPS32_PRACC_PARAM_OUT */
+               MIPS32_LW(9,0,8),                                                                       /* $9 = mem[$8]; read addr */
+               MIPS32_LW(10,4,8),                                                                      /* $10 = mem[$8+4]; read count */
+               MIPS32_LUI(11,UPPER16(MIPS32_PRACC_PARAM_OUT)),         /* $11 = MIPS32_PRACC_PARAM_OUT */
                MIPS32_ORI(11,11,LOWER16(MIPS32_PRACC_PARAM_OUT)),
                MIPS32_NOP,
                                                                                                                        /* loop: */
index f4c23d3407ce21b59845f070a53e9f303ff09879..0fef0772a77d1f7b75df9f930016dfbac9dc9f22 100644 (file)
@@ -209,7 +209,7 @@ int mips_m4k_poll(target_t *target)
                target->state = TARGET_RUNNING;
        }
 
-//     LOG_DEBUG("ctrl=0x%08X", ejtag_ctrl);
+//     LOG_DEBUG("ctrl = 0x%08X", ejtag_ctrl);
 
        return ERROR_OK;
 }
index 81d753e0d55897ddb874218917ed38e545df16df..ac2528f7ea97de1e9708dc0a352238dd4bc4b171 100644 (file)
@@ -1091,7 +1091,7 @@ int target_arch_state(struct target_s *target)
        if (target->state != TARGET_HALTED)
                return ERROR_OK;
 
-       retval=target->type->arch_state(target);
+       retval = target->type->arch_state(target);
        return retval;
 }
 
@@ -1466,8 +1466,8 @@ int target_register_user_commands(struct command_context_s *cmd_ctx)
 
        /* script procedures */
        register_command(cmd_ctx, NULL, "profile", handle_profile_command, COMMAND_EXEC, "profiling samples the CPU PC");
-       register_jim(cmd_ctx, "ocd_mem2array", jim_mem2array, "read memory and return as a TCL array for script processing <ARRAYNAME> <WIDTH=32/16/8> <ADDRESS> <COUNT>");
-       register_jim(cmd_ctx, "ocd_array2mem", jim_array2mem, "convert a TCL array to memory locations and write the values  <ARRAYNAME> <WIDTH=32/16/8> <ADDRESS> <COUNT>");
+       register_jim(cmd_ctx, "ocd_mem2array", jim_mem2array, "read memory and return as a TCL array for script processing <ARRAYNAME> <WIDTH = 32/16/8> <ADDRESS> <COUNT>");
+       register_jim(cmd_ctx, "ocd_array2mem", jim_array2mem, "convert a TCL array to memory locations and write the values  <ARRAYNAME> <WIDTH = 32/16/8> <ADDRESS> <COUNT>");
 
        register_command(cmd_ctx, NULL, "fast_load_image", handle_fast_load_image_command, COMMAND_ANY,
                        "same args as load_image, image stored in memory - mainly for profiling purposes");
@@ -1584,7 +1584,7 @@ static int sense_handler(void)
        static int prevPowerdropout = 0;
 
        int retval;
-       if ((retval=jtag_power_dropout(&powerDropout)) != ERROR_OK)
+       if ((retval = jtag_power_dropout(&powerDropout)) != ERROR_OK)
                return retval;
 
        int powerRestored;
@@ -1603,7 +1603,7 @@ static int sense_handler(void)
                lastPower = current;
        }
 
-       if ((retval=jtag_srst_asserted(&srstAsserted)) != ERROR_OK)
+       if ((retval = jtag_srst_asserted(&srstAsserted)) != ERROR_OK)
                return retval;
 
        int srstDeasserted;
@@ -1681,10 +1681,10 @@ int handle_target(void *priv)
 
                /* clear action flags */
 
-               runSrstAsserted=0;
-               runSrstDeasserted=0;
-               runPowerRestore=0;
-               runPowerDropout=0;
+               runSrstAsserted = 0;
+               runSrstDeasserted = 0;
+               runPowerRestore = 0;
+               runPowerDropout = 0;
 
                recursive = 0;
        }
@@ -1904,12 +1904,12 @@ static int handle_wait_halt_command(struct command_context_s *cmd_ctx, char *cmd
 int target_wait_state(target_t *target, enum target_state state, int ms)
 {
        int retval;
-       long long then=0, cur;
-       int once=1;
+       long long then = 0, cur;
+       int once = 1;
 
        for (;;)
        {
-               if ((retval=target_poll(target)) != ERROR_OK)
+               if ((retval = target_poll(target)) != ERROR_OK)
                        return retval;
                if (target->state == state)
                {
@@ -1918,7 +1918,7 @@ int target_wait_state(target_t *target, enum target_state state, int ms)
                cur = timeval_ms();
                if (once)
                {
-                       once=0;
+                       once = 0;
                        then = timeval_ms();
                        LOG_DEBUG("waiting for target %s...",
                                Jim_Nvp_value2name_simple(nvp_target_state,state)->name);
@@ -2070,7 +2070,7 @@ static void handle_md_output(struct command_context_s *cmd_ctx,
                                        (unsigned)(address + (i*size)));
                }
 
-               uint32_t value=0;
+               uint32_t value = 0;
                const uint8_t *value_ptr = buffer + i * size;
                switch (size) {
                case 4: value = target_buffer_get_u32(target, value_ptr); break;
@@ -2274,8 +2274,8 @@ static int handle_load_image_command(struct command_context_s *cmd_ctx, char *cm
                        break;
                }
 
-               uint32_t offset=0;
-               uint32_t length=buf_cnt;
+               uint32_t offset = 0;
+               uint32_t length = buf_cnt;
 
                /* DANGER!!! beware of unsigned comparision here!!! */
 
@@ -2447,13 +2447,13 @@ static int handle_verify_image_command_internal(struct command_context_s *cmd_ct
 
        image.start_address_set = 0;
 
-       if ((retval=image_open(&image, args[0], (argc == 3) ? args[2] : NULL)) != ERROR_OK)
+       if ((retval = image_open(&image, args[0], (argc == 3) ? args[2] : NULL)) != ERROR_OK)
        {
                return retval;
        }
 
        image_size = 0x0;
-       retval=ERROR_OK;
+       retval = ERROR_OK;
        for (i = 0; i < image.num_sections; i++)
        {
                buffer = malloc(image.sections[i].size);
@@ -2514,7 +2514,7 @@ static int handle_verify_image_command_internal(struct command_context_s *cmd_ct
                                                                                  buffer[t]);
                                                        free(data);
                                                        free(buffer);
-                                                       retval=ERROR_FAIL;
+                                                       retval = ERROR_FAIL;
                                                        goto done;
                                                }
                                                if ((t%16384) == 0)
@@ -2790,9 +2790,9 @@ static void writeData(FILE *f, const void *data, size_t len)
 static void writeLong(FILE *f, int l)
 {
        int i;
-       for (i=0; i<4; i++)
+       for (i = 0; i<4; i++)
        {
-               char c=(l >> (i*8))&0xff;
+               char c = (l >> (i*8))&0xff;
                writeData(f, &c, 1);
        }
 
@@ -2807,7 +2807,7 @@ static void writeString(FILE *f, char *s)
 static void writeGmon(uint32_t *samples, uint32_t sampleNum, char *filename)
 {
        uint32_t i;
-       FILE *f=fopen(filename, "w");
+       FILE *f = fopen(filename, "w");
        if (f == NULL)
                return;
        writeString(f, "gmon");
@@ -2820,42 +2820,42 @@ static void writeGmon(uint32_t *samples, uint32_t sampleNum, char *filename)
        writeData(f, &zero, 1);
 
        /* figure out bucket size */
-       uint32_t min=samples[0];
-       uint32_t max=samples[0];
-       for (i=0; i<sampleNum; i++)
+       uint32_t min = samples[0];
+       uint32_t max = samples[0];
+       for (i = 0; i<sampleNum; i++)
        {
                if (min>samples[i])
                {
-                       min=samples[i];
+                       min = samples[i];
                }
                if (max<samples[i])
                {
-                       max=samples[i];
+                       max = samples[i];
                }
        }
 
-       int addressSpace=(max-min+1);
+       int addressSpace = (max-min+1);
 
        static const uint32_t maxBuckets = 256 * 1024; /* maximum buckets. */
        uint32_t length = addressSpace;
        if (length > maxBuckets)
        {
-               length=maxBuckets;
+               length = maxBuckets;
        }
-       int *buckets=malloc(sizeof(int)*length);
+       int *buckets = malloc(sizeof(int)*length);
        if (buckets == NULL)
        {
                fclose(f);
                return;
        }
        memset(buckets, 0, sizeof(int)*length);
-       for (i=0; i<sampleNum;i++)
+       for (i = 0; i<sampleNum;i++)
        {
-               uint32_t address=samples[i];
-               long long a=address-min;
-               long long b=length-1;
-               long long c=addressSpace-1;
-               int index=(a*b)/c; /* danger!!!! int32 overflows */
+               uint32_t address = samples[i];
+               long long a = address-min;
+               long long b = length-1;
+               long long c = addressSpace-1;
+               int index = (a*b)/c; /* danger!!!! int32 overflows */
                buckets[index]++;
        }
 
@@ -2865,22 +2865,22 @@ static void writeGmon(uint32_t *samples, uint32_t sampleNum, char *filename)
        writeLong(f, length);           /* # of samples */
        writeLong(f, 64000000);         /* 64MHz */
        writeString(f, "seconds");
-       for (i=0; i<(15-strlen("seconds")); i++)
+       for (i = 0; i<(15-strlen("seconds")); i++)
                writeData(f, &zero, 1);
        writeString(f, "s");
 
        /*append binary memory gmon.out profile_hist_data (profile_hist_data + profile_hist_hdr.hist_size) */
 
-       char *data=malloc(2*length);
+       char *data = malloc(2*length);
        if (data != NULL)
        {
-               for (i=0; i<length;i++)
+               for (i = 0; i<length;i++)
                {
                        int val;
-                       val=buckets[i];
+                       val = buckets[i];
                        if (val>65535)
                        {
-                               val=65535;
+                               val = 65535;
                        }
                        data[i*2]=val&0xff;
                        data[i*2+1]=(val >> 8)&0xff;
@@ -2916,12 +2916,12 @@ static int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd,
 
        command_print(cmd_ctx, "Starting profiling. Halting and resuming the target as often as we can...");
 
-       static const int maxSample=10000;
-       uint32_t *samples=malloc(sizeof(uint32_t)*maxSample);
+       static const int maxSample = 10000;
+       uint32_t *samples = malloc(sizeof(uint32_t)*maxSample);
        if (samples == NULL)
                return ERROR_OK;
 
-       int numSamples=0;
+       int numSamples = 0;
        /* hopefully it is safe to cache! We want to stop/restart as quickly as possible. */
        reg_t *reg = register_get_by_name(target->reg_cache, "pc", 1);
 
@@ -2946,7 +2946,7 @@ static int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd,
                } else
                {
                        command_print(cmd_ctx, "Target not halted or running");
-                       retval=ERROR_OK;
+                       retval = ERROR_OK;
                        break;
                }
                if (retval != ERROR_OK)
@@ -4206,7 +4206,7 @@ static int target_create( Jim_GetOptInfo *goi )
        if (target->tap == NULL)
        {
                Jim_SetResultString( interp, "-chain-position required when creating target", -1);
-               e=JIM_ERR;
+               e = JIM_ERR;
        }
 
        if ( e != JIM_OK ){
@@ -4389,13 +4389,13 @@ static void free_fastload(void)
        if (fastload != NULL)
        {
                int i;
-               for (i=0; i<fastload_num; i++)
+               for (i = 0; i<fastload_num; i++)
                {
                        if (fastload[i].data)
                                free(fastload[i].data);
                }
                free(fastload);
-               fastload=NULL;
+               fastload = NULL;
        }
 }
 
@@ -4407,8 +4407,8 @@ static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, cha
        uint8_t *buffer;
        uint32_t buf_cnt;
        uint32_t image_size;
-       uint32_t min_address=0;
-       uint32_t max_address=0xffffffff;
+       uint32_t min_address = 0;
+       uint32_t max_address = 0xffffffff;
        int i;
 
        image_t image;
@@ -4430,8 +4430,8 @@ static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, cha
 
        image_size = 0x0;
        retval = ERROR_OK;
-       fastload_num=image.num_sections;
-       fastload=(struct FastLoad *)malloc(sizeof(struct FastLoad)*image.num_sections);
+       fastload_num = image.num_sections;
+       fastload = (struct FastLoad *)malloc(sizeof(struct FastLoad)*image.num_sections);
        if (fastload == NULL)
        {
                image_close(&image);
@@ -4454,8 +4454,8 @@ static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, cha
                        break;
                }
 
-               uint32_t offset=0;
-               uint32_t length=buf_cnt;
+               uint32_t offset = 0;
+               uint32_t length = buf_cnt;
 
 
                /* DANGER!!! beware of unsigned comparision here!!! */
@@ -4475,15 +4475,15 @@ static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, cha
                                length -= (image.sections[i].base_address+buf_cnt)-max_address;
                        }
 
-                       fastload[i].address=image.sections[i].base_address+offset;
-                       fastload[i].data=malloc(length);
+                       fastload[i].address = image.sections[i].base_address+offset;
+                       fastload[i].data = malloc(length);
                        if (fastload[i].data == NULL)
                        {
                                free(buffer);
                                break;
                        }
                        memcpy(fastload[i].data, buffer+offset, length);
-                       fastload[i].length=length;
+                       fastload[i].length = length;
 
                        image_size += length;
                        command_print(cmd_ctx, "%u byte written at address 0x%8.8x", 
@@ -4522,10 +4522,10 @@ static int handle_fast_load_command(struct command_context_s *cmd_ctx, char *cmd
                return ERROR_FAIL;
        }
        int i;
-       int ms=timeval_ms();
-       int size=0;
-       int retval=ERROR_OK;
-       for (i=0; i<fastload_num;i++)
+       int ms = timeval_ms();
+       int size = 0;
+       int retval = ERROR_OK;
+       for (i = 0; i<fastload_num;i++)
        {
                target_t *target = get_current_target(cmd_ctx);
                command_print(cmd_ctx, "Write to 0x%08x, length 0x%08x", 
@@ -4537,7 +4537,7 @@ static int handle_fast_load_command(struct command_context_s *cmd_ctx, char *cmd
                }
                size += fastload[i].length;
        }
-       int after=timeval_ms();
+       int after = timeval_ms();
        command_print(cmd_ctx, "Loaded image %f kBytes/s", (float)(size/1024.0)/((float)(after-ms)/1000.0));
        return retval;
 }
index 7632c9331a4cdc5a26b6596cff04efedbbe6007e..f7744460cd60c275562a5fbb1973645520f26d69 100644 (file)
@@ -87,7 +87,7 @@ extern const Jim_Nvp nvp_target_debug_reason[];
 
 enum target_endianess
 {
-       TARGET_ENDIAN_UNKNOWN=0,
+       TARGET_ENDIAN_UNKNOWN = 0,
        TARGET_BIG_ENDIAN = 1, TARGET_LITTLE_ENDIAN = 2
 };
 
index 506cd76ad3dcae24a27492ff967f255b01027b49..e07000d52b5a7f192bebd9f402c86c4aea55e24e 100644 (file)
@@ -295,8 +295,8 @@ int xscale_read_dcsr(target_t *target)
 
 static void xscale_getbuf(jtag_callback_data_t arg)
 {
-  uint8_t *in=(uint8_t *)arg;
-       *((uint32_t *)in)=buf_get_u32(in, 0, 32);
+  uint8_t *in = (uint8_t *)arg;
+       *((uint32_t *)in) = buf_get_u32(in, 0, 32);
 }
 
 int xscale_receive(target_t *target, uint32_t *buffer, int num_words)
@@ -304,7 +304,7 @@ int xscale_receive(target_t *target, uint32_t *buffer, int num_words)
        if (num_words == 0)
                return ERROR_INVALID_ARGUMENTS;
 
-       int retval=ERROR_OK;
+       int retval = ERROR_OK;
        armv4_5_common_t *armv4_5 = target->arch_info;
        xscale_common_t *xscale = armv4_5->arch_info;
 
@@ -351,7 +351,7 @@ int xscale_receive(target_t *target, uint32_t *buffer, int num_words)
        jtag_add_runtest(1, jtag_get_end_state()); /* ensures that we're in the TAP_IDLE state as the above could be a no-op */
 
        /* repeat until all words have been collected */
-       int attempts=0;
+       int attempts = 0;
        while (words_done < num_words)
        {
                /* schedule reads */
@@ -397,7 +397,7 @@ int xscale_receive(target_t *target, uint32_t *buffer, int num_words)
                        if (attempts++==1000)
                        {
                                LOG_ERROR("Failed to receiving data from debug handler after 1000 attempts");
-                               retval=ERROR_TARGET_TIMEOUT;
+                               retval = ERROR_TARGET_TIMEOUT;
                                break;
                        }
                }
@@ -886,7 +886,7 @@ int xscale_update_vectors(target_t *target)
                }
                else
                {
-                       retval=target_read_u32(target, 0xffff0000 + 4*i, &xscale->high_vectors[i]);
+                       retval = target_read_u32(target, 0xffff0000 + 4*i, &xscale->high_vectors[i]);
                        if (retval == ERROR_TARGET_TIMEOUT)
                                return retval;
                        if (retval != ERROR_OK)
@@ -905,7 +905,7 @@ int xscale_update_vectors(target_t *target)
                }
                else
                {
-                       retval=target_read_u32(target, 0x0 + 4*i, &xscale->low_vectors[i]);
+                       retval = target_read_u32(target, 0x0 + 4*i, &xscale->low_vectors[i]);
                        if (retval == ERROR_TARGET_TIMEOUT)
                                return retval;
                        if (retval != ERROR_OK)
@@ -973,7 +973,7 @@ int xscale_arch_state(struct target_s *target)
 
 int xscale_poll(target_t *target)
 {
-       int retval=ERROR_OK;
+       int retval = ERROR_OK;
        armv4_5_common_t *armv4_5 = target->arch_info;
        xscale_common_t *xscale = armv4_5->arch_info;
 
@@ -1028,11 +1028,11 @@ int xscale_debug_entry(target_t *target)
 
        /* clear external dbg break (will be written on next DCSR read) */
        xscale->external_debug_break = 0;
-       if ((retval=xscale_read_dcsr(target)) != ERROR_OK)
+       if ((retval = xscale_read_dcsr(target)) != ERROR_OK)
                return retval;
 
        /* get r0, pc, r1 to r7 and cpsr */
-       if ((retval=xscale_receive(target, buffer, 10)) != ERROR_OK)
+       if ((retval = xscale_receive(target, buffer, 10)) != ERROR_OK)
                return retval;
 
        /* move r0 from buffer to register cache */
@@ -1253,7 +1253,7 @@ int xscale_enable_single_step(struct target_s *target, uint32_t next_pc)
                }
        }
 
-       if ((retval=xscale_set_reg_u32(ibcr0, next_pc | 0x1)) != ERROR_OK)
+       if ((retval = xscale_set_reg_u32(ibcr0, next_pc | 0x1)) != ERROR_OK)
                return retval;
 
        return ERROR_OK;
@@ -1266,7 +1266,7 @@ int xscale_disable_single_step(struct target_s *target)
        reg_t *ibcr0 = &xscale->reg_cache->reg_list[XSCALE_IBCR0];
        int retval;
 
-       if ((retval=xscale_set_reg_u32(ibcr0, 0x0)) != ERROR_OK)
+       if ((retval = xscale_set_reg_u32(ibcr0, 0x0)) != ERROR_OK)
                return retval;
 
        return ERROR_OK;
@@ -1297,7 +1297,7 @@ int xscale_resume(struct target_s *target, int current, uint32_t address, int ha
        }
 
        /* update vector tables */
-       if ((retval=xscale_update_vectors(target)) != ERROR_OK)
+       if ((retval = xscale_update_vectors(target)) != ERROR_OK)
                return retval;
 
        /* current = 1: continue on current pc, otherwise continue at <address> */
@@ -1451,56 +1451,56 @@ static int xscale_step_inner(struct target_s *target, int current, uint32_t addr
        }
 
        LOG_DEBUG("enable single-step");
-       if ((retval=xscale_enable_single_step(target, next_pc)) != ERROR_OK)
+       if ((retval = xscale_enable_single_step(target, next_pc)) != ERROR_OK)
                return retval;
 
        /* restore banked registers */
-       if ((retval=xscale_restore_context(target)) != ERROR_OK)
+       if ((retval = xscale_restore_context(target)) != ERROR_OK)
                return retval;
 
        /* send resume request (command 0x30 or 0x31)
         * clean the trace buffer if it is to be enabled (0x62) */
        if (xscale->trace.buffer_enabled)
        {
-               if ((retval=xscale_send_u32(target, 0x62)) != ERROR_OK)
+               if ((retval = xscale_send_u32(target, 0x62)) != ERROR_OK)
                        return retval;
-               if ((retval=xscale_send_u32(target, 0x31)) != ERROR_OK)
+               if ((retval = xscale_send_u32(target, 0x31)) != ERROR_OK)
                        return retval;
        }
        else
-               if ((retval=xscale_send_u32(target, 0x30)) != ERROR_OK)
+               if ((retval = xscale_send_u32(target, 0x30)) != ERROR_OK)
                        return retval;
 
        /* send CPSR */
-       if ((retval=xscale_send_u32(target, buf_get_u32(armv4_5->core_cache->reg_list[ARMV4_5_CPSR].value, 0, 32))) != ERROR_OK)
+       if ((retval = xscale_send_u32(target, buf_get_u32(armv4_5->core_cache->reg_list[ARMV4_5_CPSR].value, 0, 32))) != ERROR_OK)
                return retval;
        LOG_DEBUG("writing cpsr with value 0x%8.8" PRIx32 "", buf_get_u32(armv4_5->core_cache->reg_list[ARMV4_5_CPSR].value, 0, 32));
 
        for (i = 7; i >= 0; i--)
        {
                /* send register */
-               if ((retval=xscale_send_u32(target, buf_get_u32(armv4_5->core_cache->reg_list[i].value, 0, 32))) != ERROR_OK)
+               if ((retval = xscale_send_u32(target, buf_get_u32(armv4_5->core_cache->reg_list[i].value, 0, 32))) != ERROR_OK)
                        return retval;
                LOG_DEBUG("writing r%i with value 0x%8.8" PRIx32 "", i, buf_get_u32(armv4_5->core_cache->reg_list[i].value, 0, 32));
        }
 
        /* send PC */
-       if ((retval=xscale_send_u32(target, buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32))) != ERROR_OK)
+       if ((retval = xscale_send_u32(target, buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32))) != ERROR_OK)
                return retval;
        LOG_DEBUG("writing PC with value 0x%8.8" PRIx32, buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32));
 
        target_call_event_callbacks(target, TARGET_EVENT_RESUMED);
 
        /* registers are now invalid */
-       if ((retval=armv4_5_invalidate_core_regs(target)) != ERROR_OK)
+       if ((retval = armv4_5_invalidate_core_regs(target)) != ERROR_OK)
                return retval;
 
        /* wait for and process debug entry */
-       if ((retval=xscale_debug_entry(target)) != ERROR_OK)
+       if ((retval = xscale_debug_entry(target)) != ERROR_OK)
                return retval;
 
        LOG_DEBUG("disable single-step");
-       if ((retval=xscale_disable_single_step(target)) != ERROR_OK)
+       if ((retval = xscale_disable_single_step(target)) != ERROR_OK)
                return retval;
 
        target_call_event_callbacks(target, TARGET_EVENT_HALTED);
@@ -1531,7 +1531,7 @@ int xscale_step(struct target_s *target, int current, uint32_t address, int hand
        /* if we're at the reset vector, we have to simulate the step */
        if (current_pc == 0x0)
        {
-               if ((retval=arm_simulate_step(target, NULL)) != ERROR_OK)
+               if ((retval = arm_simulate_step(target, NULL)) != ERROR_OK)
                        return retval;
                current_pc = buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32);
 
@@ -1545,7 +1545,7 @@ int xscale_step(struct target_s *target, int current, uint32_t address, int hand
        if (handle_breakpoints)
                if ((breakpoint = breakpoint_find(target, buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32))))
                {
-                       if ((retval=xscale_unset_breakpoint(target, breakpoint)) != ERROR_OK)
+                       if ((retval = xscale_unset_breakpoint(target, breakpoint)) != ERROR_OK)
                                return retval;
                }
 
@@ -1930,20 +1930,20 @@ int xscale_read_memory(struct target_s *target, uint32_t address, uint32_t size,
                return ERROR_TARGET_UNALIGNED_ACCESS;
 
        /* send memory read request (command 0x1n, n: access size) */
-       if ((retval=xscale_send_u32(target, 0x10 | size)) != ERROR_OK)
+       if ((retval = xscale_send_u32(target, 0x10 | size)) != ERROR_OK)
                return retval;
 
        /* send base address for read request */
-       if ((retval=xscale_send_u32(target, address)) != ERROR_OK)
+       if ((retval = xscale_send_u32(target, address)) != ERROR_OK)
                return retval;
 
        /* send number of requested data words */
-       if ((retval=xscale_send_u32(target, count)) != ERROR_OK)
+       if ((retval = xscale_send_u32(target, count)) != ERROR_OK)
                return retval;
 
        /* receive data from target (count times 32-bit words in host endianness) */
        buf32 = malloc(4 * count);
-       if ((retval=xscale_receive(target, buf32, count)) != ERROR_OK)
+       if ((retval = xscale_receive(target, buf32, count)) != ERROR_OK)
                return retval;
 
        /* extract data from host-endian buffer into byte stream */
@@ -1971,12 +1971,12 @@ int xscale_read_memory(struct target_s *target, uint32_t address, uint32_t size,
        free(buf32);
 
        /* examine DCSR, to see if Sticky Abort (SA) got set */
-       if ((retval=xscale_read_dcsr(target)) != ERROR_OK)
+       if ((retval = xscale_read_dcsr(target)) != ERROR_OK)
                return retval;
        if (buf_get_u32(xscale->reg_cache->reg_list[XSCALE_DCSR].value, 5, 1) == 1)
        {
                /* clear SA bit */
-               if ((retval=xscale_send_u32(target, 0x60)) != ERROR_OK)
+               if ((retval = xscale_send_u32(target, 0x60)) != ERROR_OK)
                        return retval;
 
                return ERROR_TARGET_DATA_ABORT;
@@ -2007,15 +2007,15 @@ int xscale_write_memory(struct target_s *target, uint32_t address, uint32_t size
                return ERROR_TARGET_UNALIGNED_ACCESS;
 
        /* send memory write request (command 0x2n, n: access size) */
-       if ((retval=xscale_send_u32(target, 0x20 | size)) != ERROR_OK)
+       if ((retval = xscale_send_u32(target, 0x20 | size)) != ERROR_OK)
                return retval;
 
        /* send base address for read request */
-       if ((retval=xscale_send_u32(target, address)) != ERROR_OK)
+       if ((retval = xscale_send_u32(target, address)) != ERROR_OK)
                return retval;
 
        /* send number of requested data words to be written*/
-       if ((retval=xscale_send_u32(target, count)) != ERROR_OK)
+       if ((retval = xscale_send_u32(target, count)) != ERROR_OK)
                return retval;
 
        /* extract data from host-endian buffer into byte stream */
@@ -2045,16 +2045,16 @@ int xscale_write_memory(struct target_s *target, uint32_t address, uint32_t size
                }
        }
 #endif
-       if ((retval=xscale_send(target, buffer, count, size)) != ERROR_OK)
+       if ((retval = xscale_send(target, buffer, count, size)) != ERROR_OK)
                return retval;
 
        /* examine DCSR, to see if Sticky Abort (SA) got set */
-       if ((retval=xscale_read_dcsr(target)) != ERROR_OK)
+       if ((retval = xscale_read_dcsr(target)) != ERROR_OK)
                return retval;
        if (buf_get_u32(xscale->reg_cache->reg_list[XSCALE_DCSR].value, 5, 1) == 1)
        {
                /* clear SA bit */
-               if ((retval=xscale_send_u32(target, 0x60)) != ERROR_OK)
+               if ((retval = xscale_send_u32(target, 0x60)) != ERROR_OK)
                        return retval;
 
                return ERROR_TARGET_DATA_ABORT;
@@ -2330,7 +2330,7 @@ int xscale_set_watchpoint(struct target_s *target, watchpoint_t *watchpoint)
 {
        armv4_5_common_t *armv4_5 = target->arch_info;
        xscale_common_t *xscale = armv4_5->arch_info;
-       uint8_t enable=0;
+       uint8_t enable = 0;
        reg_t *dbcon = &xscale->reg_cache->reg_list[XSCALE_DBCON];
        uint32_t dbcon_value = buf_get_u32(dbcon->value, 0, 32);
 
index f4c5df62970cd44f5b7dea958793c10f31137310..dba38dc7770dfabac7c49615502afc2c8abae559 100644 (file)
@@ -366,7 +366,7 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha
 
                                LOG_DEBUG("%s %d", op_name, xsdrsize);
 
-                               for ( attempt=0; attempt<limit;  ++attempt )
+                               for ( attempt = 0; attempt<limit;  ++attempt )
                                {
                                        scan_field_t field;
 
@@ -836,7 +836,7 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha
                                if (limit < 1)
                                        limit = 1;
 
-                               for ( attempt=0; attempt<limit;  ++attempt )
+                               for ( attempt = 0; attempt<limit;  ++attempt )
                                {
                                        scan_field_t field;
 
index 7e0c303fa450621b78705cac28163ee1a43a415a..68095da33223d59a7e67fc2d43a90f95766c376a 100644 (file)
@@ -12,7 +12,7 @@ monitor reg sp 0x20004000
 monitor reg pc 0x20002000
 stepi
 
-arm-elf-gcc -mthumb -mcpu=cortex-m3 -nostdlib -Ttest.ld test.c
+arm-elf-gcc -mthumb -mcpu = cortex-m3 -nostdlib -Ttest.ld test.c
 
 
 */
@@ -20,7 +20,7 @@ int j;
 void _start()
 {
   int i;
-  for (i=0; i<1000; i++)
+  for (i = 0; i<1000; i++)
     {
       j++;
     }