X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Fgoodfet.c;h=9fb9ec9f997ef23f76fa396a29e0236b84573e90;hp=a61f79b25b4283150704c14efa16e5a2e7a15161;hb=33c548994df07e43f25464b7d3f24642e9142a99;hpb=124d382cce21bad10a942c7d9f610a6934c24f63 diff --git a/firmware/goodfet.c b/firmware/goodfet.c index a61f79b..9fb9ec9 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. @@ -75,6 +78,11 @@ void handle(unsigned char app, case AVR: avrhandle(app,verb,len); break; +#ifdef INSTALL_PIC_APP + case PIC: + pichandle(app,verb,len); + break; +#endif case I2CAPP: i2chandle(app,verb,len); break; @@ -88,7 +96,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 +129,7 @@ int main(void) void (*reboot_function)(void) = (void *) 0xFFFE; init(); - + txstring(MONITOR,OK,"http://goodfet.sf.net/"); @@ -127,25 +137,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(); @@ -158,7 +168,7 @@ int main(void) handle(app,verb,len); }else{ //Listen to the blaberring. - for(i-0;i