* Copyright (C) 2005 by Dominic Rath *
* Dominic.Rath@gmx.de *
* *
-* Copyright (C) 2007,2008 Øyvind Harboe *
+* Copyright (C) 2007-2010 Øyvind Harboe *
* oyvind.harboe@zylin.com *
* *
* This program is free software; you can redistribute it and/or modify *
/// The number of bits this field specifies (up to 32)
int num_bits;
/// A pointer to value to be scanned into the device
- uint8_t* out_value;
+ const uint8_t* out_value;
/// A pointer to a 32-bit memory location for data scanned out
uint8_t* in_value;
* Copyright (C) 2005 by Dominic Rath *
* Dominic.Rath@gmx.de *
* *
- * Copyright (C) 2007,2008 Øyvind Harboe *
+ * Copyright (C) 2007-2010 Øyvind Harboe *
* oyvind.harboe@zylin.com *
* *
* Copyright (C) 2009 SoftPLC Corporation *
str = Jim_GetString(args[i + 1], &len);
fields[field_count].num_bits = bits;
- fields[field_count].out_value = malloc(DIV_ROUND_UP(bits, 8));
- str_to_buf(str, len, fields[field_count].out_value, bits, 0);
- fields[field_count].in_value = fields[field_count].out_value;
+ void * t = malloc(DIV_ROUND_UP(bits, 8));
+ fields[field_count].out_value = t;
+ str_to_buf(str, len, t, bits, 0);
+ fields[field_count].in_value = t;
field_count++;
}
Jim_GetLong(interp, args[i], &bits);
str = buf_to_str(fields[field_count].in_value, bits, 16);
- free(fields[field_count].out_value);
+ free((void *)fields[field_count].out_value);
Jim_ListAppendElement(interp, list, Jim_NewStringObj(interp, str, strlen(str)));
free(str);
{
int j;
for (j = 0; j < i; j++)
- free(fields[j].out_value);
+ free((void *)fields[j].out_value);
free(fields);
command_print(CMD_CTX, "Tap: %s unknown", CMD_ARGV[i*2]);
retval = parse_u32(CMD_ARGV[i * 2 + 1], &value);
if (ERROR_OK != retval)
goto error_return;
- buf_set_u32(fields[i].out_value, 0, field_size, value);
+ buf_set_u32((void *)fields[i].out_value, 0, field_size, value);
fields[i].in_value = NULL;
}
for (i = 0; i < num_fields; i++)
{
if (NULL != fields[i].out_value)
- free(fields[i].out_value);
+ free((void *)fields[i].out_value);
}
free (fields);
* Copyright (C) 2005 by Dominic Rath *
* Dominic.Rath@gmx.de *
* *
- * Copyright (C) 2007,2008,2009 Øyvind Harboe *
+ * Copyright (C) 2007-2010 Øyvind Harboe *
* oyvind.harboe@zylin.com *
* *
* Copyright (C) 2008 by Spencer Oliver *
/* bits 36:32 -- register */
fields[1].num_bits = 5;
fields[1].out_value = field1_out;
- fields[1].out_value[0] = reg_addr;
+ field1_out[0] = reg_addr;
fields[1].in_value = NULL;
fields[1].check_value = NULL;
fields[1].check_mask = NULL;
/* bit 37 -- 0/read */
fields[2].num_bits = 1;
fields[2].out_value = field2_out;
- fields[2].out_value[0] = 0;
+ field2_out[0] = 0;
fields[2].in_value = NULL;
fields[2].check_value = NULL;
fields[2].check_mask = NULL;
* EICE_COMMS_DATA would read the register twice
* reading the control register is safe
*/
- fields[1].out_value[0] = eice_regs[EICE_COMMS_CTRL].addr;
+ field1_out[0] = eice_regs[EICE_COMMS_CTRL].addr;
/* traverse Update-DR, reading but with no other side effects */
jtag_add_dr_scan_check(ice_reg->jtag_info->tap, 3, fields, TAP_IDLE);
fields[1].num_bits = 5;
fields[1].out_value = field1_out;
- fields[1].out_value[0] = eice_regs[EICE_COMMS_DATA].addr;
+ field1_out[0] = eice_regs[EICE_COMMS_DATA].addr;
fields[1].in_value = NULL;
fields[2].num_bits = 1;
fields[2].out_value = field2_out;
- fields[2].out_value[0] = 0;
+ field2_out[0] = 0;
fields[2].in_value = NULL;
jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);
* to avoid reading additional data from the DCC data reg
*/
if (size == 1)
- fields[1].out_value[0] = eice_regs[EICE_COMMS_CTRL].addr;
+ field1_out[0] = eice_regs[EICE_COMMS_CTRL].addr;
fields[0].in_value = (uint8_t *)data;
jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);
fields[1].num_bits = 5;
fields[1].out_value = field1_out;
- fields[1].out_value[0] = eice_regs[EICE_COMMS_DATA].addr;
+ field1_out[0] = eice_regs[EICE_COMMS_DATA].addr;
fields[1].in_value = NULL;
fields[2].num_bits = 1;
fields[2].out_value = field2_out;
- fields[2].out_value[0] = 1;
+ field2_out[0] = 1;
fields[2].in_value = NULL;
while (size > 0)
{
- buf_set_u32(fields[0].out_value, 0, 32, *data);
+ buf_set_u32(field0_out, 0, 32, *data);
jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);
data++;
fields[1].num_bits = 5;
fields[1].out_value = field1_out;
- fields[1].out_value[0] = eice_regs[EICE_COMMS_DATA].addr;
+ field1_out[0] = eice_regs[EICE_COMMS_DATA].addr;
fields[1].in_value = NULL;
fields[2].num_bits = 1;
fields[2].out_value = field2_out;
- fields[2].out_value[0] = 0;
+ field2_out[0] = 0;
fields[2].in_value = NULL;
jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);
struct scan_field field;
field.num_bits = tap->ir_length;
- field.out_value = calloc(DIV_ROUND_UP(field.num_bits, 8), 1);
- buf_set_u32(field.out_value, 0, field.num_bits, new_instr);
+ void * t = calloc(DIV_ROUND_UP(field.num_bits, 8), 1);
+ field.out_value = t;
+ buf_set_u32(t, 0, field.num_bits, new_instr);
field.in_value = NULL;
jtag_add_ir_scan(tap, &field, TAP_IDLE);
- free(field.out_value);
+ free(t);
}
return ERROR_OK;
struct scan_field field;
field.num_bits = 5;
- field.out_value = calloc(DIV_ROUND_UP(field.num_bits, 8), 1);
- buf_set_u32(field.out_value, 0, field.num_bits, new_scan_chain);
+ void * t = calloc(DIV_ROUND_UP(field.num_bits, 8), 1);
+ field.out_value = t;
+ buf_set_u32(t, 0, field.num_bits, new_scan_chain);
field.in_value = NULL;
etb->cur_scan_chain = new_scan_chain;
- free(field.out_value);
+ free(t);
}
return ERROR_OK;
fields[0].in_value = NULL;
fields[1].num_bits = 7;
- fields[1].out_value = malloc(1);
- buf_set_u32(fields[1].out_value, 0, 7, 4);
+ uint8_t temp1;
+ fields[1].out_value = &temp1;
+ buf_set_u32(&temp1, 0, 7, 4);
fields[1].in_value = NULL;
fields[2].num_bits = 1;
- fields[2].out_value = malloc(1);
- buf_set_u32(fields[2].out_value, 0, 1, 0);
+ uint8_t temp2;
+ fields[2].out_value = &temp2;
+ buf_set_u32(&temp2, 0, 1, 0);
fields[2].in_value = NULL;
jtag_add_dr_scan(etb->tap, 3, fields, TAP_IDLE);
for (i = 0; i < num_frames; i++)
{
/* ensure nR/W reamins set to read */
- buf_set_u32(fields[2].out_value, 0, 1, 0);
+ buf_set_u32(&temp2, 0, 1, 0);
/* address remains set to 0x4 (RAM data) until we read the last frame */
if (i < num_frames - 1)
- buf_set_u32(fields[1].out_value, 0, 7, 4);
+ buf_set_u32(&temp1, 0, 7, 4);
else
- buf_set_u32(fields[1].out_value, 0, 7, 0);
+ buf_set_u32(&temp1, 0, 7, 0);
fields[0].in_value = (uint8_t *)(data + i);
jtag_add_dr_scan(etb->tap, 3, fields, TAP_IDLE);
jtag_execute_queue();
- free(fields[1].out_value);
- free(fields[2].out_value);
-
return ERROR_OK;
}
fields[0].check_mask = NULL;
fields[1].num_bits = 7;
- fields[1].out_value = malloc(1);
- buf_set_u32(fields[1].out_value, 0, 7, reg_addr);
+ uint8_t temp1;
+ fields[1].out_value = &temp1;
+ buf_set_u32(&temp1, 0, 7, reg_addr);
fields[1].in_value = NULL;
fields[1].check_value = NULL;
fields[1].check_mask = NULL;
fields[2].num_bits = 1;
- fields[2].out_value = malloc(1);
- buf_set_u32(fields[2].out_value, 0, 1, 0);
+ uint8_t temp2;
+ fields[2].out_value = &temp2;
+ buf_set_u32(&temp2, 0, 1, 0);
fields[2].in_value = NULL;
fields[2].check_value = NULL;
fields[2].check_mask = NULL;
/* read the identification register in the second run, to make sure we
* don't read the ETB data register twice, skipping every second entry
*/
- buf_set_u32(fields[1].out_value, 0, 7, 0x0);
+ buf_set_u32(&temp1, 0, 7, 0x0);
fields[0].in_value = reg->value;
fields[0].check_value = check_value;
fields[0].check_mask = check_mask;
jtag_add_dr_scan_check(etb_reg->etb->tap, 3, fields, TAP_IDLE);
- free(fields[1].out_value);
- free(fields[2].out_value);
-
return ERROR_OK;
}
etb_set_instr(etb_reg->etb, 0xc);
fields[0].num_bits = 32;
- fields[0].out_value = malloc(4);
- buf_set_u32(fields[0].out_value, 0, 32, value);
+ uint8_t temp0[4];
+ fields[0].out_value = temp0;
+ buf_set_u32(&temp0, 0, 32, value);
fields[0].in_value = NULL;
fields[1].num_bits = 7;
- fields[1].out_value = malloc(1);
- buf_set_u32(fields[1].out_value, 0, 7, reg_addr);
+ uint8_t temp1;
+ fields[1].out_value = &temp1;
+ buf_set_u32(&temp1, 0, 7, reg_addr);
fields[1].in_value = NULL;
fields[2].num_bits = 1;
- fields[2].out_value = malloc(1);
- buf_set_u32(fields[2].out_value, 0, 1, 1);
+ uint8_t temp2;
+ fields[2].out_value = &temp2;
+ buf_set_u32(&temp2, 0, 1, 1);
fields[2].in_value = NULL;
-
- free(fields[0].out_value);
- free(fields[1].out_value);
- free(fields[2].out_value);
-
return ERROR_OK;
}
fields[0].check_mask = NULL;
fields[1].num_bits = 7;
- fields[1].out_value = malloc(1);
- buf_set_u32(fields[1].out_value, 0, 7, reg_addr);
+ uint8_t temp1;
+ fields[1].out_value = &temp1;
+ buf_set_u32(&temp1, 0, 7, reg_addr);
fields[1].in_value = NULL;
fields[1].check_value = NULL;
fields[1].check_mask = NULL;
fields[2].num_bits = 1;
- fields[2].out_value = malloc(1);
- buf_set_u32(fields[2].out_value, 0, 1, 0);
+ uint8_t temp2;
+ fields[2].out_value = &temp2;
+ buf_set_u32(&temp2, 0, 1, 0);
fields[2].in_value = NULL;
fields[2].check_value = NULL;
fields[2].check_mask = NULL;
jtag_add_dr_scan_check(etm_reg->jtag_info->tap, 3, fields, TAP_IDLE);
- free(fields[1].out_value);
- free(fields[2].out_value);
-
return ERROR_OK;
}
fields[0].num_bits = 32;
uint8_t tmp1[4];
fields[0].out_value = tmp1;
- buf_set_u32(fields[0].out_value, 0, 32, value);
+ buf_set_u32(tmp1, 0, 32, value);
fields[0].in_value = NULL;
fields[1].num_bits = 7;
uint8_t tmp2;
fields[1].out_value = &tmp2;
- buf_set_u32(fields[1].out_value, 0, 7, reg_addr);
+ buf_set_u32(&tmp2, 0, 7, reg_addr);
fields[1].in_value = NULL;
fields[2].num_bits = 1;
uint8_t tmp3;
fields[2].out_value = &tmp3;
- buf_set_u32(fields[2].out_value, 0, 1, 1);
+ buf_set_u32(&tmp3, 0, 1, 1);
fields[2].in_value = NULL;
jtag_add_dr_scan(etm_reg->jtag_info->tap, 3, fields, TAP_IDLE);