summaryrefslogtreecommitdiff
path: root/src/flash
diff options
context:
space:
mode:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-23 22:46:23 +0000
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-23 22:46:23 +0000
commitf90d8fa45f2d4c9d4b7990f198b232ee55cbb4e1 (patch)
tree66070c6e1e7a5a72c1d1af437e0e2c49a410fa7b /src/flash
parent6d1d58a1fc3dfd60e9cac89460b5a6e438d11efa (diff)
downloadopenocd+libswd-f90d8fa45f2d4c9d4b7990f198b232ee55cbb4e1.tar.gz
openocd+libswd-f90d8fa45f2d4c9d4b7990f198b232ee55cbb4e1.tar.bz2
openocd+libswd-f90d8fa45f2d4c9d4b7990f198b232ee55cbb4e1.tar.xz
openocd+libswd-f90d8fa45f2d4c9d4b7990f198b232ee55cbb4e1.zip
Remove whitespace that occurs after '('.
- Replace '([ \t]*' with '('. git-svn-id: svn://svn.berlios.de/openocd/trunk@2376 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/flash')
-rw-r--r--src/flash/at91sam7.c8
-rw-r--r--src/flash/avrf.c4
-rw-r--r--src/flash/cfi.c2
-rw-r--r--src/flash/flash.c6
-rw-r--r--src/flash/non_cfi.c76
-rw-r--r--src/flash/ocl/at91sam7x/samflash.c2
-rw-r--r--src/flash/pic32mx.c44
-rw-r--r--src/flash/stm32x.c64
-rw-r--r--src/flash/str9x.c10
-rw-r--r--src/flash/str9xpec.c18
10 files changed, 117 insertions, 117 deletions
diff --git a/src/flash/at91sam7.c b/src/flash/at91sam7.c
index bb2a28f5..6ac795b0 100644
--- a/src/flash/at91sam7.c
+++ b/src/flash/at91sam7.c
@@ -187,7 +187,7 @@ static void at91sam7_read_clock_info(flash_bank_t *bank)
}
/* Prescaler adjust */
- if ( (((mckr & PMC_MCKR_PRES) >> 2) == 7) || (tmp == 0) )
+ if ((((mckr & PMC_MCKR_PRES) >> 2) == 7) || (tmp == 0) )
{
at91sam7_info->mck_valid = 0;
at91sam7_info->mck_freq = 0;
@@ -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_pos < bank->num_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_pos < at91sam7_info->num_nvmbits; gpnvm_pos++)
{
- if ( ((status >> (8 + gpnvm_pos))&(0x01)) == 1)
+ if (((status >> (8 + gpnvm_pos))&(0x01)) == 1)
{
at91sam7_info->num_nvmbits_on++;
}
@@ -907,7 +907,7 @@ static int at91sam7_erase(struct flash_bank_s *bank, int first, int last)
buffer[pos] = 0xFF;
}
- if ( at91sam7_write(bank, buffer, bank->sectors[first].offset, nbytes) != ERROR_OK)
+ if (at91sam7_write(bank, buffer, bank->sectors[first].offset, nbytes) != ERROR_OK)
{
return ERROR_FLASH_OPERATION_FAILED;
}
diff --git a/src/flash/avrf.c b/src/flash/avrf.c
index dd964e6b..2f7901ba 100644
--- a/src/flash/avrf.c
+++ b/src/flash/avrf.c
@@ -323,7 +323,7 @@ static int avrf_probe(struct flash_bank_s *bank)
return ERROR_FAIL;
}
- LOG_INFO( "device id = 0x%08" PRIx32 "", device_id );
+ LOG_INFO("device id = 0x%08" PRIx32 "", device_id );
if (EXTRACT_MFG(device_id) != 0x1F)
{
LOG_ERROR("0x%" PRIx32 " is invalid Manufacturer for avr, 0x%X is expected", EXTRACT_MFG(device_id), 0x1F);
@@ -402,7 +402,7 @@ static int avrf_info(struct flash_bank_s *bank, char *buf, int buf_size)
return ERROR_FAIL;
}
- LOG_INFO( "device id = 0x%08" PRIx32 "", device_id );
+ LOG_INFO("device id = 0x%08" PRIx32 "", device_id );
if (EXTRACT_MFG(device_id) != 0x1F)
{
LOG_ERROR("0x%" PRIx32 " is invalid Manufacturer for avr, 0x%X is expected", EXTRACT_MFG(device_id), 0x1F);
diff --git a/src/flash/cfi.c b/src/flash/cfi.c
index 7972bdbd..21489952 100644
--- a/src/flash/cfi.c
+++ b/src/flash/cfi.c
@@ -1154,7 +1154,7 @@ static int cfi_intel_write_block(struct flash_bank_s *bank, uint8_t *buffer, uin
/* flash write code */
if (!cfi_info->write_algorithm)
{
- if ( target_code_size > sizeof(target_code) )
+ if (target_code_size > sizeof(target_code) )
{
LOG_WARNING("Internal error - target code buffer to small. Increase CFI_MAX_INTEL_CODESIZE and recompile.");
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
diff --git a/src/flash/flash.c b/src/flash/flash.c
index 5ca26622..3bf760e3 100644
--- a/src/flash/flash.c
+++ b/src/flash/flash.c
@@ -793,7 +793,7 @@ static int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cm
for (wrote = 0; wrote < (count*wordsize); wrote += cur_size)
{
- cur_size = MIN( (count*wordsize - wrote), sizeof(chunk) );
+ cur_size = MIN((count*wordsize - wrote), sizeof(chunk) );
flash_bank_t *bank;
bank = get_flash_bank_by_addr(target, address);
if (bank == NULL)
@@ -994,7 +994,7 @@ int flash_erase_address_range(target_t *target, uint32_t addr, uint32_t length)
}
}
- if ( first == -1 || last == -1 )
+ if (first == -1 || last == -1 )
return ERROR_OK;
return flash_driver_erase(c, first, last);
@@ -1127,7 +1127,7 @@ int flash_write(target_t *target, image_t *image, uint32_t *written, int erase)
if (erase)
{
/* calculate and erase sectors */
- retval = flash_erase_address_range( target, run_address, run_size );
+ retval = flash_erase_address_range(target, run_address, run_size );
}
if (retval == ERROR_OK)
diff --git a/src/flash/non_cfi.c b/src/flash/non_cfi.c
index f3fd20f9..86248ec8 100644
--- a/src/flash/non_cfi.c
+++ b/src/flash/non_cfi.c
@@ -114,10 +114,10 @@ non_cfi_t non_cfi_flashes[] = {
.num_erase_regions = 4,
.erase_region_info =
{
- ERASE_REGION( 1, 16*KB),
- ERASE_REGION( 2, 8*KB),
- ERASE_REGION( 1, 32*KB),
- ERASE_REGION( 7, 64*KB)
+ ERASE_REGION(1, 16*KB),
+ ERASE_REGION(2, 8*KB),
+ ERASE_REGION(1, 32*KB),
+ ERASE_REGION(7, 64*KB)
}
},
{
@@ -131,10 +131,10 @@ non_cfi_t non_cfi_flashes[] = {
.num_erase_regions = 4,
.erase_region_info =
{
- ERASE_REGION( 7, 64*KB),
- ERASE_REGION( 1, 32*KB),
- ERASE_REGION( 2, 8*KB),
- ERASE_REGION( 1, 16*KB)
+ ERASE_REGION(7, 64*KB),
+ ERASE_REGION(1, 32*KB),
+ ERASE_REGION(2, 8*KB),
+ ERASE_REGION(1, 16*KB)
}
},
@@ -236,10 +236,10 @@ non_cfi_t non_cfi_flashes[] = {
.num_erase_regions = 4,
.erase_region_info =
{
- ERASE_REGION( 1, 16*KB),
- ERASE_REGION( 2, 8*KB),
- ERASE_REGION( 1, 32*KB),
- ERASE_REGION( 7, 64*KB)
+ ERASE_REGION(1, 16*KB),
+ ERASE_REGION(2, 8*KB),
+ ERASE_REGION(1, 32*KB),
+ ERASE_REGION(7, 64*KB)
}
},
{
@@ -253,10 +253,10 @@ non_cfi_t non_cfi_flashes[] = {
.num_erase_regions = 4,
.erase_region_info =
{
- ERASE_REGION( 7, 64*KB),
- ERASE_REGION( 1, 32*KB),
- ERASE_REGION( 2, 8*KB),
- ERASE_REGION( 1, 16*KB)
+ ERASE_REGION(7, 64*KB),
+ ERASE_REGION(1, 32*KB),
+ ERASE_REGION(2, 8*KB),
+ ERASE_REGION(1, 16*KB)
}
},
{
@@ -270,9 +270,9 @@ non_cfi_t non_cfi_flashes[] = {
.num_erase_regions = 4,
.erase_region_info =
{
- ERASE_REGION( 1, 16*KB),
- ERASE_REGION( 2, 8*KB),
- ERASE_REGION( 1, 32*KB),
+ ERASE_REGION(1, 16*KB),
+ ERASE_REGION(2, 8*KB),
+ ERASE_REGION(1, 32*KB),
ERASE_REGION(15, 64*KB)
}
},
@@ -287,9 +287,9 @@ non_cfi_t non_cfi_flashes[] = {
.num_erase_regions = 4,
.erase_region_info =
{
- ERASE_REGION( 1, 16*KB),
- ERASE_REGION( 2, 8*KB),
- ERASE_REGION( 1, 32*KB),
+ ERASE_REGION(1, 16*KB),
+ ERASE_REGION(2, 8*KB),
+ ERASE_REGION(1, 32*KB),
ERASE_REGION(15, 64*KB)
}
},
@@ -304,9 +304,9 @@ non_cfi_t non_cfi_flashes[] = {
.num_erase_regions = 4,
.erase_region_info =
{
- ERASE_REGION( 1, 16*KB),
- ERASE_REGION( 2, 8*KB),
- ERASE_REGION( 1, 32*KB),
+ ERASE_REGION(1, 16*KB),
+ ERASE_REGION(2, 8*KB),
+ ERASE_REGION(1, 32*KB),
ERASE_REGION(15, 64*KB)
}
},
@@ -322,9 +322,9 @@ non_cfi_t non_cfi_flashes[] = {
.num_erase_regions = 4,
.erase_region_info =
{
- ERASE_REGION( 1, 16*KB),
- ERASE_REGION( 2, 8*KB),
- ERASE_REGION( 1, 32*KB),
+ ERASE_REGION(1, 16*KB),
+ ERASE_REGION(2, 8*KB),
+ ERASE_REGION(1, 32*KB),
ERASE_REGION(31, 64*KB)
}
},
@@ -340,9 +340,9 @@ non_cfi_t non_cfi_flashes[] = {
.erase_region_info =
{
ERASE_REGION(31, 64*KB),
- ERASE_REGION( 1, 32*KB),
- ERASE_REGION( 2, 8*KB),
- ERASE_REGION( 1, 16*KB)
+ ERASE_REGION(1, 32*KB),
+ ERASE_REGION(2, 8*KB),
+ ERASE_REGION(1, 16*KB)
}
},
{
@@ -356,8 +356,8 @@ non_cfi_t non_cfi_flashes[] = {
.num_erase_regions = 3,
.erase_region_info =
{
- ERASE_REGION( 8, 8*KB),
- ERASE_REGION( 2, 32*KB),
+ ERASE_REGION(8, 8*KB),
+ ERASE_REGION(2, 32*KB),
ERASE_REGION(30, 64*KB)
}
},
@@ -373,8 +373,8 @@ non_cfi_t non_cfi_flashes[] = {
.erase_region_info =
{
ERASE_REGION(30, 64*KB),
- ERASE_REGION( 2, 32*KB),
- ERASE_REGION( 8, 8*KB)
+ ERASE_REGION(2, 32*KB),
+ ERASE_REGION(8, 8*KB)
}
},
{
@@ -388,9 +388,9 @@ non_cfi_t non_cfi_flashes[] = {
.num_erase_regions = 4,
.erase_region_info =
{
- ERASE_REGION( 1, 16*KB),
- ERASE_REGION( 2, 8*KB),
- ERASE_REGION( 1, 32*KB),
+ ERASE_REGION(1, 16*KB),
+ ERASE_REGION(2, 8*KB),
+ ERASE_REGION(1, 32*KB),
ERASE_REGION(15, 64*KB)
}
},
diff --git a/src/flash/ocl/at91sam7x/samflash.c b/src/flash/ocl/at91sam7x/samflash.c
index bcb6dd09..1dcc9f9d 100644
--- a/src/flash/ocl/at91sam7x/samflash.c
+++ b/src/flash/ocl/at91sam7x/samflash.c
@@ -189,7 +189,7 @@ int flash_verify(uint32 adr, unsigned int len, uint8 *src)
unsigned char *flash_ptr;
flash_ptr = (uint8 *)FLASH_AREA_ADDR + adr;
- for ( ;len; len--) {
+ for (;len; len--) {
if (*(flash_ptr++)!=*(src++)) return FLASH_STAT_VERIFE;
}
return FLASH_STAT_OK;
diff --git a/src/flash/pic32mx.c b/src/flash/pic32mx.c
index dab58a4b..29077c6d 100644
--- a/src/flash/pic32mx.c
+++ b/src/flash/pic32mx.c
@@ -229,9 +229,9 @@ static int pic32mx_erase(struct flash_bank_s *bank, int first, int last)
{
LOG_DEBUG("Erasing entire program flash");
status = pic32mx_nvm_exec(bank, NVMCON_OP_PFM_ERASE, 50);
- if ( status & NVMCON_NVMERR )
+ if (status & NVMCON_NVMERR )
return ERROR_FLASH_OPERATION_FAILED;
- if ( status & NVMCON_LVDERR )
+ if (status & NVMCON_LVDERR )
return ERROR_FLASH_OPERATION_FAILED;
return ERROR_OK;
}
@@ -245,9 +245,9 @@ static int pic32mx_erase(struct flash_bank_s *bank, int first, int last)
status = pic32mx_nvm_exec(bank, NVMCON_OP_PAGE_ERASE, 10);
- if ( status & NVMCON_NVMERR )
+ if (status & NVMCON_NVMERR )
return ERROR_FLASH_OPERATION_FAILED;
- if ( status & NVMCON_LVDERR )
+ if (status & NVMCON_LVDERR )
return ERROR_FLASH_OPERATION_FAILED;
bank->sectors[i].is_erased = 1;
}
@@ -313,7 +313,7 @@ static int pic32mx_protect(struct flash_bank_s *bank, int set, int first, int la
reg = (i / pic32mx_info->ppage_size) / 8;
bit = (i / pic32mx_info->ppage_size) - (reg * 8);
- if ( set )
+ if (set )
prot_reg[reg] &= ~(1 << bit);
else
prot_reg[reg] |= (1 << bit);
@@ -327,7 +327,7 @@ static int pic32mx_protect(struct flash_bank_s *bank, int set, int first, int la
reg = (i / pic32mx_info->ppage_size) / 8;
bit = (i / pic32mx_info->ppage_size) - (reg * 8);
- if ( set )
+ if (set )
prot_reg[reg] &= ~(1 << bit);
else
prot_reg[reg] |= (1 << bit);
@@ -434,12 +434,12 @@ static int pic32mx_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint3
}
#endif
status = pic32mx_write_row(bank, address, source->address);
- if ( status & NVMCON_NVMERR ) {
+ if (status & NVMCON_NVMERR ) {
LOG_ERROR("Flash write error NVMERR (status = 0x%08" PRIx32 ")", status);
retval = ERROR_FLASH_OPERATION_FAILED;
break;
}
- if ( status & NVMCON_LVDERR ) {
+ if (status & NVMCON_LVDERR ) {
LOG_ERROR("Flash write error LVDERR (status = 0x%08" PRIx32 ")", status);
retval = ERROR_FLASH_OPERATION_FAILED;
break;
@@ -458,12 +458,12 @@ static int pic32mx_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint3
memcpy(&value, buffer, sizeof(uint32_t));
uint32_t status = pic32mx_write_word(bank, address, value);
- if ( status & NVMCON_NVMERR ) {
+ if (status & NVMCON_NVMERR ) {
LOG_ERROR("Flash write error NVMERR (status = 0x%08" PRIx32 ")", status);
retval = ERROR_FLASH_OPERATION_FAILED;
break;
}
- if ( status & NVMCON_LVDERR ) {
+ if (status & NVMCON_LVDERR ) {
LOG_ERROR("Flash write error LVDERR (status = 0x%08" PRIx32 ")", status);
retval = ERROR_FLASH_OPERATION_FAILED;
break;
@@ -564,9 +564,9 @@ static int pic32mx_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t of
memcpy(&value, buffer + bytes_written, sizeof(uint32_t));
status = pic32mx_write_word(bank, address, value);
- if ( status & NVMCON_NVMERR )
+ if (status & NVMCON_NVMERR )
return ERROR_FLASH_OPERATION_FAILED;
- if ( status & NVMCON_LVDERR )
+ if (status & NVMCON_LVDERR )
return ERROR_FLASH_OPERATION_FAILED;
bytes_written += 4;
@@ -580,9 +580,9 @@ static int pic32mx_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t of
memcpy(&value, buffer + bytes_written, bytes_remaining);
status = pic32mx_write_word(bank, address, value);
- if ( status & NVMCON_NVMERR )
+ if (status & NVMCON_NVMERR )
return ERROR_FLASH_OPERATION_FAILED;
- if ( status & NVMCON_LVDERR )
+ if (status & NVMCON_LVDERR )
return ERROR_FLASH_OPERATION_FAILED;
}
@@ -603,14 +603,14 @@ static int pic32mx_probe(struct flash_bank_s *bank)
pic32mx_info->probed = 0;
device_id = ejtag_info->idcode;
- LOG_INFO( "device id = 0x%08" PRIx32 " (manuf 0x%03x dev 0x%02x, ver 0x%03x)",
+ LOG_INFO("device id = 0x%08" PRIx32 " (manuf 0x%03x dev 0x%02x, ver 0x%03x)",
device_id,
(unsigned)((device_id >> 1)&0x7ff),
(unsigned)((device_id >> 12)&0xff),
(unsigned)((device_id >> 20)&0xfff) );
if (((device_id >> 1)&0x7ff) != PIC32MX_MANUF_ID) {
- LOG_WARNING( "Cannot identify target as a PIC32MX family." );
+ LOG_WARNING("Cannot identify target as a PIC32MX family." );
return ERROR_FLASH_OPERATION_FAILED;
}
@@ -626,7 +626,7 @@ static int pic32mx_probe(struct flash_bank_s *bank)
break;
}
if (pic32mx_devs[i].name == NULL) {
- LOG_WARNING( "Cannot identify target as a PIC32MX family." );
+ LOG_WARNING("Cannot identify target as a PIC32MX family." );
return ERROR_FLASH_OPERATION_FAILED;
}
}
@@ -646,7 +646,7 @@ static int pic32mx_probe(struct flash_bank_s *bank)
}
#endif
- LOG_INFO( "flash size = %dkbytes", num_pages );
+ LOG_INFO("flash size = %dkbytes", num_pages );
/* calculate numbers of pages */
num_pages /= (page_size / 1024);
@@ -847,13 +847,13 @@ static int pic32mx_chip_erase(struct flash_bank_s *bank)
target_write_u32(target, PIC32MX_FLASH_CR, FLASH_LOCK);
- if ( status & FLASH_WRPRTERR )
+ if (status & FLASH_WRPRTERR )
{
LOG_ERROR("pic32mx device protected");
return ERROR_OK;
}
- if ( status & FLASH_PGERR )
+ if (status & FLASH_PGERR )
{
LOG_ERROR("pic32mx device programming failed");
return ERROR_OK;
@@ -931,9 +931,9 @@ static int pic32mx_handle_pgm_word_command(struct command_context_s *cmd_ctx, ch
res = ERROR_OK;
status = pic32mx_write_word(bank, address, value);
- if ( status & NVMCON_NVMERR )
+ if (status & NVMCON_NVMERR )
res = ERROR_FLASH_OPERATION_FAILED;
- if ( status & NVMCON_LVDERR )
+ if (status & NVMCON_LVDERR )
res = ERROR_FLASH_OPERATION_FAILED;
if (res == ERROR_OK)
diff --git a/src/flash/stm32x.c b/src/flash/stm32x.c
index aab8b9a9..2f8ca3be 100644
--- a/src/flash/stm32x.c
+++ b/src/flash/stm32x.c
@@ -182,9 +182,9 @@ static int stm32x_erase_options(struct flash_bank_s *bank)
status = stm32x_wait_status_busy(bank, 10);
- if ( status & FLASH_WRPRTERR )
+ if (status & FLASH_WRPRTERR )
return ERROR_FLASH_OPERATION_FAILED;
- if ( status & FLASH_PGERR )
+ if (status & FLASH_PGERR )
return ERROR_FLASH_OPERATION_FAILED;
/* clear readout protection and complementary option bytes
@@ -218,9 +218,9 @@ static int stm32x_write_options(struct flash_bank_s *bank)
status = stm32x_wait_status_busy(bank, 10);
- if ( status & FLASH_WRPRTERR )
+ if (status & FLASH_WRPRTERR )
return ERROR_FLASH_OPERATION_FAILED;
- if ( status & FLASH_PGERR )
+ if (status & FLASH_PGERR )
return ERROR_FLASH_OPERATION_FAILED;
/* write protection byte 1 */
@@ -228,9 +228,9 @@ static int stm32x_write_options(struct flash_bank_s *bank)
status = stm32x_wait_status_busy(bank, 10);
- if ( status & FLASH_WRPRTERR )
+ if (status & FLASH_WRPRTERR )
return ERROR_FLASH_OPERATION_FAILED;
- if ( status & FLASH_PGERR )
+ if (status & FLASH_PGERR )
return ERROR_FLASH_OPERATION_FAILED;
/* write protection byte 2 */
@@ -238,9 +238,9 @@ static int stm32x_write_options(struct flash_bank_s *bank)
status = stm32x_wait_status_busy(bank, 10);
- if ( status & FLASH_WRPRTERR )
+ if (status & FLASH_WRPRTERR )
return ERROR_FLASH_OPERATION_FAILED;
- if ( status & FLASH_PGERR )
+ if (status & FLASH_PGERR )
return ERROR_FLASH_OPERATION_FAILED;
/* write protection byte 3 */
@@ -248,9 +248,9 @@ static int stm32x_write_options(struct flash_bank_s *bank)
status = stm32x_wait_status_busy(bank, 10);
- if ( status & FLASH_WRPRTERR )
+ if (status & FLASH_WRPRTERR )
return ERROR_FLASH_OPERATION_FAILED;
- if ( status & FLASH_PGERR )
+ if (status & FLASH_PGERR )
return ERROR_FLASH_OPERATION_FAILED;
/* write protection byte 4 */
@@ -258,9 +258,9 @@ static int stm32x_write_options(struct flash_bank_s *bank)
status = stm32x_wait_status_busy(bank, 10);
- if ( status & FLASH_WRPRTERR )
+ if (status & FLASH_WRPRTERR )
return ERROR_FLASH_OPERATION_FAILED;
- if ( status & FLASH_PGERR )
+ if (status & FLASH_PGERR )
return ERROR_FLASH_OPERATION_FAILED;
/* write readout protection bit */
@@ -268,9 +268,9 @@ static int stm32x_write_options(struct flash_bank_s *bank)
status = stm32x_wait_status_busy(bank, 10);
- if ( status & FLASH_WRPRTERR )
+ if (status & FLASH_WRPRTERR )
return ERROR_FLASH_OPERATION_FAILED;
- if ( status & FLASH_PGERR )
+ if (status & FLASH_PGERR )
return ERROR_FLASH_OPERATION_FAILED;
target_write_u32(target, STM32_FLASH_CR, FLASH_LOCK);
@@ -338,7 +338,7 @@ static int stm32x_protect_check(struct flash_bank_s *bank)
{
set = 1;
- if ( protection & (1 << i))
+ if (protection & (1 << i))
set = 0;
for (s = 0; s < stm32x_info->ppage_size; s++)
@@ -378,9 +378,9 @@ static int stm32x_erase(struct flash_bank_s *bank, int first, int last)
status = stm32x_wait_status_busy(bank, 10);
- if ( status & FLASH_WRPRTERR )
+ if (status & FLASH_WRPRTERR )
return ERROR_FLASH_OPERATION_FAILED;
- if ( status & FLASH_PGERR )
+ if (status & FLASH_PGERR )
return ERROR_FLASH_OPERATION_FAILED;
bank->sectors[i].is_erased = 1;
}
@@ -445,7 +445,7 @@ static int stm32x_protect(struct flash_bank_s *bank, int set, int first, int las
reg = (i / stm32x_info->ppage_size) / 8;
bit = (i / stm32x_info->ppage_size) - (reg * 8);
- if ( set )
+ if (set )
prot_reg[reg] &= ~(1 << bit);
else
prot_reg[reg] |= (1 << bit);
@@ -459,7 +459,7 @@ static int stm32x_protect(struct flash_bank_s *bank, int set, int first, int las
reg = (i / stm32x_info->ppage_size) / 8;
bit = (i / stm32x_info->ppage_size) - (reg * 8);
- if ( set )
+ if (set )
prot_reg[reg] &= ~(1 << bit);
else
prot_reg[reg] |= (1 << bit);
@@ -658,12 +658,12 @@ static int stm32x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t off
status = stm32x_wait_status_busy(bank, 5);
- if ( status & FLASH_WRPRTERR )
+ if (status & FLASH_WRPRTERR )
{
LOG_ERROR("flash memory not erased before writing");
return ERROR_FLASH_OPERATION_FAILED;
}
- if ( status & FLASH_PGERR )
+ if (status & FLASH_PGERR )
{
LOG_ERROR("flash memory write protected");
return ERROR_FLASH_OPERATION_FAILED;
@@ -684,12 +684,12 @@ static int stm32x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t off
status = stm32x_wait_status_busy(bank, 5);
- if ( status & FLASH_WRPRTERR )
+ if (status & FLASH_WRPRTERR )
{
LOG_ERROR("flash memory not erased before writing");
return ERROR_FLASH_OPERATION_FAILED;
}
- if ( status & FLASH_PGERR )
+ if (status & FLASH_PGERR )
{
LOG_ERROR("flash memory write protected");
return ERROR_FLASH_OPERATION_FAILED;
@@ -720,7 +720,7 @@ static int stm32x_probe(struct flash_bank_s *bank)
/* read stm32 device id register */
target_read_u32(target, 0xE0042000, &device_id);
- LOG_INFO( "device id = 0x%08" PRIx32 "", device_id );
+ LOG_INFO("device id = 0x%08" PRIx32 "", device_id );
/* get flash size from target */
if (target_read_u16(target, 0x1FFFF7E0, &num_pages) != ERROR_OK)
@@ -740,7 +740,7 @@ static int stm32x_probe(struct flash_bank_s *bank)
if (num_pages == 0xffff)
{
/* number of sectors incorrect on revA */
- LOG_WARNING( "STM32 flash size failed, probe inaccurate - assuming 128k flash" );
+ LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 128k flash" );
num_pages = 128;
}
}
@@ -755,7 +755,7 @@ static int stm32x_probe(struct flash_bank_s *bank)
if (num_pages == 0xffff)
{
/* number of sectors incorrect on revA */
- LOG_WARNING( "STM32 flash size failed, probe inaccurate - assuming 32k flash" );
+ LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 32k flash" );
num_pages = 32;
}
}
@@ -770,7 +770,7 @@ static int stm32x_probe(struct flash_bank_s *bank)
if (num_pages == 0xffff)
{
/* number of sectors incorrect on revZ */
- LOG_WARNING( "STM32 flash size failed, probe inaccurate - assuming 512k flash" );
+ LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 512k flash" );
num_pages = 512;
}
}
@@ -785,17 +785,17 @@ static int stm32x_probe(struct flash_bank_s *bank)
if (num_pages == 0xffff)
{
/* number of sectors incorrect on revZ */
- LOG_WARNING( "STM32 flash size failed, probe inaccurate - assuming 256k flash" );
+ LOG_WARNING("STM32 flash size failed, probe inaccurate - assuming 256k flash" );
num_pages = 256;
}
}
else
{
- LOG_WARNING( "Cannot identify target as a STM32 family." );
+ LOG_WARNING("Cannot identify target as a STM32 family." );
return ERROR_FLASH_OPERATION_FAILED;
}
- LOG_INFO( "flash size = %dkbytes", num_pages );
+ LOG_INFO("flash size = %dkbytes", num_pages );
/* calculate numbers of pages */
num_pages /= (page_size / 1024);
@@ -1188,13 +1188,13 @@ static int stm32x_mass_erase(struct flash_bank_s *bank)
target_write_u32(target, STM32_FLASH_CR, FLASH_LOCK);
- if ( status & FLASH_WRPRTERR )
+ if (status & FLASH_WRPRTERR )
{
LOG_ERROR("stm32x device protected");
return ERROR_OK;
}
- if ( status & FLASH_PGERR )
+ if (status & FLASH_PGERR )
{
LOG_ERROR("stm32x device programming failed");
return ERROR_OK;
diff --git a/src/flash/str9x.c b/src/flash/str9x.c
index 1911b59a..6808a068 100644
--- a/src/flash/str9x.c
+++ b/src/flash/str9x.c
@@ -305,7 +305,7 @@ static int str9x_erase(struct flash_bank_s *bank, int first, int last)
{
return retval;
}
- if ( status & 0x80 )
+ if (status & 0x80 )
break;
alive_sleep(1);
}
@@ -327,7 +327,7 @@ static int str9x_erase(struct flash_bank_s *bank, int first, int last)
return retval;
}
- if ( status & 0x22 )
+ if (status & 0x22 )
{
LOG_ERROR("error erasing flash bank, status: 0x%x", status);
return ERROR_FLASH_OPERATION_FAILED;
@@ -365,7 +365,7 @@ static int str9x_protect(struct flash_bank_s *bank,
adr = bank->base + bank->sectors[i].offset;
target_write_u16(target, adr, 0x60);
- if ( set )
+ if (set )
target_write_u16(target, adr, 0x01);
else
target_write_u16(target, adr, 0xD0);
@@ -578,7 +578,7 @@ static int str9x_write(struct flash_bank_s *bank,
for (timeout = 0; timeout < 1000; timeout++)
{
target_read_u8(target, bank_adr, &status);
- if ( status & 0x80 )
+ if (status & 0x80 )
break;
alive_sleep(1);
}
@@ -627,7 +627,7 @@ static int str9x_write(struct flash_bank_s *bank,
for (timeout = 0; timeout < 1000; timeout++)
{
target_read_u8(target, bank_adr, &status);
- if ( status & 0x80 )
+ if (status & 0x80 )
break;
alive_sleep(1);
}
diff --git a/src/flash/str9xpec.c b/src/flash/str9xpec.c
index 14dfebca..e679d42d 100644
--- a/src/flash/str9xpec.c
+++ b/src/flash/str9xpec.c
@@ -101,7 +101,7 @@ static int str9xpec_register_commands(struct command_context_s *cmd_ctx)
int str9xpec_set_instr(jtag_tap_t *tap, uint32_t new_instr, tap_state_t end_state)
{
- if ( tap == NULL ){
+ if (tap == NULL ){
return ERROR_TARGET_INVALID;
}
@@ -325,7 +325,7 @@ static int str9xpec_flash_bank_command(struct command_context_s *cmd_ctx, char *
arm7_9 = armv4_5->arch_info;
jtag_info = &arm7_9->jtag_info;
- str9xpec_info->tap = jtag_tap_by_position( jtag_info->tap->abs_chain_position - 1);
+ str9xpec_info->tap = jtag_tap_by_position(jtag_info->tap->abs_chain_position - 1);
str9xpec_info->isc_enable = 0;
str9xpec_build_block_list(bank);
@@ -349,7 +349,7 @@ static int str9xpec_blank_check(struct flash_bank_s *bank, int first, int last)
tap = str9xpec_info->tap;
if (!str9xpec_info->isc_enable) {
- str9xpec_isc_enable( bank );
+ str9xpec_isc_enable(bank );
}
if (!str9xpec_info->isc_enable) {
@@ -438,7 +438,7 @@ static int str9xpec_erase_area(struct flash_bank_s *bank, int first, int last)
tap = str9xpec_info->tap;
if (!str9xpec_info->isc_enable) {
- str9xpec_isc_enable( bank );
+ str9xpec_isc_enable(bank );
}
if (!str9xpec_info->isc_enable) {
@@ -518,7 +518,7 @@ static int str9xpec_lock_device(struct flash_bank_s *bank)
tap = str9xpec_info->tap;
if (!str9xpec_info->isc_enable) {
- str9xpec_isc_enable( bank );
+ str9xpec_isc_enable(bank );
}
if (!str9xpec_info->isc_enable) {
@@ -575,7 +575,7 @@ static int str9xpec_protect(struct flash_bank_s *bank, int set, int first, int l
/* last bank: 0xFF signals a full device protect */
if (last == 0xFF)
{
- if ( set )
+ if (set )
{
status = str9xpec_lock_device(bank);
}
@@ -589,7 +589,7 @@ static int str9xpec_protect(struct flash_bank_s *bank, int set, int first, int l
{
for (i = first; i <= last; i++)
{
- if ( set )
+ if (set )
buf_set_u32(str9xpec_info->options, str9xpec_info->sector_bits[i], 1, 1);
else
buf_set_u32(str9xpec_info->options, str9xpec_info->sector_bits[i], 1, 0);
@@ -919,13 +919,13 @@ static int str9xpec_write_options(struct flash_bank_s *bank)
tap = str9xpec_info->tap;
/* erase config options first */
- status = str9xpec_erase_area( bank, 0xFE, 0xFE );
+ status = str9xpec_erase_area(bank, 0xFE, 0xFE );
if ((status & ISC_STATUS_ERROR) != STR9XPEC_ISC_SUCCESS)
return status;
if (!str9xpec_info->isc_enable) {
- str9xpec_isc_enable( bank );
+ str9xpec_isc_enable(bank );
}
if (!str9xpec_info->isc_enable) {