X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Flib%2Fmac%2Ftkn154%2Fdummies%2FNoDeviceCfpP.nc;h=0d672ce6bc0ac8c5b63f6e847811c70073e41297;hb=d0573ffd623b75029b406fb2f74fc1de5160e8ab;hp=4cbc46899c272456afc97e91abd322c6f15983d6;hpb=4e123af010077900246c741bb14231338d98f450;p=tinyos-2.x.git diff --git a/tos/lib/mac/tkn154/dummies/NoDeviceCfpP.nc b/tos/lib/mac/tkn154/dummies/NoDeviceCfpP.nc index 4cbc4689..0d672ce6 100644 --- a/tos/lib/mac/tkn154/dummies/NoDeviceCfpP.nc +++ b/tos/lib/mac/tkn154/dummies/NoDeviceCfpP.nc @@ -54,7 +54,9 @@ module NoDeviceCfpP interface Resource as Token; interface ResourceTransferred as TokenTransferred; interface ResourceRequested as TokenRequested; + interface ResourceTransfer as TokenToBeaconSync; interface GetNow as CapStartRefTime; + interface GetNow as IsSendingBeacons; interface GetNow as CfpEnd; interface GetNow as GtsField; interface GetNow as SfSlotDuration; @@ -88,23 +90,23 @@ implementation return IEEE154_INVALID_HANDLE; } - event void TokenTransferred.transferred() + async event void TokenTransferred.transferred() { - // the CFP has started, this component now owns the token - + // the CFP has started, this component now owns the token. // because GTS is not implemented we release the token - // immediately; the general rule is: as long as a component - // owns the token it has exclusive access to the radio - call Token.release(); + // (or pass it back to BeaconSynchronizeP if + // we are not transmitting beacons) + if (call IsSendingBeacons.getNow()) + call Token.release(); + else + call TokenToBeaconSync.transfer(); } - async event void CfpEndAlarm.fired() { } + async event void CfpEndAlarm.fired() {} async event void CfpSlotAlarm.fired() {} - async event void RadioOff.offDone() - { - call Token.release(); - } + async event void RadioOff.offDone() {} async event void RadioTx.loadDone(){} async event void RadioTx.transmitDone(ieee154_txframe_t *frame,