]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
tune the LPL constants (use 5 ms listen check)
authormmaroti <mmaroti>
Mon, 29 Mar 2010 22:26:10 +0000 (22:26 +0000)
committermmaroti <mmaroti>
Mon, 29 Mar 2010 22:26:10 +0000 (22:26 +0000)
Committed on the Free edition of March Hare Software CVSNT Server.
Upgrade to CVS Suite for more features and support:
http://march-hare.com/cvsnt/

tos/chips/rf2xx/layers/LowPowerListeningConfig.nc
tos/chips/rf2xx/layers/LowPowerListeningLayerC.nc
tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc
tos/chips/rf2xx/rf212/RF212RadioP.nc
tos/chips/rf2xx/rf230/RF230RadioP.nc

index 57c99d8202d9de6713ef12779c9eba1983da7bde..06678b6a315becf52c5d307cb640f582ed8d39b2 100644 (file)
@@ -35,4 +35,11 @@ interface LowPowerListeningConfig
         * this message via the PacketAcknowledgements interface.
         */
        command bool ackRequested(message_t* msg);
+
+       /**
+        * Returns the number of milliseconds the mote should turn on
+        * its radio to check for incoming messages. This check is 
+        * performed at every localWakeInterval.
+        */
+       command uint16_t getListenLength();
 }
index 75d0715479393cdd39eed3b6ff81eca6c5610642..d3b8ebe71d7ccac536e4d684c73c2694f20f6f7f 100644 (file)
@@ -64,4 +64,7 @@ implementation
        
        LowPowerListeningLayerP.Timer -> TimerMilliC;
        LowPowerListeningLayerP.SystemLowPowerListening -> SystemLowPowerListeningC;
+
+       components NoLedsC as LedsC;
+       LowPowerListeningLayerP.Leds -> LedsC;
 }
index 7efab6dc21311283ac63822f1cb1949b6f7cec5c..b965af8a4f61c159edae10bbdf1b112990bed615 100644 (file)
@@ -48,6 +48,8 @@ module LowPowerListeningLayerP
                interface LowPowerListeningConfig as Config;
                interface Timer<TMilli>;
                interface SystemLowPowerListening;
+
+               interface Leds;
        }
 }
 
@@ -55,9 +57,6 @@ implementation
 {
        enum
        {
-               // minimum wakeup time to catch a transmission in milliseconds
-               LISTEN_WAKEUP = 6U,     // use xxxL if LISTEN_WAKEUP * 10000 > 65535
-
                MIN_SLEEP = 2,          // the minimum sleep interval in milliseconds
        };
 
@@ -108,7 +107,10 @@ implementation
                        ASSERT( error == SUCCESS || error == EBUSY );
 
                        if( error == SUCCESS )
+                       {
+                               call Leds.led2On();
                                ++state;
+                       }
                        else
                                post transition();
                }
@@ -118,7 +120,10 @@ implementation
                        ASSERT( error == SUCCESS || error == EBUSY );
 
                        if( error == SUCCESS )
+                       {
                                ++state;
+                               call Leds.led2Off();
+                       }
                        else
                                post transition();
                }
