]> git.sur5r.net Git - openocd/blobdiff - src/jtag/zy1000/zy1000.c
jtag: remove useless declarations
[openocd] / src / jtag / zy1000 / zy1000.c
index 495ff48ecf6193418ca5a82069862a9c2ca7607c..f45bff5e32a6fb6fe40f88007658bb9cc10424c4 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2007-2008 by Øyvind Harboe                              *
+ *   Copyright (C) 2007-2008 by Øyvind Harboe                              *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
 #include "embeddedice.h"
 #include "minidriver.h"
 #include "interface.h"
+#include "zy1000_version.h"
 
 #include <cyg/hal/hal_io.h>             // low level i/o
 #include <cyg/hal/hal_diag.h>
 
-
-#define ZYLIN_VERSION "1.52"
+#define ZYLIN_VERSION GIT_ZY1000_VERSION
 #define ZYLIN_DATE __DATE__
 #define ZYLIN_TIME __TIME__
-#define ZYLIN_OPENOCD "$Revision$"
-#define ZYLIN_OPENOCD_VERSION "Zylin JTAG ZY1000 " ZYLIN_VERSION " " ZYLIN_DATE " " ZYLIN_TIME
+#define ZYLIN_OPENOCD GIT_OPENOCD_VERSION
+#define ZYLIN_OPENOCD_VERSION "ZY1000 " ZYLIN_VERSION " " ZYLIN_DATE
 
 /* low level command set
  */
