diff options
author | kc8apf <kc8apf@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-05-18 17:27:46 +0000 |
---|---|---|
committer | kc8apf <kc8apf@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-05-18 17:27:46 +0000 |
commit | 0e98ab34b396389381629596dfa6bbd9ad523989 (patch) | |
tree | 3be67971876a9c42fc1aa0bd353ef8990152872c | |
parent | 373cbc01d0d1093e961ea75ad6bd609e9fd718a7 (diff) | |
download | openocd+libswd-0e98ab34b396389381629596dfa6bbd9ad523989.tar.gz openocd+libswd-0e98ab34b396389381629596dfa6bbd9ad523989.tar.bz2 openocd+libswd-0e98ab34b396389381629596dfa6bbd9ad523989.tar.xz openocd+libswd-0e98ab34b396389381629596dfa6bbd9ad523989.zip |
Add jtag_queue_command() by Michael Bruck <mbruck@digenius.de> [3/8]
git-svn-id: svn://svn.berlios.de/openocd/trunk@1817 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r-- | src/jtag/jtag.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/src/jtag/jtag.c b/src/jtag/jtag.c index d94e6a44..45a445b7 100644 --- a/src/jtag/jtag.c +++ b/src/jtag/jtag.c @@ -672,32 +672,31 @@ void jtag_add_plain_ir_scan(int num_fields, scan_field_t *fields, tap_state_t st int MINIDRIVER(interface_jtag_add_plain_ir_scan)(int num_fields, scan_field_t *fields, tap_state_t state) { - int i; - jtag_command_t **last_cmd; + /* allocate memory for a new list member */ - last_cmd = jtag_get_last_command_p(); + jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t)); + + jtag_queue_command(cmd); - /* allocate memory for a new list member */ - *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); - (*last_cmd)->next = NULL; - last_comand_pointer = &((*last_cmd)->next); - (*last_cmd)->type = JTAG_SCAN; + cmd->type = JTAG_SCAN; /* allocate memory for ir scan command */ - (*last_cmd)->cmd.scan = cmd_queue_alloc(sizeof(scan_command_t)); - (*last_cmd)->cmd.scan->ir_scan = true; - (*last_cmd)->cmd.scan->num_fields = num_fields; - (*last_cmd)->cmd.scan->fields = cmd_queue_alloc(num_fields * sizeof(scan_field_t)); - (*last_cmd)->cmd.scan->end_state = state; + cmd->cmd.scan = cmd_queue_alloc(sizeof(scan_command_t)); + cmd->cmd.scan->ir_scan = true; + cmd->cmd.scan->num_fields = num_fields; + cmd->cmd.scan->fields = cmd_queue_alloc(num_fields * sizeof(scan_field_t)); + cmd->cmd.scan->end_state = state; - for( i = 0 ; i < num_fields ; i++ ){ + for (int i = 0; i < num_fields; i++) + { int num_bits = fields[i].num_bits; int num_bytes = CEIL(fields[i].num_bits, 8); - (*last_cmd)->cmd.scan->fields[i].tap = fields[i].tap; - (*last_cmd)->cmd.scan->fields[i].num_bits = num_bits; - (*last_cmd)->cmd.scan->fields[i].out_value = buf_cpy(fields[i].out_value, cmd_queue_alloc(num_bytes), num_bits); - (*last_cmd)->cmd.scan->fields[i].in_value = fields[i].in_value; + cmd->cmd.scan->fields[i].tap = fields[i].tap; + cmd->cmd.scan->fields[i].num_bits = num_bits; + cmd->cmd.scan->fields[i].out_value = buf_cpy(fields[i].out_value, cmd_queue_alloc(num_bytes), num_bits); + cmd->cmd.scan->fields[i].in_value = fields[i].in_value; } + return ERROR_OK; } |