+ DAC12_0DAT = vcc; //high;
+ DAC12_1DAT = gnd; //low;
+ #endif
+}
+//! Set glitching rate.
+void glitchrate(u16 rate){
+ glitchcount=rate;
+}
+
+//! Handles a monitor command.
+void glitchhandle(unsigned char app,
+ unsigned char verb,
+ unsigned long len){
+ switch(verb){
+ case GLITCHVOLTAGES:
+ glitchvoltages(cmddataword[0],
+ cmddataword[1]);
+ txdata(app,verb,0);
+ break;
+ case GLITCHRATE:
+ glitchrate(cmddataword[0]);
+ txdata(app,verb,0);
+ break;
+ case GLITCHVERB:
+ //FIXME parameters don't work yet.
+ glitchprime();
+ TAR=0; //Reset clock.
+ handle(cmddata[0],cmddata[1],0);
+ TACTL |= MC0;// Stop Timer_A;
+ break;
+ case GLITCHTIME:
+ _DINT();//disable interrupts
+ TACTL=0; //clear dividers
+ TACTL|=TACLR; //clear config
+ TACTL|=TASSEL_SMCLK| //smclk source
+ MC_2; //continuous mode.
+
+ //perform the function
+ silent++;//Don't want the function to return anything.
+ TAR=0;
+ handle(cmddata[0],cmddata[1],0);
+ cmddataword[0]=TAR; //Return counter.
+ silent--;
+ txdata(app,verb,2);
+ break;
+ case START:
+ //Testing mode, for looking at the glitch waveform.
+ glitchvoltages(0,0xFFF);//Minimum glitch, for noise test.
+ //glitchvoltages(0,0);//Drop VCC
+ //glitchvoltages(0xFFF,0xFFF);//Raise Ground
+ P5OUT|=BIT7;//Normal
+ P5DIR|=BIT7;
+ while(1){
+ P5OUT&=~BIT7;//Glitch
+ //asm("nop"); //Not Necessary
+ P5OUT|=BIT7;//Normal
+ asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");
+ asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");
+ }
+ txdata(app,verb,0);
+ break;
+ case STOP:
+ case GLITCHAPP:
+ default:
+ debugstr("Unknown glitching verb.");
+ txdata(app,NOK,0);
+ }