Browse Source

- 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
tags/v0.2.0
zwelch 15 years ago
parent
commit
8959de9f67
52 changed files with 443 additions and 443 deletions
  1. +10
    -10
      src/flash/at91sam7.c
  2. +2
    -2
      src/flash/cfi.c
  3. +10
    -10
      src/flash/ecos.c
  4. +1
    -1
      src/flash/flash.c
  5. +1
    -1
      src/flash/mflash.c
  6. +1
    -1
      src/flash/mflash.h
  7. +5
    -5
      src/flash/nand.c
  8. +2
    -2
      src/flash/ocl.c
  9. +3
    -3
      src/flash/ocl/at91sam7x/main.c
  10. +20
    -20
      src/flash/ocl/at91sam7x/samflash.c
  11. +1
    -1
      src/flash/pic32mx.c
  12. +2
    -2
      src/flash/pic32mx.h
  13. +4
    -4
      src/flash/stellaris.c
  14. +1
    -1
      src/flash/str7x.c
  15. +1
    -1
      src/flash/str9x.c
  16. +1
    -1
      src/flash/tms470.c
  17. +2
    -2
      src/helper/binarybuffer.h
  18. +3
    -3
      src/helper/command.c
  19. +2
    -2
      src/helper/configuration.c
  20. +1
    -1
      src/helper/ioutil.c
  21. +1
    -1
      src/helper/jim-eventloop.c
  22. +186
    -186
      src/helper/jim.c
  23. +1
    -1
      src/helper/jim.h
  24. +2
    -2
      src/helper/log.c
  25. +1
    -1
      src/helper/log.h
  26. +1
    -1
      src/helper/replacements.c
  27. +5
    -5
      src/jtag/arm-jtag-ew.c
  28. +1
    -1
      src/jtag/ft2232.c
  29. +1
    -1
      src/jtag/jlink.c
  30. +1
    -1
      src/jtag/jtag.h
  31. +1
    -1
      src/jtag/presto.c
  32. +7
    -7
      src/jtag/tcl.c
  33. +1
    -1
      src/jtag/vsllink.c
  34. +15
    -15
      src/jtag/zy1000/jtag_minidriver.h
  35. +33
    -33
      src/jtag/zy1000/zy1000.c
  36. +13
    -13
      src/server/gdb_server.c
  37. +1
    -1
      src/server/telnet_server.c
  38. +1
    -1
      src/target/arm11.c
  39. +3
    -3
      src/target/arm7_9_common.c
  40. +3
    -3
      src/target/arm7tdmi.c
  41. +1
    -1
      src/target/arm9tdmi.c
  42. +1
    -1
      src/target/arm_adi_v5.c
  43. +1
    -1
      src/target/armv4_5.c
  44. +26
    -26
      src/target/etb.c
  45. +1
    -1
      src/target/fa526.c
  46. +2
    -2
      src/target/image.c
  47. +6
    -6
      src/target/mips32_dmaacc.c
  48. +9
    -9
      src/target/mips32_pracc.c
  49. +8
    -8
      src/target/oocd_trace.c
  50. +23
    -23
      src/target/target.c
  51. +12
    -12
      src/target/xscale.c
  52. +2
    -2
      src/xsvf/xsvf.c

+ 10
- 10
src/flash/at91sam7.c View File

@@ -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; 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);
if (retval != ERROR_OK)
{
@@ -665,7 +665,7 @@ static int at91sam7_erase_check(struct flash_bank_s *bank)
for (nSector = 0; nSector<bank->num_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_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++;
}
@@ -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;
}


+ 2
- 2
src/flash/cfi.c View File

@@ -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


+ 10
- 10
src/flash/ecos.c View File

@@ -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)


+ 1
- 1
src/flash/flash.c View File

@@ -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;


+ 1
- 1
src/flash/mflash.c View File

@@ -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)
{


+ 1
- 1
src/flash/mflash.h View File

@@ -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;



+ 5
- 5
src/flash/nand.c View File

@@ -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;
}
}


+ 2
- 2
src/flash/ocl.c View File

@@ -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)
{


+ 3
- 3
src/flash/ocl/at91sam7x/main.c View File

@@ -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);
}


+ 20
- 20
src/flash/ocl/at91sam7x/samflash.c View File

@@ -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;
}


+ 1
- 1
src/flash/pic32mx.c View File

@@ -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;


+ 2
- 2
src/flash/pic32mx.h View File

@@ -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 */



+ 4
- 4
src/flash/stellaris.c View File

@@ -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;


+ 1
- 1
src/flash/str7x.c View File

@@ -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);
}


+ 1
- 1
src/flash/str9x.c View File

@@ -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;


+ 1
- 1
src/flash/tms470.c View File

@@ -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);


+ 2
- 2
src/helper/binarybuffer.h View File

