]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
bugfix: radio token was not properly transferred when MLME_SCAN/_RX_ENABLE was called...
authorjanhauer <janhauer>
Thu, 14 May 2009 13:20:35 +0000 (13:20 +0000)
committerjanhauer <janhauer>
Thu, 14 May 2009 13:20:35 +0000 (13:20 +0000)
tos/lib/mac/tkn154/DispatchSlottedCsmaP.nc
tos/lib/mac/tkn154/DispatchUnslottedCsmaP.nc
tos/lib/mac/tkn154/RadioClientC.nc
tos/lib/mac/tkn154/TKN154BeaconEnabledP.nc
tos/lib/mac/tkn154/TKN154NonBeaconEnabledP.nc
tos/lib/mac/tkn154/TKN154_MAC.h
tos/lib/mac/tkn154/dummies/NoDispatchSlottedCsmaP.nc

index ca1abef292ce7073ba6a97380e1795a0751c1f48..c2b2932372bf3ef0225af1e313b1163756ac27aa 100644 (file)
@@ -73,6 +73,7 @@ generic module DispatchSlottedCsmaP(uint8_t sfDirection)
     interface Alarm<TSymbolIEEE802154,uint32_t> as BLEAlarm;
     interface Alarm<TSymbolIEEE802154,uint32_t> as RxWaitAlarm;
     interface TransferableResource as RadioToken;
+    interface ResourceRequested as RadioTokenRequested;
     interface SuperframeStructure; 
     interface GetNow<token_requested_t> as IsRadioTokenRequested;
     interface GetNow<bool> as IsRxEnableActive; 
@@ -741,4 +742,6 @@ implementation
 
   command error_t WasRxEnabled.enable() {return FAIL;}
   command error_t WasRxEnabled.disable() {return FAIL;}
+  async event void RadioTokenRequested.requested(){ updateState(); }
+  async event void RadioTokenRequested.immediateRequested(){ updateState(); }
 }
index 8415c1ba813e5b39599baee271516852fb91aaa1..6be52f45ea6417af89c5037532b0a4c4f1a3aa83 100644 (file)
@@ -61,6 +61,7 @@ module DispatchUnslottedCsmaP
   {
     interface Timer<TSymbolIEEE802154> as IndirectTxWaitTimer;
     interface TransferableResource as RadioToken;
+    interface ResourceRequested as RadioTokenRequested;
     interface GetNow<token_requested_t> as IsRadioTokenRequested;
     interface GetNow<bool> as IsRxEnableActive; 
     interface Set<ieee154_macSuperframeOrder_t> as SetMacSuperframeOrder;
@@ -261,8 +262,9 @@ implementation
       else if (call IsRadioTokenRequested.getNow()) {
         if (call RadioOff.isOff()) {
           // nothing more to do... just release the Token
-          m_lock = FALSE; // unlock
           dbg_serial("DispatchUnslottedCsmaP", "Token requested: releasing it.\n");
+          call RadioToken.request(); // we want it back afterwards ...
+          m_lock = FALSE; // unlock
           call RadioToken.release();
           return;
         } else 
@@ -518,4 +520,6 @@ implementation
   command error_t WasRxEnabled.disable() {return FAIL;}
   default event void MLME_START.confirm(ieee154_status_t status) {}
   async event void RadioToken.transferredFrom(uint8_t fromClientID) {ASSERT(0);}
+  async event void RadioTokenRequested.requested(){ updateState(); }
+  async event void RadioTokenRequested.immediateRequested(){ updateState(); }
 }
index 8aabcf70c1e718fe0bcdb099e87a94d8a0b2bcaa..a9fd02cf81f144a4fe16d94eba9a9d00dd1303c1 100644 (file)
@@ -44,6 +44,7 @@ generic configuration RadioClientC(uint8_t clientID)
     interface SlottedCsmaCa;
     interface UnslottedCsmaCa;
     interface TransferableResource as RadioToken;
+    interface ResourceRequested as RadioTokenRequested;
   }
 }
 implementation
