From: janhauer Date: Wed, 18 Jun 2008 15:39:32 +0000 (+0000) Subject: + fixed an issue with shadowing some CC2420 files X-Git-Tag: release_tinyos_2_1_0_0~247 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=bb75511f4160f3fb7601088f9d6c1de7668e4e76 + fixed an issue with shadowing some CC2420 files + extended Makefile to list the supported platforms (currently only telosb) + added nonbeacon-enabled mode --- diff --git a/apps/tests/tkn154/Makefile.include b/apps/tests/tkn154/Makefile.include index 747455fc..659aaf35 100644 --- a/apps/tests/tkn154/Makefile.include +++ b/apps/tests/tkn154/Makefile.include @@ -1,4 +1,5 @@ -PLATFORM_INCLUDE?=$(TOSDIR)/platforms/$(PLATFORM)/mac/tkn154/Makefile.include +PLATFORMS = telosb +TKN154_PLATFORM_INCLUDE?=$(TOSDIR)/platforms/$(PLATFORM)/mac/tkn154/Makefile.include CFLAGS += -I$(TOSDIR)/lib/mac/tkn154 \ -I$(TOSDIR)/lib/mac/tkn154/dummies \ @@ -11,6 +12,16 @@ ifdef IEEE154_EXTENDED_ADDRESS PFLAGS += -DIEEE154_EXTENDED_ADDRESS=$(IEEE154_EXTENDED_ADDRESS) endif +# parses the PLATFORM variable include $(MAKERULES) -PLATFORM?=telosb -include $(PLATFORM_INCLUDE) + +# checks whether the target platform is supported by the application; +# the application Makefile can define PLATFORMS as a whitespace-separated +# list of supported platforms +ifneq ($(PLATFORMS),) + ifeq ($(strip $(foreach platform,$(PLATFORMS),$(findstring $(platform),$(PLATFORM)))),) + $(error The target platform is not supported by this application - supported platforms are: $(PLATFORMS)) + endif +endif + +include $(TKN154_PLATFORM_INCLUDE) diff --git a/tos/chips/cc2420_tkn154/CC2420ControlTransmitC.nc b/tos/chips/cc2420_tkn154/CC2420ControlTransmitC.nc index 97637d87..76f8568e 100644 --- a/tos/chips/cc2420_tkn154/CC2420ControlTransmitC.nc +++ b/tos/chips/cc2420_tkn154/CC2420ControlTransmitC.nc @@ -139,9 +139,5 @@ implementation { components CC2420ReceiveC; CC2420TransmitP.CC2420Receive -> CC2420ReceiveC; - - components CC2420PacketC; - CC2420TransmitP.CC2420Packet -> CC2420PacketC; - CC2420TransmitP.CC2420PacketBody -> CC2420PacketC; } diff --git a/tos/chips/cc2420_tkn154/CC2420TransmitP.nc b/tos/chips/cc2420_tkn154/CC2420TransmitP.nc index b839a99c..d746c854 100644 --- a/tos/chips/cc2420_tkn154/CC2420TransmitP.nc +++ b/tos/chips/cc2420_tkn154/CC2420TransmitP.nc @@ -49,13 +49,11 @@ module CC2420TransmitP { provides interface CC2420Tx; /* provides interface RadioBackoff;*/ /* provides interface RadioTimeStamping as TimeStamp;*/ - provides interface ReceiveIndicator as EnergyIndicator; - provides interface ReceiveIndicator as ByteIndicator; +/* provides interface ReceiveIndicator as EnergyIndicator;*/ +/* provides interface ReceiveIndicator as ByteIndicator;*/ /* uses interface Alarm as BackoffAlarm;*/ uses interface Alarm as BackoffAlarm; - uses interface CC2420Packet; - uses interface CC2420PacketBody; uses interface GpioCapture as CaptureSFD; uses interface GeneralIO as CCA; uses interface GeneralIO as CSN; @@ -211,15 +209,15 @@ implementation { } /***************** Indicator Commands ****************/ - command bool EnergyIndicator.isReceiving() { - return !(call CCA.get()); - } - - command bool ByteIndicator.isReceiving() { - bool high; - atomic high = sfdHigh; - return high; - } +/* command bool EnergyIndicator.isReceiving() {*/ +/* return !(call CCA.get());*/ +/* }*/ +/* */ +/* command bool ByteIndicator.isReceiving() {*/ +/* bool high;*/ +/* atomic high = sfdHigh;*/ +/* return high;*/ +/* }*/ /***************** RadioBackoff Commands ****************/ diff --git a/tos/lib/mac/tkn154/AssociateP.nc b/tos/lib/mac/tkn154/AssociateP.nc index c1b8c2b6..fd8f3445 100644 --- a/tos/lib/mac/tkn154/AssociateP.nc +++ b/tos/lib/mac/tkn154/AssociateP.nc @@ -62,7 +62,6 @@ module AssociateP interface DataRequest; interface Timer as ResponseTimeout; - interface Get as IsTrackingBeacons; interface Pool as TxFramePool; interface Pool as TxControlPool; interface MLME_GET; diff --git a/tos/lib/mac/tkn154/BeaconSynchronizeP.nc b/tos/lib/mac/tkn154/BeaconSynchronizeP.nc index f58c22f8..0840bc0b 100644 --- a/tos/lib/mac/tkn154/BeaconSynchronizeP.nc +++ b/tos/lib/mac/tkn154/BeaconSynchronizeP.nc @@ -45,7 +45,7 @@ module BeaconSynchronizeP interface MLME_SYNC; interface MLME_BEACON_NOTIFY; interface MLME_SYNC_LOSS; - interface Get as IsTrackingBeacons; + interface GetNow as IsTrackingBeacons; interface GetNow as CapStart; interface GetNow as CapStartRefTime; interface GetNow as CapLen; @@ -66,6 +66,7 @@ module BeaconSynchronizeP interface MLME_GET; interface MLME_SET; interface FrameUtility; + interface Notify as FindBeacon; interface IEEE154BeaconFrame as BeaconFrame; interface Alarm as TrackAlarm; interface RadioRx as BeaconRx; @@ -95,12 +96,13 @@ implementation }; norace bool m_tracking = FALSE; - norace bool m_updatePending = FALSE; + bool m_updatePending = FALSE; uint8_t m_updateLogicalChannel; bool m_updateTrackBeacon; bool m_stopTracking = FALSE; + bool m_internalRequest = FALSE; - norace uint8_t m_numBeaconsLost; + uint8_t m_numBeaconsLost; uint8_t m_coordAddress[8]; message_t m_beaconBuffer; norace message_t *m_beaconBufferPtr = &m_beaconBuffer; @@ -162,7 +164,8 @@ implementation m_stopTracking = FALSE; m_updateLogicalChannel = logicalChannel; m_updateTrackBeacon = trackBeacon; - atomic m_updatePending = TRUE; + m_updatePending = TRUE; + m_internalRequest = FALSE; call Debug.log(LEVEL_INFO,SyncP_RESOURCE_REQUEST, 0, 0, 0); call Token.request(); } @@ -170,6 +173,18 @@ implementation return IEEE154_SUCCESS; } + event void FindBeacon.notify( bool val ) + { + if (!m_tracking && !m_updatePending){ + // find a single beacon now (treat this like a user request) + m_updateLogicalChannel = call MLME_GET.phyCurrentChannel(); + m_updateTrackBeacon = FALSE; + m_updatePending = TRUE; + m_internalRequest = TRUE; + call Token.request(); + } + } + event void Token.granted() { bool missed = FALSE; @@ -295,13 +310,16 @@ implementation m_tracking = FALSE; call Debug.log(LEVEL_IMPORTANT, SyncP_LOST_SYNC,0,0,0); call Leds.led2Off(); - signal MLME_SYNC_LOSS.indication( - IEEE154_BEACON_LOSS, - call MLME_GET.macPANId(), - call MLME_GET.phyCurrentChannel(), - call MLME_GET.phyCurrentPage(), - NULL // security - ); + if (m_internalRequest) + call TokenToCap.transfer(); + else + signal MLME_SYNC_LOSS.indication( + IEEE154_BEACON_LOSS, + call MLME_GET.macPANId(), + call MLME_GET.phyCurrentChannel(), + call MLME_GET.phyCurrentPage(), + NULL // security + ); } else call Token.request(); // make another request again (before giving the token up) call Debug.log(LEVEL_INFO,SyncP_RELEASE_RESOURCE, 0, 0, 0); @@ -385,7 +403,7 @@ implementation } } - command bool IsTrackingBeacons.get(){ return m_tracking;} + async command bool IsTrackingBeacons.getNow(){ return m_tracking;} default event message_t* MLME_BEACON_NOTIFY.indication (message_t* frame){return frame;} diff --git a/tos/lib/mac/tkn154/BeaconTransmitP.nc b/tos/lib/mac/tkn154/BeaconTransmitP.nc index d3034e14..b32608dc 100644 --- a/tos/lib/mac/tkn154/BeaconTransmitP.nc +++ b/tos/lib/mac/tkn154/BeaconTransmitP.nc @@ -77,7 +77,7 @@ module BeaconTransmitP interface WriteBeaconField as GtsInfoWrite; interface WriteBeaconField as PendingAddrWrite; interface FrameUtility; - interface Get as IsTrackingBeacons; + interface GetNow as IsTrackingBeacons; interface GetNow as LastBeaconRxTime; interface GetNow as LastBeaconRxRefTime; interface Ieee802154Debug as Debug; @@ -222,7 +222,7 @@ implementation !(IEEE154_SUPPORTED_CHANNELS & ((uint32_t) 1 << logicalChannel)) || (superframeOrder > beaconOrder)) status = IEEE154_INVALID_PARAMETER; - else if (startTime && !call IsTrackingBeacons.get()) + else if (startTime && !call IsTrackingBeacons.getNow()) status = IEEE154_TRACKING_OFF; else if (startTime && 0xFF000000) status = IEEE154_INVALID_PARAMETER; diff --git a/tos/lib/mac/tkn154/CapP.nc b/tos/lib/mac/tkn154/CapP.nc index c07ccc56..6b97b630 100644 --- a/tos/lib/mac/tkn154/CapP.nc +++ b/tos/lib/mac/tkn154/CapP.nc @@ -59,6 +59,7 @@ generic module CapP(uint8_t superframeDirection) interface FrameExtracted as FrameExtracted[uint8_t frameType]; interface FrameTxNow as BroadcastTx; interface Notify as WasRxEnabled; + interface Notify as FindBeacon; } uses { @@ -80,6 +81,7 @@ generic module CapP(uint8_t superframeDirection) interface GetNow as IsRxBroadcastPending; interface GetNow as IsRxEnableActive; interface Notify as RxEnableStateChange; + interface GetNow as IsTrackingBeacons; interface FrameUtility; interface RadioTx; interface RadioRx; @@ -120,6 +122,7 @@ implementation norace ieee154_txframe_t *m_bcastFrame; norace ieee154_txframe_t *m_lastFrame; norace ieee154_macMaxBE_t m_BE; + norace ieee154_macMaxBE_t m_numCCA; norace ieee154_macMaxCSMABackoffs_t m_allowedBackoffs; norace ieee154_macMaxBE_t m_macMaxBE; norace uint16_t m_backoff; @@ -129,6 +132,7 @@ implementation norace bool m_indirectTxPending = FALSE; norace bool m_broadcastRxPending; norace ieee154_macMaxFrameTotalWaitTime_t m_macMaxFrameTotalWaitTime; + norace bool m_isBeaconEnabledPAN; uint16_t generateRandomBackoff(uint8_t BE); void stopAllAlarms(); @@ -158,15 +162,24 @@ implementation signalTxBroadcastDone(m_bcastFrame, IEEE154_TRANSACTION_OVERFLOW); m_currentFrame = m_lastFrame = m_bcastFrame = NULL; m_macMaxFrameTotalWaitTime = call MLME_GET.macMaxFrameTotalWaitTime(); + m_isBeaconEnabledPAN = call IsBeaconEnabledPAN.get(); stopAllAlarms(); return SUCCESS; } - async event void TokenTransferred.transferred() + event void TokenTransferred.transferred() { // we got the token, i.e. CAP has just started uint32_t actualCapLen = call CapLen.getNow(); - if (actualCapLen < IEEE154_RADIO_GUARD_TIME){ + if (m_isBeaconEnabledPAN && (DEVICE_ROLE && !call IsTrackingBeacons.getNow())){ + // rare case: we're on a beacon-enabled PAN, not tracking beacons, searched + // and didn't find a beacon for aBaseSuperframeDuration*(2n+1) symbols + // -> transmit current frame using unslotted CSMA-CA + m_numCCA = 1; + signal Token.granted(); + return; + } + else if (actualCapLen < IEEE154_RADIO_GUARD_TIME){ call Debug.log(LEVEL_IMPORTANT, CapP_TOO_SHORT, superframeDirection, actualCapLen, IEEE154_RADIO_GUARD_TIME); call TokenToCfp.transfer(); return; @@ -188,7 +201,8 @@ implementation call CapEndAlarm.startAt(call CapStart.getNow(), actualCapLen); if (call IsBLEActive.getNow()) call BLEAlarm.startAt(call CapStart.getNow(), call BLELen.getNow()); - call Debug.log(LEVEL_IMPORTANT, CapP_SET_CAP_END, call CapStart.getNow(), actualCapLen, call CapStart.getNow()+ actualCapLen); + call Debug.log(LEVEL_IMPORTANT, CapP_SET_CAP_END, call CapStart.getNow(), + actualCapLen, call CapStart.getNow()+ actualCapLen); } updateState(); } @@ -200,7 +214,17 @@ implementation return IEEE154_TRANSACTION_OVERFLOW; else { setCurrentFrame(frame); - updateState(); + if (!m_isBeaconEnabledPAN){ + call Token.request(); // prepare for unslotted CSMA-CA + } else { + // a beacon must be found before transmitting in a beacon-enabled PAN + if (DEVICE_ROLE && !call IsTrackingBeacons.getNow()){ + signal FindBeacon.notify(TRUE); + // we'll receive the Token at latest after aBaseSuperframeDuration*(2n+1) symbols; + // if the beacon was not found, then we'll send the frame using unslotted CSMA-CA + } + updateState(); + } return IEEE154_SUCCESS; } } @@ -243,6 +267,10 @@ implementation m_BE = call MLME_GET.macMinBE(); if (call MLME_GET.macBattLifeExt() && m_BE > 2) m_BE = 2; + if (m_isBeaconEnabledPAN) + m_numCCA = 2; + else + m_numCCA = 1; m_transactionTime = IEEE154_SHR_DURATION + (frame->headerLen + frame->payloadLen) * IEEE154_SYMBOLS_PER_OCTET; if (frame->header->mhr[0] & FC1_ACK_REQUEST) @@ -304,9 +332,11 @@ implementation return; m_lock = TRUE; // lock - // Check 1: has the CAP finished? - if (call TimeCalc.hasExpired(call CapStart.getNow(), call CapLen.getNow()-IEEE154_RADIO_GUARD_TIME) || - !call CapEndAlarm.isRunning()){ + // Check 1: for beacon-enabled PANs, has the CAP finished? + if (m_isBeaconEnabledPAN + && (COORD_ROLE || call IsTrackingBeacons.getNow()) // FALSE only if device could't find a beacon + && (call TimeCalc.hasExpired(call CapStart.getNow(), call CapLen.getNow()-IEEE154_RADIO_GUARD_TIME) || + !call CapEndAlarm.isRunning())){ if (call RadioOff.isOff()) { stopAllAlarms(); // may still fire, locked through isOwner() if (DEVICE_ROLE && m_indirectTxPending) @@ -377,6 +407,13 @@ implementation // Check 8: just make sure the radio is switched off else { next = trySwitchOff(); + if (next == DO_NOTHING && (!m_isBeaconEnabledPAN || (DEVICE_ROLE && !call IsTrackingBeacons.getNow()))){ + // nothing more to do... just release the Token + m_lock = FALSE; // unlock + call TokenToCfp.transfer(); + return; + + } } // if there is nothing to do, then we must clear the lock @@ -402,29 +439,36 @@ implementation // in other module variables (m_backoff, etc.) next_state_t next; if (call RadioTx.getLoadedFrame() == m_currentFrame){ - // the frame is already loaded -> transmit it now (if there's enough time) - uint32_t capLen = call CapLen.getNow(), capStart = call CapStart.getNow(); - uint32_t elapsed, totalTime; - totalTime = IEEE154_RADIO_TX_SEND_DELAY + - m_backoff - m_backoffElapsed + m_transactionTime + IEEE154_RADIO_GUARD_TIME; - if (totalTime > capLen) - totalTime = capLen; // CAP is too short - elapsed = call TimeCalc.timeElapsed(capStart, call CapEndAlarm.getNow()); - elapsed += (20 - (elapsed % 20)); // round to backoff boundary - if (!call TimeCalc.hasExpired(capStart, capLen - totalTime)){ - call RadioTx.transmit(call CapStartRefTime.getNow(), - elapsed + IEEE154_RADIO_TX_SEND_DELAY + m_backoff - m_backoffElapsed, - 2, - m_currentFrame->header->mhr[0] & FC1_ACK_REQUEST ? TRUE : FALSE); - next = WAIT_FOR_TXDONE; // ATTENTION: this will NOT clear the lock + // the frame is already loaded -> transmit it now + if (m_numCCA == 1){ + // unslotted CSMA-CA + call RadioTx.transmit(NULL, m_backoff, m_numCCA, m_currentFrame->header->mhr[0] & FC1_ACK_REQUEST ? TRUE : FALSE); + next = WAIT_FOR_TXDONE; // this will NOT clear the lock } else { - // frame does not fit in remaing portion of the CAP - if (elapsed < call CapLen.getNow()){ - m_backoffElapsed += call CapLen.getNow() - elapsed; - if (m_backoffElapsed > m_backoff) - m_backoffElapsed = m_backoff; + // slotted CSMA-CA + uint32_t capLen = call CapLen.getNow(), capStart = call CapStart.getNow(); + uint32_t elapsed, totalTime; + totalTime = IEEE154_RADIO_TX_SEND_DELAY + + m_backoff - m_backoffElapsed + m_transactionTime + IEEE154_RADIO_GUARD_TIME; + if (totalTime > capLen) + totalTime = capLen; // CAP is too short + elapsed = call TimeCalc.timeElapsed(capStart, call CapEndAlarm.getNow()); + elapsed += (20 - (elapsed % 20)); // round to backoff boundary + if (!call TimeCalc.hasExpired(capStart, capLen - totalTime)){ + call RadioTx.transmit(call CapStartRefTime.getNow(), + elapsed + IEEE154_RADIO_TX_SEND_DELAY + m_backoff - m_backoffElapsed, + m_numCCA, + m_currentFrame->header->mhr[0] & FC1_ACK_REQUEST ? TRUE : FALSE); + next = WAIT_FOR_TXDONE; // this will NOT clear the lock + } else { + // frame does not fit in remaing portion of the CAP + if (elapsed < call CapLen.getNow()){ + m_backoffElapsed += call CapLen.getNow() - elapsed; + if (m_backoffElapsed > m_backoff) + m_backoffElapsed = m_backoff; + } + next = SWITCH_OFF; } - next = SWITCH_OFF; } } else { // the frame to transmit has not yet been loaded -> load it now @@ -637,9 +681,35 @@ implementation signal WasRxEnabled.notify(TRUE); } - async event void TokenRequested.requested() {} + bool isUnslottedCSMA_CA() + { + return (m_numCCA == 1); + } + + event void Token.granted() + { + // the current frame should be transmitted using unslotted CSMA-CA + updateState(); + } + + task void tokenRequestedTask() + { + signal TokenRequested.requested(); + } + + async event void TokenRequested.requested() + { + atomic { + if (call Token.isOwner()){ + if (!m_lock && !(DEVICE_ROLE && m_indirectTxPending) && !(COORD_ROLE && m_bcastFrame)) + call Token.release(); + else + post tokenRequestedTask(); + } + } + } + async event void TokenRequested.immediateRequested() {} - event void Token.granted(){} default event void CapTx.transmitDone(ieee154_txframe_t *data, ieee154_status_t status){} default event message_t* FrameRx.received[uint8_t client](message_t* data){return data;} @@ -661,4 +731,6 @@ implementation command error_t WasRxEnabled.enable(){return FAIL;} command error_t WasRxEnabled.disable(){return FAIL;} + command error_t FindBeacon.enable(){return FAIL;} + command error_t FindBeacon.disable(){return FAIL;} } diff --git a/tos/lib/mac/tkn154/CoordBroadcastP.nc b/tos/lib/mac/tkn154/CoordBroadcastP.nc index 3046a12d..8ba9c136 100644 --- a/tos/lib/mac/tkn154/CoordBroadcastP.nc +++ b/tos/lib/mac/tkn154/CoordBroadcastP.nc @@ -106,7 +106,7 @@ implementation return (m_realignmentFrame != NULL || m_queueHead != NULL); } - async event void TokenTransferred.transferred() + event void TokenTransferred.transferred() { // CAP has started - are there any broadcast frames to be transmitted? if (call BeaconFramePendingBit.getNow()){ diff --git a/tos/lib/mac/tkn154/PibP.nc b/tos/lib/mac/tkn154/PibP.nc index d3d3b3b9..e1c6219e 100644 --- a/tos/lib/mac/tkn154/PibP.nc +++ b/tos/lib/mac/tkn154/PibP.nc @@ -175,13 +175,8 @@ implementation return IEEE154_INVALID_PARAMETER; if (call PromiscuousModeGet.get()) return IEEE154_TRANSACTION_OVERFLOW; // must first cancel promiscuous mode! - - // nonbeacon-enabled mode is not yet implemented! - if (PANType != BEACON_ENABLED_PAN) - return IEEE154_INVALID_PARAMETER; - m_setDefaultPIB = SetDefaultPIB; - m_panType = PANType; // TODO: set this later? + m_panType = PANType; if (!call Token.isOwner()) call Token.request(); return IEEE154_SUCCESS; diff --git a/tos/lib/mac/tkn154/README.txt b/tos/lib/mac/tkn154/README.txt index 50d370c3..c94d0190 100644 --- a/tos/lib/mac/tkn154/README.txt +++ b/tos/lib/mac/tkn154/README.txt @@ -1,22 +1,25 @@ This directory contains "TKN15.4", a platform-independent IEEE 802.15.4-2006 -MAC implementation. The code is still under active development, but most of the -functionality described in the standard is implemented. The MAC itself is -platform-independent, but it requires (1) a suitable radio driver, (2) -Alarms/Timers with symbol precision and (3) some "platform glue" code (defining -guard times, etc.). Currently the only supported platform is TelosB (however: -without additional hardware support the timing is not standard compliant). +MAC implementation. The code is in alpha state, under active development, but +most of the functionality described in the standard is implemented (and +cursorily tested). The MAC itself is platform-independent, but it requires +(1) a suitable radio driver, (2) Alarms/Timers with symbol precision and (3) +some "platform glue" code (defining guard times, etc.). Currently the only +supported platform is TelosB (however: without additional hardware support on +TelosB the timing in beacon-enabled mode is not standard compliant). Status 6/16/08 -------------- missing functionality: - - security (not planned) - GTS (not planned) -- non-beacon-enabled mode - PAN ID conflict resolution - multiple indirect transmissions to the same destination -- documentation + +missing documentation: +- overview on the architecture of TKN15.4 +- porting TKN15.4 to a new platform +- ... Implementation -------------- diff --git a/tos/lib/mac/tkn154/RxEnableP.nc b/tos/lib/mac/tkn154/RxEnableP.nc index 7d5df58c..6835bed8 100644 --- a/tos/lib/mac/tkn154/RxEnableP.nc +++ b/tos/lib/mac/tkn154/RxEnableP.nc @@ -57,7 +57,7 @@ module RxEnableP interface Timer as RxEnableTimer; interface Get as IsBeaconEnabledPAN; interface Get as IsMacPanCoordinator; - interface Get as IsTrackingBeacons; + interface GetNow as IsTrackingBeacons; interface GetNow as IncomingSfStart; interface GetNow as IncomingBeaconInterval; interface Get as IsSendingBeacons; @@ -116,7 +116,7 @@ implementation // for OUTGOING SUPERFRAME lastBeaconTime = call OutgoingSfStart.getNow(); beaconInterval = call OutgoingBeaconInterval.getNow(); - } else if (call IsTrackingBeacons.get()){ + } else if (call IsTrackingBeacons.getNow()){ // for INCOMING SUPERFRAME lastBeaconTime = call IncomingSfStart.getNow(); beaconInterval = call IncomingBeaconInterval.getNow(); diff --git a/tos/lib/mac/tkn154/TKN154P.nc b/tos/lib/mac/tkn154/TKN154P.nc index 31f16599..622c6f64 100644 --- a/tos/lib/mac/tkn154/TKN154P.nc +++ b/tos/lib/mac/tkn154/TKN154P.nc @@ -248,6 +248,8 @@ implementation BeaconSynchronizeP.MLME_GET -> PibP; BeaconSynchronizeP.TrackAlarm = Alarm2; BeaconSynchronizeP.FrameUtility -> PibP; + BeaconSynchronizeP.FindBeacon -> DeviceCap.FindBeacon; + BeaconSynchronizeP.FindBeacon -> CoordCap.FindBeacon; BeaconSynchronizeP.Frame -> PibP; BeaconSynchronizeP.BeaconFrame -> PibP; BeaconSynchronizeP.BeaconRx -> SyncRadioClient; @@ -280,7 +282,6 @@ implementation CoordCap.FrameRx[FC1_FRAMETYPE_CMD + CMD_FRAME_DISASSOCIATION_NOTIFICATION]; AssociateP.DataRequest -> PollP.DataRequest[ASSOCIATE_CLIENT]; AssociateP.ResponseTimeout = Timer3; - AssociateP.IsTrackingBeacons -> BeaconSynchronizeP.IsTrackingBeacons; AssociateP.TxFramePool -> TxFramePoolP; AssociateP.TxControlPool -> TxControlPoolP; AssociateP.MLME_GET -> PibP; @@ -394,6 +395,7 @@ implementation DeviceCap.IsRxBroadcastPending -> BeaconSynchronizeP.IsRxBroadcastPending; DeviceCap.IsRxEnableActive -> RxEnableP.IsRxEnableActive; DeviceCap.RxEnableStateChange -> RxEnableP.RxEnableStateChange; + DeviceCap.IsTrackingBeacons -> BeaconSynchronizeP.IsTrackingBeacons; DeviceCap.FrameUtility -> PibP; DeviceCap.RadioTx -> DeviceCapRadioClient; DeviceCap.RadioRx -> DeviceCapRadioClient; @@ -426,6 +428,7 @@ implementation CoordCap.BLELen -> BeaconTransmitP.BLELen; CoordCap.IsRxEnableActive -> RxEnableP.IsRxEnableActive; CoordCap.RxEnableStateChange -> RxEnableP.RxEnableStateChange; + CoordCap.IsTrackingBeacons -> BeaconSynchronizeP.IsTrackingBeacons; CoordCap.FrameUtility -> PibP; CoordCap.RadioTx -> CoordCapRadioClient; CoordCap.RadioRx -> CoordCapRadioClient; @@ -496,8 +499,8 @@ implementation RxEnableP.TimeCalc -> PibP.TimeCalc; RxEnableP.RadioOff -> RxEnableRadioClient; RxEnableP.RadioPromiscuousMode = RadioPromiscuousMode; - RxEnableP.WasRxEnabled -> DeviceCap; - RxEnableP.WasRxEnabled -> CoordCap; + RxEnableP.WasRxEnabled -> DeviceCap.WasRxEnabled; + RxEnableP.WasRxEnabled -> CoordCap.WasRxEnabled; RxEnableP.RxEnableTimer = Timer5; RxEnableP.Debug = Ieee802154Debug[RXENABLE_CLIENT]; diff --git a/tos/lib/mac/tkn154/TransferClientP.nc b/tos/lib/mac/tkn154/TransferClientP.nc index be6b4f25..8a780c05 100644 --- a/tos/lib/mac/tkn154/TransferClientP.nc +++ b/tos/lib/mac/tkn154/TransferClientP.nc @@ -61,15 +61,16 @@ implementation async command uint8_t TransferredFrom.getUserId(){ return myUserId;} - async command void TransferredFrom.transfer() + task void TransferredTask() { signal ResourceTransferred.transferred(); } - async command error_t ResourceTransferred.release() + async command void TransferredFrom.transfer() { - return call ResourceTransferControl.release(myUserId); + post TransferredTask(); } default async command uint8_t TransferTo.getUserId(){ call Leds.led0On(); return 0xFF;} default async command void TransferTo.transfer(){ call Leds.led0On(); } + default event void ResourceTransferred.transferred(){} }