Author: Michael Bruck <mbruck@digenius.de>

- jtag.c: consolidate all memory allocations in scan functions in one block, add out_fields pointer to set stage for further changes



git-svn-id: svn://svn.berlios.de/openocd/trunk@1861 b42882b7-edfa-0310-969c-e2dbd0fdcd60
__archive__
kc8apf 2009-05-21 04:41:50 +00:00
parent f96077ec8d
commit 3bc0997e28
1 changed files with 20 additions and 15 deletions

View File

@ -611,6 +611,7 @@ int MINIDRIVER(interface_jtag_add_ir_scan)(int in_num_fields, const scan_field_t
jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t));
scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t));
scan_field_t * out_fields = cmd_queue_alloc(num_taps * sizeof(scan_field_t));
jtag_queue_command(cmd);
@ -619,7 +620,7 @@ int MINIDRIVER(interface_jtag_add_ir_scan)(int in_num_fields, const scan_field_t
scan->ir_scan = true;
scan->num_fields = num_taps; /* one field per device */
scan->fields = cmd_queue_alloc(num_taps * sizeof(scan_field_t));
scan->fields = out_fields;
scan->end_state = state;
nth_tap = -1;
@ -698,6 +699,7 @@ int MINIDRIVER(interface_jtag_add_plain_ir_scan)(int in_num_fields, const scan_f
jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t));
scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t));
scan_field_t * out_fields = cmd_queue_alloc(in_num_fields * sizeof(scan_field_t));
jtag_queue_command(cmd);
@ -706,7 +708,7 @@ int MINIDRIVER(interface_jtag_add_plain_ir_scan)(int in_num_fields, const scan_f
scan->ir_scan = true;
scan->num_fields = in_num_fields;
scan->fields = cmd_queue_alloc(in_num_fields * sizeof(scan_field_t));
scan->fields = out_fields;
scan->end_state = state;
for (int i = 0; i < in_num_fields; i++)
@ -842,6 +844,7 @@ int MINIDRIVER(interface_jtag_add_dr_scan)(int in_num_fields, const scan_field_t
jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t));
scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t));
scan_field_t * out_fields = cmd_queue_alloc((in_num_fields + bypass_devices) * sizeof(scan_field_t));
jtag_queue_command(cmd);
@ -850,7 +853,7 @@ int MINIDRIVER(interface_jtag_add_dr_scan)(int in_num_fields, const scan_field_t
scan->ir_scan = false;
scan->num_fields = in_num_fields + bypass_devices;
scan->fields = cmd_queue_alloc((in_num_fields + bypass_devices) * sizeof(scan_field_t));
scan->fields = out_fields;
scan->end_state = state;
tap = NULL;
@ -953,6 +956,7 @@ void MINIDRIVER(interface_jtag_add_dr_out)(jtag_tap_t *target_tap,
jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t));
scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t));
scan_field_t * out_fields = cmd_queue_alloc((in_num_fields + bypass_devices) * sizeof(scan_field_t));
jtag_queue_command(cmd);
@ -961,7 +965,7 @@ void MINIDRIVER(interface_jtag_add_dr_out)(jtag_tap_t *target_tap,
scan->ir_scan = false;
scan->num_fields = in_num_fields + bypass_devices;
scan->fields = cmd_queue_alloc((in_num_fields + bypass_devices) * sizeof(scan_field_t));
scan->fields = out_fields;
scan->end_state = end_state;
tap = NULL;
@ -1040,6 +1044,7 @@ int MINIDRIVER(interface_jtag_add_plain_dr_scan)(int in_num_fields, const scan_f
{
jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t));
scan_command_t * scan = cmd_queue_alloc(sizeof(scan_command_t));
scan_field_t * out_fields = cmd_queue_alloc(in_num_fields * sizeof(scan_field_t));
jtag_queue_command(cmd);
@ -1048,7 +1053,7 @@ int MINIDRIVER(interface_jtag_add_plain_dr_scan)(int in_num_fields, const scan_f
scan->ir_scan = false;
scan->num_fields = in_num_fields;
scan->fields = cmd_queue_alloc(in_num_fields * sizeof(scan_field_t));
scan->fields = out_fields;
scan->end_state = state;
for (int i = 0; i < in_num_fields; i++)