From 63fa73169bd88258ef82f709e79769eacc50f793 Mon Sep 17 00:00:00 2001 From: Andreas Fritiofson Date: Thu, 7 Nov 2013 00:40:50 +0100 Subject: 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 Reviewed-on: http://openocd.zylin.com/1801 Tested-by: jenkins Reviewed-by: Spencer Oliver --- src/target/xscale.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'src/target/xscale.c') 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; } -- cgit v1.1