X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tos%2Flib%2Fmac%2Ftkn154%2FDispatchSlottedCsmaP.nc;h=7709ae8f63342eab1f0f494c89ff279e08d5e3b1;hb=dbddb4bea6c87c2b0f7b32f03e181408775446bb;hp=eccccc19eb8efdf36c304e813e900f6e05dd21a2;hpb=35905c1cd223f9fbef7f5435b518dc34acfd3bef;p=tinyos-2.x.git diff --git a/tos/lib/mac/tkn154/DispatchSlottedCsmaP.nc b/tos/lib/mac/tkn154/DispatchSlottedCsmaP.nc index eccccc19..7709ae8f 100644 --- a/tos/lib/mac/tkn154/DispatchSlottedCsmaP.nc +++ b/tos/lib/mac/tkn154/DispatchSlottedCsmaP.nc @@ -80,6 +80,7 @@ generic module DispatchSlottedCsmaP(uint8_t sfDirection) interface Get as GetIndirectTxFrame; interface Notify as RxEnableStateChange; interface GetNow as IsTrackingBeacons; + interface Notify as PIBUpdateMacRxOnWhenIdle; interface FrameUtility; interface SlottedCsmaCa; interface RadioRx; @@ -121,6 +122,7 @@ implementation norace ieee154_txframe_t *m_bcastFrame; norace ieee154_txframe_t *m_lastFrame; norace uint16_t m_remainingBackoff; + ieee154_macRxOnWhenIdle_t macRxOnWhenIdle; /* variables for the slotted CSMA-CA */ norace ieee154_csma_t m_csma; @@ -406,7 +408,7 @@ implementation else if (call SuperframeStructure.battLifeExtDuration() > 0 && call TimeCalc.hasExpired(call SuperframeStructure.sfStartTime(), call SuperframeStructure.battLifeExtDuration()) && - !call IsRxEnableActive.getNow()) { + !call IsRxEnableActive.getNow() && !macRxOnWhenIdle) { dbg_push_state(5); next = trySwitchOff(); } @@ -418,13 +420,12 @@ implementation } // Check 7: should we be in receive mode? - else if (COORD_ROLE || call IsRxEnableActive.getNow()) { + else if (COORD_ROLE || call IsRxEnableActive.getNow() || macRxOnWhenIdle) { dbg_push_state(7); next = tryReceive(NO_ALARM); if (next == DO_NOTHING) { - // this means there is an active MLME_RX_ENABLE.request - // and the radio was just switched to Rx mode - signal - // a notify event to inform the respective component + // if there was an active MLME_RX_ENABLE.request then we'll + // inform the next higher layer that radio is now in Rx mode post wasRxEnabledTask(); } } @@ -524,6 +525,10 @@ implementation async event void BLEAlarm.fired() { updateState();} event void RxEnableStateChange.notify(bool whatever) { updateState();} async event void BroadcastAlarm.fired() { m_broadcastRxPending = FALSE; updateState();} + event void PIBUpdateMacRxOnWhenIdle.notify( const void* val ) { + atomic macRxOnWhenIdle = *((ieee154_macRxOnWhenIdle_t*) val); + updateState(); + } async event void IndirectTxWaitAlarm.fired() {