Chipcon SPI driver, in the works.
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Tue, 15 Jun 2010 01:38:59 +0000 (01:38 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Tue, 15 Jun 2010 01:38:59 +0000 (01:38 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@631 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

firmware/Makefile
firmware/apps/radios/ccspi.c
firmware/goodfet.c
firmware/include/apps.h
firmware/include/ccspi.h [new file with mode: 0644]
firmware/include/command.h
firmware/include/nrf.h

index e37004c..91fb495 100644 (file)
@@ -34,7 +34,7 @@ moreapps?=apps/jtag/sbw.o
 # should include apps/jtag/jtagarm7tdmi.o to build jtag for ARM7
 # should include apps/pic/dspic33f.o to build support for PIC24H/dsPIC33F
 
 # should include apps/jtag/jtagarm7tdmi.o to build jtag for ARM7
 # should include apps/pic/dspic33f.o to build support for PIC24H/dsPIC33F
 
-apps= $(moreapps) apps/chipcon/chipcon.o apps/radios/nrf.o apps/monitor/monitor.o apps/spi/spi.o   apps/jtag/jtag.o apps/jtag/jtag430.o apps/jtag/jtag430x2.o apps/avr/avr.o 
+apps= $(moreapps) apps/chipcon/chipcon.o apps/radios/nrf.o apps/radios/ccspi.o apps/monitor/monitor.o apps/spi/spi.o   apps/jtag/jtag.o apps/jtag/jtag430.o apps/jtag/jtag430x2.o apps/avr/avr.o 
 
 #apps/chipcon/chipconasm.o removed
 libs= lib/$(mcu).o lib/command.o apps/jtag/jtag430asm.o  lib/dco_calib.o
 
 #apps/chipcon/chipconasm.o removed
 libs= lib/$(mcu).o lib/command.o apps/jtag/jtag430asm.o  lib/dco_calib.o
index e1cb9bb..bf68a58 100644 (file)
@@ -128,7 +128,7 @@ void ccspihandle(unsigned char app,
     RADIOPASSIVE;
     //Get the packet.
     CLRSS;
     RADIOPASSIVE;
     //Get the packet.
     CLRSS;
-    ccspitrans8(CCSPI_R_RX_PAYLOAD);
+    ccspitrans8(CCSPI_RXFIFO);
     for(i=0;i<32;i++)
       cmddata[i]=ccspitrans8(0xde);
     SETSS;
     for(i=0;i<32;i++)
       cmddata[i]=ccspitrans8(0xde);
     SETSS;
@@ -138,7 +138,7 @@ void ccspihandle(unsigned char app,
   case CCSPI_RX_FLUSH:
     //Flush the buffer.
     CLRSS;
   case CCSPI_RX_FLUSH:
     //Flush the buffer.
     CLRSS;
-    ccspitrans8(CCSPI_FLUSH_RX);
+    ccspitrans8(CCSPI_SFLUSHRX);
     SETSS;
     
     //Return the packet.
     SETSS;
     
     //Return the packet.
index 592c3bf..d79fdac 100644 (file)
@@ -97,6 +97,9 @@ void handle(unsigned char app,
   case NRF:
     nrfhandle(app,verb,len);
     break;
   case NRF:
     nrfhandle(app,verb,len);
     break;
+  case CCSPI:
+    ccspihandle(app,verb,len);
+    break;
   case AVR:
     avrhandle(app,verb,len);
     break;
   case AVR:
     avrhandle(app,verb,len);
     break;
index ac0c471..f0b9b08 100644 (file)
@@ -21,7 +21,8 @@
 #define PIC 0x34
 
 //Radio peripherals are in the 0x50 range.
 #define PIC 0x34
 
 //Radio peripherals are in the 0x50 range.
-#define NRF 0x50
+#define NRF   0x50
+#define CCSPI 0x51
 
 //Keep 0x60 empty for now.
 
 
 //Keep 0x60 empty for now.
 
diff --git a/firmware/include/ccspi.h b/firmware/include/ccspi.h
new file mode 100644 (file)
index 0000000..6b7bb31
--- /dev/null
@@ -0,0 +1,32 @@
+/*! \file ccspi.h
+  \author Travis Goodspeed
+  \brief Constants for CCSPI Driver
+*/
+
+//Chipcon SPI Commands
+
+//Grab a packet, if one is available.
+#define CCSPI_RX 0x80
+//Send a packet.
+#define CCSPI_TX 0x81
+//Flush RX
+#define CCSPI_RX_FLUSH 0x82
+//Flush TX
+#define CCSPI_TX_FLUSH 0x83
+
+
+//Bit fields for command word.
+#define CCSPI_R_REGISTER 0
+#define CCSPI_W_REGISTER BIT7
+#define CCSPI_R_RAM BIT6
+#define CCSPI_W_RAM (BIT6|BIT7)
+
+
+
+//Register definitions might go here, at least for buffers.
+#define CCSPI_MANFIDL 0x1E
+#define CCSPI_MANFIDH 0x1F
+#define CCSPI_TXFIFO  0x3E
+#define CCSPI_RXFIFO  0x3F
+#define CCSPI_SFLUSHRX 0x08
+#define CCSPI_SFLUSHTX 0x09
index 7d0d169..f12b537 100644 (file)
@@ -141,6 +141,9 @@ WEAKDEF void jtag430x2handle(unsigned char app, unsigned char verb, unsigned lon
 WEAKDEF void nrfhandle(unsigned char,
                       unsigned char,
                       unsigned long);
 WEAKDEF void nrfhandle(unsigned char,
                       unsigned char,
                       unsigned long);
+WEAKDEF void ccspihandle(unsigned char,
+                      unsigned char,
+                      unsigned long);
 WEAKDEF void avrhandle(unsigned char app,
                       unsigned char verb,
                       unsigned long len);  
 WEAKDEF void avrhandle(unsigned char app,
                       unsigned char verb,
                       unsigned long len);  
index 06805ae..2423495 100644 (file)
@@ -3,7 +3,7 @@
   \brief Constants for NRF Driver
 */
 
   \brief Constants for NRF Driver
 */
 
-//Nording RF Commands
+//Nordic RF Commands
 
 //Grab a packet, if one is available.
 #define NRF_RX 0x80
 
 //Grab a packet, if one is available.
 #define NRF_RX 0x80