Some nRF code, untested.
[goodfet] / firmware / goodfet.c
index 4d791f8..f12e278 100644 (file)
 
 //! Initialize registers and all that jazz.
 void init(){
+  #ifdef DAC12IR
   int i;
+  #endif
+  
   WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog timer
   
   //LED out and on.
@@ -72,9 +75,16 @@ void handle(unsigned char app,
   case SPI:
     spihandle(app,verb,len);
     break;
+  case NRF:
+    nrfhandle(app,verb,len);
+    break;
   case AVR:
     avrhandle(app,verb,len);
     break;
+  case PIC:
+    pichandle(app,verb,len);
+    break;
+
   case I2CAPP:
     i2chandle(app,verb,len);
     break;
@@ -88,7 +98,9 @@ void handle(unsigned char app,
     ejtaghandle(app,verb,len);
     break;
   case JTAG430: //Also JTAG430X, JTAG430X2
+    //Revert this when X2 support returns.
     jtag430x2handle(app,verb,len);
+    //jtag430handle(app,verb,len);
     break;
   case SMARTCARD:
     smartcardhandle(app,verb,len);
@@ -119,7 +131,7 @@ int main(void)
   void (*reboot_function)(void) = (void *) 0xFFFE;
   
   init();
-
+  
   txstring(MONITOR,OK,"http://goodfet.sf.net/");
   
   
@@ -127,25 +139,25 @@ int main(void)
   while(1){
     //Magic 3
     app=serial_rx();
+    
+    // If the app is the reset byte (0x80) increment and loop
+    if (app == RESET) {
+      reset_count++;
 
-       // If the app is the reset byte (0x80) increment and loop
-       if (app == 0x80) {
-               reset_count++;
-
-               if (reset_count > 4) {
-                       // We could trigger the WDT with either:
-                       // WDTCTL = 0;
-                       // or
-                       // WDTCTL = WDTPW + WDTCNTCL + WDTSSEL + 0x00;
-                       // but instead we'll jump to our reboot function pointer
-                       (*reboot_function)();
-               }
-
-               continue;
-       } else {
-               reset_count = 0;
-       }
-
+      if (reset_count > 4) {
+       // We could trigger the WDT with either:
+       // WDTCTL = 0;
+       // or
+       // WDTCTL = WDTPW + WDTCNTCL + WDTSSEL + 0x00;
+       // but instead we'll jump to our reboot function pointer
+       (*reboot_function)();
+      }
+      
+      continue;
+    } else {
+      reset_count = 0;
+    }
+    
     verb=serial_rx();
     //len=serial_rx();
     len=rxword();