summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-05-11 12:03:40 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-05-11 12:03:40 +0000
commitf17bb0cf1ef02b67af0e8265d0131a15a9dc6474 (patch)
tree277f4c47a663cad65fedcbb445ad5b5581df2acc /src
parentce23eb7e3aebbf03e1f1cab436f417d034395439 (diff)
downloadopenocd_libswd-f17bb0cf1ef02b67af0e8265d0131a15a9dc6474.tar.gz
openocd_libswd-f17bb0cf1ef02b67af0e8265d0131a15a9dc6474.tar.bz2
openocd_libswd-f17bb0cf1ef02b67af0e8265d0131a15a9dc6474.tar.xz
openocd_libswd-f17bb0cf1ef02b67af0e8265d0131a15a9dc6474.zip
fix jtag_add_dr_scan() usage a bit... avoid lots of malloc()'s.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1746 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src')
-rw-r--r--src/target/etm.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/target/etm.c b/src/target/etm.c
index a581df34..c54087a0 100644
--- a/src/target/etm.c
+++ b/src/target/etm.c
@@ -411,31 +411,27 @@ int etm_write_reg(reg_t *reg, u32 value)
fields[0].tap = etm_reg->jtag_info->tap;
fields[0].num_bits = 32;
- fields[0].out_value = malloc(4);
+ u8 tmp1[4];
+ fields[0].out_value = tmp1;
buf_set_u32(fields[0].out_value, 0, 32, value);
-
fields[0].in_value = NULL;
fields[1].tap = etm_reg->jtag_info->tap;
fields[1].num_bits = 7;
- fields[1].out_value = malloc(1);
+ u8 tmp2;
+ fields[1].out_value = &tmp2;
buf_set_u32(fields[1].out_value, 0, 7, reg_addr);
-
fields[1].in_value = NULL;
fields[2].tap = etm_reg->jtag_info->tap;
fields[2].num_bits = 1;
- fields[2].out_value = malloc(1);
+ u8 tmp3;
+ fields[2].out_value = &tmp3;
buf_set_u32(fields[2].out_value, 0, 1, 1);
-
fields[2].in_value = NULL;
jtag_add_dr_scan(3, fields, TAP_INVALID);
- free(fields[0].out_value);
- free(fields[1].out_value);
- free(fields[2].out_value);
-
return ERROR_OK;
}