Plugin architecture stuff.
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Fri, 5 Feb 2010 04:54:12 +0000 (04:54 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Fri, 5 Feb 2010 04:54:12 +0000 (04:54 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@299 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

firmware/apps/glitch/glitch.c
firmware/apps/plugins/Makefile [new file with mode: 0644]
firmware/apps/plugins/ps2.c [new file with mode: 0644]
firmware/goodfet.c
firmware/include/apps.h
firmware/include/ps2.h [new file with mode: 0644]

index 65742bc..0ff76f1 100644 (file)
@@ -23,8 +23,8 @@ void glitchprime(){
   TACTL|=TACLR;      //Clear TimerA Config
   TACTL|=
     TASSEL_SMCLK |   //SMCLK source,
   TACTL|=TACLR;      //Clear TimerA Config
   TACTL|=
     TASSEL_SMCLK |   //SMCLK source,
-    MC_1;            //Count up to CCR0
-  //TAIE;            //Enable Interrupt
+    MC_1 |            //Count up to CCR0
+    TAIE;            //Enable Interrupt
   CCTL0 = CCIE;                         // CCR0 interrupt enabled
   CCR0 = glitchcount;
   
   CCTL0 = CCIE;                         // CCR0 interrupt enabled
   CCR0 = glitchcount;
   
diff --git a/firmware/apps/plugins/Makefile b/firmware/apps/plugins/Makefile
new file mode 100644 (file)
index 0000000..fc5470e
--- /dev/null
@@ -0,0 +1,3 @@
+
+ps2.hex:
+       cd ../.. && moreapps=apps/plugins/ps2.o make clean all && mv goodfet.hex apps/plugins/ps2.hex
diff --git a/firmware/apps/plugins/ps2.c b/firmware/apps/plugins/ps2.c
new file mode 100644 (file)
index 0000000..53b939c
--- /dev/null
@@ -0,0 +1,74 @@
+/*! \file glitch.c
+  \author Travis Goodspeed
+  \brief PS2 Timing Monitor for GoodFET
+  
+  This module spies on PS/2.  For now, it just reports the
+  inter-character timing information.
+*/
+
+#include "platform.h"
+#include "command.h"
+#include "ps2.h"
+#include "jtag.h"
+
+
+u16 mclock=0;
+u32 clock=0;
+
+// Timer A0 interrupt service routine
+interrupt(TIMERA0_VECTOR) Timer_A (void)
+{
+  if(!clock++)
+    mclock++;
+  return;
+}
+
+
+
+/** Pins (Clk, Dat)
+    TDI P5.1
+    TDO P5.2
+*/
+
+// This is just a plugin for now.
+#define ps2handle pluginhandle
+
+u32 oldclock=0;
+//! Handles a monitor command.
+int ps2handle(unsigned char app,
+             unsigned char verb,
+             unsigned int len){
+  switch(verb){
+  case START:
+    WDTCTL = WDTPW + WDTHOLD;             // Stop WDT
+    TACTL = TASSEL1 + TACLR;              // SMCLK, clear TAR
+    CCTL0 = CCIE;                         // CCR0 interrupt enabled
+    CCR0 = 0x100; //clock divider
+    TACTL |= MC_3;
+    _EINT();                              // Enable interrupts 
+    
+    
+    P5DIR&=~(TDI+TDO);//input mode
+    P5OUT=0; // pull down
+    
+    debugstr("Waiting for a keypress.");
+    //Wait for a keypress.
+    
+    while(1){
+      //Debounce the 1s polling
+      while((P5IN&TDI && P5IN&TDO))
+       while((P5IN&TDI));// && P5IN&TDO));
+      
+      //Transmit the data only if it is new.
+      
+      if((cmddatalong[0]=clock-oldclock)>0x100)
+       txdata(app,verb,4);
+      oldclock=clock;
+    }
+    break;
+  case STOP:
+  default:
+    debugstr("Unknown ps2 verb.");
+    txdata(app,NOK,0);
+  }
+}
index 3da4d04..1e9b015 100644 (file)
@@ -13,9 +13,6 @@
 #include "glitch.h"\r
 \r
 \r
 #include "glitch.h"\r
 \r
 \r
-//LED on P1.0\r
-//IO on P5\r
-\r
 //! Initialize registers and all that jazz.\r
 void init(){\r
   int i;\r
 //! Initialize registers and all that jazz.\r
 void init(){\r
   int i;\r
index f33a315..e2b93fb 100644 (file)
@@ -15,5 +15,6 @@
 
 #define OCT 0x70
 #define GLITCH 0x71
 
 #define OCT 0x70
 #define GLITCH 0x71
+#define PLUGIN 0x72
 
 #define DEBUGAPP 0xFF
 
 #define DEBUGAPP 0xFF
diff --git a/firmware/include/ps2.h b/firmware/include/ps2.h
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+