@@ -138,7 +143,7 @@ implementation
                {
                        state = LISTEN;
                        if( sleepInterval > 0 )
-                               call Timer.startOneShot(LISTEN_WAKEUP);
+                               call Timer.startOneShot(call Config.getListenLength());
                }
                else if( state == SLEEP_TIMER )
                {
@@ -158,7 +163,8 @@ implementation
                        transmitInterval = call LowPowerListening.getRemoteWakeupInterval(txMsg);
 
                        if( transmitInterval > 0 )
-                               call Timer.startOneShot(transmitInterval);
+                               call Timer.startOneShot(transmitInterval 
+                                       + 2 * call Config.getListenLength());
 
                        state = SEND_SUBSEND;
                        post transition();
@@ -264,6 +270,8 @@ implementation
 
        event message_t* SubReceive.receive(message_t* msg)
        {
+               call Leds.led0Toggle();
+
                if( state == SLEEP_SUBSTOP )
                        state = LISTEN;
 
@@ -341,6 +349,9 @@ implementation
                        state = SEND_SUBSEND;
 
                post transition();
+
+               if( error == SUCCESS )
+                       call Leds.led1Toggle();
        }
 
 /*----------------- LowPowerListening -----------------*/
index 16f93405627d204ecce2bd6d77acd264e63c20bd..81fc60b2e806c2735ade8547ff3bd77454066d76 100644 (file)
@@ -246,6 +246,8 @@ implementation
         * congestion backoff = 0x7 * CC2420_BACKOFF_PERIOD = 70 jiffies = 2240 microsec
         */
 
+#ifndef LOW_POWER_LISTENING
+
        async command uint16_t RandomCollisionConfig.getMinimumBackoff()
        {
                return (uint16_t)(320 * RADIO_ALARM_MICROSEC);
@@ -261,6 +263,8 @@ implementation
                return (uint16_t)(2240 * RADIO_ALARM_MICROSEC);
        }
 
+#endif
+
        async command uint16_t RandomCollisionConfig.getTransmitBarrier(message_t* msg)
        {
                uint16_t time;
@@ -330,6 +334,26 @@ implementation
                return call Ieee154PacketLayer.getAckRequired(msg);
        }
 
+       command uint16_t LowPowerListeningConfig.getListenLength()
+       {
+               return 5;
+       }
+
+       async command uint16_t RandomCollisionConfig.getMinimumBackoff()
+       {
+               return (uint16_t)(320 * RADIO_ALARM_MICROSEC);
+       }
+
+       async command uint16_t RandomCollisionConfig.getInitialBackoff(message_t* msg)
+       {
+               return (uint16_t)(1600 * RADIO_ALARM_MICROSEC);
+       }
+
+       async command uint16_t RandomCollisionConfig.getCongestionBackoff(message_t* msg)
+       {
+               return (uint16_t)(3200 * RADIO_ALARM_MICROSEC);
+       }
+
 #endif
 
 }
index f4b0eab716172d4bfd62c7768d5bf90b3eaec53d..2a259f088d6db73cb1783a3b5fcdb2d21106109d 100644 (file)
@@ -246,6 +246,8 @@ implementation
         * congestion backoff = 0x7 * CC2420_BACKOFF_PERIOD = 70 jiffies = 2240 microsec
         */
 
+#ifndef LOW_POWER_LISTENING
+
        async command uint16_t RandomCollisionConfig.getMinimumBackoff()
        {
                return (uint16_t)(320 * RADIO_ALARM_MICROSEC);
@@ -261,6 +263,8 @@ implementation
                return (uint16_t)(2240 * RADIO_ALARM_MICROSEC);
        }
 
+#endif
+
        async command uint16_t RandomCollisionConfig.getTransmitBarrier(message_t* msg)
        {
                uint16_t time;
@@ -330,6 +334,26 @@ implementation
                return call Ieee154PacketLayer.getAckRequired(msg);
        }
 
+       command uint16_t LowPowerListeningConfig.getListenLength()
+       {
+               return 5;
+       }
+
+       async command uint16_t RandomCollisionConfig.getMinimumBackoff()
+       {
+               return (uint16_t)(320 * RADIO_ALARM_MICROSEC);
+       }
+
+       async command uint16_t RandomCollisionConfig.getInitialBackoff(message_t* msg)
+       {
+               return (uint16_t)(1600 * RADIO_ALARM_MICROSEC);
+       }
+
+       async command uint16_t RandomCollisionConfig.getCongestionBackoff(message_t* msg)
+       {
+               return (uint16_t)(3200 * RADIO_ALARM_MICROSEC);
+       }
+
 #endif
 
 }