Beginnings of info flash support. It isn't very good.
[goodfet] / firmware / apps / jtag / jtag.c
index 97db51b..d0d2118 100644 (file)
 void jtagsetup(){
   P5DIR|=MOSI+SCK+TMS;
   P5DIR&=~MISO;
+  /*
   P5OUT|=0xFFFF;
   P5OUT=0;
+  */
   P4DIR|=TST;
   P2DIR|=RST;
   msdelay(100);
@@ -103,7 +105,7 @@ void jtag_stop(){
   P4OUT=0;
 }
 
-unsigned int drwidth=20;
+unsigned int drwidth=16;
 //! Shift all bits of the DR.
 unsigned long jtag_dr_shift20(unsigned long in){
   // idle
@@ -135,6 +137,26 @@ unsigned int jtag_dr_shift16(unsigned int in){
   return(jtagtransn(in,16));
 }
 
+//! Shift native width of the DR
+unsigned long jtag_dr_shiftadr(unsigned long in){
+  unsigned long out=0;
+  
+  // idle
+  SETTMS;
+  TCKTOCK;
+  // select DR
+  CLRTMS;
+  TCKTOCK;
+  // capture IR
+  TCKTOCK;
+
+  
+  out=jtagtransn(in,drwidth);
+  
+  // shift DR, then idle
+  return(out);
+}
+
 
 //! Shift 8 bits of the IR.
 unsigned char jtag_ir_shift8(unsigned char in){