X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Fgoodfet.c;h=f12e278b0179049ce14f2babe83e0924c3b93a4b;hp=4d791f8b3885b5c1c134f865c4c38d95b5f4149f;hb=dffb4095b5c57ed45748646d224b719015ebd92f;hpb=602c5212c0b08f5056f639749e0246b4855a4921 diff --git a/firmware/goodfet.c b/firmware/goodfet.c index 4d791f8..f12e278 100644 --- a/firmware/goodfet.c +++ b/firmware/goodfet.c @@ -15,7 +15,10 @@ //! 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();