X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fxsvf%2Fxsvf.c;h=e7ca5596eaa092cb284b484c9a0ab79f158950cb;hp=d732871a5fc5e6dd1bbfb0132075d741e4e43405;hb=a28eaa85f73759bb189a46308642502c9fa5aa4b;hpb=68c598e88d5e09728ea845a81ab279c615bbaf0f diff --git a/src/xsvf/xsvf.c b/src/xsvf/xsvf.c index d732871a5f..e7ca5596ea 100644 --- a/src/xsvf/xsvf.c +++ b/src/xsvf/xsvf.c @@ -5,6 +5,9 @@ * Copyright (C) 2007,2008 Øyvind Harboe * * oyvind.harboe@zylin.com * * * + * Copyright (C) 2008 Peter Hettkamp * + * peter.hettkamp@htp-tel.de * + * * * 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 * * the Free Software Foundation; either version 2 of the License, or * @@ -86,6 +89,11 @@ void xsvf_add_statemove(enum tap_state state) if ((state != TAP_TLR) && (state == cmd_queue_cur_state)) return; + if(state==TAP_TLR) + { + jtag_add_tlr(); + return; + } for (i=0; i<7; i++) { int j = (move >> i) & 1; @@ -161,7 +169,10 @@ int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, char **arg int runtest_requires_tck = 0; - int device = -1; /* use -1 to indicate a "plain" xsvf file which accounts for additional devices in the scan chain, otherwise the device that should be affected */ + jtag_tap_t *tap = NULL; + /* use NULL to indicate a "plain" xsvf file which accounts for + additional devices in the scan chain, otherwise the device + that should be affected */ if (argc < 2) { @@ -171,7 +182,11 @@ int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, char **arg if (strcmp(args[0], "plain") != 0) { - device = strtoul(args[0], NULL, 0); + tap = jtag_TapByString( args[0] ); + if( !tap ){ + command_print( cmd_ctx, "Tap: %s unknown", args[0] ); + return ERROR_OK; + } } if ((xsvf_fd = open(args[1], O_RDONLY)) < 0) @@ -214,7 +229,7 @@ int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, char **arg else { scan_field_t field; - field.device = device; + field.tap = tap; field.num_bits = c; field.out_value = ir_buf; field.out_mask = NULL; @@ -223,7 +238,7 @@ int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, char **arg field.in_check_mask = NULL; field.in_handler = NULL; field.in_handler_priv = NULL; - if (device == -1) + if (tap == NULL) jtag_add_plain_ir_scan(1, &field, TAP_PI); else jtag_add_ir_scan(1, &field, TAP_PI); @@ -257,13 +272,13 @@ int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, char **arg else { scan_field_t field; - field.device = device; + field.tap = tap; field.num_bits = xsdrsize; field.out_value = dr_out_buf; field.out_mask = NULL; field.in_value = NULL; jtag_set_check_value(&field, dr_in_buf, dr_in_mask, NULL); - if (device == -1) + if (tap == NULL) jtag_add_plain_dr_scan(1, &field, TAP_PD); else jtag_add_dr_scan(1, &field, TAP_PD); @@ -331,13 +346,13 @@ int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, char **arg else { scan_field_t field; - field.device = device; + field.tap = tap; field.num_bits = xsdrsize; field.out_value = dr_out_buf; field.out_mask = NULL; field.in_value = NULL; jtag_set_check_value(&field, dr_in_buf, dr_in_mask, NULL); - if (device == -1) + if (tap == NULL) jtag_add_plain_dr_scan(1, &field, TAP_PD); else jtag_add_dr_scan(1, &field, TAP_PD); @@ -401,7 +416,27 @@ int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, char **arg do_abort = 1; else { - jtag_add_pathmove(path_len, path); + int i,lasti; + /* here the trick is that jtag_add_pathmove() must end in a stable + state, so we must only invoke jtag_add_tlr() when we absolutely + have to + */ + for(i=0,lasti=0;ilasti) + { + jtag_add_pathmove(i-lasti,path+lasti); + } + lasti=i+1; + jtag_add_tlr(); + } + } + if(i>=lasti) + { + jtag_add_pathmove(i-lasti, path+lasti); + } } free(path); } @@ -454,7 +489,7 @@ int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, char **arg else { scan_field_t field; - field.device = device; + field.tap = tap; field.num_bits = us; field.out_value = ir_buf; field.out_mask = NULL; @@ -463,7 +498,7 @@ int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, char **arg field.in_check_mask = NULL; field.in_handler = NULL; field.in_handler_priv = NULL; - if (device == -1) + if (tap == NULL) jtag_add_plain_ir_scan(1, &field, xsvf_to_tap[xendir]); else jtag_add_ir_scan(1, &field, xsvf_to_tap[xendir]);