@@ -42,7 +42,7 @@ static inline void buf_set_u32(uint8_t* buffer, unsigned int first, unsigned int
{
unsigned int i;
for (i = first; i<first+num; i++)
for (i = first; i<first + num; i++)
{
if (((value >> (i-first))&1) == 1)
buffer[i/8] |= 1 << (i%8);
@@ -61,7 +61,7 @@ static inline uint32_t buf_get_u32(const uint8_t* buffer, unsigned int first, un
uint32_t result = 0;
unsigned int i;
for (i = first; i<first+num; i++)
for (i = first; i<first + num; i++)
{
if (((buffer[i/8]>>(i%8))&1) == 1)
result |= 1 << (i-first);


+ 3
- 3
src/helper/command.c View File

@@ -495,14 +495,14 @@ int command_run_line(command_context_t *context, char *line)
if (reslen>0)
{
int i;
char buff[256+1];
char buff[256 + 1];
for (i = 0; i < reslen; i += 256)
{
int chunk;
chunk = reslen - i;
if (chunk > 256)
chunk = 256;
strncpy(buff, result+i, chunk);
strncpy(buff, result + i, chunk);
buff[chunk] = 0;
LOG_USER_N("%s", buff);
}
@@ -599,7 +599,7 @@ static size_t openocd_jim_fwrite(const void *_ptr, size_t size, size_t n, void *
}
/* GRR we must chunk - not null terminated */
while (nbytes) {
char chunk[128+1];
char chunk[128 + 1];
int x;

x = nbytes;


+ 2
- 2
src/helper/configuration.c View File

@@ -37,7 +37,7 @@ static char** script_search_dirs;
void add_script_search_dir (const char *dir)
{
num_script_dirs++;
script_search_dirs = (char **)realloc(script_search_dirs, (num_script_dirs+1) * sizeof (char *));
script_search_dirs = (char **)realloc(script_search_dirs, (num_script_dirs + 1) * sizeof (char *));

script_search_dirs[num_script_dirs-1] = strdup(dir);
script_search_dirs[num_script_dirs] = NULL;
@@ -46,7 +46,7 @@ void add_script_search_dir (const char *dir)
void add_config_command (const char *cfg)
{
num_config_files++;
config_file_names = (char **)realloc(config_file_names, (num_config_files+1) * sizeof (char *));
config_file_names = (char **)realloc(config_file_names, (num_config_files + 1) * sizeof (char *));

config_file_names[num_config_files-1] = strdup(cfg);
config_file_names[num_config_files] = NULL;


+ 1
- 1
src/helper/ioutil.c View File

@@ -274,7 +274,7 @@ int handle_cp_command(struct command_context_s *cmd_ctx, char *cmd, char **args,
chunk = maxChunk;
}

if ((retval == ERROR_OK) && (fwrite(((char *)data)+pos, 1, chunk, f) != chunk))
if ((retval == ERROR_OK) && (fwrite(((char *)data) + pos, 1, chunk, f) != chunk))
retval = ERROR_INVALID_ARGUMENTS;

if (retval != ERROR_OK)


+ 1
- 1
src/helper/jim-eventloop.c View File

@@ -310,7 +310,7 @@ int Jim_ProcessEvents(Jim_Interp *interp, int flags)
// fprintf(stderr,"No Event\n");
}

retval = select(maxfd+1, &rfds, &wfds, &efds, tvp);
retval = select(maxfd + 1, &rfds, &wfds, &efds, tvp);
if (retval < 0) {
switch (errno) {
case EINTR: fprintf(stderr,"select EINTR\n"); break;


+ 186
- 186
src/helper/jim.c
File diff suppressed because it is too large
View File


+ 1
- 1
src/helper/jim.h View File

@@ -563,7 +563,7 @@ typedef struct Jim_Interp {
typedef struct Jim_Reference {
Jim_Obj *objPtr;
Jim_Obj *finalizerCmdNamePtr;
char tag[JIM_REFERENCE_TAGLEN+1];
char tag[JIM_REFERENCE_TAGLEN + 1];
} Jim_Reference;

/** Name Value Pairs, aka: NVP


+ 2
- 2
src/helper/log.c View File

@@ -103,7 +103,7 @@ static void log_puts(enum log_levels level, const char *file, int line, const ch
#ifdef _DEBUG_FREE_SPACE_
" %d"
#endif
": %s", log_strings[level+1], count, t, file, line, function,
": %s", log_strings[level + 1], count, t, file, line, function,
#ifdef _DEBUG_FREE_SPACE_
info.fordblks,
#endif
@@ -117,7 +117,7 @@ static void log_puts(enum log_levels level, const char *file, int line, const ch
{
/* print human readable output - but skip empty lines */
fprintf(log_output, "%s%s",
(level > LOG_LVL_USER)?log_strings[level+1]:"", string);
(level > LOG_LVL_USER)?log_strings[level + 1]:"", string);
}
}
} else


+ 1
- 1
src/helper/log.h View File

@@ -29,7 +29,7 @@
#include "command.h"

/* logging priorities
* LOG_LVL_SILENT - turn off all output. In lieu of try+catch this can be used as a
* LOG_LVL_SILENT - turn off all output. In lieu of try + catch this can be used as a
* feeble ersatz.
* LOG_LVL_USER - user messages. Could be anything from information
* to progress messags. These messages do not represent


+ 1
- 1
src/helper/replacements.c View File

@@ -218,7 +218,7 @@ int win_select(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *efds, struct time
tvslice.tv_sec = 0;
tvslice.tv_usec = 100000;

retcode = select(sock_max_fd+1, &aread, &awrite, &aexcept, &tvslice);
retcode = select(sock_max_fd + 1, &aread, &awrite, &aexcept, &tvslice);
}
if (n_handles > 0) {
/* check handles */


+ 5
- 5
src/jtag/arm-jtag-ew.c View File

@@ -207,7 +207,7 @@ static int armjtagew_speed(int speed)


usb_out_buffer[0] = CMD_SET_TCK_FREQUENCY;
buf_set_u32(usb_out_buffer+1, 0, 32, speed);
buf_set_u32(usb_out_buffer + 1, 0, 32, speed);

result = armjtagew_usb_message(armjtagew_jtag_handle, 4, 4);

@@ -500,7 +500,7 @@ static int armjtagew_get_version_info(void)

/* query hardware version */
usb_out_buffer[0] = CMD_GET_VERSION;
result = armjtagew_usb_message(armjtagew_jtag_handle, 1, 4+15+256);
result = armjtagew_usb_message(armjtagew_jtag_handle, 1, 4 + 15 + 256);

if (result != 0)
{
@@ -509,9 +509,9 @@ static int armjtagew_get_version_info(void)
}


memcpy(sn, usb_in_buffer+4, 15);
memcpy(sn, usb_in_buffer + 4, 15);
sn[15] = '\0';
memcpy(auxinfo, usb_in_buffer+4+15, 256);
memcpy(auxinfo, usb_in_buffer + 4+15, 256);
auxinfo[256] = '\0';

LOG_INFO("ARM-JTAG-EW firmware version %d.%d, hardware revision %c, SN=%s, Additional info: %s", \
@@ -651,7 +651,7 @@ static int armjtagew_tap_execute(void)
byte_length = tap_length / 8;

usb_out_buffer[0] = CMD_TAP_SHIFT;
buf_set_u32(usb_out_buffer+1, 0, 16, byte_length);
buf_set_u32(usb_out_buffer + 1, 0, 16, byte_length);

tms_offset = 3;
for (i = 0; i < byte_length; i++)


+ 1
- 1
src/jtag/ft2232.c View File

@@ -188,7 +188,7 @@ static jtag_command_t* first_unsent; /* next command that has to be sent
static int require_send;


/* http://urjtag.wiki.sourceforge.net/Cable+FT2232 says:
/* http://urjtag.wiki.sourceforge.net/Cable + FT2232 says:

"There is a significant difference between libftdi and libftd2xx. The latter
one allows to schedule up to 64*64 bytes of result data while libftdi fails


+ 1
- 1
src/jtag/jlink.c View File

@@ -50,7 +50,7 @@ static unsigned int jlink_hw_jtag_version = 2;
//#define JLINK_TAP_BUFFER_SIZE 384

#define JLINK_IN_BUFFER_SIZE 2048
#define JLINK_OUT_BUFFER_SIZE 2*2048+4
#define JLINK_OUT_BUFFER_SIZE 2*2048 + 4
#define JLINK_EMU_RESULT_BUFFER_SIZE 64

/* Global USB buffers */


+ 1
- 1
src/jtag/jtag.h View File

@@ -633,7 +633,7 @@ extern void jtag_execute_queue_noclear(void);
int jtag_get_flush_queue_count(void);


/* can be implemented by hw+sw */
/* can be implemented by hw + sw */
extern int jtag_power_dropout(int* dropout);
extern int jtag_srst_asserted(int* srst_asserted);



+ 1
- 1
src/jtag/presto.c View File

@@ -712,7 +712,7 @@ static int presto_jtag_khz(int khz, int *jtag_speed)
}

if (khz >= 3000) *jtag_speed = 0;
else *jtag_speed = (1000+khz-1)/khz;
else *jtag_speed = (1000 + khz-1)/khz;

return 0;
}


+ 7
- 7
src/jtag/tcl.c View File

@@ -532,7 +532,7 @@ static int jim_jtag_command( Jim_Interp *interp, int argc, Jim_Obj *const *argv

context = Jim_GetAssocData(interp, "context");
/* go past the command */
Jim_GetOpt_Setup( &goi, interp, argc-1, argv+1 );
Jim_GetOpt_Setup( &goi, interp, argc-1, argv + 1 );

e = Jim_GetOpt_Nvp( &goi, jtag_cmds, &n );
if ( e != JIM_OK ){
@@ -1286,7 +1286,7 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args
}

/* Not valid.. are we at the end? */
if ( ((i+2) != argc) ){
if ( ((i + 2) != argc) ){
/* nope, then error */
return e;
}
@@ -1301,7 +1301,7 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args
/* is it the magic? */
if ( 0 == strcmp( "-endstate", cp ) ){
/* is the statename valid? */
cp = Jim_GetString( args[i+1], NULL );
cp = Jim_GetString( args[i + 1], NULL );

/* see if it is a valid state name */
endstate = tap_state_by_name(cp);
@@ -1340,7 +1340,7 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args
const char *str;

Jim_GetLong(interp, args[i], &bits);
str = Jim_GetString(args[i+1], &len);
str = Jim_GetString(args[i + 1], &len);

fields[field_count].tap = tap;
fields[field_count].num_bits = bits;
@@ -1387,7 +1387,7 @@ static int Jim_Command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *ar
{
tap_state_t states[8];

if ((argc < 2) || ((size_t)argc > (sizeof(states)/sizeof(*states)+1)))
if ((argc < 2) || ((size_t)argc > (sizeof(states)/sizeof(*states) + 1)))
{
Jim_WrongNumArgs(interp, 1, args, "wrong arguments");
return JIM_ERR;
@@ -1399,7 +1399,7 @@ static int Jim_Command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *ar
for (i = 0; i<argc-1; i++)
{
const char *cp;
cp = Jim_GetString( args[i+1], NULL );
cp = Jim_GetString( args[i + 1], NULL );
states[i] = tap_state_by_name(cp);
if ( states[i] < 0 )
{
@@ -1415,7 +1415,7 @@ static int Jim_Command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *ar
return JIM_ERR;
}

jtag_add_pathmove(argc-2, states+1);
jtag_add_pathmove(argc-2, states + 1);

if (jtag_execute_queue()!= ERROR_OK)
{


+ 1
- 1
src/jtag/vsllink.c View File

@@ -1585,7 +1585,7 @@ static void vsllink_tap_append_scan_dma(int length, uint8_t *buffer, scan_comman

for (i = 0; i < len_tmp; i++)
{
vsllink_tap_append_step(((len_all+i) < length-1 ? 0 : 1), (buffer[(len_all+i)/8] >> ((len_all+i)%8)) & 1);
vsllink_tap_append_step(((len_all + i) < length-1 ? 0 : 1), (buffer[(len_all + i)/8] >> ((len_all + i)%8)) & 1);
}

pending_scan_results_length++;


+ 15
- 15
src/jtag/zy1000/jtag_minidriver.h View File

@@ -40,7 +40,7 @@ static __inline__ void waitIdle(void)
cyg_uint32 empty;
do
{
ZY1000_PEEK(ZY1000_JTAG_BASE+0x10, empty);
ZY1000_PEEK(ZY1000_JTAG_BASE + 0x10, empty);
} while ((empty & 0x100) == 0);
}

@@ -54,7 +54,7 @@ static void sampleShiftRegister(void)
#if 0
cyg_uint32 dummy;
waitIdle();
ZY1000_PEEK(ZY1000_JTAG_BASE+0xc, dummy);
ZY1000_PEEK(ZY1000_JTAG_BASE + 0xc, dummy);
#endif
}

@@ -74,7 +74,7 @@ static void setCurrentState(enum tap_state state)
}
waitQueue();
sampleShiftRegister();
ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (repeat << 8)|(a << 4)|a);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (repeat << 8)|(a << 4)|a);

}

@@ -89,7 +89,7 @@ static __inline__ void shiftValueInner(const enum tap_state state, const enum ta
b = endState;
waitQueue();
sampleShiftRegister();
ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value);
ZY1000_POKE(ZY1000_JTAG_BASE + 0xc, value);
#if 1
#if TEST_MANUAL()
if ((state == TAP_DRSHIFT) && (endState != TAP_DRSHIFT))
@@ -106,21 +106,21 @@ static __inline__ void shiftValueInner(const enum tap_state state, const enum ta
}
/* shift out value */
waitIdle();
ZY1000_POKE(ZY1000_JTAG_BASE+0x28, (((value >> i)&1) << 1)|tms);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, (((value >> i)&1) << 1)|tms);
}
waitIdle();
ZY1000_POKE(ZY1000_JTAG_BASE+0x28, 0);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, 0);
waitIdle();
//ZY1000_POKE(ZY1000_JTAG_BASE+0x20, TAP_DRSHIFT); // set this state and things break => expected
ZY1000_POKE(ZY1000_JTAG_BASE+0x20, TAP_DRPAUSE); // set this and things will work => expected. Not setting this is not sufficient to make things break.
//ZY1000_POKE(ZY1000_JTAG_BASE + 0x20, TAP_DRSHIFT); // set this state and things break => expected
ZY1000_POKE(ZY1000_JTAG_BASE + 0x20, TAP_DRPAUSE); // set this and things will work => expected. Not setting this is not sufficient to make things break.
setCurrentState(endState);
} else
{
ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (repeat << 8)|(a << 4)|b);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (repeat << 8)|(a << 4)|b);
}
#else
/* fast version */
ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (repeat << 8)|(a << 4)|b);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (repeat << 8)|(a << 4)|b);
#endif
#else
/* maximum debug version */
@@ -131,16 +131,16 @@ static __inline__ void shiftValueInner(const enum tap_state state, const enum ta
for (i = 0; i<repeat-1; i++)
{
sampleShiftRegister();
ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value >> i);
ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (1 << 8)|(a << 4)|a);
ZY1000_POKE(ZY1000_JTAG_BASE + 0xc, value >> i);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (1 << 8)|(a << 4)|a);
}
sampleShiftRegister();
ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value >> (repeat-1));
ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (1 << 8)|(a << 4)|b);
ZY1000_POKE(ZY1000_JTAG_BASE + 0xc, value >> (repeat-1));
ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (1 << 8)|(a << 4)|b);
} else
{
sampleShiftRegister();
ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (repeat << 8)|(a << 4)|b);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (repeat << 8)|(a << 4)|b);
}
sampleShiftRegister();
#endif


