Some Chipcon devices have a resistor and capacitor on the !RST line.
[goodfet] / firmware / apps / jtag / jtag.c
index 415f36a..cc6ef16 100644 (file)
@@ -25,10 +25,8 @@ void jtagsetup(){
 /************************** JTAG Primitives ****************************/
 // these have been turned into functions to save flash space
 void jtag_tcktock() {
-  //delay(1);  // FIXME: Should never wait this long...
   CLRTCK; 
   PLEDOUT^=PLEDPIN; 
-  //delay(1);  // FIXME: Should never wait this long...
   SETTCK; 
   PLEDOUT^=PLEDPIN;
 }
@@ -50,7 +48,7 @@ void jtag_goto_shift_dr() {
   jtag_tcktock();
 }
 
-void jtag_reset_to_runtest_idle() {
+void jtag_resettap(){
   SETTMS;
   jtag_tcktock();
   jtag_tcktock();
@@ -186,7 +184,7 @@ unsigned char jtagtrans8(unsigned char byte){
   SAVETCLK;
   
   for (bit = 0; bit < bitcount; bit++) {
-    //* write MOSI on trailing edge of previous clock *
+    // write MOSI on trailing edge of previous clock *
     if (word & high)
       {SETMOSI;}
     else
@@ -197,7 +195,7 @@ unsigned char jtagtrans8(unsigned char byte){
       SETTMS;//TMS high on last bit to exit.
     
     TCKTOCK;
-    //* read MISO on trailing edge *
+    // read MISO on trailing edge *
     word |= READMISO;
   }
   
@@ -315,6 +313,10 @@ void jtaghandle(unsigned char app,
     cmddataword[0]=jtag_dr_shift16(cmddataword[0]);
     txdata(app,verb,2);
     break;
+  case JTAG_RESETTAP:
+    jtag_resettap();
+    txdata(app,verb,0);
+    break;
   default:
     txdata(app,NOK,0);
   }