aboutsummaryrefslogtreecommitdiff
path: root/src/jtag/commands.c
diff options
context:
space:
mode:
authorSteven Stallion <stallion@squareup.com>2017-03-26 15:01:56 -0500
committerMatthias Welwarsky <matthias@welwarsky.de>2018-10-16 11:58:17 +0100
commite72b2601e71f49af10f72c4bb6220ee2061ef173 (patch)
tree60976dac9e8e006e8eb4c64bc2b48236d9e3a0a3 /src/jtag/commands.c
parente65acd889c61a424c7bd72fdee5d6a3aee1d8504 (diff)
downloadriscv-openocd-e72b2601e71f49af10f72c4bb6220ee2061ef173.zip
riscv-openocd-e72b2601e71f49af10f72c4bb6220ee2061ef173.tar.gz
riscv-openocd-e72b2601e71f49af10f72c4bb6220ee2061ef173.tar.bz2
jtag: make cmd_queue_scan_field_clone public
This patch makes the cmd_queue_scan_field_clone function public. This permits targets to insert fields without affecting the submitted scan_field list. This will be used in an upcoming target implementation that needs to insert additional padding bits. Change-Id: I8fbd3b9b4e413432471f4f1444048932c8fa189e Signed-off-by: Steven Stallion <stallion@squareup.com> Reviewed-on: http://openocd.zylin.com/4082 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Diffstat (limited to 'src/jtag/commands.c')
-rw-r--r--src/jtag/commands.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/jtag/commands.c b/src/jtag/commands.c
index ed40755..e2d22cc 100644
--- a/src/jtag/commands.c
+++ b/src/jtag/commands.c
@@ -144,6 +144,18 @@ void jtag_command_queue_reset(void)
next_command_pointer = &jtag_command_queue;
}
+/**
+ * Copy a struct scan_field for insertion into the queue.
+ *
+ * This allocates a new copy of out_value using cmd_queue_alloc.
+ */
+void jtag_scan_field_clone(struct scan_field *dst, const struct scan_field *src)
+{
+ dst->num_bits = src->num_bits;
+ dst->out_value = buf_cpy(src->out_value, cmd_queue_alloc(DIV_ROUND_UP(src->num_bits, 8)), src->num_bits);
+ dst->in_value = src->in_value;
+}
+
enum scan_type jtag_scan_type(const struct scan_command *cmd)
{
int i;