summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordbrownell <dbrownell@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-09-26 19:08:34 +0000
committerdbrownell <dbrownell@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-09-26 19:08:34 +0000
commit2e210ee48fa5a2dfc1ddc3b47c1aef4da814ca25 (patch)
tree75919eddc5172f5519d806fa5d5c6b440471bc5e /src
parentad43374c7fe781ede0f5472f9cbdc55fc9486a6d (diff)
downloadopenocd+libswd-2e210ee48fa5a2dfc1ddc3b47c1aef4da814ca25.tar.gz
openocd+libswd-2e210ee48fa5a2dfc1ddc3b47c1aef4da814ca25.tar.bz2
openocd+libswd-2e210ee48fa5a2dfc1ddc3b47c1aef4da814ca25.tar.xz
openocd+libswd-2e210ee48fa5a2dfc1ddc3b47c1aef4da814ca25.zip
Streamline Capture-IR handling and integrity test.
Change the handling of the "-ircapture" and "-irmask" parameters to be slightly more sensible, given that the JTAG spec describes what is required, and that we already require that conformance in one place. IR scan returns some bitstring with LSBs "01". - First, provide and use default values that satisfy the IEEE spec. Existing TAP configs will override the defaults, but those parms are no longer required. - Second, warn if any TAP gets set up to violate the JTAG spec. It's likely a bug, but maybe not; else this should be an error. Improve the related diagnostics to say which TAP is affected. And associated minor fixes/cleanups to comments and diagnostics. git-svn-id: svn://svn.berlios.de/openocd/trunk@2758 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src')
-rw-r--r--src/jtag/tcl.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index 0368c4f8..aa32085b 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -242,13 +242,15 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
LOG_DEBUG("Creating New Tap, Chip: %s, Tap: %s, Dotted: %s, %d params",
pTap->chip, pTap->tapname, pTap->dotted_name, goi->argc);
- /* deal with options */
-#define NTREQ_IRLEN 1
-#define NTREQ_IRCAPTURE 2
-#define NTREQ_IRMASK 4
+ /* IEEE specifies that the two LSBs of an IR scan are 01, so make
+ * that the default. The "-irlen" and "-irmask" options are only
+ * needed to cope with nonstandard TAPs, or to specify more bits.
+ */
+ pTap->ir_capture_mask = 0x03;
+ pTap->ir_capture_value = 0x01;
- /* clear them as we find them */
- reqbits = (NTREQ_IRLEN | NTREQ_IRCAPTURE | NTREQ_IRMASK);
+ /* clear flags for "required options" them as we find them */
+ reqbits = 1;
while (goi->argc) {
e = Jim_GetOpt_Nvp(goi, opts, &n);
@@ -308,31 +310,39 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
switch (n->value) {
case NTAP_OPT_IRLEN:
if (w > (jim_wide) (8 * sizeof(pTap->ir_capture_value)))
- LOG_WARNING("huge IR length %d", (int) w);
+ LOG_WARNING("%s: huge IR length %d",
+ pTap->dotted_name,
+ (int) w);
pTap->ir_length = w;
- reqbits &= (~(NTREQ_IRLEN));
+ reqbits = 0;
break;
case NTAP_OPT_IRMASK:
if (is_bad_irval(pTap->ir_length, w)) {
- LOG_ERROR("IR mask %x too big",
+ LOG_ERROR("%s: IR mask %x too big",
+ pTap->dotted_name,
(int) w);
free((void *)pTap->dotted_name);
free(pTap);
return ERROR_FAIL;
}
+ if ((w & 3) != 3)
+ LOG_WARNING("%s: nonstandard IR mask",
+ pTap->dotted_name);
pTap->ir_capture_mask = w;
- reqbits &= (~(NTREQ_IRMASK));
break;
case NTAP_OPT_IRCAPTURE:
if (is_bad_irval(pTap->ir_length, w)) {
- LOG_ERROR("IR capture %x too big",
+ LOG_ERROR("%s: IR capture %x too big",
+ pTap->dotted_name,
(int) w);
free((void *)pTap->dotted_name);
free(pTap);
return ERROR_FAIL;
}
+ if ((w & 3) != 1)
+ LOG_WARNING("%s: nonstandard IR value",
+ pTap->dotted_name);
pTap->ir_capture_value = w;
- reqbits &= (~(NTREQ_IRCAPTURE));
break;
}
} /* switch (n->value) */