Preparing for an AVR port of at least the monitor.
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Sun, 17 Apr 2011 21:03:44 +0000 (21:03 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Sun, 17 Apr 2011 21:03:44 +0000 (21:03 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@993 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

firmware/Makefile
firmware/apps/monitor/monitor.c
firmware/include/gfports.h
firmware/include/glitch.h
firmware/include/platform.h
firmware/lib/atmega168.c [new file with mode: 0644]
firmware/lib/command.c

index 36c0cdf..11eaddb 100644 (file)
@@ -24,8 +24,9 @@ platform?=goodfet
 #GCCINC=-T ldscripts/161x.x
 GCCINC=-T ldscripts/$(mcu).x
 
-CCEXTRA?=
-CC=msp430-gcc -Wall -Os -fno-strict-aliasing -g -mmcu=$(mcu) -D$(mcu) -D$(platform) -Dplatform=$(platform) -DGCC $(GCCINC) -I include -I platforms $(CCEXTRA)
+CCEXTRA?=  -D$(mcu) -D$(platform) -Dplatform=$(platform) -DGCC $(GCCINC) -I include -I platforms
+GCC?=msp430-gcc
+CC=$(GCC) -Wall -Os -fno-strict-aliasing -g -mmcu=$(mcu)  $(CCEXTRA)
 
 # Available Applications
 # ======================
index ab6f8a4..73aa61c 100644 (file)
@@ -123,19 +123,22 @@ void monitor_handle_fn(uint8_t const app,
                break;
 
        case MONITOR_DIR:
-               P5DIR=cmddata[0];
-               txdata(app,verb,1);
-               break;
+         //P5DIR=cmddata[0];
+         debugstr("Command deprecated.");
+         txdata(app,verb,1);
+         break;
 
        case MONITOR_IN:
-               cmddata[0]=P5IN;
-               txdata(app,verb,1);
-               break;
+         //cmddata[0]=P5IN;
+         debugstr("Command deprecated.");
+         txdata(app,verb,1);
+         break;
 
        case MONITOR_OUT:
-               P5OUT=cmddata[0];
-               txdata(app,verb,1);
-               break;
+         //P5OUT=cmddata[0];
+         debugstr("Command deprecated.");
+         txdata(app,verb,1);
+         break;
                
        case MONITOR_SILENT:
                silent=cmddata[0];
index 7257c9d..d38dd21 100644 (file)
@@ -6,7 +6,8 @@
 #ifndef GFPORTS
 #define GFPORTS
 
-#include <io.h>
+//#include <io.h>
+
 
 // N.B., only asm-clean CPP definitions allowed.
 
index 5705e4e..e208549 100644 (file)
@@ -9,10 +9,6 @@
 #include "command.h"
 #include "app.h"
 
-#include <signal.h>
-#include <io.h>
-#include <iomacros.h>
-
 #define GLITCH 0x71
 
 //Command codes
index a9f9ebc..d1efb89 100644 (file)
@@ -9,10 +9,14 @@
 
 #include "gfports.h"
 
-#include <signal.h>
+#include <stdint.h>
+
+#ifdef MSP430
 #include <io.h>
+#include <signal.h>
 #include <iomacros.h>
-#include <stdint.h>
+
+#endif
 
 #include "config.h"
 
diff --git a/firmware/lib/atmega168.c b/firmware/lib/atmega168.c
new file mode 100644 (file)
index 0000000..36795fa
--- /dev/null
@@ -0,0 +1,89 @@
+//! MSP430F1612/1611 clock and I/O definitions
+
+#include "platform.h"
+
+//! Receive a byte.
+unsigned char serial0_rx(){
+  return 0;
+}
+
+//! Receive a byte.
+unsigned char serial1_rx(){
+  return 0;
+}
+
+//! Transmit a byte.
+void serial0_tx(unsigned char x){
+}
+
+//! Transmit a byte on the second UART.
+void serial1_tx(unsigned char x){
+}
+
+//! Set the baud rate.
+void setbaud0(unsigned char rate){
+  
+  //http://mspgcc.sourceforge.net/baudrate.html
+  switch(rate){
+  case 1://9600 baud
+    
+    break;
+  case 2://19200 baud
+    
+    break;
+  case 3://38400 baud
+    
+    break;
+  case 4://57600 baud
+    
+    break;
+  default:
+  case 5://115200 baud
+    
+    break;
+  }
+}
+
+//! Set the baud rate of the second uart.
+void setbaud1(unsigned char rate){
+  //http://mspgcc.sourceforge.net/baudrate.html
+  switch(rate){
+  case 1://9600 baud
+    
+    break;
+  case 2://19200 baud
+    
+    break;
+  case 3://38400 baud
+    
+    break;
+  case 4://57600 baud
+    
+    break;
+  default:
+  case 5://115200 baud
+    
+    break;
+  }
+}
+
+
+void msp430_init_uart0(){
+}
+
+
+void msp430_init_uart1(){
+}
+
+
+
+//! Initialization is correct.
+void msp430_init_dco_done(){
+  //Nothing to do for the 1612.
+}
+
+
+void msp430_init_dco() {
+
+}
+
index 8b83d47..ec74ebb 100644 (file)
@@ -140,17 +140,22 @@ void msdelay(unsigned int ms){
    delaying slightly longer than requested. */
 void prep_timer()
 {
+  #ifdef MSP430
   BCSCTL2 = 0x00; /* In particular, use DCOCLK as SMCLK source with
                     divider 1. Hence, Timer B ticks with system
                     clock at 16 MHz. */
 
   TBCTL = 0x0204; /* Driven by SMCLK; disable Timer B interrupts;
                     reset timer in case it was previously in use */
+  #else
+  #warning "Function unimplemented for this platform."
+  #endif
 }
 
 //! Delay for specified number of milliseconds (given 16 MHz clock)
 void delay_ms( unsigned int ms )
 {
+  #ifdef MSP430
   // 16000 ticks = 1 ms
   TBCTL |= 0x20; // Start timer!
   while (ms--) {
@@ -159,11 +164,15 @@ void delay_ms( unsigned int ms )
     TBCTL = 0x0224;
   }
   TBCTL = 0x0204; // Reset Timer B, till next time
+  #else
+  #warning "Function unimplemented for this platform."
+  #endif
 }
 
 //! Delay for specified number of microseconds (given 16 MHz clock)
 void delay_us( unsigned int us )
 {
+  #ifdef MSP430
   // 16 ticks = 1 us
   TBCTL |= 0x20; // Start timer!
   while (us--) {
@@ -172,13 +181,20 @@ void delay_us( unsigned int us )
     TBCTL = 0x0224;
   }
   TBCTL = 0x0204; // Reset Timer B, till next time
+  #else
+  #warning "Function unimplemented for this platform."
+  #endif
 }
 
 //! Delay for specified number of clock ticks (16 MHz clock implies 62.5 ns per tick).
 void delay_ticks( unsigned int num_ticks )
 {
+  #ifdef MSP430
   TBCTL |= 0x20; // Start timer
   while (TBR < num_ticks)
     asm( "nop" );
   TBCTL = 0x0204; // Reset Timer B, till next time
+  #else
+  #warning "Function unimplemented for this platform."
+  #endif
 }