+ 33
- 33
src/jtag/zy1000/zy1000.c View File

@@ -78,8 +78,8 @@ static bool readPowerDropout(void)
{
cyg_uint32 state;
// sample and clear power dropout
HAL_WRITE_UINT32(ZY1000_JTAG_BASE+0x10, 0x80);
HAL_READ_UINT32(ZY1000_JTAG_BASE+0x10, state);
HAL_WRITE_UINT32(ZY1000_JTAG_BASE + 0x10, 0x80);
HAL_READ_UINT32(ZY1000_JTAG_BASE + 0x10, state);
bool powerDropout;
powerDropout = (state & 0x80) != 0;
return powerDropout;
@@ -90,8 +90,8 @@ static bool readSRST(void)
{
cyg_uint32 state;
// sample and clear SRST sensing
HAL_WRITE_UINT32(ZY1000_JTAG_BASE+0x10, 0x00000040);
HAL_READ_UINT32(ZY1000_JTAG_BASE+0x10, state);
HAL_WRITE_UINT32(ZY1000_JTAG_BASE + 0x10, 0x00000040);
HAL_READ_UINT32(ZY1000_JTAG_BASE + 0x10, state);
bool srstAsserted;
srstAsserted = (state & 0x40) != 0;
return srstAsserted;
@@ -129,35 +129,35 @@ void zy1000_reset(int trst, int srst)
LOG_DEBUG("zy1000 trst=%d, srst=%d", trst, srst);
if (!srst)
{
ZY1000_POKE(ZY1000_JTAG_BASE+0x14, 0x00000001);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x14, 0x00000001);
}
else
{
/* Danger!!! if clk != 0 when in
* idle in TAP_IDLE, reset halt on str912 will fail.
*/
ZY1000_POKE(ZY1000_JTAG_BASE+0x10, 0x00000001);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x10, 0x00000001);
}

if (!trst)
{
ZY1000_POKE(ZY1000_JTAG_BASE+0x14, 0x00000002);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x14, 0x00000002);
}
else
{
/* assert reset */
ZY1000_POKE(ZY1000_JTAG_BASE+0x10, 0x00000002);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x10, 0x00000002);
}

if (trst||(srst && (jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
{
waitIdle();
/* we're now in the RESET state until trst is deasserted */
ZY1000_POKE(ZY1000_JTAG_BASE+0x20, TAP_RESET);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x20, TAP_RESET);
} else
{
/* We'll get RCLK failure when we assert TRST, so clear any false positives here */
ZY1000_POKE(ZY1000_JTAG_BASE+0x14, 0x400);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x14, 0x400);
}

/* wait for srst to float back up */
@@ -192,7 +192,7 @@ int zy1000_speed(int speed)
{
/*0 means RCLK*/
speed = 0;
ZY1000_POKE(ZY1000_JTAG_BASE+0x10, 0x100);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x10, 0x100);
LOG_DEBUG("jtag_speed using RCLK");
}
else
@@ -204,8 +204,8 @@ int zy1000_speed(int speed)
}

LOG_USER("jtag_speed %d => JTAG clk=%f", speed, 64.0/(float)speed);
ZY1000_POKE(ZY1000_JTAG_BASE+0x14, 0x100);
ZY1000_POKE(ZY1000_JTAG_BASE+0x1c, speed&~1);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x14, 0x100);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x1c, speed&~1);
}
return ERROR_OK;
}
@@ -218,10 +218,10 @@ static void setPower(bool power)
savePower = power;
if (power)
{
HAL_WRITE_UINT32(ZY1000_JTAG_BASE+0x14, 0x8);
HAL_WRITE_UINT32(ZY1000_JTAG_BASE + 0x14, 0x8);
} else
{
HAL_WRITE_UINT32(ZY1000_JTAG_BASE+0x10, 0x8);
HAL_WRITE_UINT32(ZY1000_JTAG_BASE + 0x10, 0x8);
}
}

