summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkc8apf <kc8apf@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-05-20 04:51:46 +0000
committerkc8apf <kc8apf@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-05-20 04:51:46 +0000
commit044e3a4904c75f95819303190845511beb16ee90 (patch)
treeb2c19dbe9b3135a480e21bdd622bb13217b1e6fe
parentc1b397e48c03c9459d8251cdf83d82f41a7b0cd9 (diff)
downloadopenocd_libswd-044e3a4904c75f95819303190845511beb16ee90.tar.gz
openocd_libswd-044e3a4904c75f95819303190845511beb16ee90.tar.bz2
openocd_libswd-044e3a4904c75f95819303190845511beb16ee90.tar.xz
openocd_libswd-044e3a4904c75f95819303190845511beb16ee90.zip
Author: Michael Bruck <mbruck@digenius.de>
- simplify code in interface_jtag_add_plain_ir_scan() by adding a local variable 'scan' to hold the scan_command_t git-svn-id: svn://svn.berlios.de/openocd/trunk@1844 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r--src/jtag/jtag.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/jtag/jtag.c b/src/jtag/jtag.c
index a974cad8..33205bd8 100644
--- a/src/jtag/jtag.c
+++ b/src/jtag/jtag.c
@@ -678,29 +678,28 @@ void jtag_add_plain_ir_scan(int in_num_fields, scan_field_t *in_fields, tap_stat
int MINIDRIVER(interface_jtag_add_plain_ir_scan)(int in_num_fields, scan_field_t *in_fields, tap_state_t state)
{
- /* allocate memory for a new list member */
- jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t));
+ jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t));
+ scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t));
jtag_queue_command(cmd);
- cmd->type = JTAG_SCAN;
+ cmd->type = JTAG_SCAN;
+ cmd->cmd.scan = scan;
- /* allocate memory for ir scan command */
- cmd->cmd.scan = cmd_queue_alloc(sizeof(scan_command_t));
- cmd->cmd.scan->ir_scan = true;
- cmd->cmd.scan->num_fields = in_num_fields;
- cmd->cmd.scan->fields = cmd_queue_alloc(in_num_fields * sizeof(scan_field_t));
- cmd->cmd.scan->end_state = state;
+ scan->ir_scan = true;
+ scan->num_fields = in_num_fields;
+ scan->fields = cmd_queue_alloc(in_num_fields * sizeof(scan_field_t));
+ scan->end_state = state;
for (int i = 0; i < in_num_fields; i++)
{
int num_bits = in_fields[i].num_bits;
int num_bytes = CEIL(in_fields[i].num_bits, 8);
- cmd->cmd.scan->fields[i].tap = in_fields[i].tap;
- cmd->cmd.scan->fields[i].num_bits = num_bits;
- cmd->cmd.scan->fields[i].out_value = buf_cpy(in_fields[i].out_value, cmd_queue_alloc(num_bytes), num_bits);
- cmd->cmd.scan->fields[i].in_value = in_fields[i].in_value;
+ scan->fields[i].tap = in_fields[i].tap;
+ scan->fields[i].num_bits = num_bits;
+ scan->fields[i].out_value = buf_cpy(in_fields[i].out_value, cmd_queue_alloc(num_bytes), num_bits);
+ scan->fields[i].in_value = in_fields[i].in_value;
}
return ERROR_OK;