Author: Michael Bruck <mbruck@digenius.de>
authorkc8apf <kc8apf@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Thu, 21 May 2009 04:41:50 +0000 (04:41 +0000)
committerkc8apf <kc8apf@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Thu, 21 May 2009 04:41:50 +0000 (04:41 +0000)
    - 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

src/jtag/jtag.c

index e12af353fcb1c301249ca9810ac36b6a868be034..df062991c6521df318cde2d42441e3eb55ab5f51 100644 (file)
@@ -609,8 +609,9 @@ int MINIDRIVER(interface_jtag_add_ir_scan)(int in_num_fields, const scan_field_t
 
        int num_taps = jtag_NumEnabledTaps();
 
-       jtag_command_t * cmd    = cmd_queue_alloc(sizeof(jtag_command_t));
-       scan_command_t * scan   = cmd_queue_alloc(sizeof(scan_command_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;
@@ -696,8 +697,9 @@ void jtag_add_plain_ir_scan(int in_num_fields, const scan_field_t *in_fields, ta
 int MINIDRIVER(interface_jtag_add_plain_ir_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state)
 {
 
-       jtag_command_t * cmd    = cmd_queue_alloc(sizeof(jtag_command_t));
-       scan_command_t * scan   = cmd_queue_alloc(sizeof(scan_command_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 * 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++)
@@ -840,8 +842,9 @@ 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));
+       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;
@@ -951,8 +954,9 @@ 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));
+       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;
@@ -1038,8 +1042,9 @@ void jtag_add_plain_dr_scan(int in_num_fields, const scan_field_t *in_fields, ta
  */
 int MINIDRIVER(interface_jtag_add_plain_dr_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state)
 {
-       jtag_command_t * cmd    = cmd_queue_alloc(sizeof(jtag_command_t));
-       scan_command_t * scan   = cmd_queue_alloc(sizeof(scan_command_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 * 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++)

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)