From 8959de9f679cfd0436d731fd91b88a68b9a75fa6 Mon Sep 17 00:00:00 2001 From: zwelch Date: Tue, 23 Jun 2009 22:44:17 +0000 Subject: - Fixes '+' whitespace - Replace ')\(+\)(' with ') \1 ('. - Replace ')\(+\)\(\w\)' with ') \1 \2'. - Replace '\(\w\)\(+\)(' with '\1 \2 ('. - Replace '\(\w\)\(+\)\(\w\)' with '\1 \2 \3'. git-svn-id: svn://svn.berlios.de/openocd/trunk@2373 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/flash/at91sam7.c | 20 +++++++++---------- src/flash/cfi.c | 4 ++-- src/flash/ecos.c | 20 +++++++++---------- src/flash/flash.c | 2 +- src/flash/mflash.c | 2 +- src/flash/mflash.h | 2 +- src/flash/nand.c | 10 +++++----- src/flash/ocl.c | 4 ++-- src/flash/ocl/at91sam7x/main.c | 6 +++--- src/flash/ocl/at91sam7x/samflash.c | 40 +++++++++++++++++++------------------- src/flash/pic32mx.c | 2 +- src/flash/pic32mx.h | 4 ++-- src/flash/stellaris.c | 8 ++++---- src/flash/str7x.c | 2 +- src/flash/str9x.c | 2 +- src/flash/tms470.c | 2 +- 16 files changed, 65 insertions(+), 65 deletions(-) (limited to 'src/flash') diff --git a/src/flash/at91sam7.c b/src/flash/at91sam7.c index 6fb3440d..2ab1cd3f 100644 --- a/src/flash/at91sam7.c +++ b/src/flash/at91sam7.c @@ -213,19 +213,19 @@ static void at91sam7_set_flash_mode(flash_bank_t *bank, int mode) if (at91sam7_info->cidr_arch == 0x60) { /* AT91SAM7A3 uses master clocks in 100 ns */ - fmcn = (at91sam7_info->mck_freq/10000000ul)+1; + fmcn = (at91sam7_info->mck_freq/10000000ul) + 1; } else { /* master clocks in 1uS for ARCH 0x7 types */ - fmcn = (at91sam7_info->mck_freq/1000000ul)+1; + fmcn = (at91sam7_info->mck_freq/1000000ul) + 1; } } else if (mode == FMR_TIMING_FLASH) { /* main clocks in 1.5uS */ fmcn = (at91sam7_info->mck_freq/1000000ul)+ - (at91sam7_info->mck_freq/2000000ul)+1; + (at91sam7_info->mck_freq/2000000ul) + 1; } /* hard overclocking */ @@ -282,7 +282,7 @@ static int at91sam7_flash_command(struct flash_bank_s *bank, uint8_t cmd, uint16 fcr = (0x5A << 24) | ((pagen&0x3FF) << 8) | cmd; target_write_u32(target, MC_FCR[bank->bank_number], fcr); - LOG_DEBUG("Flash command: 0x%" PRIx32 ", flash bank: %i, page number: %u", fcr, bank->bank_number+1, pagen); + LOG_DEBUG("Flash command: 0x%" PRIx32 ", flash bank: %i, page number: %u", fcr, bank->bank_number + 1, pagen); if ((at91sam7_info->cidr_arch == 0x60) && ((cmd == SLB)|(cmd == CLB))) { @@ -641,7 +641,7 @@ static int at91sam7_erase_check(struct flash_bank_s *bank) fast_check = 1; for (nSector = 0; nSectornum_sectors; nSector++) { - retval = target_blank_check_memory(target, bank->base+bank->sectors[nSector].offset, + retval = target_blank_check_memory(target, bank->base + bank->sectors[nSector].offset, bank->sectors[nSector].size, &blank); if (retval != ERROR_OK) { @@ -665,7 +665,7 @@ static int at91sam7_erase_check(struct flash_bank_s *bank) for (nSector = 0; nSectornum_sectors; nSector++) { bank->sectors[nSector].is_erased = 1; - retval = target_read_memory(target, bank->base+bank->sectors[nSector].offset, 4, + retval = target_read_memory(target, bank->base + bank->sectors[nSector].offset, 4, bank->sectors[nSector].size/4, buffer); if (retval != ERROR_OK) return retval; @@ -707,7 +707,7 @@ static int at91sam7_protect_check(struct flash_bank_s *bank) at91sam7_info->num_lockbits_on = 0; for (lock_pos = 0; lock_posnum_sectors; lock_pos++) { - if ( ((status >> (16+lock_pos))&(0x0001)) == 1) + if ( ((status >> (16 + lock_pos))&(0x0001)) == 1) { at91sam7_info->num_lockbits_on++; bank->sectors[lock_pos].is_protected = 1; @@ -725,7 +725,7 @@ static int at91sam7_protect_check(struct flash_bank_s *bank) at91sam7_info->num_nvmbits_on = 0; for (gpnvm_pos = 0; gpnvm_posnum_nvmbits; gpnvm_pos++) { - if ( ((status >> (8+gpnvm_pos))&(0x01)) == 1) + if ( ((status >> (8 + gpnvm_pos))&(0x01)) == 1) { at91sam7_info->num_nvmbits_on++; } @@ -803,7 +803,7 @@ static int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char * page_size = atoi(args[11]); num_nvmbits = atoi(args[12]); - target_name = calloc(strlen(args[7])+1, sizeof(char)); + target_name = calloc(strlen(args[7]) + 1, sizeof(char)); strcpy(target_name, args[7]); /* calculate bank size */ @@ -1027,7 +1027,7 @@ static int at91sam7_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t o /* Write one block to the PageWriteBuffer */ buffer_pos = (pagen-first_page)*dst_min_alignment; wcount = CEIL(count,4); - if ((retval = target_write_memory(target, bank->base+pagen*dst_min_alignment, 4, wcount, buffer+buffer_pos)) != ERROR_OK) + if ((retval = target_write_memory(target, bank->base + pagen*dst_min_alignment, 4, wcount, buffer + buffer_pos)) != ERROR_OK) { return retval; } diff --git a/src/flash/cfi.c b/src/flash/cfi.c index 1f6043e4..60d1834d 100644 --- a/src/flash/cfi.c +++ b/src/flash/cfi.c @@ -213,7 +213,7 @@ static uint16_t cfi_query_u16(flash_bank_t *bank, int sector, uint32_t offset) { uint8_t i; for (i = 0;i<2;i++) - target_read_memory(target, flash_address(bank, sector, offset+i), bank->bus_width, 1, + target_read_memory(target, flash_address(bank, sector, offset + i), bank->bus_width, 1, &data[i*bank->bus_width] ); } else @@ -235,7 +235,7 @@ static uint32_t cfi_query_u32(flash_bank_t *bank, int sector, uint32_t offset) { uint8_t i; for (i = 0;i<4;i++) - target_read_memory(target, flash_address(bank, sector, offset+i), bank->bus_width, 1, + target_read_memory(target, flash_address(bank, sector, offset + i), bank->bus_width, 1, &data[i*bank->bus_width] ); } else diff --git a/src/flash/ecos.c b/src/flash/ecos.c index 686a63fb..1a2aa68d 100644 --- a/src/flash/ecos.c +++ b/src/flash/ecos.c @@ -274,8 +274,8 @@ static int eCosBoard_erase(ecosflash_flash_bank_t *info, uint32_t address, uint3 uint32_t flashErr; retval = runCode(info, - info->start_address+OFFSET_ERASE, - info->start_address+OFFSET_ERASE+OFFSET_ERASE_SIZE, + info->start_address + OFFSET_ERASE, + info->start_address + OFFSET_ERASE + OFFSET_ERASE_SIZE, address, len, 0, @@ -307,8 +307,8 @@ static int eCosBoard_flash(ecosflash_flash_bank_t *info, void *data, uint32_t ad uint32_t buffer; retval = runCode(info, - info->start_address+OFFSET_GET_WORKAREA, - info->start_address+OFFSET_GET_WORKAREA+OFFSET_GET_WORKAREA_SIZE, + info->start_address + OFFSET_GET_WORKAREA, + info->start_address + OFFSET_GET_WORKAREA + OFFSET_GET_WORKAREA_SIZE, 0, 0, 0, @@ -328,16 +328,16 @@ static int eCosBoard_flash(ecosflash_flash_bank_t *info, void *data, uint32_t ad } 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, - info->start_address+OFFSET_FLASH, - info->start_address+OFFSET_FLASH+OFFSET_FLASH_SIZE, + info->start_address + OFFSET_FLASH, + info->start_address + OFFSET_FLASH + OFFSET_FLASH_SIZE, buffer, - address+i, + address + i, t, &flashErr, timeout); @@ -410,7 +410,7 @@ static int ecosflash_erase(struct flash_bank_s *bank, int first, int last) { 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)); + return eCosBoard_erase(info, c->base + first*sectorSize, sectorSize*(last-first + 1)); } static int ecosflash_protect(struct flash_bank_s *bank, int set, int first, int last) @@ -422,7 +422,7 @@ static int ecosflash_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t { ecosflash_flash_bank_t *info = bank->driver_priv; struct flash_bank_s *c = bank; - return eCosBoard_flash(info, buffer, c->base+offset, count); + return eCosBoard_flash(info, buffer, c->base + offset, count); } static int ecosflash_protect_check(struct flash_bank_s *bank) diff --git a/src/flash/flash.c b/src/flash/flash.c index 61dc4a6a..d93c4efa 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -1110,7 +1110,7 @@ int flash_write(target_t *target, image_t *image, uint32_t *written, int erase) /* see if we need to pad the section */ while (padding[section]--) - (buffer+buffer_size)[size_read++] = 0xff; + (buffer + buffer_size)[size_read++] = 0xff; buffer_size += size_read; section_offset += size_read; diff --git a/src/flash/mflash.c b/src/flash/mflash.c index 328e9578..25b9f096 100644 --- a/src/flash/mflash.c +++ b/src/flash/mflash.c @@ -923,7 +923,7 @@ static double mg_do_calc_pll(double XIN, mg_pll_t * p_pll_val, int is_approximat CLK_OUT = XIN * ((double)M / N) / NO; - if ((int)((CLK_OUT+ROUND) / DIV) + if ((int)((CLK_OUT + ROUND) / DIV) == (int)(MG_PLL_CLK_OUT / DIV)) { if (mg_is_valid_pll(XIN, N, CLK_OUT, NO) == ERROR_OK) { diff --git a/src/flash/mflash.h b/src/flash/mflash.h index 04eb99a9..bfaf743e 100644 --- a/src/flash/mflash.h +++ b/src/flash/mflash.h @@ -294,7 +294,7 @@ typedef enum _mg_vcmd typedef enum _mg_opmode { mg_op_mode_xip = 1, /* TRUE XIP */ - mg_op_mode_snd = 2, /* BOOT+Storage */ + mg_op_mode_snd = 2, /* BOOT + Storage */ mg_op_mode_stg = 0 /* Only Storage */ } mg_opmode; diff --git a/src/flash/nand.c b/src/flash/nand.c index 79858d63..9851e789 100644 --- a/src/flash/nand.c +++ b/src/flash/nand.c @@ -518,9 +518,9 @@ int nand_probe(struct nand_device_s *device) { if (device->bus_width == 8) { - device->controller->read_data(device, id_buff+3); - device->controller->read_data(device, id_buff+4); - device->controller->read_data(device, id_buff+5); + device->controller->read_data(device, id_buff + 3); + device->controller->read_data(device, id_buff + 4); + device->controller->read_data(device, id_buff + 5); } else { @@ -1420,7 +1420,7 @@ static int handle_nand_write_command(struct command_context_s *cmd_ctx, char *cm uint8_t ecc[3]; memset(oob, 0xff, oob_size); for (i = 0, j = 0; i < page_size; i += 256) { - nand_calculate_ecc(p, page+i, ecc); + nand_calculate_ecc(p, page + i, ecc); oob[eccpos[j++]] = ecc[0]; oob[eccpos[j++]] = ecc[1]; oob[eccpos[j++]] = ecc[2]; @@ -1437,7 +1437,7 @@ static int handle_nand_write_command(struct command_context_s *cmd_ctx, char *cm uint8_t *ecc = oob + oob_size - page_size/512 * 10; memset(oob, 0xff, oob_size); for (i = 0; i < page_size; i += 512) { - nand_calculate_ecc_kw(p, page+i, ecc); + nand_calculate_ecc_kw(p, page + i, ecc); ecc += 10; } } diff --git a/src/flash/ocl.c b/src/flash/ocl.c index 17b57a87..06cbbaad 100644 --- a/src/flash/ocl.c +++ b/src/flash/ocl.c @@ -139,7 +139,7 @@ static int ocl_erase(struct flash_bank_s *bank, int first, int last) } /* receive response */ - if ((retval = embeddedice_receive(ocl->jtag_info, dcc_buffer+1, 1) != ERROR_OK)) + if ((retval = embeddedice_receive(ocl->jtag_info, dcc_buffer + 1, 1) != ERROR_OK)) return retval; if (dcc_buffer[1] != OCL_CMD_DONE) @@ -182,7 +182,7 @@ static int ocl_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset } /* allocate buffer for max. ocl buffer + overhead */ - dcc_buffer = malloc(sizeof(uint32_t)*(ocl->buflen/4+3)); + dcc_buffer = malloc(sizeof(uint32_t)*(ocl->buflen/4 + 3)); while (count) { diff --git a/src/flash/ocl/at91sam7x/main.c b/src/flash/ocl/at91sam7x/main.c index c65a171d..2d6ba0a5 100644 --- a/src/flash/ocl/at91sam7x/main.c +++ b/src/flash/ocl/at91sam7x/main.c @@ -43,7 +43,7 @@ void cmd_flash(uint32 cmd) len = cmd&0xffff; ofs = adr%flash_page_size; bi_start = ofs/4; - bi_end = (ofs+len+3)/4; + bi_end = (ofs + len + 3)/4; if (bi_end>BUFSIZE) { dcc_wr(OCL_BUFF_OVER); @@ -65,12 +65,12 @@ void cmd_flash(uint32 cmd) result = 0; pagenum = adr/flash_page_size; for (bi = 0; bi> 16; + lockbits = inr(MC_FSR + efc_ofs) >> 16; while (lockbits) { if (lockbits&1) { /* wait until FLASH is ready, just for sure */ - while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0); + while ((inr(MC_FSR + efc_ofs)&MC_FRDY) == 0); - outr(MC_FCR+efc_ofs, ((page_num&0x3ff) << 8) | 0x5a000004); + outr(MC_FCR + efc_ofs, ((page_num&0x3ff) << 8) | 0x5a000004); /* wait until it's done */ - while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0); + while ((inr(MC_FSR + efc_ofs)&MC_FRDY) == 0); /* check for errors */ - if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE; - if ((inr(MC_FSR+efc_ofs)&MC_LOCKE)) return FLASH_STAT_LOCKE; + if ((inr(MC_FSR + efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE; + if ((inr(MC_FSR + efc_ofs)&MC_LOCKE)) return FLASH_STAT_LOCKE; } if ((page_num += flash_lock_pages)>flash_page_count) break; @@ -151,20 +151,20 @@ int flash_erase_plane(int efc_ofs) } /* wait until FLASH is ready, just for sure */ - while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0); + while ((inr(MC_FSR + efc_ofs)&MC_FRDY) == 0); /* erase all command to FCR */ - outr(MC_FCR+efc_ofs, 0x5a000008); + outr(MC_FCR + efc_ofs, 0x5a000008); /* wait until it's done */ - while ((inr(MC_FSR+efc_ofs)&MC_FRDY) == 0); + while ((inr(MC_FSR + efc_ofs)&MC_FRDY) == 0); /* check for errors */ - if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE; - if ((inr(MC_FSR+efc_ofs)&MC_LOCKE)) return FLASH_STAT_LOCKE; + if ((inr(MC_FSR + efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE; + if ((inr(MC_FSR + efc_ofs)&MC_LOCKE)) return FLASH_STAT_LOCKE; /* set no erase before programming */ - outr(MC_FMR+efc_ofs, inr(MC_FMR+efc_ofs)|0x80); + outr(MC_FMR + efc_ofs, inr(MC_FMR + efc_ofs)|0x80); return FLASH_STAT_OK; } @@ -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; } diff --git a/src/flash/pic32mx.c b/src/flash/pic32mx.c index 5112482c..3ed2bf5d 100644 --- a/src/flash/pic32mx.c +++ b/src/flash/pic32mx.c @@ -923,7 +923,7 @@ static int pic32mx_handle_pgm_word_command(struct command_context_s *cmd_ctx, ch command_print(cmd_ctx, "flash bank '#%s' is out of bounds", args[2]); return ERROR_OK; } - if (address < bank->base || address >= (bank->base+bank->size)) + if (address < bank->base || address >= (bank->base + bank->size)) { command_print(cmd_ctx, "flash address '%s' is out of bounds", args[0]); return ERROR_OK; diff --git a/src/flash/pic32mx.h b/src/flash/pic32mx.h index 49a9bb40..b1c4ef2f 100644 --- a/src/flash/pic32mx.h +++ b/src/flash/pic32mx.h @@ -62,9 +62,9 @@ typedef struct pic32mx_flash_bank_s * Note: These macros only work for KSEG0/KSEG1 addresses. */ #define KS1Virt2Phys(vaddr) ((vaddr)-0xA0000000) -#define Phys2KS1Virt(paddr) ((paddr)+0xA0000000) +#define Phys2KS1Virt(paddr) ((paddr) + 0xA0000000) #define KS0Virt2Phys(vaddr) ((vaddr)-0x80000000) -#define Phys2KS0Virt(paddr) ((paddr)+0x80000000) +#define Phys2KS0Virt(paddr) ((paddr) + 0x80000000) /* pic32mx configuration register locations */ diff --git a/src/flash/stellaris.c b/src/flash/stellaris.c index 09d7f0dd..9cf862a4 100644 --- a/src/flash/stellaris.c +++ b/src/flash/stellaris.c @@ -309,8 +309,8 @@ static int stellaris_info(struct flash_bank_s *bank, char *buf, int buf_size) stellaris_info->did1, stellaris_info->did1, "ARMV7M", - (int)((1+((stellaris_info->dc0 >> 16) & 0xFFFF))/4), - (int)((1+(stellaris_info->dc0 & 0xFFFF))*2)); + (int)((1 + ((stellaris_info->dc0 >> 16) & 0xFFFF))/4), + (int)((1 + (stellaris_info->dc0 & 0xFFFF))*2)); buf += printed; buf_size -= printed; @@ -396,7 +396,7 @@ static void stellaris_read_clock_info(flash_bank_t *bank) mainfreq = 200000000; /* PLL out frec */ if (usesysdiv) - stellaris_info->mck_freq = mainfreq/(1+sysdiv); + stellaris_info->mck_freq = mainfreq/(1 + sysdiv); else stellaris_info->mck_freq = mainfreq; @@ -499,7 +499,7 @@ static int stellaris_read_part_info(struct flash_bank_s *bank) stellaris_info->did1 = did1; stellaris_info->num_lockbits = 1 + (stellaris_info->dc0 & 0xFFFF); - stellaris_info->num_pages = 2 *(1+(stellaris_info->dc0 & 0xFFFF)); + stellaris_info->num_pages = 2 *(1 + (stellaris_info->dc0 & 0xFFFF)); stellaris_info->pagesize = 1024; bank->size = 1024 * stellaris_info->num_pages; stellaris_info->pages_in_lockregion = 2; diff --git a/src/flash/str7x.c b/src/flash/str7x.c index 4068ad33..b6fef22c 100644 --- a/src/flash/str7x.c +++ b/src/flash/str7x.c @@ -703,7 +703,7 @@ static int str7x_handle_disable_jtag_command(struct command_context_s *cmd_ctx, flash_cmd = FLASH_SPR; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), flash_cmd); target_write_u32(target, str7x_get_flash_adr(bank, FLASH_AR), 0x4010DFBC); - target_write_u32(target, str7x_get_flash_adr(bank, FLASH_DR0), ~(1 << (15+ProtectionLevel))); + target_write_u32(target, str7x_get_flash_adr(bank, FLASH_DR0), ~(1 << (15 + ProtectionLevel))); flash_cmd = FLASH_SPR | FLASH_WMS; target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), flash_cmd); } diff --git a/src/flash/str9x.c b/src/flash/str9x.c index 880dac4d..cfd37b9d 100644 --- a/src/flash/str9x.c +++ b/src/flash/str9x.c @@ -145,7 +145,7 @@ static int str9x_build_block_list(struct flash_bank_s *bank) if (str9x_info->variant) str9x_info->sector_bits[num_sectors++] = (1 << i); else - str9x_info->sector_bits[num_sectors++] = (1 << (i+8)); + str9x_info->sector_bits[num_sectors++] = (1 << (i + 8)); } return ERROR_OK; diff --git a/src/flash/tms470.c b/src/flash/tms470.c index 5ed36588..26fcadda 100644 --- a/src/flash/tms470.c +++ b/src/flash/tms470.c @@ -593,7 +593,7 @@ static int tms470_flash_initialize_internal_state_machine(struct flash_bank_s *b 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); -- cgit v1.2.3