diff src/jtag.c @ 5:eb14cac68cbb

Transite TAP controller to shift state. - shift commands will transite state machine of TAP controller to shift state before starting shifting.
author Thinker K.F. Li <thinker@branda.to>
date Sun, 22 Feb 2009 13:55:50 +0800
parents 6b1594fb668f
children 61f27549de57
line wrap: on
line diff
--- a/src/jtag.c	Sun Feb 22 12:54:45 2009 +0800
+++ b/src/jtag.c	Sun Feb 22 13:55:50 2009 +0800
@@ -30,6 +30,11 @@
     } while(0)
 #define GET_TDO() (JTAG_PIN & _BV(JTAG_TDO))
 
+/*!
+ * Before shifting registers, TAP controller must move to last state before
+ * shift state.  The state machine transite to shift state when shifting
+ * starts.
+ */
 void jtag_tms(char *buf, int nbits) {
     int i;
     int nbytes, byte;
@@ -88,6 +93,11 @@
     int byteoff, bitoff;
     int bit;
     
+    /* Transite to shift state.
+     * \sa jtag_tms()
+     */
+    pin_lo(JTAG_PORT, JTAG_TMS);
+
     nbytes = nbits / 8;
     for(i = 0; i < nbytes; i++) {
 	byte = buf[i];
@@ -143,6 +153,11 @@
     int byteoff, bitoff;
     int bit;
     
+    /* Transite to shift state.
+     * \sa jtag_tms()
+     */
+    pin_lo(JTAG_PORT, JTAG_TMS);
+
     nbytes = nbits / 8;
     for(i = 0; i < nbytes; i++) {
 	byte = ibuf[i];