Remove unused code, TAP_INVALID is never passed to drivers.
[openocd.git] / src / jtag / vsllink.c
index 57f69bcd6d4010f45b6df36c47e30051db542643..4af92e0f3059bee266f88125204b56437aca7f93 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #endif
 
+#define INCLUDE_JTAG_INTERFACE_H
 #include "jtag.h"
 
 #include <usb.h>
@@ -296,33 +297,18 @@ static int vsllink_execute_queue(void)
        {
                switch (cmd->type)
                {
-                       case JTAG_END_STATE:
-                               DEBUG_JTAG_IO("end_state: %s", tap_state_name(cmd->cmd.end_state->end_state));
-                       
-                               if (cmd->cmd.end_state->end_state != TAP_INVALID)
-                               {
-                                       vsllink_end_state(cmd->cmd.end_state->end_state);
-                               }
-                               break;
-                               
                        case JTAG_RUNTEST:
                                DEBUG_JTAG_IO( "runtest %i cycles, end in %s", cmd->cmd.runtest->num_cycles, \
                                        tap_state_name(cmd->cmd.runtest->end_state));
                                        
-                               if (cmd->cmd.runtest->end_state != TAP_INVALID)
-                               {
-                                       vsllink_end_state(cmd->cmd.runtest->end_state);
-                               }
+                               vsllink_end_state(cmd->cmd.runtest->end_state);
                                vsllink_runtest(cmd->cmd.runtest->num_cycles);
                                break;
                                
                        case JTAG_STATEMOVE:
                                DEBUG_JTAG_IO("statemove end in %s", tap_state_name(cmd->cmd.statemove->end_state));
                                
-                               if (cmd->cmd.statemove->end_state != TAP_INVALID)
-                               {
-                                       vsllink_end_state(cmd->cmd.statemove->end_state);
-                               }
+                               vsllink_end_state(cmd->cmd.statemove->end_state);
                                vsllink_state_move();
                                break;
                                
@@ -335,10 +321,7 @@ static int vsllink_execute_queue(void)
                                break;
                                
                        case JTAG_SCAN:
-                               if (cmd->cmd.scan->end_state != TAP_INVALID)
-                               {
-                                       vsllink_end_state(cmd->cmd.scan->end_state);
-                               }
+                               vsllink_end_state(cmd->cmd.scan->end_state);
                                
                                scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer);
                                if (cmd->cmd.scan->ir_scan)
@@ -710,10 +693,10 @@ static void vsllink_state_move_dma(void)
                &VSLLINK_TAP_MOVE_INSERT_INSIGNIFICANT[tap_move_ndx(tap_get_state())][tap_move_ndx(tap_get_end_state())];
        u8 tms_scan = VSLLINK_TAP_MOVE(tap_get_state(), tap_get_end_state());
        
-       vsllink_tap_ensure_space(0, 8);
-       
        if (tap_get_state() == TAP_RESET)
        {
+               vsllink_tap_ensure_space(0, 8);
+               
                for (i = 0; i < 8; i++)
                {
                        vsllink_tap_append_step(1, 0);
@@ -1318,7 +1301,6 @@ static void vsllink_scan_dma(bool ir_scan, enum scan_type type, u8 *buffer, int
        vsllink_end_state(saved_end_state);
        
        /* Scan */
-       vsllink_tap_ensure_space(1, (scan_size + 7) & ~0x00000007);
        vsllink_tap_append_scan_dma(scan_size, buffer, command);
        
        tap_set_state(ir_scan ? TAP_IRPAUSE : TAP_DRPAUSE);
@@ -1581,20 +1563,37 @@ static void vsllink_tap_append_scan_normal(int length, u8 *buffer, scan_command_
 }
 static void vsllink_tap_append_scan_dma(int length, u8 *buffer, scan_command_t *command)
 {
-       pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[pending_scan_results_length];
-       int i;
+       pending_scan_result_t *pending_scan_result;
+       int len_tmp, len_all, i;
        
-       pending_scan_result->offset = tap_length;
-       pending_scan_result->length = length;
-       pending_scan_result->command = command;
-       pending_scan_result->buffer = buffer;
-       
-       for (i = 0; i < length; i++)
+       len_all = 0;
+       while (len_all < length)
        {
-               vsllink_tap_append_step((i < length-1 ? 0 : 1), (buffer[i/8] >> (i%8)) & 1);
+               if ((length - len_all) > tap_buffer_size * 8)
+               {
+                       len_tmp = tap_buffer_size * 8;
+               }
+               else
+               {
+                       len_tmp = length - len_all;
+               }
+               
+               vsllink_tap_ensure_space(1, (len_tmp + 7) & ~7);
+               
+               pending_scan_result = &pending_scan_results_buffer[pending_scan_results_length];
+               pending_scan_result->offset = tap_length;
+               pending_scan_result->length = len_tmp;
+               pending_scan_result->command = command;
+               pending_scan_result->buffer = buffer + len_all / 8;
+               
+               for (i = 0; i < len_tmp; i++)
+               {
+                       vsllink_tap_append_step(((len_all+i) < length-1 ? 0 : 1), (buffer[(len_all+i)/8] >> ((len_all+i)%8)) & 1);
+               }
+               
+               pending_scan_results_length++;
+               len_all += len_tmp;
        }
-       
-       pending_scan_results_length++;
 }
 
 /* Pad and send a tap sequence to the device, and receive the answer.

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)