@@ -55,5 +56,6 @@ implementation
   SlottedCsmaCa = RadioControlP.SlottedCsmaCa[clientID];
   UnslottedCsmaCa = RadioControlP.UnslottedCsmaCa[clientID];
   RadioToken = RadioControlP.TransferableResource[clientID];
+  RadioTokenRequested = RadioControlP.ResourceRequested[clientID];
 }
 
index 26a24c7d3e08c7f65ba2506b7d2d0c8bfea5a6a9..7d7d749a4990fae36a80f3e95822f80f02cb8e5a 100644 (file)
@@ -403,6 +403,7 @@ implementation
   DeviceCap.BLEAlarm = Alarm4;
   DeviceCap.RxWaitAlarm = Alarm5;
   DeviceCap.RadioToken -> DeviceCapRadioClient;
+  DeviceCap.RadioTokenRequested -> DeviceCapRadioClient;
   DeviceCap.SuperframeStructure -> BeaconSynchronizeP.IncomingSF;
   DeviceCap.IsRxEnableActive -> RxEnableP.IsRxEnableActive;
   DeviceCap.IsRadioTokenRequested -> PibP.IsRadioTokenRequested; // fan out...
@@ -430,6 +431,7 @@ implementation
   CoordCap.CapEndAlarm = Alarm6;
   CoordCap.BLEAlarm = Alarm7;
   CoordCap.RadioToken -> CoordCapRadioClient;
+  CoordCap.RadioTokenRequested -> CoordCapRadioClient;
   CoordCap.SuperframeStructure -> BeaconTransmitP.OutgoingSF;
   CoordCap.IsRxEnableActive -> RxEnableP.IsRxEnableActive;
   CoordCap.IsRadioTokenRequested -> PibP.IsRadioTokenRequested; // fan out...
index fa2d24d2e6ef90455b6e4a63c122b602b2d3f837..70f527bcc174b097f5efe6ba2c49338988bb25a6 100644 (file)
@@ -288,6 +288,7 @@ implementation
   DispatchP.SetMacSuperframeOrder -> PibP.SetMacSuperframeOrder;
   DispatchP.SetMacPanCoordinator -> PibP.SetMacPanCoordinator;
   DispatchP.IsRxEnableActive -> RxEnableP.IsRxEnableActive;
+  DispatchP.RadioTokenRequested -> DispatchRadioClient;
   DispatchP.IsRadioTokenRequested -> PibP.IsRadioTokenRequested; // fan out...
   DispatchP.IsRadioTokenRequested -> PromiscuousModeP.IsRadioTokenRequested;
   DispatchP.IsRadioTokenRequested -> ScanP.IsRadioTokenRequested;
index 20d4e982c4f4c8295ad62c20757697fada13245d..f7544e0788f10ba20dc533e44bf03380f36a8bf1 100644 (file)
@@ -283,7 +283,7 @@ enum {
 typedef bool token_requested_t __attribute__((combine(rcombine)));
 token_requested_t rcombine(token_requested_t r1, token_requested_t r2)
 {
-  return r1 && r2;
+  return r1 || r2;
 }
 
 #ifdef TKN154_DEBUG
index 67dcc5ba00281a38df8a3804498f1bcb6d7ca257..e2fb050986d8e21cf380a9434fb3d52ed33ce5c6 100644 (file)
@@ -56,6 +56,7 @@ generic module NoDispatchSlottedCsmaP(uint8_t sfDirection)
     interface Alarm<TSymbolIEEE802154,uint32_t> as RxWaitAlarm;
     interface GetNow<token_requested_t> as IsRadioTokenRequested;
     interface TransferableResource as RadioToken;
+    interface ResourceRequested as RadioTokenRequested;
     interface SuperframeStructure; 
     interface GetNow<bool> as IsRxEnableActive; 
     interface Get<ieee154_txframe_t*> as GetIndirectTxFrame; 
@@ -113,4 +114,6 @@ implementation
   command error_t WasRxEnabled.enable(){return FAIL;}
   command error_t WasRxEnabled.disable(){return FAIL;}
   event void PIBUpdateMacRxOnWhenIdle.notify( const void* val ) {}
+  async event void RadioTokenRequested.requested(){ }
+  async event void RadioTokenRequested.immediateRequested(){ }
 }