]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - apps/IPBaseStation/BaseStationP.nc
add support for IRIS (it was CC2420 specific)
[tinyos-2.x.git] / apps / IPBaseStation / BaseStationP.nc
index dfe80cd48065cf05ab3c3306423a319c1d96e9d9..0a27e04ecf9c8e94346dd53ca50f5e5bac76c68f 100644 (file)
@@ -65,7 +65,6 @@
  */
 
 #ifndef SIM
-#include "CC2420.h"
 #endif
 #include "AM.h"
 #include "Serial.h"
@@ -95,7 +94,12 @@ module BaseStationP {
 
     interface PacketLink;
     interface LowPowerListening;
+
+#ifdef PLATFORM_IRIS
+    interface RadioChannel;
+#else
     interface CC2420Config;
+#endif
 
     interface Leds;
 
@@ -303,7 +307,7 @@ implementation
     bool reflectToken = FALSE;
     CHECK_NODE_ID msg;
     dbg("base", "uartreceive len %i of 0x%x\n", len, call SerialAMPacket.destination(msg));
-#if defined(PLATFORM_TELOS) || defined(PLATFORM_TELOSB) || defined(PLATFORM_EPIC)
+#if defined(BLIP_WATCHDOG) && (defined(PLATFORM_TELOS) || defined(PLATFORM_TELOSB) || defined(PLATFORM_EPIC))
     WDTCTL = WDT_ARST_1000;
 #endif
     atomic
@@ -358,7 +362,7 @@ implementation
       call PacketLink.setRetries(msg, 0);
     }
 #ifdef LPL_SLEEP_INTERVAL
-    call LowPowerListening.setRxSleepInterval(msg, LPL_SLEEP_INTERVAL);
+    call LowPowerListening.setRemoteWakeupInterval(msg, LPL_SLEEP_INTERVAL);
 #endif
     dbg("base", "radio send to: 0x%x len: %i\n", addr, len);
     if (call RadioSend.send(addr, msg, len) == SUCCESS)
@@ -397,7 +401,7 @@ implementation
                                             uint8_t len) {
     config_cmd_t *cmd;
     uint8_t error = CONFIG_ERROR_OK;
-#if defined(PLATFORM_TELOS) || defined(PLATFORM_TELOSB) || defined(PLATFORM_EPIC)
+#if defined(BLIP_WATCHDOG) && (defined(PLATFORM_TELOS) || defined(PLATFORM_TELOSB) || defined(PLATFORM_EPIC))
     WDTCTL = WDT_ARST_1000;
 #endif
 
@@ -410,10 +414,16 @@ implementation
     case CONFIG_ECHO:
       break;
     case CONFIG_SET_PARM:
+#ifdef PLATFORM_IRIS
+      // we should check the return value, hope it works
+      call RadioChannel.setChannel(cmd->rf.channel);
+      call IPAddress.setShortAddr(cmd->rf.addr);
+#else
       call CC2420Config.setChannel(cmd->rf.channel);
       // IPAddress calls sync() for you, I think, so we'll put it second 
       call IPAddress.setShortAddr(cmd->rf.addr);
       call CC2420Config.sync();
+#endif
       radioRetries = cmd->retx.retries;
       radioDelay   = cmd->retx.delay;
       break;
@@ -430,10 +440,12 @@ implementation
     return msg;
   }
 
-
+#ifdef PLATFORM_IRIS
+  event void RadioChannel.setChannelDone() { }
+#else
   event void CC2420Config.syncDone(error_t error) {
-
   }
+#endif
 
   event void ConfigureSend.sendDone(message_t *msg, error_t error) {
     echo_busy = FALSE;