]> git.sur5r.net Git - openocd/commitdiff
jtag: jtag_add_ir_scan() now takes a single field
authorØyvind Harboe <oyvind.harboe@zylin.com>
Thu, 4 Mar 2010 13:38:19 +0000 (14:38 +0100)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Mon, 8 Mar 2010 07:12:25 +0000 (08:12 +0100)
In the code a single field was all that was ever used. Makes
jtag_add_ir_scan() simpler and leaves more complicated stuff
to jtag_add_plain_ir_scan().

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
15 files changed:
src/flash/nor/str9xpec.c
src/jtag/core.c
src/jtag/drivers/driver.c
src/jtag/jtag.h
src/jtag/minidriver.h
src/jtag/minidummy/minidummy.c
src/jtag/tcl.c
src/jtag/zy1000/zy1000.c
src/pld/virtex2.c
src/target/arm11_dbgtap.c
src/target/arm_jtag.c
src/target/etb.c
src/target/mips_ejtag.c
src/target/xscale.c
src/xsvf/xsvf.c

index 3796a4b19060976c289cfbcfdb74f51a82bfda35..b6d24f58cb9757165fd2590cf8a3843693afb5b1 100644 (file)
@@ -48,7 +48,7 @@ int str9xpec_set_instr(struct jtag_tap *tap, uint32_t new_instr, tap_state_t end
                buf_set_u32(field.out_value, 0, field.num_bits, new_instr);
                field.in_value = NULL;
 
-               jtag_add_ir_scan(tap, 1, &field, end_state);
+               jtag_add_ir_scan(tap, &field, end_state);
 
                free(field.out_value);
        }
index 2e09cb6d58bcb5e026af80cc2a50f2ef539fad25..bce332fc844cdb4411cd7b343081bd4acb949451 100644 (file)
@@ -42,7 +42,8 @@
 /// The number of JTAG queue flushes (for profiling and debugging purposes).
 static int jtag_flush_queue_count;
 
-static void jtag_add_scan_check(struct jtag_tap *active, void (*jtag_add_scan)(struct jtag_tap *active, int in_num_fields, const struct scan_field *in_fields, tap_state_t state),
+static void jtag_add_scan_check(struct jtag_tap *active,
+               void (*jtag_add_scan)(struct jtag_tap *active, int in_num_fields, const struct scan_field *in_fields, tap_state_t state),
                int in_num_fields, struct scan_field *in_fields, tap_state_t state);
 
 /**
@@ -352,17 +353,22 @@ void jtag_alloc_in_value32(struct scan_field *field)
        interface_jtag_alloc_in_value32(field);
 }
 
-void jtag_add_ir_scan_noverify(struct jtag_tap *active, int in_count, const struct scan_field *in_fields,
+void jtag_add_ir_scan_noverify(struct jtag_tap *active, const struct scan_field *in_fields,
                tap_state_t state)
 {
        jtag_prelude(state);
 
-       int retval = interface_jtag_add_ir_scan(active, in_count, in_fields, state);
+       int retval = interface_jtag_add_ir_scan(active, in_fields, state);
        jtag_set_error(retval);
 }
 
+static void jtag_add_ir_scan_noverify_callback(struct jtag_tap *active, int dummy, const struct scan_field *in_fields,
+               tap_state_t state)
+{
+       jtag_add_ir_scan_noverify(active, in_fields, state);
+}
 
-void jtag_add_ir_scan(struct jtag_tap *active, int in_num_fields, struct scan_field *in_fields, tap_state_t state)
+void jtag_add_ir_scan(struct jtag_tap *active, struct scan_field *in_fields, tap_state_t state)
 {
        assert(state != TAP_RESET);
 
@@ -370,18 +376,15 @@ void jtag_add_ir_scan(struct jtag_tap *active, int in_num_fields, struct scan_fi
        {
                /* 8 x 32 bit id's is enough for all invocations */
 
-               for (int j = 0; j < in_num_fields; j++)
-               {
-                       /* if we are to run a verification of the ir scan, we need to get the input back.
-                        * We may have to allocate space if the caller didn't ask for the input back.
-                        */
-                       in_fields[j].check_value = active->expected;
-                       in_fields[j].check_mask = active->expected_mask;
-               }
-               jtag_add_scan_check(active, jtag_add_ir_scan_noverify, in_num_fields, in_fields, state);
+               /* if we are to run a verification of the ir scan, we need to get the input back.
+                * We may have to allocate space if the caller didn't ask for the input back.
+                */
+               in_fields->check_value = active->expected;
+               in_fields->check_mask = active->expected_mask;
+               jtag_add_scan_check(active, jtag_add_ir_scan_noverify_callback, 1, in_fields, state);
        } else
        {
-               jtag_add_ir_scan_noverify(active, in_num_fields, in_fields, state);
+               jtag_add_ir_scan_noverify(active, in_fields, state);
        }
 }
 
