Partial refactoring, forgot spi.h early.
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Wed, 9 Sep 2009 05:52:51 +0000 (05:52 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Wed, 9 Sep 2009 05:52:51 +0000 (05:52 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@126 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

firmware/Makefile
firmware/apps/monitor/monitor.c
firmware/include/command.h
firmware/include/spi.h [new file with mode: 0644]

index 41c9edf..f0c2345 100644 (file)
@@ -32,7 +32,7 @@ run:
 
 install: $(app).hex
        $(BSL) -e
-       #$(BSL) -p info.txt || true  #MSP430F2xx targets only, inelegant.
+       ls info.txt && $(BSL) -p info.txt || true  #MSP430F2xx targets only, inelegant.
        $(BSL) -p $(app).hex 
 verify:
        $(BSL) -P $(app).hex -v $(app).hex
index 78aaa91..162e27e 100644 (file)
@@ -29,6 +29,18 @@ void monitorhandle(unsigned char app,
     cmddataword[0]=monitor_ram_depth();
     txdata(app,verb,2);
     break;
+  case MONITOR_DIR:
+    P5DIR=cmddata[0];
+    txdata(app,verb,1);
+    break;
+  case MONITOR_IN:
+    cmddata[0]=P5IN;
+    txdata(app,verb,1);
+    break;
+  case MONITOR_OUT:
+    P5OUT=cmddata[0];
+    txdata(app,verb,1);
+    break;
   }
 }
 
index 5855699..a20067a 100644 (file)
@@ -23,6 +23,10 @@ extern unsigned char cmddata[256];
 #define MONITOR_RAM_PATTERN 0x90
 #define MONITOR_RAM_DEPTH 0x91
 
+#define MONITOR_DIR 0xA0
+#define MONITOR_OUT 0xA1
+#define MONITOR_IN  0xA2
+
 //CHIPCON commands
 #define CC_CHIP_ERASE 0x80
 #define CC_WR_CONFIG 0x81
diff --git a/firmware/include/spi.h b/firmware/include/spi.h
new file mode 100644 (file)
index 0000000..8cd488a
--- /dev/null
@@ -0,0 +1,17 @@
+/** SPI **/
+
+
+//Pins and I/O
+#define SS   BIT0
+#define MOSI BIT1
+#define MISO BIT2
+#define SCK  BIT3
+
+#define SETSS P5OUT|=SS
+#define CLRSS P5OUT&=~SS
+
+#define SETMOSI P5OUT|=MOSI
+#define CLRMOSI P5OUT&=~MOSI
+#define SETCLK P5OUT|=SCK
+#define CLRCLK P5OUT&=~SCK
+#define READMISO (P5IN&MISO?1:0)