aboutsummaryrefslogtreecommitdiff
path: root/src/target/xscale.c
diff options
context:
space:
mode:
authorAndreas Fritiofson <andreas.fritiofson@gmail.com>2013-11-07 00:40:50 +0100
committerSpencer Oliver <spen@spen-soft.co.uk>2014-01-20 13:28:26 +0000
commit63fa73169bd88258ef82f709e79769eacc50f793 (patch)
tree5f259281041de2aa5d7097db46a64d4175279a96 /src/target/xscale.c
parent87e91f4db9bea66a7866261130c6152c0304bc29 (diff)
downloadriscv-openocd-63fa73169bd88258ef82f709e79769eacc50f793.zip
riscv-openocd-63fa73169bd88258ef82f709e79769eacc50f793.tar.gz
riscv-openocd-63fa73169bd88258ef82f709e79769eacc50f793.tar.bz2
Retire jtag_add_dr_out
The out only version of jtag_add_dr_scan smells like a bogus optimization that complicates the minidriver API for questionable gain. The function was only used by four old ARM targets. Rewrite the callers to use the generic function and remove all implementations. Change-Id: I13b643687ee8ed6bc9b6336e7096c34f40ea96af Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1801 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src/target/xscale.c')
-rw-r--r--src/target/xscale.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/src/target/xscale.c b/src/target/xscale.c
index 388c8eb..99f67af 100644
--- a/src/target/xscale.c
+++ b/src/target/xscale.c
@@ -513,8 +513,6 @@ done:
static int xscale_send(struct target *target, const uint8_t *buffer, int count, int size)
{
struct xscale_common *xscale = target_to_xscale(target);
- uint32_t t[3];
- int bits[3];
int retval;
int done_count = 0;
@@ -522,37 +520,45 @@ static int xscale_send(struct target *target, const uint8_t *buffer, int count,
XSCALE_DBGRX << xscale->xscale_variant,
TAP_IDLE);
- bits[0] = 3;
- t[0] = 0;
- bits[1] = 32;
- t[2] = 1;
- bits[2] = 1;
+ static const uint8_t t0;
+ uint8_t t1[4];
+ static const uint8_t t2 = 1;
+ struct scan_field fields[3] = {
+ { .num_bits = 3, .out_value = &t0 },
+ { .num_bits = 32, .out_value = t1 },
+ { .num_bits = 1, .out_value = &t2 },
+ };
+
int endianness = target->endianness;
while (done_count++ < count) {
+ uint32_t t;
+
switch (size) {
case 4:
if (endianness == TARGET_LITTLE_ENDIAN)
- t[1] = le_to_h_u32(buffer);
+ t = le_to_h_u32(buffer);
else
- t[1] = be_to_h_u32(buffer);
+ t = be_to_h_u32(buffer);
break;
case 2:
if (endianness == TARGET_LITTLE_ENDIAN)
- t[1] = le_to_h_u16(buffer);
+ t = le_to_h_u16(buffer);
else
- t[1] = be_to_h_u16(buffer);
+ t = be_to_h_u16(buffer);
break;
case 1:
- t[1] = buffer[0];
+ t = buffer[0];
break;
default:
LOG_ERROR("BUG: size neither 4, 2 nor 1");
return ERROR_COMMAND_SYNTAX_ERROR;
}
- jtag_add_dr_out(target->tap,
+
+ buf_set_u32(t1, 0, 32, t);
+
+ jtag_add_dr_scan(target->tap,
3,
- bits,
- t,
+ fields,
TAP_IDLE);
buffer += size;
}