Added a GLITCHTIME verb (0x82) for timing the execution of a verb.
[goodfet] / firmware / apps / avr / avr.c
index a4ba6fd..9db6ce4 100644 (file)
@@ -16,8 +16,6 @@
 //! Setup the AVR pins.
 void avrsetup(){
   spisetup();
-  
-  glitchsetup();
 }
 
 //! Initialized an attached AVR.
@@ -31,17 +29,17 @@ void avrconnect(){
 
   SETSS;
   CLRCLK;
-  delay(500);
+  //delay(5);
   CLRSS;
-  delay(500);
+  //delay(5);
   
   //Enable programming
   avr_prgen();
 }
 
 //! Read and write an SPI byte with delays.
-unsigned char avrtrans8(unsigned char byte){
-  register unsigned int bit;
+u8 avrtrans8(u8 byte){
+  register u16 bit;
   //This function came from the SPI Wikipedia article.
   //Minor alterations.
   
@@ -106,7 +104,6 @@ u8 avr_lockbits(){
 }
 //! Write lock bits.
 void avr_setlock(u8 bits){
-  debugstr("Setting lock bits.");
   avrexchange(0xAC,0xE0,0x00,
              bits);
 }
@@ -138,8 +135,10 @@ void avrhandle(unsigned char app,
   unsigned int at;
   static u8 connected=0;
   
+  /*
   if(!avr_isready() && connected)
     debugstr("AVR is not yet ready.");
+  */
   
   switch(verb){
   case READ:
@@ -152,9 +151,10 @@ void avrhandle(unsigned char app,
     avrsetup();
     txdata(app,verb,0);
     break;
-  case START://returns device code
+  case START:
     avrconnect();
-    //no break here
+    txdata(app,verb,0);
+    break;
   case AVR_PEEKSIG:
     for(i=0;i<4;i++)
       cmddata[i]=avr_sig(i);