@@ -270,10 +270,7 @@ static int jim_zy1000_version(Jim_Interp *interp, int argc, Jim_Obj *const *argv
                const char *str = Jim_GetString(argv[1], NULL);
                if (strcmp("openocd", str) == 0)
                {
-                       int revision;
-                       revision = atol(ZYLIN_OPENOCD + strlen("XRevision: "));
-                       sprintf(buff, "%d", revision);
-                       version_str = buff;
+                       version_str = ZYLIN_OPENOCD;
                }
                else if (strcmp("zy1000", str) == 0)
                {
@@ -283,6 +280,10 @@ static int jim_zy1000_version(Jim_Interp *interp, int argc, Jim_Obj *const *argv
                {
                        version_str = ZYLIN_DATE;
                }
+               else if (strcmp("time", str) == 0)
+               {
+                       version_str = ZYLIN_TIME;
+               }
                else if (strcmp("pcb", str) == 0)
                {
 #ifdef CYGPKG_HAL_NIOS2
@@ -456,7 +457,12 @@ static void shiftValueInnerFlip(const tap_state_t state, const tap_state_t endSt
 
 extern int jtag_check_value(uint8_t *captured, void *priv);
 
-static __inline void scanFields(int num_fields, const scan_field_t *fields, tap_state_t shiftState, tap_state_t end_state)
+static void gotoEndState(tap_state_t end_state)
+{
+       setCurrentState(end_state);
+}
+
+static __inline void scanFields(int num_fields, const scan_field_t *fields, tap_state_t shiftState, int pause)
 {
        int i;
        int j;
@@ -488,10 +494,10 @@ static __inline void scanFields(int num_fields, const scan_field_t *fields, tap_
                        {
                                k = 32;
                                /* we have more to shift out */
-                       } else if (i == num_fields-1)
+                       } else if (pause&&(i == num_fields-1))
                        {
                                /* this was the last to shift out this time */
-                               pause_state = end_state;
+                               pause_state = (shiftState==TAP_DRSHIFT)?TAP_DRPAUSE:TAP_IRPAUSE;
                        }
 
                        // we have (num_bits + 7)/8 bytes of bits to toggle out.
@@ -526,12 +532,6 @@ static __inline void scanFields(int num_fields, const scan_field_t *fields, tap_
        }
 }
 
-int interface_jtag_set_end_state(tap_state_t state)
-{
-       return ERROR_OK;
-}
-
-
 int interface_jtag_add_ir_scan(int num_fields, const scan_field_t *fields, tap_state_t state)
 {
 
@@ -541,14 +541,7 @@ int interface_jtag_add_ir_scan(int num_fields, const scan_field_t *fields, tap_s
        for (tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap = nextTap)
        {
                nextTap = jtag_tap_next_enabled(tap);
-               tap_state_t end_state;
-               if (nextTap == NULL)
-               {
-                       end_state = state;
-               } else
-               {
-                       end_state = TAP_IRSHIFT;
-               }
+               int pause = (nextTap==NULL);
 
                int found = 0;
 
@@ -561,7 +554,7 @@ int interface_jtag_add_ir_scan(int num_fields, const scan_field_t *fields, tap_s
                        {
                                found = 1;
 
-                               scanFields(1, fields + j, TAP_IRSHIFT, end_state);
+                               scanFields(1, fields + j, TAP_IRSHIFT, pause);
                                /* update device information */
                                buf_cpy(fields[j].out_value, tap->cur_instr, scan_size);
 
@@ -579,12 +572,13 @@ int interface_jtag_add_ir_scan(int num_fields, const scan_field_t *fields, tap_s
                        memset(&tmp, 0, sizeof(tmp));
                        tmp.out_value = ones;
                        tmp.num_bits = scan_size;
-                       scanFields(1, &tmp, TAP_IRSHIFT, end_state);
+                       scanFields(1, &tmp, TAP_IRSHIFT, pause);
                        /* update device information */
                        buf_cpy(tmp.out_value, tap->cur_instr, scan_size);
                        tap->bypass = 1;
                }
        }
+       gotoEndState(state);
 
        return ERROR_OK;
 }
@@ -595,7 +589,8 @@ int interface_jtag_add_ir_scan(int num_fields, const scan_field_t *fields, tap_s
 
 int interface_jtag_add_plain_ir_scan(int num_fields, const scan_field_t *fields, tap_state_t state)
 {
-       scanFields(num_fields, fields, TAP_IRSHIFT, state);
+       scanFields(num_fields, fields, TAP_IRSHIFT, 1);
+       gotoEndState(state);
 
        return ERROR_OK;
 }
@@ -611,14 +606,7 @@ int interface_jtag_add_dr_scan(int num_fields, const scan_field_t *fields, tap_s
        {
                nextTap = jtag_tap_next_enabled(tap);
                int found = 0;
-               tap_state_t end_state;
-               if (nextTap == NULL)
-               {
-                       end_state = state;
-               } else
-               {
-                       end_state = TAP_DRSHIFT;
-               }
+               int pause = (nextTap==NULL);
 
                for (j = 0; j < num_fields; j++)
                {
@@ -626,7 +614,7 @@ int interface_jtag_add_dr_scan(int num_fields, const scan_field_t *fields, tap_s
                        {
                                found = 1;
 
-                               scanFields(1, fields + j, TAP_DRSHIFT, end_state);
+                               scanFields(1, fields+j, TAP_DRSHIFT, pause);
                        }
                }
                if (!found)
@@ -637,18 +625,20 @@ int interface_jtag_add_dr_scan(int num_fields, const scan_field_t *fields, tap_s
                        tmp.out_value = NULL;
                        tmp.in_value = NULL;
 
-                       scanFields(1, &tmp, TAP_DRSHIFT, end_state);
+                       scanFields(1, &tmp, TAP_DRSHIFT, pause);
                }
                else
                {
                }
        }
+       gotoEndState(state);
        return ERROR_OK;
 }
 
 int interface_jtag_add_plain_dr_scan(int num_fields, const scan_field_t *fields, tap_state_t state)
 {
-       scanFields(num_fields, fields, TAP_DRSHIFT, state);
+       scanFields(num_fields, fields, TAP_DRSHIFT, 1);
+       gotoEndState(state);
        return ERROR_OK;
 }
 
@@ -662,9 +652,6 @@ int interface_jtag_add_tlr()
 
 
 
-extern int jtag_nsrst_delay;
-extern int jtag_ntrst_delay;
-
 int interface_jtag_add_reset(int req_trst, int req_srst)
 {
        zy1000_reset(req_trst, req_srst);