David Brownell <david-b@pacbell.net>:
[fw/openocd] / src / jtag / arm-jtag-ew.c
index a997956cacfd368fd82c60b29c53e19f6685adec..98fd0d6229258fbd80892aa6a60c403044cc7ecb 100644 (file)
@@ -1,4 +1,4 @@
-// vim:ts=4 sw=4: 
+// vim:ts=4 sw=4:
 
 /***************************************************************************
  *   Copyright (C) 2009 by Dimitar Dimitrov <dinuxbg@gmail.com>            *
@@ -24,8 +24,8 @@
 #include "config.h"
 #endif
 
-#define INCLUDE_JTAG_INTERFACE_H
-#include "jtag.h"
+#include "interface.h"
+#include "commands.h"
 #include <usb.h>
 
 
@@ -138,20 +138,14 @@ static int armjtagew_execute_queue(void)
                                DEBUG_JTAG_IO( "runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles, \
                                        cmd->cmd.runtest->end_state);
 
-                               if (cmd->cmd.runtest->end_state != TAP_INVALID)
-                               {
-                                       armjtagew_end_state(cmd->cmd.runtest->end_state);
-                               }
+                               armjtagew_end_state(cmd->cmd.runtest->end_state);
                                armjtagew_runtest(cmd->cmd.runtest->num_cycles);
                                break;
 
                        case JTAG_STATEMOVE:
                                DEBUG_JTAG_IO("statemove end in %i", cmd->cmd.statemove->end_state);
 
-                               if (cmd->cmd.statemove->end_state != TAP_INVALID)
-                               {
-                                       armjtagew_end_state(cmd->cmd.statemove->end_state);
-                               }
+                               armjtagew_end_state(cmd->cmd.statemove->end_state);
                                armjtagew_state_move();
                                break;
 
@@ -166,10 +160,7 @@ static int armjtagew_execute_queue(void)
                        case JTAG_SCAN:
                                DEBUG_JTAG_IO("scan end in %i", cmd->cmd.scan->end_state);
 
-                               if (cmd->cmd.scan->end_state != TAP_INVALID)
-                               {
-                                       armjtagew_end_state(cmd->cmd.scan->end_state);
-                               }
+                               armjtagew_end_state(cmd->cmd.scan->end_state);
 
                                scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer);
                                DEBUG_JTAG_IO("scan input, length = %d", scan_size);
@@ -231,14 +222,14 @@ static int armjtagew_speed(int speed)
        usb_out_buffer[0] = CMD_GET_TCK_FREQUENCY;
     result = armjtagew_usb_message(armjtagew_jtag_handle, 1, 4);
        speed_real = (int)buf_get_u32(usb_in_buffer,0,32);
-       if(result < 0) 
+       if(result < 0)
        {
         LOG_ERROR("ARM-JTAG-EW getting speed failed (%d)", result);
         return ERROR_JTAG_DEVICE_ERROR;
-       } 
+       }
        else
        {
-       LOG_INFO("Requested speed %dkHz, emulator reported %dkHz.", speed, speed_real);
+       LOG_INFO("Requested speed %dkHz, emulator reported %dkHz.", speed, speed_real);
        }
 
     return ERROR_OK;
@@ -343,7 +334,7 @@ static void armjtagew_path_move(int num_states, tap_state_t *path)
        for (i = 0; i < num_states; i++)
        {
                /*
-                * TODO: The ARM-JTAG-EW hardware delays TDI with 3 TCK cycles when in RTCK mode. 
+                * TODO: The ARM-JTAG-EW hardware delays TDI with 3 TCK cycles when in RTCK mode.
                 * Either handle that here, or update the documentation with examples
                 * how to fix that in the configuration files.
                 */
@@ -513,7 +504,7 @@ static int armjtagew_get_version_info(void)
        usb_out_buffer[0] = CMD_GET_VERSION;
        result = armjtagew_usb_message(armjtagew_jtag_handle, 1, 4+15+256);
 
-       if (result != 0) 
+       if (result != 0)
        {
                LOG_ERROR("ARM-JTAG-EW command CMD_GET_VERSION failed (%d)\n", result);
                return ERROR_JTAG_DEVICE_ERROR;
@@ -800,7 +791,7 @@ static int armjtagew_usb_message(armjtagew_jtag_t *armjtagew_jtag, int out_lengt
        if (result == out_length)
        {
                result = armjtagew_usb_read(armjtagew_jtag, in_length);
-               if (result != in_length) 
+               if (result != in_length)
                {
                        LOG_ERROR("usb_bulk_read failed (requested=%d, result=%d)", in_length, result);
                        return -1;