summaryrefslogtreecommitdiff
path: root/src/flash/ocl
diff options
context:
space:
mode:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-23 22:44:17 +0000
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-23 22:44:17 +0000
commit8959de9f679cfd0436d731fd91b88a68b9a75fa6 (patch)
tree8d9bc182b4adc0e718ffafdbd12469d8c8bb14d9 /src/flash/ocl
parent84df52f9ea78e2d71bde648a16b69d80404c6421 (diff)
downloadopenocd_libswd-8959de9f679cfd0436d731fd91b88a68b9a75fa6.tar.gz
openocd_libswd-8959de9f679cfd0436d731fd91b88a68b9a75fa6.tar.bz2
openocd_libswd-8959de9f679cfd0436d731fd91b88a68b9a75fa6.tar.xz
openocd_libswd-8959de9f679cfd0436d731fd91b88a68b9a75fa6.zip
- 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
Diffstat (limited to 'src/flash/ocl')
-rw-r--r--src/flash/ocl/at91sam7x/main.c6
-rw-r--r--src/flash/ocl/at91sam7x/samflash.c40
2 files changed, 23 insertions, 23 deletions
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<bi_end; bi += flash_page_size/4) {
- result = flash_page_program(buffer+bi, pagenum++);
+ 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);
}
diff --git a/src/flash/ocl/at91sam7x/samflash.c b/src/flash/ocl/at91sam7x/samflash.c
index 678d5393..caa3dad4 100644
--- a/src/flash/ocl/at91sam7x/samflash.c
+++ b/src/flash/ocl/at91sam7x/samflash.c
@@ -86,11 +86,11 @@ int flash_page_program(uint32 *data, int page_num)
else efc_ofs = 0;
/* 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);
/* 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));
+ flash_ptr = (uint32 *)(FLASH_AREA_ADDR + (page_num*flash_page_size));
data_ptr = data;
/* copy data to latch */
@@ -100,18 +100,18 @@ int flash_page_program(uint32 *data, int page_num)
}
/* page number and page write command to FCR */
- outr(MC_FCR+efc_ofs, ((page_num&0x3ff) << 8) | MC_KEY | MC_FCMD_WP);
+ outr(MC_FCR + efc_ofs, ((page_num&0x3ff) << 8) | MC_KEY | MC_FCMD_WP);
/* 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 0
/* verify written data */
- flash_ptr = (uint32 *)(FLASH_AREA_ADDR+(page_num*flash_page_size));
+ flash_ptr = (uint32 *)(FLASH_AREA_ADDR + (page_num*flash_page_size));
data_ptr = data;
for (i = flash_page_size/4; i; i--) {
@@ -129,21 +129,21 @@ int flash_erase_plane(int efc_ofs)
int page_num;
page_num = 0;
- lockbits = inr(MC_FSR+efc_ofs) >> 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;
}