commit c267686e5d15278cd98bbed9386c10f7d4f4b14c
parent ca407666dff8a0b4b071b5ccd0c15a5191f81454
Author: Brian Swetland <swetland@frotz.net>
Date: Sun, 5 Oct 2014 01:56:26 -0700
jtag: add jtag_idle() to sit in IDLE for count TCKs
Diffstat:
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/jtag-core.c b/jtag-core.c
@@ -187,6 +187,9 @@ static u32 jtag_plot(u32 from, u32 to, u8 **bits) {
fprintf(stderr,"jtag_plot: move from %s to %s\n",
JSTATE[from], JSTATE[to]);
#endif
+ if (from == to) {
+ return 0;
+ }
switch (from) {
case JTAG_RESET:
if (to == JTAG_IDLE) JPATH(0x00, 1); // 0
@@ -233,6 +236,20 @@ void jtag_goto(JTAG *jtag, unsigned state) {
}
}
+void jtag_idle(JTAG *jtag, unsigned count) {
+ unsigned zero = 0;
+ jtag_goto(jtag, JTAG_IDLE);
+ while (count > 0) {
+ if (count > 6) {
+ _scan_tms(0, 6, (void*) &zero, 0, 0);
+ count -= 6;
+ } else {
+ _scan_tms(0, count, (void*) &zero, 0, 0);
+ count = 0;
+ }
+ }
+}
+
static void jtag_xr_wr(JTAG *jtag, JREG *xr, u32 count, u8 *wbits) {
u32 mcount;
u8 *mbits;
diff --git a/jtag.h b/jtag.h
@@ -76,6 +76,9 @@ void jtag_dr_wr(JTAG *jtag, unsigned count, const void *wbits);
void jtag_dr_rd(JTAG *jtag, unsigned count, void *rbits);
void jtag_dr_io(JTAG *jtag, unsigned count, const void *wbits, void *rbits);
+// Move to IDLE and stay there for count clocks
+void jtag_idle(JTAG *jtag, unsigned count);
+
int jtag_commit(JTAG *jtag);
typedef struct {