]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
move the energy detection to a better place so we can measure the energy of ack frames
authormmaroti <mmaroti>
Sun, 29 Nov 2009 07:37:10 +0000 (07:37 +0000)
committermmaroti <mmaroti>
Sun, 29 Nov 2009 07:37:10 +0000 (07:37 +0000)
tos/chips/rf2xx/rf212/RF212DriverLayerP.nc
tos/chips/rf2xx/rf230/RF230DriverLayerP.nc

index 1365e6a8d625f5d9f8094bf2fa164683fe9c302a..b8e7fbb002396421212885c74e9f67330661bd87 100644 (file)
@@ -689,6 +689,17 @@ implementation
                        }
 #endif
 
+#ifdef RF212_RSSI_ENERGY
+                       if( irq & RF212_IRQ_TRX_END )
+                       {
+                               if( irq == RF212_IRQ_TRX_END || 
+                                       (irq == (RF212_IRQ_RX_START | RF212_IRQ_TRX_END) && cmd == CMD_NONE) )
+                                       call PacketRSSI.set(rxMsg, readRegister(RF212_PHY_ED_LEVEL));
+                               else
+                                       call PacketRSSI.clear(rxMsg);
+                       }
+#endif
+
                        if( irq & RF212_IRQ_PLL_LOCK )
                        {
                                if( cmd == CMD_TURNON || cmd == CMD_CHANNEL )
@@ -771,12 +782,7 @@ implementation
                                else if( cmd == CMD_RECEIVE )
                                {
                                        ASSERT( state == STATE_RX_ON || state == STATE_PLL_ON_2_RX_ON );
-#ifdef RF212_RSSI_ENERGY
-                                       if( irq == RF212_IRQ_TRX_END )
-                                               call PacketRSSI.set(rxMsg, readRegister(RF212_PHY_ED_LEVEL));
-                                       else
-                                               call PacketRSSI.clear(rxMsg);
-#endif
+
                                        if( state == STATE_PLL_ON_2_RX_ON )
                                        {
                                                ASSERT( (readRegister(RF212_TRX_STATUS) & RF212_TRX_STATUS_MASK) == RF212_PLL_ON );
index 65de3ca5449773d3653e55c4fd6d3f92e2dc3c5f..22c969cb8b904ee830f1f57ec21aed5b4de753f2 100644 (file)
@@ -702,6 +702,17 @@ implementation
                        }
 #endif
 
+#ifdef RF230_RSSI_ENERGY
+                       if( irq & RF230_IRQ_TRX_END )
+                       {
+                               if( irq == RF230_IRQ_TRX_END || 
+                                       (irq == (RF230_IRQ_RX_START | RF230_IRQ_TRX_END) && cmd == CMD_NONE) )
+                                       call PacketRSSI.set(rxMsg, readRegister(RF230_PHY_ED_LEVEL));
+                               else
+                                       call PacketRSSI.clear(rxMsg);
+                       }
+#endif
+
                        if( irq & RF230_IRQ_PLL_LOCK )
                        {
                                if( cmd == CMD_TURNON || cmd == CMD_CHANNEL )
@@ -784,12 +795,7 @@ implementation
                                else if( cmd == CMD_RECEIVE )
                                {
                                        ASSERT( state == STATE_RX_ON || state == STATE_PLL_ON_2_RX_ON );
-#ifdef RF230_RSSI_ENERGY
-                                       if( irq == RF230_IRQ_TRX_END )
-                                               call PacketRSSI.set(rxMsg, readRegister(RF230_PHY_ED_LEVEL));
-                                       else
-                                               call PacketRSSI.clear(rxMsg);
-#endif
+
                                        if( state == STATE_PLL_ON_2_RX_ON )
                                        {
                                                ASSERT( (readRegister(RF230_TRX_STATUS) & RF230_TRX_STATUS_MASK) == RF230_PLL_ON );