diff options
author | zwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-06-23 22:42:54 +0000 |
---|---|---|
committer | zwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-06-23 22:42:54 +0000 |
commit | 84df52f9ea78e2d71bde648a16b69d80404c6421 (patch) | |
tree | 93c683e2ec71d33978585da29c4bcaa73fd37222 /src/flash/ocl | |
parent | 3813fda44adcea486b7308423a699f63d79273ee (diff) | |
download | openocd_libswd-84df52f9ea78e2d71bde648a16b69d80404c6421.tar.gz openocd_libswd-84df52f9ea78e2d71bde648a16b69d80404c6421.tar.bz2 openocd_libswd-84df52f9ea78e2d71bde648a16b69d80404c6421.tar.xz openocd_libswd-84df52f9ea78e2d71bde648a16b69d80404c6421.zip |
- Fixes '=' whitespace
- 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
Diffstat (limited to 'src/flash/ocl')
-rw-r--r-- | src/flash/ocl/at91sam7x/main.c | 30 | ||||
-rw-r--r-- | src/flash/ocl/at91sam7x/samflash.c | 64 |
2 files changed, 47 insertions, 47 deletions
diff --git a/src/flash/ocl/at91sam7x/main.c b/src/flash/ocl/at91sam7x/main.c index b49a5b89..c65a171d 100644 --- a/src/flash/ocl/at91sam7x/main.c +++ b/src/flash/ocl/at91sam7x/main.c @@ -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()); diff --git a/src/flash/ocl/at91sam7x/samflash.c b/src/flash/ocl/at91sam7x/samflash.c index a534f6d8..678d5393 100644 --- a/src/flash/ocl/at91sam7x/samflash.c +++ b/src/flash/ocl/at91sam7x/samflash.c @@ -20,11 +20,11 @@ #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; } |