@@ -271,7 +271,7 @@ static int jim_zy1000_version(Jim_Interp *interp, int argc, Jim_Obj *const *argv
if (strcmp("openocd", str) == 0)
{
int revision;
revision = atol(ZYLIN_OPENOCD+strlen("XRevision: "));
revision = atol(ZYLIN_OPENOCD + strlen("XRevision: "));
sprintf(buff, "%d", revision);
version_str = buff;
}
@@ -307,7 +307,7 @@ zylinjtag_Jim_Command_powerstatus(Jim_Interp *interp,
}

cyg_uint32 status;
ZY1000_PEEK(ZY1000_JTAG_BASE+0x10, status);
ZY1000_PEEK(ZY1000_JTAG_BASE + 0x10, status);

Jim_SetResult(interp, Jim_NewIntObj(interp, (status&0x80) != 0));

@@ -334,7 +334,7 @@ int zy1000_init(void)
{
LOG_USER("%s", ZYLIN_OPENOCD_VERSION);

ZY1000_POKE(ZY1000_JTAG_BASE+0x10, 0x30); // Turn on LED1 & LED2
ZY1000_POKE(ZY1000_JTAG_BASE + 0x10, 0x30); // Turn on LED1 & LED2

setPower(true); // on by default

@@ -359,9 +359,9 @@ int interface_jtag_execute_queue(void)
cyg_uint32 empty;

waitIdle();
ZY1000_PEEK(ZY1000_JTAG_BASE+0x10, empty);
ZY1000_PEEK(ZY1000_JTAG_BASE + 0x10, empty);
/* clear JTAG error register */
ZY1000_POKE(ZY1000_JTAG_BASE+0x14, 0x400);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x14, 0x400);

if ((empty&0x400) != 0)
{
@@ -382,7 +382,7 @@ static cyg_uint32 getShiftValue(void)
{
cyg_uint32 value;
waitIdle();
ZY1000_PEEK(ZY1000_JTAG_BASE+0xc, value);
ZY1000_PEEK(ZY1000_JTAG_BASE + 0xc, value);
VERBOSE(LOG_INFO("getShiftValue %08x", value));
return value;
}
@@ -391,7 +391,7 @@ static cyg_uint32 getShiftValueFlip(void)
{
cyg_uint32 value;
waitIdle();
ZY1000_PEEK(ZY1000_JTAG_BASE+0x18, value);
ZY1000_PEEK(ZY1000_JTAG_BASE + 0x18, value);
VERBOSE(LOG_INFO("getShiftValue %08x (flipped)", value));
return value;
}
@@ -404,8 +404,8 @@ static void shiftValueInnerFlip(const tap_state_t state, const tap_state_t endSt
cyg_uint32 a,b;
a = state;
b = endState;
ZY1000_POKE(ZY1000_JTAG_BASE+0xc, value);
ZY1000_POKE(ZY1000_JTAG_BASE+0x8, (1 << 15)|(repeat << 8)|(a << 4)|b);
ZY1000_POKE(ZY1000_JTAG_BASE + 0xc, value);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x8, (1 << 15)|(repeat << 8)|(a << 4)|b);
VERBOSE(getShiftValueFlip());
}
#endif
@@ -450,14 +450,14 @@ static __inline void scanFields(int num_fields, const scan_field_t *fields, tap_
pause_state = end_state;
}

// we have (num_bits+7)/8 bytes of bits to toggle out.
// we have (num_bits + 7)/8 bytes of bits to toggle out.
// bits are pushed out LSB to MSB
value = 0;
if (fields[i].out_value != NULL)
{
for (l = 0; l<k; l += 8)
{
value|=fields[i].out_value[(j+l)/8]<<l;
value|=fields[i].out_value[(j + l)/8]<<l;
}
}
/* mask away unused bits for easier debugging */
@@ -474,7 +474,7 @@ static __inline void scanFields(int num_fields, const scan_field_t *fields, tap_

for (l = 0; l<k; l += 8)
{
inBuffer[(j+l)/8]=(value >> l)&0xff;
inBuffer[(j + l)/8]=(value >> l)&0xff;
}
}
j += k;
@@ -517,7 +517,7 @@ int interface_jtag_add_ir_scan(int num_fields, const scan_field_t *fields, tap_s
{
found = 1;

scanFields(1, fields+j, TAP_IRSHIFT, end_state);
scanFields(1, fields + j, TAP_IRSHIFT, end_state);
/* update device information */
buf_cpy(fields[j].out_value, tap->cur_instr, scan_size);

@@ -582,7 +582,7 @@ int interface_jtag_add_dr_scan(int num_fields, const scan_field_t *fields, tap_s
{
found = 1;

scanFields(1, fields+j, TAP_DRSHIFT, end_state);
scanFields(1, fields + j, TAP_DRSHIFT, end_state);
}
}
if (!found)
@@ -659,10 +659,10 @@ static int zy1000_jtag_add_clocks(int num_cycles, tap_state_t state, tap_state_t
{
tms = (tms_scan >> i) & 1;
waitIdle();
ZY1000_POKE(ZY1000_JTAG_BASE+0x28, tms);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, tms);
}
waitIdle();
ZY1000_POKE(ZY1000_JTAG_BASE+0x20, state);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x20, state);
#endif


@@ -714,7 +714,7 @@ int interface_jtag_add_pathmove(int num_states, const tap_state_t *path)
}

waitIdle();
ZY1000_POKE(ZY1000_JTAG_BASE+0x28, tms);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x28, tms);

cur_state = path[state_count];
state_count++;
@@ -722,7 +722,7 @@ int interface_jtag_add_pathmove(int num_states, const tap_state_t *path)
}

waitIdle();
ZY1000_POKE(ZY1000_JTAG_BASE+0x20, cur_state);
ZY1000_POKE(ZY1000_JTAG_BASE + 0x20, cur_state);
return ERROR_OK;
}



+ 13
- 13
src/server/gdb_server.c View File