index 673d191e56ece38cae8f18d43165eff840d054f5..57bc28d1601673956339ece10d2b69e0942bce4f 100644 (file)
@@ -74,7 +74,7 @@ static void cmd_queue_scan_field_clone(struct scan_field * dst, const struct sca
  * see jtag_add_ir_scan()
  *
  */
-int interface_jtag_add_ir_scan(struct jtag_tap* active, int in_num_fields, const struct scan_field *in_fields, tap_state_t state)
+int interface_jtag_add_ir_scan(struct jtag_tap* active, const struct scan_field *in_fields, tap_state_t state)
 {
        size_t num_taps = jtag_tap_count_enabled();
 
@@ -106,8 +106,7 @@ int interface_jtag_add_ir_scan(struct jtag_tap* active, int in_num_fields, const
                        /* if TAP is listed in input fields, copy the value */
                        tap->bypass = 0;
 
-                       for (int j = 0; j < in_num_fields; j++)
-                               cmd_queue_scan_field_clone(field, in_fields + j);
+                       cmd_queue_scan_field_clone(field, in_fields);
                } else
                {
                        /* if a TAP isn't listed in input fields, set it to BYPASS */
index 6e21024e37285a1397e928fe649a6cdf95914a55..fe57db108b2729d7f21ebb49c2cb899473e5e6ec 100644 (file)
@@ -350,13 +350,13 @@ int jtag_init_inner(struct command_context *cmd_ctx);
  * subsequent DR SCANs.
  *
  */
-void jtag_add_ir_scan(struct jtag_tap* tap, int num_fields,
+void jtag_add_ir_scan(struct jtag_tap* tap,
                struct scan_field* fields, tap_state_t endstate);
 /**
  * The same as jtag_add_ir_scan except no verification is performed out
  * the output values.
  */
-void jtag_add_ir_scan_noverify(struct jtag_tap* tap, int num_fields,
+void jtag_add_ir_scan_noverify(struct jtag_tap* tap,
                const struct scan_field *fields, tap_state_t state);
 /**
  * Duplicate the scan fields passed into the function into an IR SCAN
index a4172169fbaadc8e814836e20ec958ebb79deca0..4631593f418405a83351031147f570f5d1c8ee35 100644 (file)
@@ -50,7 +50,7 @@
 #include <jtag/minidriver_imp.h>
 
 int interface_jtag_add_ir_scan(struct jtag_tap* active,
-               int num_fields, const struct scan_field* fields,
+               const struct scan_field* fields,
                tap_state_t endstate);
 int interface_jtag_add_plain_ir_scan(
                int num_fields, const struct scan_field* fields,
index 98b449f9fe4e89dd21faf50f5753eefe28b45821..1eef08795c769ca0e441e49c9da08e3e6a60d14c 100644 (file)
@@ -46,7 +46,7 @@ int interface_jtag_execute_queue(void)
        return ERROR_OK;
 }
 
-int interface_jtag_add_ir_scan(struct jtag_tap *active, int num_fields, const struct scan_field *fields, tap_state_t state)
+int interface_jtag_add_ir_scan(struct jtag_tap *active, const struct scan_field *fields, tap_state_t state)
 {
        /* synchronously do the operation here */
 
index da01f8125c719dab8fbdd37d08b3ecdf223a6558..1073abc024887bc4ffb9420058efa4cd8070adf0 100644 (file)
@@ -1490,6 +1490,15 @@ COMMAND_HANDLER(handle_irscan_command)
        }
 
        int num_fields = CMD_ARGC / 2;
+       if (num_fields > 1)
+       {
+               /* we really should be looking at plain_ir_scan if we want
+                * anything more fancy.
+                */
+               LOG_ERROR("Specify a single value for tap");
+               return ERROR_COMMAND_SYNTAX_ERROR;
+       }
+
        size_t fields_len = sizeof(struct scan_field) * num_fields;
        fields = malloc(fields_len);
        memset(fields, 0, fields_len);
@@ -1521,7 +1530,7 @@ COMMAND_HANDLER(handle_irscan_command)
        }
 
        /* did we have an endstate? */
-       jtag_add_ir_scan(tap, num_fields, fields, endstate);
+       jtag_add_ir_scan(tap, fields, endstate);
 
        retval = jtag_execute_queue();
 
index 0b112589d5c82b1bc50cbe12ea6c3fbada4bb8f8..391d8f2076201d9383aee80dec7a3a1f3c2c7249 100644 (file)
@@ -574,13 +574,11 @@ static __inline void scanFields(int num_fields, const struct scan_field *fields,
        }
 }
 
-int interface_jtag_add_ir_scan(struct jtag_tap *active, int num_fields, const struct scan_field *fields, tap_state_t state)
+int interface_jtag_add_ir_scan(struct jtag_tap *active, const struct scan_field *fields, tap_state_t state)
 {
        int scan_size = 0;
        struct jtag_tap *tap, *nextTap;
 
-       assert(num_fields == 1);
-
        for (tap = jtag_tap_next_enabled(NULL); tap!= NULL; tap = nextTap)
        {
                nextTap = jtag_tap_next_enabled(tap);
@@ -590,7 +588,7 @@ int interface_jtag_add_ir_scan(struct jtag_tap *active, int num_fields, const st
                /* search the list */
                if (tap == active)
                {
-                       scanFields(num_fields, fields, TAP_IRSHIFT, pause);
+                       scanFields(1, fields, TAP_IRSHIFT, pause);
                        /* update device information */
                        buf_cpy(fields[0].out_value, tap->cur_instr, scan_size);
 
index 15685e61b675c1e7fd17b4bf489388e72dbfef2b..976535b4cd14c2f647350faf666b5fb18b0e66e3 100644 (file)
@@ -40,7 +40,7 @@ static int virtex2_set_instr(struct jtag_tap *tap, uint32_t new_instr)
                buf_set_u32(field.out_value, 0, field.num_bits, new_instr);
                field.in_value = NULL;
 
-               jtag_add_ir_scan(tap, 1, &field, jtag_set_end_state(TAP_IDLE));
+               jtag_add_ir_scan(tap, &field, jtag_set_end_state(TAP_IDLE));
 
                free(field.out_value);
        }
index f0490596edcc5db54e7f24a059c0525806c014d4..2b7b4e42d6a56c132113c3910938cc484e991ef7 100644 (file)
@@ -49,13 +49,13 @@ static const tap_state_t arm11_move_pi_to_si_via_ci[] =
 
 
 /* REVISIT no error handling here! */
-static void arm11_add_ir_scan_vc(struct jtag_tap *tap, int num_fields, struct scan_field *fields,
+static void arm11_add_ir_scan_vc(struct jtag_tap *tap, struct scan_field *fields,
                tap_state_t state)
 {
        if (cmd_queue_cur_state == TAP_IRPAUSE)
                jtag_add_pathmove(ARRAY_SIZE(arm11_move_pi_to_si_via_ci), arm11_move_pi_to_si_via_ci);
 
-       jtag_add_ir_scan(tap, num_fields, fields, state);
+       jtag_add_ir_scan(tap, fields, state);
 }
 
 static const tap_state_t arm11_move_pd_to_sd_via_cd[] =
@@ -149,7 +149,7 @@ void arm11_add_IR(struct arm11_common * arm11, uint8_t instr, tap_state_t state)
 
        arm11_setup_field(arm11, 5, &instr, NULL, &field);
 
-       arm11_add_ir_scan_vc(arm11->arm.target->tap, 1, &field, state == ARM11_TAP_DEFAULT ? TAP_IRPAUSE : state);
+       arm11_add_ir_scan_vc(arm11->arm.target->tap, &field, state == ARM11_TAP_DEFAULT ? TAP_IRPAUSE : state);
 }
 
 /** Verify data shifted out from Scan Chain Register (SCREG). */
index 3e27b7638aa1c3085497755545809457298567bc..5ed104cf11d0273a09b9c98d981e617a6b567078 100644 (file)
@@ -45,13 +45,13 @@ int arm_jtag_set_instr_inner(struct arm_jtag *jtag_info, uint32_t new_instr,  vo
 
        if (no_verify_capture == NULL)
        {
-               jtag_add_ir_scan(tap, 1, &field, jtag_get_end_state());
+               jtag_add_ir_scan(tap, &field, jtag_get_end_state());
        } else
        {
                /* FIX!!!! this is a kludge!!! arm926ejs.c should reimplement this arm_jtag_set_instr to
                 * have special verification code.
                 */
-               jtag_add_ir_scan_noverify(tap, 1, &field, jtag_get_end_state());
+               jtag_add_ir_scan_noverify(tap, &field, jtag_get_end_state());
        }
 
        return ERROR_OK;
index 1f73ff5ef243f438597abb65a2b4355571bdb8d4..2c4e3ebe90037e5c4330857fd3a34677057a6895 100644 (file)
@@ -60,7 +60,7 @@ static int etb_set_instr(struct etb *etb, uint32_t new_instr)
 
                field.in_value = NULL;
 
-               jtag_add_ir_scan(tap, 1, &field, jtag_get_end_state());
+               jtag_add_ir_scan(tap, &field, jtag_get_end_state());
 
                free(field.out_value);
        }
index 79160fc4c2b2b7e92019a592daabf759c38d957a..e0550a81a442b136f9f4b16b26d95ab69e7173ef 100644 (file)
@@ -46,7 +46,7 @@ int mips_ejtag_set_instr(struct mips_ejtag *ejtag_info, int new_instr, void *del
                buf_set_u32(field.out_value, 0, field.num_bits, new_instr);
                field.in_value = NULL;
 
-               jtag_add_ir_scan(tap, 1, &field, jtag_get_end_state());
+               jtag_add_ir_scan(tap, &field, jtag_get_end_state());
        }
 
        return ERROR_OK;
index 497389818a803e5e452558a01e55b27423d411b7..602034eb323ee02da20921803d8290a1ada0abbe 100644 (file)
@@ -173,7 +173,7 @@ static int xscale_jtag_set_instr(struct jtag_tap *tap, uint32_t new_instr)
                field.out_value = scratch;
                buf_set_u32(field.out_value, 0, field.num_bits, new_instr);
 
-               jtag_add_ir_scan(tap, 1, &field, jtag_get_end_state());
+               jtag_add_ir_scan(tap, &field, jtag_get_end_state());
        }
 
        return ERROR_OK;
index faa55421638e70e7c8f1d971287e0d8bc19e9232..14bed8efb44996f4aaa7fdd2921d08cfd7a6ed69 100644 (file)
@@ -704,7 +704,7 @@ COMMAND_HANDLER(handle_xsvf_command)
                                        if (tap == NULL)
                                                jtag_add_plain_ir_scan(1, &field, my_end_state);
                                        else
-                                               jtag_add_ir_scan(tap, 1, &field, my_end_state);
+                                               jtag_add_ir_scan(tap, &field, my_end_state);
 
                                        if (xruntest)
                                        {