updated command line 802.15.4 checksum calculator and added serClose to GoodFET to...
[goodfet] / firmware / include / sbw.h
index 3ca6063..206dd6a 100644 (file)
@@ -3,6 +3,18 @@
   \brief Spy-Bi-Wire Stuff
 */
 
+#ifndef SBW_H
+#define SBW_H
+
+#include "app.h"
+extern app_t const sbw_app;
+
+#define SBW 0x17
+
+#include "platform.h"
+#include "command.h"
+#include "app.h"
+
 //IO Pins; these are for EZ430, not GoodFET/UIF
 #define SBWTCK  BIT3
 #define SBWTDIO BIT2
 
 // I/O Redefintions
 extern int tms, tdi, tdo;
+#undef SETTMS
 #define SETTMS tms=1
+#undef CLRTMS
 #define CLRTMS tms=0
+#undef SETTDI
 #define SETTDI tdi=1
+#undef CLRTDI
 #define CLRTDI tdi=0
+#undef TCKTOCK
 #define TCKTOCK clock_sbw()
+#undef SETMOSI
 #define SETMOSI SETTDI
+#undef CLRMOSI
 #define CLRMOSI CLRTDI
+#undef READMISO
 #define READMISO tdo
 
 #endif
@@ -31,7 +51,7 @@ extern int tms, tdi, tdo;
 void sbwsetup();
 
 //! Handle a SBW request.
-void sbwhandle(u8 app, u8 verb, u8 len);
+void sbw_handler_fn(u8 app, u8 verb, u32 len);
 
 //! Perform a SBW bit transaction.
 void clock_sbw();
@@ -41,19 +61,18 @@ void sbwSETTCLK();
 void sbwCLRTCLK();
 
 // Macros
-
 #define SBWCLK() do { \
-    P5OUT &= ~SBWTCK; \
+    SPIOUT &= ~SBWTCK; \
     asm("nop");              \
     asm("nop");              \
     asm("nop");              \
-    P5OUT |= SBWTCK;  \
+    SPIOUT |= SBWTCK;  \
   } while (0)
 #define SETSBWIO(x) do {                       \
   if (x)                                       \
-    P5OUT |= SBWTDIO;                          \
+    SPIOUT |= SBWTDIO;                         \
   else                                         \
-    P5OUT &= ~SBWTDIO;                         \
+    SPIOUT &= ~SBWTDIO;                                \
   } while (0)
 #undef RESTORETCLK
 #define RESTORETCLK do {                       \
@@ -78,5 +97,5 @@ void sbwCLRTCLK();
 //Do nothing for this.
 #define SAVETCLK 
 
-
+#endif // SBW_H