X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Fgoodfet.c;h=69436a14065405a07e83a19240aa7424f599b66a;hp=53591509c91d11d567ba031b7a09803f35a642a5;hb=b6d999dedf6b66a435091e45a7d1bf69100e4b3d;hpb=6e4a1014e1ddfdf63dbf07fa3fdcaa1fdca99bab diff --git a/firmware/goodfet.c b/firmware/goodfet.c index 5359150..69436a1 100644 --- a/firmware/goodfet.c +++ b/firmware/goodfet.c @@ -13,11 +13,9 @@ #include "glitch.h" -//LED on P1.0 -//IO on P5 - //! Initialize registers and all that jazz. void init(){ + int i; WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer //LED out and on. @@ -29,9 +27,29 @@ void init(){ msp430_init_uart(); //DAC should be at full voltage if it exists. - #ifdef DAC12IR - glitchvoltages(0xfff,0xfff); - #endif +#ifdef DAC12IR + //glitchvoltages(0xfff,0xfff); + ADC12CTL0 = REF2_5V + REFON; // Internal 2.5V ref on + for(i=0;i!=0xFFFF;i++) asm("nop"); + DAC12_0CTL = DAC12IR + DAC12AMP_5 + DAC12ENC; // Int ref gain 1 + DAC12_0DAT = 0xFFF; //Max voltage 0xfff + DAC12_1CTL = DAC12IR + DAC12AMP_5 + DAC12ENC; // Int ref gain 1 + DAC12_1DAT = 0x000; //Min voltage 0x000 +#endif + + /** FIXME + + This part is really ugly. GSEL (P5.7) must be high to select + normal voltage, but a lot of applications light to swing it low + to be a nuissance. To get around this, we assume that anyone + with a glitching FET will also have a DAC, then we set that DAC + to a high voltage. + + At some point, each target must be sanitized to show that it + doesn't clear P5OUT or P5DIR. + */ + P5DIR|=BIT7; P5OUT=BIT7; //Normal Supply + P5DIR&=~BIT7; //Glitch Supply //Enable Interrupts. //eint(); @@ -66,6 +84,9 @@ void handle(unsigned char app, case JTAG: jtaghandle(app,verb,len); break; + case EJTAG: + ejtaghandle(app,verb,len); + break; case JTAG430: //Also JTAG430X, JTAG430X2 jtag430x2handle(app,verb,len); break;