Commit 8959de9f authored by zwelch's avatar zwelch
Browse files

- 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
parent 84df52f9
...@@ -213,19 +213,19 @@ static void at91sam7_set_flash_mode(flash_bank_t *bank, int mode) ...@@ -213,19 +213,19 @@ static void at91sam7_set_flash_mode(flash_bank_t *bank, int mode)
if (at91sam7_info->cidr_arch == 0x60) if (at91sam7_info->cidr_arch == 0x60)
{ {
/* AT91SAM7A3 uses master clocks in 100 ns */ /* AT91SAM7A3 uses master clocks in 100 ns */
fmcn = (at91sam7_info->mck_freq/10000000ul)+1; fmcn = (at91sam7_info->mck_freq/10000000ul) + 1;
} }
else else
{ {
/* master clocks in 1uS for ARCH 0x7 types */ /* 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) else if (mode == FMR_TIMING_FLASH)
{ {
/* main clocks in 1.5uS */ /* main clocks in 1.5uS */
fmcn = (at91sam7_info->mck_freq/1000000ul)+ fmcn = (at91sam7_info->mck_freq/1000000ul)+
(at91sam7_info->mck_freq/2000000ul)+1; (at91sam7_info->mck_freq/2000000ul) + 1;
} }
/* hard overclocking */ /* hard overclocking */
...@@ -282,7 +282,7 @@ static int at91sam7_flash_command(struct flash_bank_s *bank, uint8_t cmd, uint16 ...@@ -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; fcr = (0x5A << 24) | ((pagen&0x3FF) << 8) | cmd;
target_write_u32(target, MC_FCR[bank->bank_number], fcr); 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))) if ((at91sam7_info->cidr_arch == 0x60) && ((cmd == SLB)|(cmd == CLB)))
{ {
...@@ -641,7 +641,7 @@ static int at91sam7_erase_check(struct flash_bank_s *bank) ...@@ -641,7 +641,7 @@ static int at91sam7_erase_check(struct flash_bank_s *bank)
fast_check = 1; 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, retval = target_blank_check_memory(target, bank->base + bank->sectors[nSector].offset,
bank->sectors[nSector].size, &blank); bank->sectors[nSector].size, &blank);
if (retval != ERROR_OK) if (retval != ERROR_OK)
{ {
...@@ -665,7 +665,7 @@ static int at91sam7_erase_check(struct flash_bank_s *bank) ...@@ -665,7 +665,7 @@ static int at91sam7_erase_check(struct flash_bank_s *bank)
for (nSector = 0; nSector<bank->num_sectors; nSector++) for (nSector = 0; nSector<bank->num_sectors; nSector++)
{ {
bank->sectors[nSector].is_erased = 1; 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); bank->sectors[nSector].size/4, buffer);
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;
...@@ -707,7 +707,7 @@ static int at91sam7_protect_check(struct flash_bank_s *bank) ...@@ -707,7 +707,7 @@ static int at91sam7_protect_check(struct flash_bank_s *bank)
at91sam7_info->num_lockbits_on = 0; 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) if ( ((status >> (16 + lock_pos))&(0x0001)) == 1)
{ {
at91sam7_info->num_lockbits_on++; at91sam7_info->num_lockbits_on++;
bank->sectors[lock_pos].is_protected = 1; bank->sectors[lock_pos].is_protected = 1;
...@@ -725,7 +725,7 @@ static int at91sam7_protect_check(struct flash_bank_s *bank) ...@@ -725,7 +725,7 @@ static int at91sam7_protect_check(struct flash_bank_s *bank)
at91sam7_info->num_nvmbits_on = 0; 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) if ( ((status >> (8 + gpnvm_pos))&(0x01)) == 1)
{ {
at91sam7_info->num_nvmbits_on++; at91sam7_info->num_nvmbits_on++;
} }
...@@ -803,7 +803,7 @@ static int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char * ...@@ -803,7 +803,7 @@ static int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char *
page_size = atoi(args[11]); page_size = atoi(args[11]);
num_nvmbits = atoi(args[12]); 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]); strcpy(target_name, args[7]);
/* calculate bank size */ /* calculate bank size */
...@@ -1027,7 +1027,7 @@ static int at91sam7_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t o ...@@ -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 */ /* Write one block to the PageWriteBuffer */
buffer_pos = (pagen-first_page)*dst_min_alignment; buffer_pos = (pagen-first_page)*dst_min_alignment;
wcount = CEIL(count,4); 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; return retval;
} }
......
...@@ -213,7 +213,7 @@ static uint16_t cfi_query_u16(flash_bank_t *bank, int sector, uint32_t offset) ...@@ -213,7 +213,7 @@ static uint16_t cfi_query_u16(flash_bank_t *bank, int sector, uint32_t offset)
{ {
uint8_t i; 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, target_read_memory(target, flash_address(bank, sector, offset + i), bank->bus_width, 1,
&data[i*bank->bus_width] ); &data[i*bank->bus_width] );
} }
else else
...@@ -235,7 +235,7 @@ static uint32_t cfi_query_u32(flash_bank_t *bank, int sector, uint32_t offset) ...@@ -235,7 +235,7 @@ static uint32_t cfi_query_u32(flash_bank_t *bank, int sector, uint32_t offset)
{ {
uint8_t i; 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, target_read_memory(target, flash_address(bank, sector, offset + i), bank->bus_width, 1,
&data[i*bank->bus_width] ); &data[i*bank->bus_width] );
} }
else else
......
...@@ -274,8 +274,8 @@ static int eCosBoard_erase(ecosflash_flash_bank_t *info, uint32_t address, uint3 ...@@ -274,8 +274,8 @@ static int eCosBoard_erase(ecosflash_flash_bank_t *info, uint32_t address, uint3
uint32_t flashErr; uint32_t flashErr;
retval = runCode(info, retval = runCode(info,
info->start_address+OFFSET_ERASE, info->start_address + OFFSET_ERASE,
info->start_address+OFFSET_ERASE+OFFSET_ERASE_SIZE, info->start_address + OFFSET_ERASE + OFFSET_ERASE_SIZE,
address, address,
len, len,
0, 0,
...@@ -307,8 +307,8 @@ static int eCosBoard_flash(ecosflash_flash_bank_t *info, void *data, uint32_t ad ...@@ -307,8 +307,8 @@ static int eCosBoard_flash(ecosflash_flash_bank_t *info, void *data, uint32_t ad
uint32_t buffer; uint32_t buffer;
retval = runCode(info, retval = runCode(info,
info->start_address+OFFSET_GET_WORKAREA, info->start_address + OFFSET_GET_WORKAREA,
info->start_address+OFFSET_GET_WORKAREA+OFFSET_GET_WORKAREA_SIZE, info->start_address + OFFSET_GET_WORKAREA + OFFSET_GET_WORKAREA_SIZE,
0, 0,
0, 0,
0, 0,
...@@ -328,16 +328,16 @@ static int eCosBoard_flash(ecosflash_flash_bank_t *info, void *data, uint32_t ad ...@@ -328,16 +328,16 @@ static int eCosBoard_flash(ecosflash_flash_bank_t *info, void *data, uint32_t ad
} }
int retval; 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) if (retval != ERROR_OK)
return retval; return retval;
uint32_t flashErr; uint32_t flashErr;
retval = runCode(info, retval = runCode(info,
info->start_address+OFFSET_FLASH, info->start_address + OFFSET_FLASH,
info->start_address+OFFSET_FLASH+OFFSET_FLASH_SIZE, info->start_address + OFFSET_FLASH + OFFSET_FLASH_SIZE,
buffer, buffer,
address+i, address + i,
t, t,
&flashErr, &flashErr,
timeout); timeout);
...@@ -410,7 +410,7 @@ static int ecosflash_erase(struct flash_bank_s *bank, int first, int last) ...@@ -410,7 +410,7 @@ 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; 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) 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 ...@@ -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; 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); return eCosBoard_flash(info, buffer, c->base + offset, count);
} }
static int ecosflash_protect_check(struct flash_bank_s *bank) static int ecosflash_protect_check(struct flash_bank_s *bank)
......
...@@ -1110,7 +1110,7 @@ int flash_write(target_t *target, image_t *image, uint32_t *written, int erase) ...@@ -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 */ /* see if we need to pad the section */
while (padding[section]--) while (padding[section]--)
(buffer+buffer_size)[size_read++] = 0xff; (buffer + buffer_size)[size_read++] = 0xff;
buffer_size += size_read; buffer_size += size_read;
section_offset += size_read; section_offset += size_read;
......
...@@ -923,7 +923,7 @@ static double mg_do_calc_pll(double XIN, mg_pll_t * p_pll_val, int is_approximat ...@@ -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; 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)) { == (int)(MG_PLL_CLK_OUT / DIV)) {
if (mg_is_valid_pll(XIN, N, CLK_OUT, NO) == ERROR_OK) if (mg_is_valid_pll(XIN, N, CLK_OUT, NO) == ERROR_OK)
{ {
......
...@@ -294,7 +294,7 @@ typedef enum _mg_vcmd ...@@ -294,7 +294,7 @@ typedef enum _mg_vcmd
typedef enum _mg_opmode typedef enum _mg_opmode
{ {
mg_op_mode_xip = 1, /* TRUE XIP */ 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_op_mode_stg = 0 /* Only Storage */
} mg_opmode; } mg_opmode;
......
...@@ -518,9 +518,9 @@ int nand_probe(struct nand_device_s *device) ...@@ -518,9 +518,9 @@ int nand_probe(struct nand_device_s *device)
{ {
if (device->bus_width == 8) if (device->bus_width == 8)
{ {
device->controller->read_data(device, id_buff+3); device->controller->read_data(device, id_buff + 3);
device->controller->read_data(device, id_buff+4); device->controller->read_data(device, id_buff + 4);
device->controller->read_data(device, id_buff+5); device->controller->read_data(device, id_buff + 5);
} }
else else
{ {
...@@ -1420,7 +1420,7 @@ static int handle_nand_write_command(struct command_context_s *cmd_ctx, char *cm ...@@ -1420,7 +1420,7 @@ static int handle_nand_write_command(struct command_context_s *cmd_ctx, char *cm
uint8_t ecc[3]; uint8_t ecc[3];
memset(oob, 0xff, oob_size); memset(oob, 0xff, oob_size);
for (i = 0, j = 0; i < page_size; i += 256) { 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[0];
oob[eccpos[j++]] = ecc[1]; oob[eccpos[j++]] = ecc[1];
oob[eccpos[j++]] = ecc[2]; oob[eccpos[j++]] = ecc[2];
...@@ -1437,7 +1437,7 @@ static int handle_nand_write_command(struct command_context_s *cmd_ctx, char *cm ...@@ -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; uint8_t *ecc = oob + oob_size - page_size/512 * 10;
memset(oob, 0xff, oob_size); memset(oob, 0xff, oob_size);
for (i = 0; i < page_size; i += 512) { 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; ecc += 10;
} }
} }
......
...@@ -139,7 +139,7 @@ static int ocl_erase(struct flash_bank_s *bank, int first, int last) ...@@ -139,7 +139,7 @@ static int ocl_erase(struct flash_bank_s *bank, int first, int last)
} }
/* receive response */ /* 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; return retval;
if (dcc_buffer[1] != OCL_CMD_DONE) 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 ...@@ -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 */ /* 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) while (count)
{ {
......
...@@ -43,7 +43,7 @@ void cmd_flash(uint32 cmd) ...@@ -43,7 +43,7 @@ void cmd_flash(uint32 cmd)
len = cmd&0xffff; len = cmd&0xffff;
ofs = adr%flash_page_size; ofs = adr%flash_page_size;
bi_start = ofs/4; bi_start = ofs/4;
bi_end = (ofs+len+3)/4; bi_end = (ofs + len + 3)/4;
if (bi_end>BUFSIZE) { if (bi_end>BUFSIZE) {
dcc_wr(OCL_BUFF_OVER); dcc_wr(OCL_BUFF_OVER);
...@@ -65,12 +65,12 @@ void cmd_flash(uint32 cmd) ...@@ -65,12 +65,12 @@ void cmd_flash(uint32 cmd)
result = 0; result = 0;
pagenum = adr/flash_page_size; pagenum = adr/flash_page_size;
for (bi = 0; bi<bi_end; bi += flash_page_size/4) { 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; if (result) break;
} }
/* verify written data */ /* 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); dcc_wr(OCL_CMD_DONE|result);
} }
......
...@@ -86,11 +86,11 @@ int flash_page_program(uint32 *data, int page_num) ...@@ -86,11 +86,11 @@ int flash_page_program(uint32 *data, int page_num)
else efc_ofs = 0; else efc_ofs = 0;
/* wait until FLASH is ready, just for sure */ /* 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, /* 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 */ 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; data_ptr = data;
/* copy data to latch */ /* copy data to latch */
...@@ -100,18 +100,18 @@ int flash_page_program(uint32 *data, int page_num) ...@@ -100,18 +100,18 @@ int flash_page_program(uint32 *data, int page_num)
} }
/* page number and page write command to FCR */ /* 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 */ /* 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 */ /* check for errors */
if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE; 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_LOCKE)) return FLASH_STAT_LOCKE;
#if 0 #if 0
/* verify written data */ /* 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; data_ptr = data;
for (i = flash_page_size/4; i; i--) { for (i = flash_page_size/4; i; i--) {
...@@ -129,21 +129,21 @@ int flash_erase_plane(int efc_ofs) ...@@ -129,21 +129,21 @@ int flash_erase_plane(int efc_ofs)
int page_num; int page_num;
page_num = 0; page_num = 0;
lockbits = inr(MC_FSR+efc_ofs) >> 16; lockbits = inr(MC_FSR + efc_ofs) >> 16;
while (lockbits) { while (lockbits) {
if (lockbits&1) { if (lockbits&1) {
/* wait until FLASH is ready, just for sure */ /* 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 */ /* 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 */ /* check for errors */
if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE; 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_LOCKE)) return FLASH_STAT_LOCKE;
} }
if ((page_num += flash_lock_pages)>flash_page_count) break; if ((page_num += flash_lock_pages)>flash_page_count) break;
...@@ -151,20 +151,20 @@ int flash_erase_plane(int efc_ofs) ...@@ -151,20 +151,20 @@ int flash_erase_plane(int efc_ofs)
} }
/* wait until FLASH is ready, just for sure */ /* 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 */ /* erase all command to FCR */
outr(MC_FCR+efc_ofs, 0x5a000008); outr(MC_FCR + efc_ofs, 0x5a000008);
/* wait until it's done */ /* 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 */ /* check for errors */
if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE; 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_LOCKE)) return FLASH_STAT_LOCKE;
/* set no erase before programming */ /* 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; return FLASH_STAT_OK;
} }
...@@ -188,7 +188,7 @@ int flash_verify(uint32 adr, unsigned int len, uint8 *src) ...@@ -188,7 +188,7 @@ int flash_verify(uint32 adr, unsigned int len, uint8 *src)
{ {
unsigned char *flash_ptr; unsigned char *flash_ptr;
flash_ptr = (uint8 *)FLASH_AREA_ADDR+adr; flash_ptr = (uint8 *)FLASH_AREA_ADDR + adr;
for ( ;len; len--) { for ( ;len; len--) {
if (*(flash_ptr++)!=*(src++)) return FLASH_STAT_VERIFE; if (*(flash_ptr++)!=*(src++)) return FLASH_STAT_VERIFE;
} }
......
...@@ -923,7 +923,7 @@ static int pic32mx_handle_pgm_word_command(struct command_context_s *cmd_ctx, ch ...@@ -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]); command_print(cmd_ctx, "flash bank '#%s' is out of bounds", args[2]);
return ERROR_OK; 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]); command_print(cmd_ctx, "flash address '%s' is out of bounds", args[0]);
return ERROR_OK; return ERROR_OK;
......
...@@ -62,9 +62,9 @@ typedef struct pic32mx_flash_bank_s ...@@ -62,9 +62,9 @@ typedef struct pic32mx_flash_bank_s
* Note: These macros only work for KSEG0/KSEG1 addresses. * Note: These macros only work for KSEG0/KSEG1 addresses.
*/ */
#define KS1Virt2Phys(vaddr) ((vaddr)-0xA0000000) #define KS1Virt2Phys(vaddr) ((vaddr)-0xA0000000)
#define Phys2KS1Virt(paddr) ((paddr)+0xA0000000) #define Phys2KS1Virt(paddr) ((paddr) + 0xA0000000)
#define KS0Virt2Phys(vaddr) ((vaddr)-0x80000000) #define KS0Virt2Phys(vaddr) ((vaddr)-0x80000000)
#define Phys2KS0Virt(paddr) ((paddr)+0x80000000) #define Phys2KS0Virt(paddr) ((paddr) + 0x80000000)
/* pic32mx configuration register locations */ /* pic32mx configuration register locations */
......
...@@ -309,8 +309,8 @@ static int stellaris_info(struct flash_bank_s *bank, char *buf, int buf_size) ...@@ -309,8 +309,8 @@ static int stellaris_info(struct flash_bank_s *bank, char *buf, int buf_size)
stellaris_info->did1, stellaris_info->did1,
stellaris_info->did1, stellaris_info->did1,
"ARMV7M", "ARMV7M",
(int)((1+((stellaris_info->dc0 >> 16) & 0xFFFF))/4), (int)((1 + ((stellaris_info->dc0 >> 16) & 0xFFFF))/4),
(int)((1+(stellaris_info->dc0 & 0xFFFF))*2)); (int)((1 + (stellaris_info->dc0 & 0xFFFF))*2));
buf += printed; buf += printed;
buf_size -= printed; buf_size -= printed;
...@@ -396,7 +396,7 @@ static void stellaris_read_clock_info(flash_bank_t *bank) ...@@ -396,7 +396,7 @@ static void stellaris_read_clock_info(flash_bank_t *bank)
mainfreq = 200000000; /* PLL out frec */ mainfreq = 200000000; /* PLL out frec */
if (usesysdiv) if (usesysdiv)
stellaris_info->mck_freq = mainfreq/(1+sysdiv);