> I was looking at this, and it had a few style problems. Here's
> a slightly cleaned-up version of your code ... untested.
> I suggest you eyeball what I changed, and update your latest
> patch ...
Hello David,
I've been reading the XSVF spec a bit more, and I'm pretty sure that the
handling of xenddr around line 550 was wrong in the first place. Testing
xendir doesn't make sense IMHO - if at all, xenddr should be tested
here, shouldn't it?
I've attached an updated patch. I'm out of my office until next week, so
I can't test it right now. Could you give it a try?
Thanks,
Florian
P.S. Sending this to the list, too, since pacbell.net seems to block my
mails..?
diff --git a/src/xsvf/xsvf.c b/src/xsvf/xsvf.c
index 539fbdc..cda093e 100644
--- a/src/xsvf/xsvf.c
+++ b/src/xsvf/xsvf.c
@@ -269,7 +269,7 @@ COMMAND_HANDLER(handle_xsvf_command)
*/
if (collecting_path) {
tap_state_t mystate;
- uint8_t uc;
+ uint8_t uc = opcode;
switch (opcode) {
case XCOMMENT:
@@ -414,27 +414,56 @@ COMMAND_HANDLER(handle_xsvf_command)
}
break;
- case XSDR: /* these two are identical except for the dr_in_buf */
+ case XSDRB:
+ case XSDRC:
+ case XSDRE:
+ /* these two are identical except for the dr_in_buf */
+ case XSDR:
case XSDRTDO:
{
- int limit = xrepeat;
- int matched = 0;
- int attempt;
-
- const char* op_name = (opcode == XSDR ? "XSDR" : "XSDRTDO");
+ int limit = xrepeat;
+ int matched = 0;
+ int attempt;
+ const char *op_name;
+
+ switch (opcode) {
+ case XSDR:
+ op_name = "XSDR";
+ break;
+ case XSDRB:
+ op_name = "XSDRB";
+ break;
+ case XSDRC:
+ op_name = "XSDRC";
+ break;
+ case XSDRE:
+ op_name = "XSDRE";
+ break;
+ default:
+ op_name = "XSDRTDO";
+ break;
+ }
- if (xsvf_read_buffer(xsdrsize, xsvf_fd, dr_out_buf) != ERROR_OK)
+ if (xsvf_read_buffer(xsdrsize, xsvf_fd,
+ dr_out_buf) != ERROR_OK)
{
do_abort = 1;
break;
}
- if (opcode == XSDRTDO)
- {
- if (xsvf_read_buffer(xsdrsize, xsvf_fd, dr_in_buf) != ERROR_OK)
- {
+ switch (opcode) {
+ case XSDRB:
+ case XSDRC:
+ goto done;
+ case XSDRE:
+ result = svf_add_statemove(xenddr);
+ goto done;
+ case XSDRTDO:
+ result = xsvf_read_buffer(xsdrsize,
+ xsvf_fd, dr_in_buf);
+ if (result != ERROR_OK) {
do_abort = 1;
- break;
+ goto done;
}
}
@@ -517,8 +546,7 @@ COMMAND_HANDLER(handle_xsvf_command)
else
jtag_add_sleep(xruntest);
}
- else if (xendir != TAP_DRPAUSE) /* we are already in TAP_DRPAUSE */
- result = svf_add_statemove(xenddr);
+ else result = svf_add_statemove(xenddr);
}
break;
@@ -532,21 +560,6 @@ COMMAND_HANDLER(handle_xsvf_command)
unsupported = 1;
break;
- case XSDRB:
- LOG_ERROR("unsupported XSDRB\n");
- unsupported = 1;
- break;
-
- case XSDRC:
- LOG_ERROR("unsupported XSDRC\n");
- unsupported = 1;
- break;
-
- case XSDRE:
- LOG_ERROR("unsupported XSDRE\n");
- unsupported = 1;
- break;
-
case XSDRTDOB:
LOG_ERROR("unsupported XSDRTDOB\n");
unsupported = 1;
@@ -999,6 +1012,7 @@ COMMAND_HANDLER(handle_xsvf_command)
unsupported = 1;
}
+done:
if (do_abort || unsupported || tdo_mismatch)
{
LOG_DEBUG("xsvf failed, setting taps to reasonable state");
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development