X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=firmware%2Fapps%2Fglitch%2Fglitch.c;h=83fa9d6e3246845ea11039d99817343f0df3c0b7;hb=2d4fe6ee83444a71d01956a1bf43a0eedcd2284b;hp=0691932f3ba173276bbc8a7fc30ba4635addf2b4;hpb=704a3e5036b88ba2fc03606d24b0e474b22338e8;p=goodfet diff --git a/firmware/apps/glitch/glitch.c b/firmware/apps/glitch/glitch.c index 0691932..83fa9d6 100644 --- a/firmware/apps/glitch/glitch.c +++ b/firmware/apps/glitch/glitch.c @@ -11,6 +11,31 @@ #include "command.h" #include "glitch.h" +#include + +//! Handles a monitor command. +void glitch_handle_fn( uint8_t const app, + uint8_t const verb, + uint32_t const len); + +// define the glitch app's app_t +app_t const glitch_app = { + + /* app number */ + GLITCH, + + /* handle fn */ + glitch_handle_fn, + + /* name */ + "GLITCH", + + /* desc */ + "\tThe GLITCH app adds support for doing glitch research.\n" + "\tSee the TI example MSP430x261x_dac12_01.c for usage of the DAC.\n" + "\tThis module sends odd and insufficient voltages on P6.6/DAC0\n" + "\tin order to bypass security restrictions of target devices.\n" +}; //! Call this before the function to be glitched. void glitchprime(){ @@ -18,7 +43,8 @@ void glitchprime(){ WDTCTL = WDTPW + WDTHOLD; // Stop WDT glitchsetup(); - _EINT(); + //_EINT(); + __eint(); return; #endif } @@ -46,7 +72,7 @@ void glitchsetup(){ } // Timer A0 interrupt service routine -interrupt(TIMERA0_VECTOR) Timer_A (void){ +void __attribute__((interrupt(TIMERA0_VECTOR))) Timer_A (void){ //This oughtn't be necessary, but glitches repeat without it. TACTL=0; //disable counter. @@ -102,9 +128,10 @@ void glitchrate(u16 rate){ } //! Handles a monitor command. -void glitchhandle(unsigned char app, - unsigned char verb, - unsigned long len){ +void glitch_handle_fn( uint8_t const app, + uint8_t const verb, + uint32_t const len) +{ switch(verb){ case GLITCHVOLTAGES: glitchvoltages(cmddataword[0], @@ -124,11 +151,12 @@ void glitchhandle(unsigned char app, break; case GLITCHTIME: debugstr("Measuring start time."); - _DINT();//disable interrupts + __dint();//disable interrupts TACTL=0; //clear dividers TACTL|=TACLR; //clear config - TACTL|=TASSEL_SMCLK| //smclk source - MC_2; //continuous mode. + TACTL|= + TASSEL_2 //smclk source + | MC_2; //continuous mode. //perform the function silent++;//Don't want the function to return anything.