+ if (word & high)
+ {SETMOSI;}
+ else
+ {CLRMOSI;}
+ word <<= 1;
+
+ if(bit==bitcount-1)
+ SETTMS;//TMS high on last bit to exit.
+
+ CLRTCK;
+ SETTCK;
+ /* read MISO on trailing edge */
+ word |= READMISO;
+ }
+
+ if(bitcount==20){
+ word = ((word << 16) | (word >> 4)) & 0x000FFFFF;
+ }
+
+ RESTORETCLK;
+
+ // exit state
+ CLRTCK;
+ SETTCK;
+ // update state
+ CLRTMS;
+ CLRTCK;
+ SETTCK;
+
+ return word;
+}
+
+/*
+//! Shift 16 bits in and out.
+unsigned int jtagtrans16(unsigned int word){ //REMOVEME
+ unsigned int bit;
+ SAVETCLK;
+
+ for (bit = 0; bit < 16; bit++) {
+ // write MOSI on trailing edge of previous clock