@@ -345,7 +345,7 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
if ((size_t)len + 4 <= sizeof(local_buffer))
{
/* performance gain on smaller packets by only a single call to gdb_write() */
memcpy(local_buffer+1, buffer, len++);
memcpy(local_buffer + 1, buffer, len++);
local_buffer[len++] = '#';
local_buffer[len++] = DIGITS[(my_checksum >> 4) & 0xf];
local_buffer[len++] = DIGITS[my_checksum & 0xf];
@@ -369,7 +369,7 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
{
return retval;
}
if ((retval = gdb_write(connection, local_buffer+1, 3)) != ERROR_OK)
if ((retval = gdb_write(connection, local_buffer + 1, 3)) != ERROR_OK)
{
return retval;
}
@@ -461,7 +461,7 @@ static __inline__ int fetch_packet(connection_t *connection, int *checksum_ok, i
* We need to leave at least 2 bytes in the buffer to have
* gdb_get_char() update various bits and bobs correctly.
*/
if ((gdb_con->buf_cnt > 2) && ((gdb_con->buf_cnt+count) < *len))
if ((gdb_con->buf_cnt > 2) && ((gdb_con->buf_cnt + count) < *len))
{
/* The compiler will struggle a bit with constant propagation and
* aliasing, so we help it by showing that these values do not
@@ -651,7 +651,7 @@ int gdb_output_con(connection_t *connection, const char* line)
hex_buffer[0] = 'O';
for (i = 0; i<bin_size; i++)
snprintf(hex_buffer + 1 + i*2, 3, "%2.2x", line[i]);
hex_buffer[bin_size*2+1] = 0;
hex_buffer[bin_size*2 + 1] = 0;

int retval = gdb_put_packet(connection, hex_buffer, bin_size*2 + 1);

@@ -894,7 +894,7 @@ void gdb_str_to_target(target_t *target, char *tstr, reg_t *reg)
{
int j = gdb_reg_pos(target, i, buf_len);
tstr[i*2] = DIGITS[(buf[j]>>4) & 0xf];
tstr[i*2+1] = DIGITS[buf[j]&0xf];
tstr[i*2 + 1] = DIGITS[buf[j]&0xf];
}
}

@@ -926,7 +926,7 @@ void gdb_target_to_reg(target_t *target, char *tstr, int str_len, uint8_t *bin)
for (i = 0; i < str_len; i += 2)
{
uint8_t t = hextoint(tstr[i]) << 4;
t |= hextoint(tstr[i+1]);
t |= hextoint(tstr[i + 1]);

int j = gdb_reg_pos(target, i/2, str_len/2);
bin[j] = t;
@@ -1182,7 +1182,7 @@ int gdb_read_memory_packet(connection_t *connection, target_t *target, char *pac
return ERROR_SERVER_REMOTE_CLOSED;
}

len = strtoul(separator+1, NULL, 16);
len = strtoul(separator + 1, NULL, 16);

buffer = malloc(len);

@@ -1256,7 +1256,7 @@ int gdb_write_memory_packet(connection_t *connection, target_t *target, char *pa
return ERROR_SERVER_REMOTE_CLOSED;
}

len = strtoul(separator+1, &separator, 16);
len = strtoul(separator + 1, &separator, 16);

if (*(separator++) != ':')
{
@@ -1310,7 +1310,7 @@ int gdb_write_memory_binary_packet(connection_t *connection, target_t *target, c
return ERROR_SERVER_REMOTE_CLOSED;
}

len = strtoul(separator+1, &separator, 16);
len = strtoul(separator + 1, &separator, 16);

if (*(separator++) != ':')
{
@@ -1408,7 +1408,7 @@ int gdb_breakpoint_watchpoint_packet(connection_t *connection, target_t *target,
return ERROR_SERVER_REMOTE_CLOSED;
}

address = strtoul(separator+1, &separator, 16);
address = strtoul(separator + 1, &separator, 16);

if (*separator != ',')
{
@@ -1416,7 +1416,7 @@ int gdb_breakpoint_watchpoint_packet(connection_t *connection, target_t *target,
return ERROR_SERVER_REMOTE_CLOSED;
}

size = strtoul(separator+1, &separator, 16);
size = strtoul(separator + 1, &separator, 16);

switch (type)
{
@@ -1533,7 +1533,7 @@ static int decode_xfer_read(char *buf, char **annex, int *ofs, unsigned int *len
if (*separator != ',')
return -1;

*len = strtoul(separator+1, NULL, 16);
*len = strtoul(separator + 1, NULL, 16);

return 0;
}
@@ -1736,7 +1736,7 @@ int gdb_query_packet(connection_t *connection, target_t *target, char *packet, i
"<property name=\"blocksize\">0x%x</property>\n" \
"</memory>\n", \
p->base, p->size, blocksize);
ram_start = p->base+p->size;
ram_start = p->base + p->size;
}
if (ram_start != 0)
{


+ 1
- 1
src/server/telnet_server.c View File

@@ -86,7 +86,7 @@ int telnet_outputline(connection_t *connection, const char *line)
if (line_end)
{
telnet_write(connection, "\r\n", 2);
line += len+1;
line += len + 1;
}
else
{


+ 1
- 1
src/target/arm11.c View File

@@ -1399,7 +1399,7 @@ int arm11_run_algorithm(struct target_s *target, int num_mem_params, mem_param_t
LOG_DEBUG("Save %zi: 0x%" PRIx32 "",i,context[i]);
}

cpsr = buf_get_u32((uint8_t*)(arm11->reg_values+ARM11_RC_CPSR),0,32);
cpsr = buf_get_u32((uint8_t*)(arm11->reg_values + ARM11_RC_CPSR),0,32);
LOG_DEBUG("Save CPSR: 0x%" PRIx32 "", cpsr);

for (int i = 0; i < num_mem_params; i++)


+ 3
- 3
src/target/arm7_9_common.c View File

@@ -2672,14 +2672,14 @@ int arm7_9_bulk_write_memory(target_t *target, uint32_t address, uint32_t count,
dcc_count = count;
dcc_buffer = buffer;
retval = armv4_5_run_algorithm_inner(target, 0, NULL, 1, reg_params,
arm7_9->dcc_working_area->address, arm7_9->dcc_working_area->address+6*4, 20*1000, &armv4_5_info, arm7_9_dcc_completion);
arm7_9->dcc_working_area->address, arm7_9->dcc_working_area->address + 6*4, 20*1000, &armv4_5_info, arm7_9_dcc_completion);

if (retval == ERROR_OK)
{
uint32_t endaddress = buf_get_u32(reg_params[0].value, 0, 32);
if (endaddress != (address+count*4))
if (endaddress != (address + count*4))
{
LOG_ERROR("DCC write failed, expected end address 0x%08" PRIx32 " got 0x%0" PRIx32 "", (address+count*4), endaddress);
LOG_ERROR("DCC write failed, expected end address 0x%08" PRIx32 " got 0x%0" PRIx32 "", (address + count*4), endaddress);
retval = ERROR_FAIL;
}
}


+ 3
- 3
src/target/arm7tdmi.c View File

@@ -383,7 +383,7 @@ void arm7tdmi_read_core_regs(target_t *target, uint32_t mask, uint32_t* core_reg
for (i = 0; i <= 15; i++)
{
if (mask & (1 << i))
/* nothing fetched, STM still in EXECUTE (1+i cycle) */
/* nothing fetched, STM still in EXECUTE (1 + i cycle) */
arm7tdmi_clock_data_in(jtag_info, core_regs[i]);
}
}
@@ -412,7 +412,7 @@ void arm7tdmi_read_core_regs_target_buffer(target_t *target, uint32_t mask, void

for (i = 0; i <= 15; i++)
{
/* nothing fetched, STM still in EXECUTE (1+i cycle), read databus */
/* nothing fetched, STM still in EXECUTE (1 + i cycle), read databus */
if (mask & (1 << i))
{
switch (size)
@@ -522,7 +522,7 @@ void arm7tdmi_write_core_regs(target_t *target, uint32_t mask, uint32_t core_reg
for (i = 0; i <= 15; i++)
{
if (mask & (1 << i))
/* nothing fetched, LDM still in EXECUTE (1+i cycle) */
/* nothing fetched, LDM still in EXECUTE (1 + i cycle) */
arm7tdmi_clock_out_inner(jtag_info, core_regs[i], 0);
}
arm7tdmi_clock_out_inner(jtag_info, ARMV4_5_NOP, 0);


+ 1
- 1
src/target/arm9tdmi.c View File

@@ -587,7 +587,7 @@ void arm9tdmi_write_core_regs(target_t *target, uint32_t mask, uint32_t core_reg
for (i = 0; i <= 15; i++)
{
if (mask & (1 << i))
/* nothing fetched, LDM still in EXECUTE (1+i cycle) */
/* nothing fetched, LDM still in EXECUTE (1 + i cycle) */
arm9tdmi_clock_out(jtag_info, ARMV4_5_NOP, core_regs[i], NULL, 0);
}
arm9tdmi_clock_out(jtag_info, ARMV4_5_NOP, 0, NULL, 0);


+ 1
- 1
src/target/arm_adi_v5.c View File

@@ -1093,7 +1093,7 @@ int dap_info_command(struct command_context_s *cmd_ctx, swjdp_common_t *swjdp, i
if (romentry&0x01)
{
uint32_t c_cid0,c_cid1,c_cid2,c_cid3,c_pid0,c_pid1,c_pid2,c_pid3,c_pid4,component_start;
uint32_t component_base = (uint32_t)((dbgbase&0xFFFFF000)+(int)(romentry&0xFFFFF000));
uint32_t component_base = (uint32_t)((dbgbase&0xFFFFF000) + (int)(romentry&0xFFFFF000));
mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000)|0xFE0, &c_pid0);
mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000)|0xFE4, &c_pid1);
mem_ap_read_atomic_u32(swjdp, (component_base&0xFFFFF000)|0xFE8, &c_pid2);


+ 1
- 1
src/target/armv4_5.c View File

@@ -71,7 +71,7 @@ char * armv4_5_mode_strings_list[] =
};

/* Hack! Yuk! allow -1 index, which simplifies codepaths elsewhere in the code */
char** armv4_5_mode_strings = armv4_5_mode_strings_list+1;
char** armv4_5_mode_strings = armv4_5_mode_strings_list + 1;

char* armv4_5_state_strings[] =
{


+ 26
- 26
src/target/etb.c View File

@@ -204,10 +204,10 @@ static int etb_read_ram(etb_t *etb, uint32_t *data, int num_frames)
else
buf_set_u32(fields[1].out_value, 0, 7, 0);

fields[0].in_value = (uint8_t *)(data+i);
fields[0].in_value = (uint8_t *)(data + i);
jtag_add_dr_scan(3, fields, jtag_get_end_state());

jtag_add_callback(etb_getbuf, (jtag_callback_data_t)(data+i));
jtag_add_callback(etb_getbuf, (jtag_callback_data_t)(data + i));
}

jtag_execute_queue();
@@ -550,32 +550,32 @@ static int etb_read_trace(etm_context_t *etm_ctx)
etm_ctx->trace_data[j].flags |= ETMV1_TRIGGER_CYCLE;
}

/* trace word j+1 */
etm_ctx->trace_data[j+1].pipestat = (trace_data[i] & 0x100) >> 8;
etm_ctx->trace_data[j+1].packet = (trace_data[i] & 0x7800) >> 11;
etm_ctx->trace_data[j+1].flags = 0;
/* trace word j + 1 */
etm_ctx->trace_data[j + 1].pipestat = (trace_data[i] & 0x100) >> 8;
etm_ctx->trace_data[j + 1].packet = (trace_data[i] & 0x7800) >> 11;
etm_ctx->trace_data[j + 1].flags = 0;
if ((trace_data[i] & 0x8000) >> 15)
{
etm_ctx->trace_data[j+1].flags |= ETMV1_TRACESYNC_CYCLE;
etm_ctx->trace_data[j + 1].flags |= ETMV1_TRACESYNC_CYCLE;
}
if (etm_ctx->trace_data[j+1].pipestat == STAT_TR)
if (etm_ctx->trace_data[j + 1].pipestat == STAT_TR)
{
etm_ctx->trace_data[j+1].pipestat = etm_ctx->trace_data[j+1].packet & 0x7;
etm_ctx->trace_data[j+1].flags |= ETMV1_TRIGGER_CYCLE;
etm_ctx->trace_data[j + 1].pipestat = etm_ctx->trace_data[j + 1].packet & 0x7;
etm_ctx->trace_data[j + 1].flags |= ETMV1_TRIGGER_CYCLE;
}

/* trace word j+2 */
etm_ctx->trace_data[j+2].pipestat = (trace_data[i] & 0x10000) >> 16;
etm_ctx->trace_data[j+2].packet = (trace_data[i] & 0x780000) >> 19;
etm_ctx->trace_data[j+2].flags = 0;
/* trace word j + 2 */
etm_ctx->trace_data[j + 2].pipestat = (trace_data[i] & 0x10000) >> 16;
etm_ctx->trace_data[j + 2].packet = (trace_data[i] & 0x780000) >> 19;
etm_ctx->trace_data[j + 2].flags = 0;
if ((trace_data[i] & 0x800000) >> 23)
{
etm_ctx->trace_data[j+2].flags |= ETMV1_TRACESYNC_CYCLE;
etm_ctx->trace_data[j + 2].flags |= ETMV1_TRACESYNC_CYCLE;
}
if (etm_ctx->trace_data[j+2].pipestat == STAT_TR)
if (etm_ctx->trace_data[j + 2].pipestat == STAT_TR)
{
etm_ctx->trace_data[j+2].pipestat = etm_ctx->trace_data[j+2].packet & 0x7;
etm_ctx->trace_data[j+2].flags |= ETMV1_TRIGGER_CYCLE;
etm_ctx->trace_data[j + 2].pipestat = etm_ctx->trace_data[j + 2].packet & 0x7;
etm_ctx->trace_data[j + 2].flags |= ETMV1_TRIGGER_CYCLE;
}

j += 3;
@@ -596,18 +596,18 @@ static int etb_read_trace(etm_context_t *etm_ctx)
etm_ctx->trace_data[j].flags |= ETMV1_TRIGGER_CYCLE;
}

/* trace word j+1 */
etm_ctx->trace_data[j+1].pipestat = (trace_data[i] & 0x7000) >> 12;
etm_ctx->trace_data[j+1].packet = (trace_data[i] & 0x7f8000) >> 15;
etm_ctx->trace_data[j+1].flags = 0;
/* trace word j + 1 */
etm_ctx->trace_data[j + 1].pipestat = (trace_data[i] & 0x7000) >> 12;
etm_ctx->trace_data[j + 1].packet = (trace_data[i] & 0x7f8000) >> 15;
etm_ctx->trace_data[j + 1].flags = 0;
if ((trace_data[i] & 0x800000) >> 23)
{
etm_ctx->trace_data[j+1].flags |= ETMV1_TRACESYNC_CYCLE;
etm_ctx->trace_data[j + 1].flags |= ETMV1_TRACESYNC_CYCLE;
}
if (etm_ctx->trace_data[j+1].pipestat == STAT_TR)
if (etm_ctx->trace_data[j + 1].pipestat == STAT_TR)
{
etm_ctx->trace_data[j+1].pipestat = etm_ctx->trace_data[j+1].packet & 0x7;
etm_ctx->trace_data[j+1].flags |= ETMV1_TRIGGER_CYCLE;
etm_ctx->trace_data[j + 1].pipestat = etm_ctx->trace_data[j + 1].packet & 0x7;
etm_ctx->trace_data[j + 1].flags |= ETMV1_TRIGGER_CYCLE;
}

j += 2;


+ 1
- 1
src/target/fa526.c View File

@@ -269,7 +269,7 @@ void fa526_write_core_regs(target_t *target, uint32_t mask, uint32_t core_regs[1
for (i = 0; i <= 15; i++)
{
if (mask & (1 << i))
/* nothing fetched, LDM still in EXECUTE (1+i cycle) */
/* nothing fetched, LDM still in EXECUTE (1 + i cycle) */
arm9tdmi_clock_out(jtag_info, ARMV4_5_NOP, core_regs[i], NULL, 0);
}
arm9tdmi_clock_out(jtag_info, ARMV4_5_NOP, 0, NULL, 0);


+ 2
- 2
src/target/image.c View File

@@ -454,9 +454,9 @@ static int image_elf_read_section(image_t *image, int section, uint32_t offset,
/* maximal size present in file for the current segment */
read_size = MIN(size, field32(elf,segment->p_filesz)-offset);
LOG_DEBUG("read elf: size = 0x%" PRIx32 " at 0x%" PRIx32 "",read_size,
field32(elf,segment->p_offset)+offset);
field32(elf,segment->p_offset) + offset);
/* read initialized area of the segment */
if ((retval = fileio_seek(&elf->fileio, field32(elf,segment->p_offset)+offset)) != ERROR_OK)
if ((retval = fileio_seek(&elf->fileio, field32(elf,segment->p_offset) + offset)) != ERROR_OK)
{
LOG_ERROR("cannot find ELF segment content, seek failed");
return retval;


+ 6
- 6
src/target/mips32_dmaacc.c View File

@@ -370,7 +370,7 @@ int mips32_dmaacc_read_mem32(mips_ejtag_t *ejtag_info, uint32_t addr, int count,
int retval;

for (i = 0; i<count; i++) {
if ((retval = ejtag_dma_read(ejtag_info, addr+i*sizeof(*buf), &buf[i])) != ERROR_OK)
if ((retval = ejtag_dma_read(ejtag_info, addr + i*sizeof(*buf), &buf[i])) != ERROR_OK)
return retval;
}

@@ -383,7 +383,7 @@ int mips32_dmaacc_read_mem16(mips_ejtag_t *ejtag_info, uint32_t addr, int count,
int retval;

for (i = 0; i<count; i++) {
if ((retval = ejtag_dma_read_h(ejtag_info, addr+i*sizeof(*buf), &buf[i])) != ERROR_OK)
if ((retval = ejtag_dma_read_h(ejtag_info, addr + i*sizeof(*buf), &buf[i])) != ERROR_OK)
return retval;
}

@@ -396,7 +396,7 @@ int mips32_dmaacc_read_mem8(mips_ejtag_t *ejtag_info, uint32_t addr, int count,
int retval;

for (i = 0; i<count; i++) {
if ((retval = ejtag_dma_read_b(ejtag_info, addr+i*sizeof(*buf), &buf[i])) != ERROR_OK)
if ((retval = ejtag_dma_read_b(ejtag_info, addr + i*sizeof(*buf), &buf[i])) != ERROR_OK)
return retval;
}

@@ -424,7 +424,7 @@ int mips32_dmaacc_write_mem32(mips_ejtag_t *ejtag_info, uint32_t addr, int count
int retval;

for (i = 0; i<count; i++) {
if ((retval = ejtag_dma_write(ejtag_info, addr+i*sizeof(*buf), buf[i])) != ERROR_OK)
if ((retval = ejtag_dma_write(ejtag_info, addr + i*sizeof(*buf), buf[i])) != ERROR_OK)
return retval;
}

@@ -437,7 +437,7 @@ int mips32_dmaacc_write_mem16(mips_ejtag_t *ejtag_info, uint32_t addr, int count
int retval;

for (i = 0; i<count; i++) {
if ((retval = ejtag_dma_write_h(ejtag_info, addr+i*sizeof(*buf), buf[i])) != ERROR_OK)
if ((retval = ejtag_dma_write_h(ejtag_info, addr + i*sizeof(*buf), buf[i])) != ERROR_OK)
return retval;
}

@@ -450,7 +450,7 @@ int mips32_dmaacc_write_mem8(mips_ejtag_t *ejtag_info, uint32_t addr, int count,
int retval;

for (i = 0; i<count; i++) {
if ((retval = ejtag_dma_write_b(ejtag_info, addr+i*sizeof(*buf), buf[i])) != ERROR_OK)
if ((retval = ejtag_dma_write_b(ejtag_info, addr + i*sizeof(*buf), buf[i])) != ERROR_OK)
return retval;
}



+ 9
- 9
src/target/mips32_pracc.c View File

@@ -302,7 +302,7 @@ int mips32_pracc_read_mem32(mips_ejtag_t *ejtag_info, uint32_t addr, int count,
MIPS32_LUI(8,UPPER16(MIPS32_PRACC_PARAM_IN)), /* $8 = MIPS32_PRACC_PARAM_IN */
MIPS32_ORI(8,8,LOWER16(MIPS32_PRACC_PARAM_IN)),
MIPS32_LW(9,0,8), /* $9 = mem[$8]; read addr */
MIPS32_LW(10,4,8), /* $10 = mem[$8+4]; read count */
MIPS32_LW(10,4,8), /* $10 = mem[$8 + 4]; read count */
MIPS32_LUI(11,UPPER16(MIPS32_PRACC_PARAM_OUT)), /* $11 = MIPS32_PRACC_PARAM_OUT */
MIPS32_ORI(11,11,LOWER16(MIPS32_PRACC_PARAM_OUT)),
MIPS32_NOP,
@@ -410,7 +410,7 @@ int mips32_pracc_read_mem16(mips_ejtag_t *ejtag_info, uint32_t addr, int count,
MIPS32_LUI(8,UPPER16(MIPS32_PRACC_PARAM_IN)), /* $8 = MIPS32_PRACC_PARAM_IN */
MIPS32_ORI(8,8,LOWER16(MIPS32_PRACC_PARAM_IN)),
MIPS32_LW(9,0,8), /* $9 = mem[$8]; read addr */
MIPS32_LW(10,4,8), /* $10 = mem[$8+4]; read count */
MIPS32_LW(10,4,8), /* $10 = mem[$8 + 4]; read count */
MIPS32_LUI(11,UPPER16(MIPS32_PRACC_PARAM_OUT)), /* $11 = MIPS32_PRACC_PARAM_OUT */
MIPS32_ORI(11,11,LOWER16(MIPS32_PRACC_PARAM_OUT)),
MIPS32_NOP,
@@ -489,7 +489,7 @@ int mips32_pracc_read_mem8(mips_ejtag_t *ejtag_info, uint32_t addr, int count, u
MIPS32_LUI(8,UPPER16(MIPS32_PRACC_PARAM_IN)), /* $8 = MIPS32_PRACC_PARAM_IN */
MIPS32_ORI(8,8,LOWER16(MIPS32_PRACC_PARAM_IN)),
MIPS32_LW(9,0,8), /* $9 = mem[$8]; read addr */
MIPS32_LW(10,4,8), /* $10 = mem[$8+4]; read count */
MIPS32_LW(10,4,8), /* $10 = mem[$8 + 4]; read count */
MIPS32_LUI(11,UPPER16(MIPS32_PRACC_PARAM_OUT)), /* $11 = MIPS32_PRACC_PARAM_OUT */
MIPS32_ORI(11,11,LOWER16(MIPS32_PRACC_PARAM_OUT)),
MIPS32_NOP,
@@ -608,7 +608,7 @@ int mips32_pracc_write_mem32(mips_ejtag_t *ejtag_info, uint32_t addr, int count,
};
/* TODO remove array */
uint32_t param_in[count+2];
uint32_t param_in[count + 2];
param_in[0] = addr;
param_in[1] = addr + count * sizeof(uint32_t); //last address
@@ -643,7 +643,7 @@ int mips32_pracc_write_u32(mips_ejtag_t *ejtag_info, uint32_t addr, uint32_t *bu
};

/* TODO remove array */
uint32_t param_in[1+1];
uint32_t param_in[1 + 1];
param_in[0] = addr;
param_in[1] = *buf;

@@ -697,14 +697,14 @@ int mips32_pracc_write_mem16(mips_ejtag_t *ejtag_info, uint32_t addr, int count,
};
/* TODO remove array */
uint32_t param_in[count+2];
uint32_t param_in[count + 2];
int i;
param_in[0] = addr;
param_in[1] = count;
for (i = 0; i < count; i++)
{
param_in[i+2] = buf[i];
param_in[i + 2] = buf[i];
}
mips32_pracc_exec(ejtag_info, sizeof(code)/sizeof(code[0]), code, \
@@ -757,7 +757,7 @@ int mips32_pracc_write_mem8(mips_ejtag_t *ejtag_info, uint32_t addr, int count,
};
/* TODO remove array */
uint32_t param_in[count+2];
uint32_t param_in[count + 2];
int retval;
int i;
param_in[0] = addr;
@@ -765,7 +765,7 @@ int mips32_pracc_write_mem8(mips_ejtag_t *ejtag_info, uint32_t addr, int count,
for (i = 0; i < count; i++)
{
param_in[i+2] = buf[i];
param_in[i + 2] = buf[i];
}
retval = mips32_pracc_exec(ejtag_info, sizeof(code)/sizeof(code[0]), code, \


+ 8
- 8
src/target/oocd_trace.c View File

@@ -197,7 +197,7 @@ static int oocd_trace_read_trace(etm_context_t *etm_ctx)
num_frames = address;

/* read data into temporary array for unpacking
* one frame from OpenOCD+trace corresponds to 16 trace cycles
* one frame from OpenOCD + trace corresponds to 16 trace cycles
*/
trace_data = malloc(sizeof(uint8_t) * num_frames * 16);
oocd_trace_read_memory(oocd_trace, trace_data, first_frame, num_frames);
@@ -242,7 +242,7 @@ static int oocd_trace_start_capture(etm_context_t *etm_ctx)
if (((etm_ctx->portmode & ETM_PORT_MODE_MASK) != ETM_PORT_NORMAL)
|| ((etm_ctx->portmode & ETM_PORT_WIDTH_MASK) != ETM_PORT_4BIT))
{
LOG_DEBUG("OpenOCD+trace only supports normal 4-bit ETM mode");
LOG_DEBUG("OpenOCD + trace only supports normal 4-bit ETM mode");
return ERROR_ETM_PORTMODE_NOT_SUPPORTED;
}

@@ -251,7 +251,7 @@ static int oocd_trace_start_capture(etm_context_t *etm_ctx)
control |= 0x2; /* half rate clock, capture at twice the clock rate */
}

/* OpenOCD+trace holds up to 16 million samples,
/* OpenOCD + trace holds up to 16 million samples,
* but trigger counts is set in multiples of 16 */
trigger_count = (1048576 * etm_ctx->trigger_percent) / 100;

@@ -316,12 +316,12 @@ static int handle_oocd_trace_config_command(struct command_context_s *cmd_ctx, c
arm7_9->etm_ctx->capture_driver_priv = oocd_trace;
oocd_trace->etm_ctx = arm7_9->etm_ctx;

/* copy name of TTY device used to communicate with OpenOCD+trace */
/* copy name of TTY device used to communicate with OpenOCD + trace */
oocd_trace->tty = strndup(args[1], 256);
}
else
{
LOG_ERROR("target has no ETM defined, OpenOCD+trace left unconfigured");
LOG_ERROR("target has no ETM defined, OpenOCD + trace left unconfigured");
}

return ERROR_OK;
@@ -412,12 +412,12 @@ int oocd_trace_register_commands(struct command_context_s *cmd_ctx)
{
command_t *oocd_trace_cmd;

oocd_trace_cmd = register_command(cmd_ctx, NULL, "oocd_trace", NULL, COMMAND_ANY, "OpenOCD+trace");
oocd_trace_cmd = register_command(cmd_ctx, NULL, "oocd_trace", NULL, COMMAND_ANY, "OpenOCD + trace");

register_command(cmd_ctx, oocd_trace_cmd, "config", handle_oocd_trace_config_command, COMMAND_CONFIG, NULL);

register_command(cmd_ctx, oocd_trace_cmd, "status", handle_oocd_trace_status_command, COMMAND_EXEC, "display OpenOCD+trace status");
register_command(cmd_ctx, oocd_trace_cmd, "resync", handle_oocd_trace_resync_command, COMMAND_EXEC, "resync OpenOCD+trace capture clock");
register_command(cmd_ctx, oocd_trace_cmd, "status", handle_oocd_trace_status_command, COMMAND_EXEC, "display OpenOCD + trace status");
register_command(cmd_ctx, oocd_trace_cmd, "resync", handle_oocd_trace_resync_command, COMMAND_EXEC, "resync OpenOCD + trace capture clock");

return ERROR_OK;
}

+ 23
- 23
src/target/target.c View File

@@ -246,7 +246,7 @@ static int max_target_number(void)
t = all_targets;
while ( t ){
if ( x < t->target_number ){
x = (t->target_number)+1;
x = (t->target_number) + 1;
}
t = t->next;
}
@@ -268,7 +268,7 @@ static int new_target_number(void)
}
t = t->next;
}
return x+1;
return x + 1;
}

static int target_continuous_poll = 1;
@@ -492,7 +492,7 @@ static int jtag_enable_callback(enum jtag_event event, void *priv)
}


/* Targets that correctly implement init+examine, i.e.
/* Targets that correctly implement init + examine, i.e.
* no communication with target during init:
*
* XScale
@@ -1118,7 +1118,7 @@ int target_write_buffer(struct target_s *target, uint32_t address, uint32_t size
if ((address + size - 1) < address)
{
/* GDB can request this when e.g. PC is 0xfffffffc*/
LOG_ERROR("address+size wrapped(0x%08x, 0x%08x)",
LOG_ERROR("address + size wrapped(0x%08x, 0x%08x)",
(unsigned)address,
(unsigned)size);
return ERROR_FAIL;
@@ -1200,7 +1200,7 @@ int target_read_buffer(struct target_s *target, uint32_t address, uint32_t size,
if ((address + size - 1) < address)
{
/* GDB can request this when e.g. PC is 0xfffffffc*/
LOG_ERROR("address+size wrapped(0x%08" PRIx32 ", 0x%08" PRIx32 ")",
LOG_ERROR("address + size wrapped(0x%08" PRIx32 ", 0x%08" PRIx32 ")",
address,
size);
return ERROR_FAIL;
@@ -2279,7 +2279,7 @@ static int handle_load_image_command(struct command_context_s *cmd_ctx, char *cm

/* DANGER!!! beware of unsigned comparision here!!! */

if ((image.sections[i].base_address+buf_cnt >= min_address)&&
if ((image.sections[i].base_address + buf_cnt >= min_address)&&
(image.sections[i].base_address<max_address))
{
if (image.sections[i].base_address<min_address)
@@ -2289,12 +2289,12 @@ static int handle_load_image_command(struct command_context_s *cmd_ctx, char *cm
length -= offset;
}

if (image.sections[i].base_address+buf_cnt>max_address)
if (image.sections[i].base_address + buf_cnt>max_address)
{
length -= (image.sections[i].base_address+buf_cnt)-max_address;
length -= (image.sections[i].base_address + buf_cnt)-max_address;
}

if ((retval = target_write_buffer(target, image.sections[i].base_address+offset, length, buffer+offset)) != ERROR_OK)
if ((retval = target_write_buffer(target, image.sections[i].base_address + offset, length, buffer + offset)) != ERROR_OK)
{
free(buffer);
break;
@@ -2302,7 +2302,7 @@ static int handle_load_image_command(struct command_context_s *cmd_ctx, char *cm
image_size += length;
command_print(cmd_ctx, "%u byte written at address 0x%8.8" PRIx32 "",
(unsigned int)length,
image.sections[i].base_address+offset);
image.sections[i].base_address + offset);
}

free(buffer);
@@ -2834,7 +2834,7 @@ static void writeGmon(uint32_t *samples, uint32_t sampleNum, char *filename)
}
}

int addressSpace = (max-min+1);
int addressSpace = (max-min + 1);

static const uint32_t maxBuckets = 256 * 1024; /* maximum buckets. */
uint32_t length = addressSpace;
@@ -2883,7 +2883,7 @@ static void writeGmon(uint32_t *samples, uint32_t sampleNum, char *filename)
val = 65535;
}
data[i*2]=val&0xff;
data[i*2+1]=(val >> 8)&0xff;
data[i*2 + 1]=(val >> 8)&0xff;
}
free(buckets);
writeData(f, data, length * 2);
@@ -3028,7 +3028,7 @@ static int jim_mem2array(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return JIM_ERR;
}

return target_mem2array(interp, target, argc-1, argv+1);
return target_mem2array(interp, target, argc-1, argv + 1);
}

static int target_mem2array(Jim_Interp *interp, target_t *target, int argc, Jim_Obj *const *argv)
@@ -3215,7 +3215,7 @@ static int jim_array2mem(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return JIM_ERR;
}

return target_array2mem( interp,target, argc-1, argv+1 );
return target_array2mem( interp,target, argc-1, argv + 1 );
}

static int target_array2mem(Jim_Interp *interp, target_t *target, int argc, Jim_Obj *const *argv)
@@ -3749,7 +3749,7 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
};

/* go past the "command" */
Jim_GetOpt_Setup( &goi, interp, argc-1, argv+1 );
Jim_GetOpt_Setup( &goi, interp, argc-1, argv + 1 );

target = Jim_CmdPrivData( goi.interp );
cmd_ctx = Jim_GetAssocData(goi.interp, "context");
@@ -4141,7 +4141,7 @@ static int target_create( Jim_GetOptInfo *goi )
if ( target_types[x] == NULL ){
Jim_SetResult_sprintf( goi->interp, "Unknown target type %s, try one of ", cp );
for ( x = 0 ; target_types[x] ; x++ ){
if ( target_types[x+1] ){
if ( target_types[x + 1] ){
Jim_AppendStrings( goi->interp,
Jim_GetResult(goi->interp),
target_types[x]->name,
@@ -4283,7 +4283,7 @@ static int jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv )

cmd_ctx = Jim_GetAssocData( interp, "context" );

Jim_GetOpt_Setup( &goi, interp, argc-1, argv+1 );
Jim_GetOpt_Setup( &goi, interp, argc-1, argv + 1 );

if ( goi.argc == 0 ){
Jim_WrongNumArgs(interp, 1, argv, "missing: command ...");
@@ -4460,7 +4460,7 @@ static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, cha

/* DANGER!!! beware of unsigned comparision here!!! */

if ((image.sections[i].base_address+buf_cnt >= min_address)&&
if ((image.sections[i].base_address + buf_cnt >= min_address)&&
(image.sections[i].base_address<max_address))
{
if (image.sections[i].base_address<min_address)
@@ -4470,25 +4470,25 @@ static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, cha
length -= offset;
}

if (image.sections[i].base_address+buf_cnt>max_address)
if (image.sections[i].base_address + buf_cnt>max_address)
{
length -= (image.sections[i].base_address+buf_cnt)-max_address;
length -= (image.sections[i].base_address + buf_cnt)-max_address;
}

fastload[i].address = image.sections[i].base_address+offset;
fastload[i].address = image.sections[i].base_address + offset;
fastload[i].data = malloc(length);
if (fastload[i].data == NULL)
{
free(buffer);
break;
}
memcpy(fastload[i].data, buffer+offset, length);
memcpy(fastload[i].data, buffer + offset, length);
fastload[i].length = length;

image_size += length;
command_print(cmd_ctx, "%u byte written at address 0x%8.8x",
(unsigned int)length,
((unsigned int)(image.sections[i].base_address+offset)));
((unsigned int)(image.sections[i].base_address + offset)));
}

free(buffer);


+ 12
- 12
src/target/xscale.c View File

@@ -264,8 +264,8 @@ int xscale_read_dcsr(target_t *target)

jtag_add_dr_scan(3, fields, jtag_get_end_state());

jtag_check_value_mask(fields+0, &field0_check_value, &field0_check_mask);
jtag_check_value_mask(fields+2, &field2_check_value, &field2_check_mask);
jtag_check_value_mask(fields + 0, &field0_check_value, &field0_check_mask);
jtag_check_value_mask(fields + 2, &field2_check_value, &field2_check_mask);

if ((retval = jtag_execute_queue()) != ERROR_OK)
{
@@ -362,11 +362,11 @@ int xscale_receive(target_t *target, uint32_t *buffer, int num_words)

jtag_add_pathmove(3, path);

fields[1].in_value = (uint8_t *)(field1+i);
fields[1].in_value = (uint8_t *)(field1 + i);

jtag_add_dr_scan_check(3, fields, jtag_set_end_state(TAP_IDLE));

jtag_add_callback(xscale_getbuf, (jtag_callback_data_t)(field1+i));
jtag_add_callback(xscale_getbuf, (jtag_callback_data_t)(field1 + i));

words_scheduled++;
}
@@ -386,8 +386,8 @@ int xscale_receive(target_t *target, uint32_t *buffer, int num_words)
int j;
for (j = i; j < num_words - 1; j++)
{
field0[j] = field0[j+1];
field1[j] = field1[j+1];
field0[j] = field0[j + 1];
field1[j] = field1[j + 1];
}
words_scheduled--;
}
@@ -480,8 +480,8 @@ int xscale_read_tx(target_t *target, int consume)

jtag_add_dr_scan(3, fields, jtag_set_end_state(TAP_IDLE));

jtag_check_value_mask(fields+0, &field0_check_value, &field0_check_mask);
jtag_check_value_mask(fields+2, &field2_check_value, &field2_check_mask);
jtag_check_value_mask(fields + 0, &field0_check_value, &field0_check_mask);
jtag_check_value_mask(fields + 2, &field2_check_value, &field2_check_mask);

if ((retval = jtag_execute_queue()) != ERROR_OK)
{
@@ -563,8 +563,8 @@ int xscale_write_rx(target_t *target)
{
jtag_add_dr_scan(3, fields, jtag_set_end_state(TAP_IDLE));

jtag_check_value_mask(fields+0, &field0_check_value, &field0_check_mask);
jtag_check_value_mask(fields+2, &field2_check_value, &field2_check_mask);
jtag_check_value_mask(fields + 0, &field0_check_value, &field0_check_mask);
jtag_check_value_mask(fields + 2, &field2_check_value, &field2_check_mask);

if ((retval = jtag_execute_queue()) != ERROR_OK)
{
@@ -728,8 +728,8 @@ int xscale_write_dcsr(target_t *target, int hold_rst, int ext_dbg_brk)

jtag_add_dr_scan(3, fields, jtag_get_end_state());

jtag_check_value_mask(fields+0, &field0_check_value, &field0_check_mask);
jtag_check_value_mask(fields+2, &field2_check_value, &field2_check_mask);
jtag_check_value_mask(fields + 0, &field0_check_value, &field0_check_mask);
jtag_check_value_mask(fields + 2, &field2_check_value, &field2_check_mask);

if ((retval = jtag_execute_queue()) != ERROR_OK)
{


+ 2
- 2
src/xsvf/xsvf.c View File

@@ -82,7 +82,7 @@

! Set the maximum loop count to 25.
LCOUNT 25;
! Step to DRPAUSE give 5 clocks and wait for 1.00e+000 SEC.
! Step to DRPAUSE give 5 clocks and wait for 1.00e + 000 SEC.
LDELAY DRPAUSE 5 TCK 1.00E-003 SEC;
! Test for the completed status. Match means pass.
! Loop back to LDELAY line if not match and loop count less than 25.
@@ -605,7 +605,7 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha
LOG_DEBUG("XSIR2 %d", bitcount);
}

ir_buf = malloc((bitcount+7) / 8);
ir_buf = malloc((bitcount + 7) / 8);

if (xsvf_read_buffer(bitcount, xsvf_fd, ir_buf) != ERROR_OK)
do_abort = 1;


Loading…
Cancel
Save