X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Fchips%2Frf2xx%2Frf230%2FRF230DriverLayerP.nc;h=22c969cb8b904ee830f1f57ec21aed5b4de753f2;hb=c520bf97bb3dea73573ff5919cf0e3158f7b5670;hp=65de3ca5449773d3653e55c4fd6d3f92e2dc3c5f;hpb=58f4320bd65608131f8ebef1b9446fc6204e0eeb;p=tinyos-2.x.git diff --git a/tos/chips/rf2xx/rf230/RF230DriverLayerP.nc b/tos/chips/rf2xx/rf230/RF230DriverLayerP.nc index 65de3ca5..22c969cb 100644 --- a/tos/chips/rf2xx/rf230/RF230DriverLayerP.nc +++ b/tos/chips/rf2xx/rf230/RF230DriverLayerP.nc @@ -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 );