[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/mac/tkn154 BeaconSynchronizeP.nc, 1.8, 1.9 BeaconTransmitP.nc, 1.7, 1.8 CoordBroadcastP.nc, 1.4, 1.5 DataP.nc, 1.3, 1.4 DispatchSlottedCsmaP.nc, 1.1, 1.2 DispatchUnslottedCsmaP.nc, 1.1, 1.2 PibP.nc, 1.6, 1.7 PromiscuousModeP.nc, 1.3, 1.4 RadioClientC.nc, 1.3, 1.4 RadioControlP.nc, 1.2, 1.3 ScanP.nc, 1.3, 1.4 SimpleTransferArbiterP.nc, 1.3, 1.4 TKN154BeaconEnabledP.nc, 1.2, 1.3 TKN154_MAC.h, 1.4, 1.5 TKN154NonBeaconEnabledP.nc, 1.2, 1.3 SimpleRoundRobinTransferArbiterC.nc, 1.1, NONE TransferClientP.nc, 1.4, NONE

Jan-Hinrich Hauer janhauer at users.sourceforge.net
Tue Mar 24 05:56:49 PDT 2009


Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23986/tos/lib/mac/tkn154

Modified Files:
	BeaconSynchronizeP.nc BeaconTransmitP.nc CoordBroadcastP.nc 
	DataP.nc DispatchSlottedCsmaP.nc DispatchUnslottedCsmaP.nc 
	PibP.nc PromiscuousModeP.nc RadioClientC.nc RadioControlP.nc 
	ScanP.nc SimpleTransferArbiterP.nc TKN154BeaconEnabledP.nc 
	TKN154_MAC.h TKN154NonBeaconEnabledP.nc 
Removed Files:
	SimpleRoundRobinTransferArbiterC.nc TransferClientP.nc 
Log Message:
1) simplified the resource transfer: removed ResourceTransfer* interfaces and corresponding components, replaced them by a single new extended TransferableResource interface (the token passing mechanism remains the same, but now there are less interfaces/components involved).
2) made some small fixes/modifications to facilitate porting to micaz, as proposed by Daniel F. Piñeiro Santos

Index: BeaconSynchronizeP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/BeaconSynchronizeP.nc,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** BeaconSynchronizeP.nc	4 Mar 2009 18:31:14 -0000	1.8
--- BeaconSynchronizeP.nc	24 Mar 2009 12:56:46 -0000	1.9
***************
*** 64,71 ****
      interface DataRequest;
      interface FrameRx as CoordRealignmentRx;
!     interface Resource as Token;
!     interface GetNow<bool> as IsTokenRequested;
!     interface ResourceTransferred as TokenTransferred;
!     interface ResourceTransfer as TokenToCap;
      interface TimeCalc;
      interface IEEE154Frame as Frame;
--- 64,68 ----
      interface DataRequest;
      interface FrameRx as CoordRealignmentRx;
!     interface TransferableResource as RadioToken;
      interface TimeCalc;
      interface IEEE154Frame as Frame;
***************
*** 161,168 ****
          m_updatePending = TRUE;
          atomic {
!           // if we are tracking then we'll get the Token automatically,
            // otherwise request it now
!           if (!m_tracking && !call Token.isOwner())
!             call Token.request();  
          }
        }
--- 158,165 ----
          m_updatePending = TRUE;
          atomic {
!           // if we are tracking then we'll get the RadioToken automatically,
            // otherwise request it now
!           if (!m_tracking && !call RadioToken.isOwner())
!             call RadioToken.request();  
          }
        }
***************
*** 172,176 ****
    }
  
!   event void Token.granted()
    {
      dbg_serial("BeaconSynchronizeP","Got token, expecting beacon in %lu\n",
--- 169,173 ----
    }
  
!   event void RadioToken.granted()
    {
      dbg_serial("BeaconSynchronizeP","Got token, expecting beacon in %lu\n",
***************
*** 192,206 ****
    }
  
!   async event void TokenTransferred.transferred()
    {
      dbg_serial("BeaconSynchronizeP","Token.transferred(), expecting beacon in %lu symbols.\n",
          (uint32_t) ((m_lastBeaconRxTime + m_dt) - call TrackAlarm.getNow())); 
!     if (call IsTokenRequested.getNow()) {
!       // some other component needs the token - we give it up for now,  
!       // but make another request to get it back later
!       dbg_serial("BeaconSynchronizeP", "Token is requested, releasing it now.\n");
!       call Token.request();
!       call Token.release();
!     } else if (m_updatePending)
        post signalGrantedTask();
      else
--- 189,197 ----
    }
  
!   async event void RadioToken.transferredFrom(uint8_t clientFrom)
    {
      dbg_serial("BeaconSynchronizeP","Token.transferred(), expecting beacon in %lu symbols.\n",
          (uint32_t) ((m_lastBeaconRxTime + m_dt) - call TrackAlarm.getNow())); 
!     if (m_updatePending)
        post signalGrantedTask();
      else
***************
*** 211,215 ****
    task void signalGrantedTask()
    {
!     signal Token.granted();
    }
  
--- 202,206 ----
    task void signalGrantedTask()
    {
!     signal RadioToken.granted();
    }
  
***************
*** 219,230 ****
  
      if (m_state != S_INITIAL_SCAN) {
!       // we have received at least one previous beacon
!       m_state = S_PREPARE;
        if (!m_tracking) {
          // nothing to do, just give up the token
          dbg_serial("BeaconSynchronizeP", "Stop tracking.\n");
!         call Token.release();
          return;
        }
        while (call TimeCalc.hasExpired(m_lastBeaconRxTime, m_dt)) { // missed a beacon!
          dbg_serial("BeaconSynchronizeP", "Missed a beacon, expected it: %lu, now: %lu\n", 
--- 210,223 ----
  
      if (m_state != S_INITIAL_SCAN) {
! 
        if (!m_tracking) {
          // nothing to do, just give up the token
          dbg_serial("BeaconSynchronizeP", "Stop tracking.\n");
!         call RadioToken.release();
          return;
        }
+ 
+       // we have received at least one previous beacon
+       m_state = S_PREPARE;
        while (call TimeCalc.hasExpired(m_lastBeaconRxTime, m_dt)) { // missed a beacon!
          dbg_serial("BeaconSynchronizeP", "Missed a beacon, expected it: %lu, now: %lu\n", 
***************
*** 234,237 ****
--- 227,231 ----
          m_numBeaconsLost++;
        }
+ 
        if (m_numBeaconsLost >= IEEE154_aMaxLostBeacons) {
          dbg_serial("BeaconSynchronizeP", "Missed too many beacons.\n");
***************
*** 239,250 ****
          return;
        }
        if (missed) {
          // let other components get a chance to use the radio
!         call Token.request();
          dbg_serial("BeaconSynchronizeP", "Allowing other components to get the token.\n");
!         call Token.release();
          return;
        }
      }
      if (call RadioOff.isOff())
        signal RadioOff.offDone();
--- 233,246 ----
          return;
        }
+ 
        if (missed) {
          // let other components get a chance to use the radio
!         call RadioToken.request();
          dbg_serial("BeaconSynchronizeP", "Allowing other components to get the token.\n");
!         call RadioToken.release();
          return;
        }
      }
+ 
      if (call RadioOff.isOff())
        signal RadioOff.offDone();
***************
*** 351,357 ****
                NULL);
        } else
!         call Token.request(); // make another request again (before giving the token up)
  
!       call Token.release();
      } else { 
        // got the beacon!
--- 347,353 ----
                NULL);
        } else
!         call RadioToken.request(); // make another request again (before giving the token up)
  
!       call RadioToken.release();
      } else { 
        // got the beacon!
***************
*** 399,407 ****
          dbg_serial("BeaconSynchronizeP", "Stop tracking.\n");
          if (m_updatePending) // there is already a new request ...
!           call Token.request();
!         call Token.release();
        } else {
          dbg_serial("BeaconSynchronizeP", "Handing over to CAP.\n");
!         call TokenToCap.transfer(); 
        }
        
--- 395,406 ----
          dbg_serial("BeaconSynchronizeP", "Stop tracking.\n");
          if (m_updatePending) // there is already a new request ...
!           call RadioToken.request();
!         call RadioToken.release();
        } else {
          dbg_serial("BeaconSynchronizeP", "Handing over to CAP.\n");
!         // we pass on the token now, but make a reservation to get it back 
!         // to receive the next beacon (at the start of the next superframe)
!         call RadioToken.request();  
!         call RadioToken.transferTo(RADIO_CLIENT_DEVICECAP); 
        }
        
***************
*** 443,447 ****
    {
      // Track a single beacon now
!     if (!m_tracking && !m_updatePending && !call Token.isOwner()) {
        // find a single beacon now (treat this like a user request)
        m_updateLogicalChannel = call MLME_GET.phyCurrentChannel();
--- 442,446 ----
    {
      // Track a single beacon now
!     if (!m_tracking && !m_updatePending && !call RadioToken.isOwner()) {
        // find a single beacon now (treat this like a user request)
        m_updateLogicalChannel = call MLME_GET.phyCurrentChannel();
***************
*** 449,453 ****
        m_stopTracking = TRUE;
        m_updatePending = TRUE;
!       call Token.request();
      }
      return SUCCESS;
--- 448,452 ----
        m_stopTracking = TRUE;
        m_updatePending = TRUE;
!       call RadioToken.request();
      }
      return SUCCESS;

Index: BeaconTransmitP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/BeaconTransmitP.nc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** BeaconTransmitP.nc	4 Mar 2009 18:31:17 -0000	1.7
--- BeaconTransmitP.nc	24 Mar 2009 12:56:46 -0000	1.8
***************
*** 60,67 ****
      interface MLME_GET;
      interface MLME_SET;
!     interface Resource as Token;
!     interface ResourceTransferred as TokenTransferred;
!     interface ResourceTransfer as TokenToBroadcast;
!     interface GetNow<bool> as IsTokenRequested;
      interface FrameTx as RealignmentBeaconEnabledTx;
      interface FrameTx as RealignmentNonBeaconEnabledTx;
--- 60,64 ----
      interface MLME_GET;
      interface MLME_SET;
!     interface TransferableResource as RadioToken;
      interface FrameTx as RealignmentBeaconEnabledTx;
      interface FrameTx as RealignmentNonBeaconEnabledTx;
***************
*** 155,159 ****
    task void txDoneTask();
    task void signalStartConfirmSuccessTask();
!   void prepareNextBeaconTransmission();
    void continueStartRequest();
    void finishRealignment(ieee154_txframe_t *frame, ieee154_status_t status);
--- 152,157 ----
    task void txDoneTask();
    task void signalStartConfirmSuccessTask();
!   void nextRound();
!   void prepareBeaconTransmission();
    void continueStartRequest();
    void finishRealignment(ieee154_txframe_t *frame, ieee154_status_t status);
***************
*** 243,247 ****
          // We're not already transmitting beacons, i.e. we have to request the token
          // (otherwise we'd get the token "automatically" for the next scheduled beacon).
!         call Token.request();
        }
        // We'll continue the MLME_START operation in continueStartRequest() once we have the token
--- 241,245 ----
          // We're not already transmitting beacons, i.e. we have to request the token
          // (otherwise we'd get the token "automatically" for the next scheduled beacon).
!         call RadioToken.request();
        }
        // We'll continue the MLME_START operation in continueStartRequest() once we have the token
***************
*** 374,391 ****
    }
  
!   task void grantedTask()
    {
!     signal Token.granted();
    }
  
!   event void Token.granted()
    {
!     dbg_serial("BeaconSynchronizeP","Got token, will Tx beacon in %lu\n",
!         (uint32_t) ((m_lastBeaconTxTime + m_dt) - call BeaconSendAlarm.getNow())); 
      if (m_requestBitmap & REQUEST_REALIGNMENT_DONE_PENDING) {
!       // unlikely to occur: we have not yet received a done()
        // event after sending out a realignment frame 
        dbg_serial("BeaconTransmitP", "Realignment pending (request: %lu) !\n", (uint32_t) m_requestBitmap);
!       post grantedTask(); // spin
        return;
      } else if (m_requestBitmap & REQUEST_UPDATE_SF) {
--- 372,388 ----
    }
  
!   task void signalGrantedTask()
    {
!     signal RadioToken.granted();
    }
  
!   event void RadioToken.granted()
    {
!     dbg_serial("BeaconSynchronizeP","Token granted.\n");
      if (m_requestBitmap & REQUEST_REALIGNMENT_DONE_PENDING) {
!       // very unlikely: we have not yet received a done()
        // event after sending out a realignment frame 
        dbg_serial("BeaconTransmitP", "Realignment pending (request: %lu) !\n", (uint32_t) m_requestBitmap);
!       post signalGrantedTask(); // spin
        return;
      } else if (m_requestBitmap & REQUEST_UPDATE_SF) {
***************
*** 394,430 ****
        continueStartRequest();
      }
      if (call RadioOff.isOff())
!       prepareNextBeaconTransmission();
      else
!       ASSERT(call RadioOff.off() == SUCCESS); // will continue in prepareNextBeaconTransmission()
    }
  
!   async event void TokenTransferred.transferred()
    {
!     if (call IsTokenRequested.getNow()) {
!       // some other component needs the token - we give it up for now, 
!       // but before make another request to get it back afterwards     
!       dbg_serial("BeaconTransmitP", "Token is requested, releasing it now.\n");
!       call Token.request();
!       call Token.release();
!     } else
!       post grantedTask();
    }  
  
    async event void RadioOff.offDone()
    {
!     prepareNextBeaconTransmission();
    }
  
!   void prepareNextBeaconTransmission()
    {
      if (m_txState == S_TX_LOCKED) {
        // have not had time to finish processing the last sent beacon
        dbg_serial("BeaconTransmitP", "Token was returned too fast!\n");
!       post grantedTask();
      } else if (m_beaconOrder == 15) {
        // we're not sending any beacons!?
        dbg_serial("BeaconTransmitP", "Stop sending beacons.\n");
!       call Token.release();
      } else {
        // get ready for next beacon transmission
--- 391,430 ----
        continueStartRequest();
      }
+     nextRound();
+   }
+ 
+   void nextRound()
+   {
      if (call RadioOff.isOff())
!       prepareBeaconTransmission();
      else
!       ASSERT(call RadioOff.off() == SUCCESS); // will continue in prepareBeaconTransmission()
    }
  
!   async event void RadioToken.transferredFrom(uint8_t fromClientID)
    {
!     dbg_serial("BeaconSynchronizeP","Token transferred, will Tx beacon in %lu\n",
!         (uint32_t) ((m_lastBeaconTxTime + m_dt) - call BeaconSendAlarm.getNow())); 
!     if (m_requestBitmap & (REQUEST_REALIGNMENT_DONE_PENDING | REQUEST_UPDATE_SF))
!       post signalGrantedTask(); // need to be in sync context
!     else
!       nextRound();
    }  
  
    async event void RadioOff.offDone()
    {
!     prepareBeaconTransmission();
    }
  
!   void prepareBeaconTransmission()
    {
      if (m_txState == S_TX_LOCKED) {
        // have not had time to finish processing the last sent beacon
        dbg_serial("BeaconTransmitP", "Token was returned too fast!\n");
!       post signalGrantedTask();
      } else if (m_beaconOrder == 15) {
        // we're not sending any beacons!?
        dbg_serial("BeaconTransmitP", "Stop sending beacons.\n");
!       call RadioToken.release();
      } else {
        // get ready for next beacon transmission
***************
*** 517,526 ****
      } else {
        // Timestamp is invalid; this is bad. We need the beacon timestamp for the 
!       // slotted CSMA-CA, because it defines slot reference time. We can't use this superframe
        // TODO: check if this was the initial beacon (then m_lastBeaconTxRefTime is invalid)
        dbg_serial("BeaconTransmitP", "Invalid timestamp!\n");
        m_dt += m_beaconInterval;
!       call Token.request();
!       call Token.release();      
        return;
      }
--- 517,526 ----
      } else {
        // Timestamp is invalid; this is bad. We need the beacon timestamp for the 
!       // slotted CSMA-CA, because it defines the slot reference time. We can't use this superframe
        // TODO: check if this was the initial beacon (then m_lastBeaconTxRefTime is invalid)
        dbg_serial("BeaconTransmitP", "Invalid timestamp!\n");
        m_dt += m_beaconInterval;
!       call RadioToken.request();
!       call RadioToken.release();      
        return;
      }
***************
*** 548,552 ****
      } else
        m_battLifeExtDuration = 0;
!     call TokenToBroadcast.transfer(); 
      post txDoneTask();
    }
--- 548,556 ----
      } else
        m_battLifeExtDuration = 0;
! 
!     // we pass on the token now, but make a reservation to get it back 
!     // to transmit the next beacon (at the start of the next superframe)
!     call RadioToken.request();  
!     call RadioToken.transferTo(RADIO_CLIENT_COORDBROADCAST); 
      post txDoneTask();
    }

Index: CoordBroadcastP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/CoordBroadcastP.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CoordBroadcastP.nc	4 Mar 2009 18:31:18 -0000	1.4
--- CoordBroadcastP.nc	24 Mar 2009 12:56:46 -0000	1.5
***************
*** 50,57 ****
      interface Queue<ieee154_txframe_t*>; 
      interface FrameTxNow as CapTransmitNow;
!     interface ResourceTransfer as TokenToCap;
!     interface ResourceTransferred as TokenTransferred;
      interface SuperframeStructure as OutgoingSF;
-     interface Leds;
    }
  }
--- 50,55 ----
      interface Queue<ieee154_txframe_t*>; 
      interface FrameTxNow as CapTransmitNow;
!     interface TransferableResource as RadioToken;
      interface SuperframeStructure as OutgoingSF;
    }
  }
***************
*** 107,111 ****
    }
  
!   async event void TokenTransferred.transferred()
    {
      // CAP has started - are there any broadcast frames to be transmitted?
--- 105,109 ----
    }
  
!   async event void RadioToken.transferredFrom(uint8_t fromClient)
    {
      // CAP has started - are there any broadcast frames to be transmitted?
***************
*** 118,122 ****
        call CapTransmitNow.transmitNow(broadcastFrame);
      }
!     call TokenToCap.transfer();
    }
  
--- 116,120 ----
        call CapTransmitNow.transmitNow(broadcastFrame);
      }
!     call RadioToken.transferTo(RADIO_CLIENT_COORDCAP);
    }
  
***************
*** 142,144 ****
--- 140,144 ----
      m_lock = FALSE;
    }
+ 
+   event void RadioToken.granted(){ ASSERT(0); }
  }

Index: DataP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/DataP.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** DataP.nc	4 Mar 2009 18:31:22 -0000	1.3
--- DataP.nc	24 Mar 2009 12:56:46 -0000	1.4
***************
*** 273,276 ****
--- 273,278 ----
    default event message_t* MCPS_DATA.indication(message_t* frame) { return frame; }
    default command ieee154_status_t DeviceCfpTx.transmit(ieee154_txframe_t *data) {return IEEE154_INVALID_GTS;}
+   default command ieee154_status_t BroadcastTx.transmit(ieee154_txframe_t *data) {return IEEE154_INVALID_PARAMETER;}
    default command ieee154_status_t CoordCfpTx.transmit(ieee154_txframe_t *data) {return IEEE154_INVALID_GTS;}
+   default async command bool IsSendingBeacons.getNow() {return FALSE;}
  }

Index: DispatchSlottedCsmaP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/DispatchSlottedCsmaP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DispatchSlottedCsmaP.nc	5 Mar 2009 10:07:11 -0000	1.1
--- DispatchSlottedCsmaP.nc	24 Mar 2009 12:56:46 -0000	1.2
***************
*** 78,86 ****
      interface Alarm<TSymbolIEEE802154,uint32_t> as IndirectTxWaitAlarm;
      interface Alarm<TSymbolIEEE802154,uint32_t> as BroadcastAlarm;
!     interface Resource as Token;
!     interface GetNow<bool> as IsTokenRequested;
!     interface ResourceTransfer as TokenToCfp;
!     interface ResourceTransferred as TokenTransferred;
      interface SuperframeStructure; 
      interface GetNow<bool> as IsRxEnableActive; 
      interface Get<ieee154_txframe_t*> as GetIndirectTxFrame; 
--- 78,84 ----
      interface Alarm<TSymbolIEEE802154,uint32_t> as IndirectTxWaitAlarm;
      interface Alarm<TSymbolIEEE802154,uint32_t> as BroadcastAlarm;
!     interface TransferableResource as RadioToken;
      interface SuperframeStructure; 
+     interface GetNow<token_requested_t> as IsRadioTokenRequested;
      interface GetNow<bool> as IsRxEnableActive; 
      interface Get<ieee154_txframe_t*> as GetIndirectTxFrame; 
***************
*** 118,121 ****
--- 116,120 ----
      COORD_ROLE = (sfDirection == OUTGOING_SUPERFRAME),
      DEVICE_ROLE = !COORD_ROLE,
+     RADIO_CLIENT_CFP = COORD_ROLE ? RADIO_CLIENT_COORDCFP : RADIO_CLIENT_DEVICECFP,
    };
  
***************
*** 189,193 ****
    }
  
!   async event void TokenTransferred.transferred()
    {
      // we got the token, i.e. CAP has just started
--- 188,192 ----
    }
  
!   async event void RadioToken.transferredFrom(uint8_t fromClient)
    {
      // we got the token, i.e. CAP has just started
***************
*** 213,217 ****
        // CAP is too short to do anything practical
        dbg_serial("DispatchSlottedCsmaP", "CAP too short!\n");
!       call TokenToCfp.transfer();
        return;
      } else {
--- 212,216 ----
        // CAP is too short to do anything practical
        dbg_serial("DispatchSlottedCsmaP", "CAP too short!\n");
!       call RadioToken.transferTo(RADIO_CLIENT_CFP);
        return;
      } else {
***************
*** 344,348 ****
        // long atomics are bad... but in this block, once the/ current state has
        // been determined only one branch will/ be taken (there are no loops)
!       if (m_lock || !call Token.isOwner())
          return;
        m_lock = TRUE; // lock
--- 343,347 ----
        // long atomics are bad... but in this block, once the/ current state has
        // been determined only one branch will/ be taken (there are no loops)
!       if (m_lock || !call RadioToken.isOwner())
          return;
        m_lock = TRUE; // lock
***************
*** 370,374 ****
            dbg_flush_state();
            dbg_serial("DispatchSlottedCsmaP", "Handing over to CFP.\n");
!           call TokenToCfp.transfer();
            return;
          } else 
--- 369,373 ----
            dbg_flush_state();
            dbg_serial("DispatchSlottedCsmaP", "Handing over to CFP.\n");
!           call RadioToken.transferTo(RADIO_CLIENT_CFP);
            return;
          } else 
***************
*** 395,399 ****
  
        // Check 4: is some other operation (like MLME-SCAN or MLME-RESET) pending? 
!       else if (call IsTokenRequested.getNow()) {
          dbg_push_state(4);
          if (call RadioOff.isOff()) {
--- 394,398 ----
  
        // Check 4: is some other operation (like MLME-SCAN or MLME-RESET) pending? 
!       else if (call IsRadioTokenRequested.getNow()) {
          dbg_push_state(4);
          if (call RadioOff.isOff()) {
***************
*** 402,406 ****
            m_lock = FALSE; // unlock
            dbg_serial("DispatchSlottedCsmaP", "Token requested: Handing over to CFP.\n");
!           call TokenToCfp.transfer();
            return;
          } else 
--- 401,405 ----
            m_lock = FALSE; // unlock
            dbg_serial("DispatchSlottedCsmaP", "Token requested: Handing over to CFP.\n");
!           call RadioToken.release();
            return;
          } else 
***************
*** 440,451 ****
          dbg_push_state(8);
          next = trySwitchOff();
-         if (next == DO_NOTHING && (DEVICE_ROLE && capDuration == 0)) {
-           // nothing more to do... just release the Token
-           stopAllAlarms();  // may still fire, but is locked through isOwner()
-           m_lock = FALSE; // unlock
-           dbg_serial("DispatchSlottedCsmaP", "Releasing token\n");
-           call Token.release();
-           return;
-         }
        }
  
--- 439,442 ----
***************
*** 698,702 ****
      // transmission)
      atomic {
!       if (!call Token.isOwner() && m_bcastFrame == NULL) {
          m_bcastFrame = frame;
          return IEEE154_SUCCESS;
--- 689,693 ----
      // transmission)
      atomic {
!       if (!call RadioToken.isOwner() && m_bcastFrame == NULL) {
          m_bcastFrame = frame;
          return IEEE154_SUCCESS;
***************
*** 718,722 ****
    }
  
!   event void Token.granted()
    {
      ASSERT(0); // should never happen
--- 709,713 ----
    }
  
!   event void RadioToken.granted()
    {
      ASSERT(0); // should never happen

Index: DispatchUnslottedCsmaP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/DispatchUnslottedCsmaP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DispatchUnslottedCsmaP.nc	5 Mar 2009 10:07:11 -0000	1.1
--- DispatchUnslottedCsmaP.nc	24 Mar 2009 12:56:46 -0000	1.2
***************
*** 65,70 ****
    {
      interface Timer<TSymbolIEEE802154> as IndirectTxWaitTimer;
!     interface Resource as Token;
!     interface GetNow<bool> as IsTokenRequested;
      interface GetNow<bool> as IsRxEnableActive; 
      interface Set<ieee154_macSuperframeOrder_t> as SetMacSuperframeOrder;
--- 65,70 ----
    {
      interface Timer<TSymbolIEEE802154> as IndirectTxWaitTimer;
!     interface TransferableResource as RadioToken;
!     interface GetNow<token_requested_t> as IsRadioTokenRequested;
      interface GetNow<bool> as IsRxEnableActive; 
      interface Set<ieee154_macSuperframeOrder_t> as SetMacSuperframeOrder;
***************
*** 192,201 ****
      } else {
        setCurrentFrame(frame);
!       call Token.request();
        return IEEE154_SUCCESS;
      }
    }
  
!   event void Token.granted()
    {
      updateState();
--- 192,201 ----
      } else {
        setCurrentFrame(frame);
!       call RadioToken.request();
        return IEEE154_SUCCESS;
      }
    }
  
!   event void RadioToken.granted()
    {
      updateState();
***************
*** 249,253 ****
        // current state has been determined only one branch will
        // be taken (there are no loops)
!       if (m_lock || !call Token.isOwner())
          return;
        m_lock = TRUE; // lock
--- 249,253 ----
        // current state has been determined only one branch will
        // be taken (there are no loops)
!       if (m_lock || !call RadioToken.isOwner())
          return;
        m_lock = TRUE; // lock
***************
*** 260,269 ****
  
        // Check 2: is some other operation (like MLME-SCAN or MLME-RESET) pending? 
!       else if (call IsTokenRequested.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 Token.release();
            return;
          } else 
--- 260,269 ----
  
        // Check 2: is some other operation (like MLME-SCAN or MLME-RESET) pending? 
!       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.release();
            return;
          } else 
***************
*** 287,291 ****
        }
  
!       // Check 6: just make sure the radio is switched off  
        else {
          next = trySwitchOff();
--- 287,291 ----
        }
  
!       // Check 5: just make sure the radio is switched off  
        else {
          next = trySwitchOff();
***************
*** 294,298 ****
            m_lock = FALSE; // unlock
            dbg_serial("DispatchUnslottedCsmaP", "Releasing token\n");
!           call Token.release();
            return;
          }
--- 294,298 ----
            m_lock = FALSE; // unlock
            dbg_serial("DispatchUnslottedCsmaP", "Releasing token\n");
!           call RadioToken.release();
            return;
          }
***************
*** 358,362 ****
    async event void RadioOff.offDone() { m_lock = FALSE; updateState();}
    async event void RadioRx.enableRxDone() { m_lock = FALSE; updateState();}
!   event void RxEnableStateChange.notify(bool whatever) { updateState();}
  
    event void IndirectTxWaitTimer.fired() 
--- 358,367 ----
    async event void RadioOff.offDone() { m_lock = FALSE; updateState();}
    async event void RadioRx.enableRxDone() { m_lock = FALSE; updateState();}
!   event void RxEnableStateChange.notify(bool whatever) { 
!     if (!call RadioToken.isOwner())
!       call RadioToken.request();
!     else
!       updateState();
!   }
  
    event void IndirectTxWaitTimer.fired() 
***************
*** 459,462 ****
--- 464,469 ----
      uint8_t *mhr = MHR(frame);
      uint8_t frameType = mhr[MHR_INDEX_FC1] & FC1_FRAMETYPE_MASK;
+ 
+     dbg("DispatchUnslottedCsmaP", "Received frame, DSN: %lu, result: 0x%lx\n", (uint32_t) mhr[MHR_INDEX_SEQNO]);
      if (frameType == FC1_FRAMETYPE_CMD)
        frameType += payload[0];
***************
*** 495,497 ****
--- 502,505 ----
    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);}
  }

Index: PibP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/PibP.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** PibP.nc	5 Mar 2009 10:07:12 -0000	1.6
--- PibP.nc	24 Mar 2009 12:56:46 -0000	1.7
***************
*** 56,59 ****
--- 56,60 ----
      interface IEEE154BeaconFrame as BeaconFrame;
      interface Get<uint64_t> as GetLocalExtendedAddress;
+     interface GetNow<token_requested_t> as IsRadioTokenRequested;
      interface Notify<const void*> as PIBUpdate[uint8_t PIBAttributeID];
      interface Packet;
***************
*** 68,72 ****
      interface SplitControl as RadioControl;
      interface Random;
!     interface Resource as Token;
      interface RadioOff;
      interface LocalTime<TSymbolIEEE802154>;
--- 69,73 ----
      interface SplitControl as RadioControl;
      interface Random;
!     interface TransferableResource as RadioToken;
      interface RadioOff;
      interface LocalTime<TSymbolIEEE802154>;
***************
*** 78,82 ****
    uint8_t m_numResetClientPending;
    bool m_setDefaultPIB;
!   uint8_t m_resetSpin;
  
  #ifdef IEEE154_EXTENDED_ADDRESS
--- 79,83 ----
    uint8_t m_numResetClientPending;
    bool m_setDefaultPIB;
!   norace uint8_t m_resetSpin;
  
  #ifdef IEEE154_EXTENDED_ADDRESS
***************
*** 96,102 ****
    {
  #ifndef IEEE154_EXTENDED_ADDRESS
!     uint32_t *p = (uint32_t*) &m_aExtendedAddressLE;
!     *p++ = call Random.rand32();
!     *p = call Random.rand32();
  #endif
      resetAttributesToDefault();
--- 97,101 ----
    {
  #ifndef IEEE154_EXTENDED_ADDRESS
!     m_aExtendedAddressLE = (((uint64_t) call Random.rand32() ) << 32 ) | call Random.rand32(); 
  #endif
      resetAttributesToDefault();
***************
*** 176,181 ****
      else {
        m_setDefaultPIB = SetDefaultPIB;
!       if (!call Token.isOwner())
!         call Token.request();
      }   
      dbg_serial("PibP", "MLME_RESET.request(%lu) -> result: %lu\n", 
--- 175,180 ----
      else {
        m_setDefaultPIB = SetDefaultPIB;
!       m_resetSpin = 5;
!       call RadioToken.request();
      }   
      dbg_serial("PibP", "MLME_RESET.request(%lu) -> result: %lu\n", 
***************
*** 184,188 ****
    }
  
!   event void Token.granted()
    {
      if (call RadioOff.off() != SUCCESS)
--- 183,187 ----
    }
  
!   event void RadioToken.granted()
    {
      if (call RadioOff.off() != SUCCESS)
***************
*** 210,214 ****
      call DispatchQueueReset.init();  // resets the dispatch queue component(s), spools out frames
      call MacReset.init();            // resets the remaining components
-     m_resetSpin = 5;
      post resetSpinTask();
    }
--- 209,212 ----
***************
*** 216,226 ****
    task void resetSpinTask()
    {
!     if (m_resetSpin == 2) {
!       // just to be safe...
!       call DispatchReset.init();       
!       call DispatchQueueReset.init();  
!       call MacReset.init();       
!     }
!     if (m_resetSpin--) {
        post resetSpinTask();
        return;
--- 214,219 ----
    task void resetSpinTask()
    {
!     m_resetSpin -= 1;
!     if (m_resetSpin != 0) {
        post resetSpinTask();
        return;
***************
*** 229,232 ****
--- 222,227 ----
    }
  
+   async command token_requested_t IsRadioTokenRequested.getNow(){ return m_resetSpin != 0; }
+ 
    event void RadioControl.startDone(error_t error)
    {
***************
*** 243,247 ****
        signal PIBUpdate.notify[IEEE154_macPanCoordinator](&m_pib.macPanCoordinator);
      }
!     call Token.release();
      signal MLME_RESET.confirm(IEEE154_SUCCESS);
    }
--- 238,242 ----
        signal PIBUpdate.notify[IEEE154_macPanCoordinator](&m_pib.macPanCoordinator);
      }
!     call RadioToken.release();
      signal MLME_RESET.confirm(IEEE154_SUCCESS);
    }
***************
*** 1053,1055 ****
--- 1048,1051 ----
    command error_t PIBUpdate.enable[uint8_t PIBAttributeID]() {return FAIL;}
    command error_t PIBUpdate.disable[uint8_t PIBAttributeID]() {return FAIL;}
+   async event void RadioToken.transferredFrom(uint8_t fromClient){ASSERT(0);}
  }

Index: PromiscuousModeP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/PromiscuousModeP.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** PromiscuousModeP.nc	4 Mar 2009 18:31:26 -0000	1.3
--- PromiscuousModeP.nc	24 Mar 2009 12:56:46 -0000	1.4
***************
*** 43,48 ****
      interface Get<bool> as PromiscuousModeGet;
      interface FrameRx;
    } uses {
!     interface Resource as Token;
      interface RadioRx as PromiscuousRx;
      interface RadioOff;
--- 43,49 ----
      interface Get<bool> as PromiscuousModeGet;
      interface FrameRx;
+     interface GetNow<token_requested_t> as IsRadioTokenRequested;
    } uses {
!     interface TransferableResource as RadioToken;
      interface RadioRx as PromiscuousRx;
      interface RadioOff;
***************
*** 77,81 ****
      if (m_state == S_STOPPED) {
        m_state = S_STARTING;
!       call Token.request();
        result = SUCCESS;
      }
--- 78,82 ----
      if (m_state == S_STOPPED) {
        m_state = S_STARTING;
!       call RadioToken.request();
        result = SUCCESS;
      }
***************
*** 84,88 ****
    }
  
!   event void Token.granted()
    {
      call RadioPromiscuousMode.set(TRUE);
--- 85,89 ----
    }
  
!   event void RadioToken.granted()
    {
      call RadioPromiscuousMode.set(TRUE);
***************
*** 130,134 ****
      call RadioPromiscuousMode.set(FALSE);
      m_state = S_STOPPED;
!     call Token.release();
      dbg_serial("PromiscuousModeP", "Promiscuous mode disabled.\n");
      signal PromiscuousMode.stopDone(SUCCESS);
--- 131,135 ----
      call RadioPromiscuousMode.set(FALSE);
      m_state = S_STOPPED;
!     call RadioToken.release();
      dbg_serial("PromiscuousModeP", "Promiscuous mode disabled.\n");
      signal PromiscuousMode.stopDone(SUCCESS);
***************
*** 143,147 ****
--- 144,150 ----
    }
  
+   async command token_requested_t IsRadioTokenRequested.getNow(){ return m_state == S_STARTING; }
    default event void PromiscuousMode.startDone(error_t error) {}
    default event void PromiscuousMode.stopDone(error_t error) {}
+   async event void RadioToken.transferredFrom(uint8_t clientFrom){ASSERT(0);}
  }

Index: RadioClientC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/RadioClientC.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** RadioClientC.nc	4 Mar 2009 18:31:26 -0000	1.3
--- RadioClientC.nc	24 Mar 2009 12:56:46 -0000	1.4
***************
*** 35,39 ****
  
  #include "TKN154_MAC.h"
! generic configuration RadioClientC() 
  {
    provides
--- 35,39 ----
  
  #include "TKN154_MAC.h"
! generic configuration RadioClientC(uint8_t clientID) 
  {
    provides
***************
*** 44,80 ****
      interface SlottedCsmaCa;
      interface UnslottedCsmaCa;
!     interface Resource as Token;
!     interface ResourceRequested as TokenRequested;
!     interface ResourceTransfer;
!     interface ResourceTransferred;
!     interface ResourceTransferConnector as TransferFrom;
!     interface GetNow<bool> as IsResourceRequested;
!   } uses {
!     interface ResourceTransferConnector as TransferTo;
    }
  }
  implementation
  {
-   enum {
-     CLIENT = unique(IEEE802154_RADIO_RESOURCE),
-   };
- 
    components RadioControlP;
!   RadioRx = RadioControlP.RadioRx[CLIENT];
!   RadioTx = RadioControlP.RadioTx[CLIENT];
!   RadioOff = RadioControlP.RadioOff[CLIENT];
!   SlottedCsmaCa = RadioControlP.SlottedCsmaCa[CLIENT];
!   UnslottedCsmaCa = RadioControlP.UnslottedCsmaCa[CLIENT];
!   Token = RadioControlP.Token[CLIENT];
!   IsResourceRequested = RadioControlP.IsResourceRequested;
!   TokenRequested = RadioControlP.TokenRequested[CLIENT];
! 
!   components new TransferClientP(CLIENT);
!   ResourceTransfer = TransferClientP;
!   ResourceTransferred = TransferClientP;
!   TransferTo = TransferClientP;
!   TransferFrom = TransferClientP;
!   TransferClientP.ResourceTransferControl -> RadioControlP;
!   TransferClientP.Leds -> RadioControlP;
  }
  
--- 44,59 ----
      interface SlottedCsmaCa;
      interface UnslottedCsmaCa;
!     interface TransferableResource as RadioToken;
    }
  }
  implementation
  {
    components RadioControlP;
!   RadioRx = RadioControlP.RadioRx[clientID];
!   RadioTx = RadioControlP.RadioTx[clientID];
!   RadioOff = RadioControlP.RadioOff[clientID];
!   SlottedCsmaCa = RadioControlP.SlottedCsmaCa[clientID];
!   UnslottedCsmaCa = RadioControlP.UnslottedCsmaCa[clientID];
!   RadioToken = RadioControlP.TransferableResource[clientID];
  }
  

Index: RadioControlP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/RadioControlP.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RadioControlP.nc	4 Mar 2009 18:31:28 -0000	1.2
--- RadioControlP.nc	24 Mar 2009 12:56:46 -0000	1.3
***************
*** 43,51 ****
      interface UnslottedCsmaCa as UnslottedCsmaCa[uint8_t client];
      interface RadioOff as RadioOff[uint8_t client];
!     interface Resource as Token[uint8_t client];
!     interface ResourceRequested as TokenRequested[uint8_t client];
!     interface ResourceTransferControl as TokenTransferControl;
!     interface GetNow<bool> as IsResourceRequested;
!     interface Leds as LedsRadioClient;
    } uses {
      interface RadioRx as PhyRx;
--- 43,48 ----
      interface UnslottedCsmaCa as UnslottedCsmaCa[uint8_t client];
      interface RadioOff as RadioOff[uint8_t client];
!     interface TransferableResource[uint8_t id];
!     interface ResourceRequested[uint8_t id];
    } uses {
      interface RadioRx as PhyRx;
***************
*** 55,58 ****
--- 52,56 ----
      interface RadioOff as PhyRadioOff;
      interface Get<bool> as RadioPromiscuousMode;
+     interface ResourceConfigure[uint8_t id];
      interface Leds;
    }
***************
*** 73,83 ****
    RadioPromiscuousMode = RadioControlImplP;
    Leds = RadioControlImplP;
-   LedsRadioClient = Leds;
  
!   components new SimpleRoundRobinTransferArbiterC(IEEE802154_RADIO_RESOURCE) as Arbiter;
!   Token = Arbiter;  
!   TokenRequested = Arbiter;
!   TokenTransferControl = Arbiter;
!   IsResourceRequested = Arbiter;
    RadioControlImplP.ArbiterInfo -> Arbiter;
  }
--- 71,86 ----
    RadioPromiscuousMode = RadioControlImplP;
    Leds = RadioControlImplP;
  
!   components MainC;
!   components new RoundRobinResourceQueueC(uniqueCount(IEEE802154_RADIO_RESOURCE)) as Queue;
!   components new SimpleTransferArbiterP() as Arbiter;
! 
!   MainC.SoftwareInit -> Queue;
! 
!   TransferableResource = Arbiter;
!   ResourceRequested = Arbiter;
    RadioControlImplP.ArbiterInfo -> Arbiter;
+   ResourceConfigure = Arbiter;
+ 
+   Arbiter.Queue -> Queue;
  }

Index: ScanP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/ScanP.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ScanP.nc	4 Mar 2009 18:31:31 -0000	1.3
--- ScanP.nc	24 Mar 2009 12:56:46 -0000	1.4
***************
*** 46,49 ****
--- 46,50 ----
      interface MLME_SCAN;
      interface MLME_BEACON_NOTIFY;
+     interface GetNow<token_requested_t> as IsRadioTokenRequested;
    }
    uses
***************
*** 60,64 ****
      interface Pool<ieee154_txframe_t> as TxFramePool;
      interface Pool<ieee154_txcontrol_t> as TxControlPool;
!     interface Resource as Token;
      interface FrameUtility;
      interface Leds;
--- 61,65 ----
      interface Pool<ieee154_txframe_t> as TxFramePool;
      interface Pool<ieee154_txcontrol_t> as TxControlPool;
!     interface TransferableResource as RadioToken;
      interface FrameUtility;
      interface Leds;
***************
*** 84,88 ****
    ieee154_macPANId_t m_PANID;
    norace uint32_t m_scanDuration;
!   bool m_busy = FALSE;
  
    void nextIteration();
--- 85,89 ----
    ieee154_macPANId_t m_PANID;
    norace uint32_t m_scanDuration;
!   norace bool m_busy = FALSE;
  
    void nextIteration();
***************
*** 93,100 ****
    command error_t Init.init()
    {
!     // triggered by MLME_RESET; remember: Init will not be called
!     // while this component owns the Token, so the worst case is 
      // that a MLME_SCAN was accepted (returned IEEE154_SUCCESS)  
!     // but the Token.granted() has not been signalled            
      if (m_busy) {
        m_currentChannelNum = 27;
--- 94,101 ----
    command error_t Init.init()
    {
!     // triggered by MLME_RESET; Note: Init will not be called
!     // while this component owns the RadioToken, so the worst case is 
      // that a MLME_SCAN was accepted (returned IEEE154_SUCCESS)  
!     // but the RadioToken.granted() has not been signalled            
      if (m_busy) {
        m_currentChannelNum = 27;
***************
*** 170,174 ****
        if (m_resultList == NULL)
          m_resultListNumEntries = 0;
!       call Token.request();
      }
      dbg_serial("ScanP", "MLME_SCAN.request -> result: %lu\n", (uint32_t) status);
--- 171,175 ----
        if (m_resultList == NULL)
          m_resultListNumEntries = 0;
!       call RadioToken.request();
      }
      dbg_serial("ScanP", "MLME_SCAN.request -> result: %lu\n", (uint32_t) status);
***************
*** 176,180 ****
    }
  
!   event void Token.granted()
    {
      if (call RadioOff.isOff())
--- 177,181 ----
    }
  
!   event void RadioToken.granted()
    {
      if (call RadioOff.isOff())
***************
*** 197,201 ****
  
      if (!m_busy) {
!       call Token.release();
        return;
      }
--- 198,202 ----
  
      if (!m_busy) {
!       call RadioToken.release();
        return;
      }
***************
*** 279,284 ****
        }
        m_txFrame = NULL;
!       if (call Token.isOwner())
!         call Token.release();
        m_busy = FALSE;
        dbg_serial("ScanP", "MLME_SCAN.confirm()\n");
--- 280,285 ----
        }
        m_txFrame = NULL;
!       if (call RadioToken.isOwner())
!         call RadioToken.release();
        m_busy = FALSE;
        dbg_serial("ScanP", "MLME_SCAN.confirm()\n");
***************
*** 289,293 ****
            m_unscannedChannels,
            (m_scanType == ENERGY_DETECTION_SCAN) ? m_resultIndex : 0,
!           (m_scanType == ENERGY_DETECTION_SCAN) ? (uint8_t*) m_resultList : NULL,
            ((m_scanType == ACTIVE_SCAN ||
             m_scanType == PASSIVE_SCAN) && m_macAutoRequest) ? m_resultIndex : 0,
--- 290,294 ----
            m_unscannedChannels,
            (m_scanType == ENERGY_DETECTION_SCAN) ? m_resultIndex : 0,
!           (m_scanType == ENERGY_DETECTION_SCAN) ? (int8_t*) m_resultList : NULL,
            ((m_scanType == ACTIVE_SCAN ||
             m_scanType == PASSIVE_SCAN) && m_macAutoRequest) ? m_resultIndex : 0,
***************
*** 295,298 ****
--- 296,300 ----
             m_scanType == PASSIVE_SCAN) && m_macAutoRequest) ? (ieee154_PANDescriptor_t*) m_resultList : NULL);
      }
+     dbg_serial_flush();
    }
    
***************
*** 406,409 ****
--- 408,413 ----
    }
  
+   async command token_requested_t IsRadioTokenRequested.getNow(){ return m_busy;}
+   async event void RadioToken.transferredFrom(uint8_t id){ ASSERT(0);}
    default event message_t* MLME_BEACON_NOTIFY.indication (message_t *beaconFrame) {return beaconFrame;}
    default event void MLME_SCAN.confirm    (

Index: SimpleTransferArbiterP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/SimpleTransferArbiterP.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SimpleTransferArbiterP.nc	4 Mar 2009 18:31:32 -0000	1.3
--- SimpleTransferArbiterP.nc	24 Mar 2009 12:56:47 -0000	1.4
***************
*** 45,58 ****
   * @author Kevin Klues (klues at tkn.tu-berlin.de)
   * @author Philip Levis
!  * @author: Jan Hauer <hauer at tkn.tu-berlin.de> (added resource transfer)
   */
   
  generic module SimpleTransferArbiterP() {
    provides {
!     interface Resource[uint8_t id];
      interface ResourceRequested[uint8_t id];
-     interface ResourceTransferControl;
      interface ArbiterInfo;
-     interface GetNow<bool> as IsResourceRequested;
    }
    uses {
--- 45,56 ----
   * @author Kevin Klues (klues at tkn.tu-berlin.de)
   * @author Philip Levis
!  * @author: Jan Hauer <hauer at tkn.tu-berlin.de> (added TransferableResource interface)
   */
   
  generic module SimpleTransferArbiterP() {
    provides {
!     interface TransferableResource as Resource[uint8_t id];
      interface ResourceRequested[uint8_t id];
      interface ArbiterInfo;
    }
    uses {
***************
*** 121,136 ****
    }
  
!   async command bool IsResourceRequested.getNow()
!   {
!     return !(call Queue.isEmpty());
!   }
! 
!   async command error_t ResourceTransferControl.transfer(uint8_t fromClient, uint8_t toClient)
    {
      atomic {
!       if (call ArbiterInfo.userId() == fromClient) {
!         call ResourceConfigure.unconfigure[fromClient]();
          call ResourceConfigure.configure[resId]();
!         resId = toClient;
          return SUCCESS;
        }
--- 119,130 ----
    }
  
!   async command error_t Resource.transferTo[uint8_t fromID](uint8_t toID)
    {
      atomic {
!       if (call ArbiterInfo.userId() == fromID) {
!         call ResourceConfigure.unconfigure[fromID]();
          call ResourceConfigure.configure[resId]();
!         resId = toID;
!         signal Resource.transferredFrom[toID](fromID); // consider moving this outside the atomic
          return SUCCESS;
        }
***************
*** 193,195 ****
--- 187,191 ----
    default async command void ResourceConfigure.unconfigure[uint8_t id]() {
    }
+   default async event void Resource.transferredFrom[uint8_t id](uint8_t c) {
+   }
  }

Index: TKN154BeaconEnabledP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/TKN154BeaconEnabledP.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** TKN154BeaconEnabledP.nc	5 Mar 2009 10:07:13 -0000	1.2
--- TKN154BeaconEnabledP.nc	24 Mar 2009 12:56:47 -0000	1.3
***************
*** 223,227 ****
    /* ----------------------- Scanning (MLME-SCAN) ----------------------- */
  
!   components new RadioClientC() as ScanRadioClient;
    PibP.MacReset -> ScanP;
    ScanP.MLME_GET -> PibP;
--- 223,227 ----
    /* ----------------------- Scanning (MLME-SCAN) ----------------------- */
  
!   components new RadioClientC(RADIO_CLIENT_SCAN) as ScanRadioClient;
    PibP.MacReset -> ScanP;
    ScanP.MLME_GET -> PibP;
***************
*** 236,240 ****
    ScanP.TxFramePool -> TxFramePoolP;
    ScanP.TxControlPool -> TxControlPoolP;
!   ScanP.Token -> ScanRadioClient;
    ScanP.Leds = Leds;
    ScanP.FrameUtility -> PibP;
--- 236,240 ----
    ScanP.TxFramePool -> TxFramePoolP;
    ScanP.TxControlPool -> TxControlPoolP;
!   ScanP.RadioToken -> ScanRadioClient;
    ScanP.Leds = Leds;
    ScanP.FrameUtility -> PibP;
***************
*** 242,246 ****
    /* ----------------- Beacon Transmission (MLME-START) ----------------- */
    
!   components new RadioClientC() as BeaconTxRadioClient;
    PibP.MacReset -> BeaconTransmitP;
    BeaconTransmitP.PIBUpdate[IEEE154_macAssociationPermit] -> PibP.PIBUpdate[IEEE154_macAssociationPermit];
--- 242,246 ----
    /* ----------------- Beacon Transmission (MLME-START) ----------------- */
    
!   components new RadioClientC(RADIO_CLIENT_BEACONTRANSMIT) as BeaconTxRadioClient;
    PibP.MacReset -> BeaconTransmitP;
    BeaconTransmitP.PIBUpdate[IEEE154_macAssociationPermit] -> PibP.PIBUpdate[IEEE154_macAssociationPermit];
***************
*** 255,262 ****
    BeaconTransmitP.SetMacBeaconTxTime -> PibP.SetMacBeaconTxTime;
    BeaconTransmitP.SetMacPanCoordinator -> PibP.SetMacPanCoordinator;
!   BeaconTransmitP.Token -> BeaconTxRadioClient;
!   BeaconTransmitP.IsTokenRequested -> BeaconTxRadioClient;
!   BeaconTransmitP.TokenTransferred -> BeaconTxRadioClient;
!   BeaconTransmitP.TokenToBroadcast -> BeaconTxRadioClient;
    BeaconTransmitP.RealignmentBeaconEnabledTx -> CoordBroadcastP.RealignmentTx;
    BeaconTransmitP.RealignmentNonBeaconEnabledTx -> CoordCapQueue.FrameTx[unique(CAP_TX_CLIENT)];
--- 255,259 ----
    BeaconTransmitP.SetMacBeaconTxTime -> PibP.SetMacBeaconTxTime;
    BeaconTransmitP.SetMacPanCoordinator -> PibP.SetMacPanCoordinator;
!   BeaconTransmitP.RadioToken -> BeaconTxRadioClient;
    BeaconTransmitP.RealignmentBeaconEnabledTx -> CoordBroadcastP.RealignmentTx;
    BeaconTransmitP.RealignmentNonBeaconEnabledTx -> CoordCapQueue.FrameTx[unique(CAP_TX_CLIENT)];
***************
*** 272,280 ****
    BeaconTransmitP.TimeCalc -> PibP;
    BeaconTransmitP.Leds = Leds;
-   BeaconTxRadioClient.TransferTo -> CoordBroadcastRadioClient.TransferFrom;
  
    /* ------------------ Beacon Tracking (MLME-SYNC) ------------------ */
  
!   components new RadioClientC() as SyncRadioClient;
    PibP.MacReset -> BeaconSynchronizeP;
    BeaconSynchronizeP.MLME_SET -> PibP.MLME_SET;
--- 269,276 ----
    BeaconTransmitP.TimeCalc -> PibP;
    BeaconTransmitP.Leds = Leds;
  
    /* ------------------ Beacon Tracking (MLME-SYNC) ------------------ */
  
!   components new RadioClientC(RADIO_CLIENT_BEACONSYNCHRONIZE) as SyncRadioClient;
    PibP.MacReset -> BeaconSynchronizeP;
    BeaconSynchronizeP.MLME_SET -> PibP.MLME_SET;
***************
*** 287,298 ****
    BeaconSynchronizeP.RadioOff -> SyncRadioClient;
    BeaconSynchronizeP.DataRequest -> PollP.DataRequest[SYNC_POLL_CLIENT];
!   BeaconSynchronizeP.Token -> SyncRadioClient;
!   BeaconSynchronizeP.IsTokenRequested -> SyncRadioClient;
!   BeaconSynchronizeP.TokenTransferred -> SyncRadioClient;
!   BeaconSynchronizeP.TokenToCap -> SyncRadioClient;
    BeaconSynchronizeP.TimeCalc -> PibP;
    BeaconSynchronizeP.CoordRealignmentRx -> DeviceCap.FrameRx[FC1_FRAMETYPE_CMD + CMD_FRAME_COORDINATOR_REALIGNMENT];
    BeaconSynchronizeP.Leds = Leds;
-   SyncRadioClient.TransferTo -> DeviceCapRadioClient.TransferFrom;
  
    /* -------------------- Association (MLME-ASSOCIATE) -------------------- */
--- 283,290 ----
    BeaconSynchronizeP.RadioOff -> SyncRadioClient;
    BeaconSynchronizeP.DataRequest -> PollP.DataRequest[SYNC_POLL_CLIENT];
!   BeaconSynchronizeP.RadioToken -> SyncRadioClient;
    BeaconSynchronizeP.TimeCalc -> PibP;
    BeaconSynchronizeP.CoordRealignmentRx -> DeviceCap.FrameRx[FC1_FRAMETYPE_CMD + CMD_FRAME_COORDINATOR_REALIGNMENT];
    BeaconSynchronizeP.Leds = Leds;
  
    /* -------------------- Association (MLME-ASSOCIATE) -------------------- */
***************
*** 391,403 ****
    /* ---------------------------- Broadcasts ---------------------------- */
  
!   components new RadioClientC() as CoordBroadcastRadioClient;
    PibP.MacReset -> CoordBroadcastP;
!   CoordBroadcastP.TokenTransferred -> CoordBroadcastRadioClient;
!   CoordBroadcastP.TokenToCap -> CoordBroadcastRadioClient;
!   CoordBroadcastRadioClient.TransferTo -> CoordCapRadioClient.TransferFrom;
    CoordBroadcastP.OutgoingSF -> BeaconTransmitP.OutgoingSF;
    CoordBroadcastP.CapTransmitNow -> CoordCap.BroadcastTx;
    CoordBroadcastP.Queue -> BroadcastQueueC;
-   CoordBroadcastP.Leds = Leds;
  
    /* --------------------- CAP (incoming superframe) -------------------- */
--- 383,392 ----
    /* ---------------------------- Broadcasts ---------------------------- */
  
!   components new RadioClientC(RADIO_CLIENT_COORDBROADCAST) as CoordBroadcastRadioClient;
    PibP.MacReset -> CoordBroadcastP;
!   CoordBroadcastP.RadioToken -> CoordBroadcastRadioClient;
    CoordBroadcastP.OutgoingSF -> BeaconTransmitP.OutgoingSF;
    CoordBroadcastP.CapTransmitNow -> CoordCap.BroadcastTx;
    CoordBroadcastP.Queue -> BroadcastQueueC;
  
    /* --------------------- CAP (incoming superframe) -------------------- */
***************
*** 411,415 ****
    CoordCapQueue.FrameTxCsma -> CoordCap;
    
!   components new RadioClientC() as DeviceCapRadioClient;
    PibP.DispatchReset -> DeviceCap;
    DeviceCap.CapEndAlarm = Alarm3;
--- 400,404 ----
    CoordCapQueue.FrameTxCsma -> CoordCap;
    
!   components new RadioClientC(RADIO_CLIENT_DEVICECAP) as DeviceCapRadioClient;
    PibP.DispatchReset -> DeviceCap;
    DeviceCap.CapEndAlarm = Alarm3;
***************
*** 417,426 ****
    DeviceCap.IndirectTxWaitAlarm = Alarm5;
    DeviceCap.BroadcastAlarm = Alarm6;
!   DeviceCap.Token -> DeviceCapRadioClient;
!   DeviceCap.IsTokenRequested -> DeviceCapRadioClient;
!   DeviceCap.TokenToCfp -> DeviceCapRadioClient;
!   DeviceCap.TokenTransferred -> DeviceCapRadioClient;
    DeviceCap.SuperframeStructure -> BeaconSynchronizeP.IncomingSF;
    DeviceCap.IsRxEnableActive -> RxEnableP.IsRxEnableActive;
    DeviceCap.GetIndirectTxFrame -> IndirectTxP;
    DeviceCap.RxEnableStateChange -> RxEnableP.RxEnableStateChange;  
--- 406,415 ----
    DeviceCap.IndirectTxWaitAlarm = Alarm5;
    DeviceCap.BroadcastAlarm = Alarm6;
!   DeviceCap.RadioToken -> DeviceCapRadioClient;
    DeviceCap.SuperframeStructure -> BeaconSynchronizeP.IncomingSF;
    DeviceCap.IsRxEnableActive -> RxEnableP.IsRxEnableActive;
+   DeviceCap.IsRadioTokenRequested -> PibP.IsRadioTokenRequested; // fan out...
+   DeviceCap.IsRadioTokenRequested -> PromiscuousModeP.IsRadioTokenRequested;
+   DeviceCap.IsRadioTokenRequested -> ScanP.IsRadioTokenRequested;
    DeviceCap.GetIndirectTxFrame -> IndirectTxP;
    DeviceCap.RxEnableStateChange -> RxEnableP.RxEnableStateChange;  
***************
*** 435,453 ****
    DeviceCap.Leds = Leds;
    DeviceCap.TrackSingleBeacon -> BeaconSynchronizeP.TrackSingleBeacon;
-   DeviceCapRadioClient.TransferTo -> DeviceCfpRadioClient.TransferFrom;
  
    /* ---------------------- CAP (outgoing superframe) ------------------- */
  
!   components new RadioClientC() as CoordCapRadioClient, 
               new BackupP(ieee154_cap_frame_backup_t);
    PibP.DispatchReset -> CoordCap;
    CoordCap.CapEndAlarm = Alarm7;
    CoordCap.BLEAlarm = Alarm8;
!   CoordCap.Token -> CoordCapRadioClient;
!   CoordCap.TokenToCfp -> CoordCapRadioClient;
!   CoordCap.TokenTransferred -> CoordCapRadioClient;
!   CoordCap.IsTokenRequested -> CoordCapRadioClient;
    CoordCap.SuperframeStructure -> BeaconTransmitP.OutgoingSF;
    CoordCap.IsRxEnableActive -> RxEnableP.IsRxEnableActive;
    CoordCap.GetIndirectTxFrame -> IndirectTxP;
    CoordCap.RxEnableStateChange -> RxEnableP.RxEnableStateChange;  
--- 424,441 ----
    DeviceCap.Leds = Leds;
    DeviceCap.TrackSingleBeacon -> BeaconSynchronizeP.TrackSingleBeacon;
  
    /* ---------------------- CAP (outgoing superframe) ------------------- */
  
!   components new RadioClientC(RADIO_CLIENT_COORDCAP) as CoordCapRadioClient, 
               new BackupP(ieee154_cap_frame_backup_t);
    PibP.DispatchReset -> CoordCap;
    CoordCap.CapEndAlarm = Alarm7;
    CoordCap.BLEAlarm = Alarm8;
!   CoordCap.RadioToken -> CoordCapRadioClient;
    CoordCap.SuperframeStructure -> BeaconTransmitP.OutgoingSF;
    CoordCap.IsRxEnableActive -> RxEnableP.IsRxEnableActive;
+   CoordCap.IsRadioTokenRequested -> PibP.IsRadioTokenRequested; // fan out...
+   CoordCap.IsRadioTokenRequested -> PromiscuousModeP.IsRadioTokenRequested;
+   CoordCap.IsRadioTokenRequested -> ScanP.IsRadioTokenRequested;
    CoordCap.GetIndirectTxFrame -> IndirectTxP;
    CoordCap.RxEnableStateChange -> RxEnableP.RxEnableStateChange;  
***************
*** 461,465 ****
    CoordCap.TimeCalc -> PibP;
    CoordCap.Leds = Leds;
-   CoordCapRadioClient.TransferTo -> CoordCfpRadioClient.TransferFrom;
    CoordCap.FrameBackup -> BackupP;
    CoordCap.FrameRestore -> BackupP;
--- 449,452 ----
***************
*** 467,475 ****
    /* -------------------- GTS (incoming superframe) --------------------- */
  
!   components new RadioClientC() as DeviceCfpRadioClient;
    PibP.MacReset -> DeviceCfp;
!   DeviceCfp.TokenTransferred -> DeviceCfpRadioClient;
!   DeviceCfp.TokenRequested -> DeviceCfpRadioClient;
!   DeviceCfp.TokenToBeaconSync -> DeviceCfpRadioClient;
    DeviceCfp.IncomingSF -> BeaconSynchronizeP.IncomingSF; 
    DeviceCfp.CfpSlotAlarm = Alarm9;
--- 454,460 ----
    /* -------------------- GTS (incoming superframe) --------------------- */
  
!   components new RadioClientC(RADIO_CLIENT_DEVICECFP) as DeviceCfpRadioClient;
    PibP.MacReset -> DeviceCfp;
!   DeviceCfp.RadioToken -> DeviceCfpRadioClient;
    DeviceCfp.IncomingSF -> BeaconSynchronizeP.IncomingSF; 
    DeviceCfp.CfpSlotAlarm = Alarm9;
***************
*** 480,492 ****
    DeviceCfp.MLME_GET -> PibP;
    DeviceCfp.MLME_SET -> PibP.MLME_SET; 
-   DeviceCfpRadioClient.TransferTo -> SyncRadioClient.TransferFrom;
  
    /* -------------------- GTS (outgoing superframe) --------------------- */
  
!   components new RadioClientC() as CoordCfpRadioClient;
    PibP.MacReset -> CoordCfp;
!   CoordCfp.TokenTransferred -> CoordCfpRadioClient;
!   CoordCfp.TokenRequested -> CoordCfpRadioClient;
!   CoordCfp.TokenToBeaconTransmit -> CoordCfpRadioClient;
    CoordCfp.OutgoingSF -> BeaconTransmitP.OutgoingSF; 
    CoordCfp.CfpSlotAlarm = Alarm11;
--- 465,474 ----
    DeviceCfp.MLME_GET -> PibP;
    DeviceCfp.MLME_SET -> PibP.MLME_SET; 
  
    /* -------------------- GTS (outgoing superframe) --------------------- */
  
!   components new RadioClientC(RADIO_CLIENT_COORDCFP) as CoordCfpRadioClient;
    PibP.MacReset -> CoordCfp;
!   CoordCfp.RadioToken -> CoordCfpRadioClient;
    CoordCfp.OutgoingSF -> BeaconTransmitP.OutgoingSF; 
    CoordCfp.CfpSlotAlarm = Alarm11;
***************
*** 497,507 ****
    CoordCfp.MLME_GET -> PibP;
    CoordCfp.MLME_SET -> PibP.MLME_SET;
-   CoordCfpRadioClient.TransferTo -> BeaconTxRadioClient.TransferFrom;
  
    /* -------------------------- promiscuous mode ------------------------ */
  
!   components new RadioClientC() as PromiscuousModeRadioClient;
    PibP.MacReset -> PromiscuousModeP;
!   PromiscuousModeP.Token -> PromiscuousModeRadioClient;
    PromiscuousModeP.PromiscuousRx -> PromiscuousModeRadioClient;
    PromiscuousModeP.RadioOff -> PromiscuousModeRadioClient;
--- 479,488 ----
    CoordCfp.MLME_GET -> PibP;
    CoordCfp.MLME_SET -> PibP.MLME_SET;
  
    /* -------------------------- promiscuous mode ------------------------ */
  
!   components new RadioClientC(RADIO_CLIENT_PROMISCUOUSMODE) as PromiscuousModeRadioClient;
    PibP.MacReset -> PromiscuousModeP;
!   PromiscuousModeP.RadioToken -> PromiscuousModeRadioClient;
    PromiscuousModeP.PromiscuousRx -> PromiscuousModeRadioClient;
    PromiscuousModeP.RadioOff -> PromiscuousModeRadioClient;
***************
*** 522,526 ****
    /* ------------------------------- PIB -------------------------------- */
  
!   components new RadioClientC() as PibRadioClient;
    PIBUpdate = PibP;
    MainC.SoftwareInit -> PibP.LocalInit;
--- 503,507 ----
    /* ------------------------------- PIB -------------------------------- */
  
!   components new RadioClientC(RADIO_CLIENT_PIB) as PibRadioClient;
    PIBUpdate = PibP;
    MainC.SoftwareInit -> PibP.LocalInit;
***************
*** 529,533 ****
    PibP.PromiscuousModeGet -> PromiscuousModeP; 
    PibP.LocalTime = LocalTime;
!   PibP.Token -> PibRadioClient;
    PibP.RadioOff -> PibRadioClient;
  
--- 510,514 ----
    PibP.PromiscuousModeGet -> PromiscuousModeP; 
    PibP.LocalTime = LocalTime;
!   PibP.RadioToken -> PibRadioClient;
    PibP.RadioOff -> PibRadioClient;
  

Index: TKN154_MAC.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/TKN154_MAC.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TKN154_MAC.h	4 Mar 2009 18:31:32 -0000	1.4
--- TKN154_MAC.h	24 Mar 2009 12:56:47 -0000	1.5
***************
*** 136,139 ****
--- 136,160 ----
  
  enum {
+   // The following identfiers map to components that access the radio
+   // via RadioClientC(). They are used as parameters for RadioClientC(),
+   // the TransferableResource.transferTo() command and in
+   // the TransferableResource.transferredFrom() event
+ 
+   RADIO_CLIENT_SCAN = unique(IEEE802154_RADIO_RESOURCE),
+   RADIO_CLIENT_PIB = unique(IEEE802154_RADIO_RESOURCE),
+   RADIO_CLIENT_PROMISCUOUSMODE = unique(IEEE802154_RADIO_RESOURCE),
+ 
+   RADIO_CLIENT_BEACONTRANSMIT = unique(IEEE802154_RADIO_RESOURCE),
+   RADIO_CLIENT_COORDBROADCAST = unique(IEEE802154_RADIO_RESOURCE),
+   RADIO_CLIENT_COORDCAP = unique(IEEE802154_RADIO_RESOURCE),
+   RADIO_CLIENT_COORDCFP = unique(IEEE802154_RADIO_RESOURCE),
+ 
+   RADIO_CLIENT_BEACONSYNCHRONIZE = unique(IEEE802154_RADIO_RESOURCE),
+   RADIO_CLIENT_DEVICECAP = unique(IEEE802154_RADIO_RESOURCE),
+   RADIO_CLIENT_DEVICECFP = unique(IEEE802154_RADIO_RESOURCE),
+ };
+ 
+ enum {
+   // parameter for the generic DispatchSlottedCsmaP
    OUTGOING_SUPERFRAME,
    INCOMING_SUPERFRAME,
***************
*** 259,262 ****
--- 280,290 ----
  };
  
+ // combine function for IsRadioTokenRequested (GetNow) interface
+ typedef bool token_requested_t __attribute__((combine(rcombine)));
+ token_requested_t rcombine(token_requested_t r1, token_requested_t r2)
+ {
+   return r1 && r2;
+ }
+ 
  #ifdef TKN154_DEBUG
  

Index: TKN154NonBeaconEnabledP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/TKN154NonBeaconEnabledP.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** TKN154NonBeaconEnabledP.nc	5 Mar 2009 10:07:13 -0000	1.2
--- TKN154NonBeaconEnabledP.nc	24 Mar 2009 12:56:47 -0000	1.3
***************
*** 175,179 ****
    /* ----------------------- Scanning (MLME-SCAN) ----------------------- */
  
!   components new RadioClientC() as ScanRadioClient;
    PibP.MacReset -> ScanP;
    ScanP.MLME_GET -> PibP;
--- 175,179 ----
    /* ----------------------- Scanning (MLME-SCAN) ----------------------- */
  
!   components new RadioClientC(RADIO_CLIENT_SCAN) as ScanRadioClient;
    PibP.MacReset -> ScanP;
    ScanP.MLME_GET -> PibP;
***************
*** 188,192 ****
    ScanP.TxFramePool -> TxFramePoolP;
    ScanP.TxControlPool -> TxControlPoolP;
!   ScanP.Token -> ScanRadioClient;
    ScanP.Leds = Leds;
    ScanP.FrameUtility -> PibP;
--- 188,192 ----
    ScanP.TxFramePool -> TxFramePoolP;
    ScanP.TxControlPool -> TxControlPoolP;
!   ScanP.RadioToken -> ScanRadioClient;
    ScanP.Leds = Leds;
    ScanP.FrameUtility -> PibP;
***************
*** 283,294 ****
    DispatchQueueP.FrameTxCsma -> DispatchP;
    
!   components new RadioClientC() as DispatchRadioClient;
    PibP.DispatchReset -> DispatchP;
    DispatchP.IndirectTxWaitTimer = Timer4;
!   DispatchP.Token -> DispatchRadioClient;
    DispatchP.SetMacSuperframeOrder -> PibP.SetMacSuperframeOrder;
    DispatchP.SetMacPanCoordinator -> PibP.SetMacPanCoordinator;
-   DispatchP.IsTokenRequested -> DispatchRadioClient;
    DispatchP.IsRxEnableActive -> RxEnableP.IsRxEnableActive;
    DispatchP.GetIndirectTxFrame -> IndirectTxP;
    DispatchP.RxEnableStateChange -> RxEnableP.RxEnableStateChange;  
--- 283,296 ----
    DispatchQueueP.FrameTxCsma -> DispatchP;
    
!   components new RadioClientC(unique(IEEE802154_RADIO_RESOURCE)) as DispatchRadioClient;
    PibP.DispatchReset -> DispatchP;
    DispatchP.IndirectTxWaitTimer = Timer4;
!   DispatchP.RadioToken -> DispatchRadioClient;
    DispatchP.SetMacSuperframeOrder -> PibP.SetMacSuperframeOrder;
    DispatchP.SetMacPanCoordinator -> PibP.SetMacPanCoordinator;
    DispatchP.IsRxEnableActive -> RxEnableP.IsRxEnableActive;
+   DispatchP.IsRadioTokenRequested -> PibP.IsRadioTokenRequested; // fan out...
+   DispatchP.IsRadioTokenRequested -> PromiscuousModeP.IsRadioTokenRequested;
+   DispatchP.IsRadioTokenRequested -> ScanP.IsRadioTokenRequested;
    DispatchP.GetIndirectTxFrame -> IndirectTxP;
    DispatchP.RxEnableStateChange -> RxEnableP.RxEnableStateChange;  
***************
*** 304,310 ****
    /* -------------------------- promiscuous mode ------------------------ */
  
!   components new RadioClientC() as PromiscuousModeRadioClient;
    PibP.MacReset -> PromiscuousModeP;
!   PromiscuousModeP.Token -> PromiscuousModeRadioClient;
    PromiscuousModeP.PromiscuousRx -> PromiscuousModeRadioClient;
    PromiscuousModeP.RadioOff -> PromiscuousModeRadioClient;
--- 306,312 ----
    /* -------------------------- promiscuous mode ------------------------ */
  
!   components new RadioClientC(RADIO_CLIENT_PROMISCUOUSMODE) as PromiscuousModeRadioClient;
    PibP.MacReset -> PromiscuousModeP;
!   PromiscuousModeP.RadioToken -> PromiscuousModeRadioClient;
    PromiscuousModeP.PromiscuousRx -> PromiscuousModeRadioClient;
    PromiscuousModeP.RadioOff -> PromiscuousModeRadioClient;
***************
*** 321,325 ****
    /* ------------------------------- PIB -------------------------------- */
  
!   components new RadioClientC() as PibRadioClient;
    PIBUpdate = PibP;
    MainC.SoftwareInit -> PibP.LocalInit;
--- 323,327 ----
    /* ------------------------------- PIB -------------------------------- */
  
!   components new RadioClientC(RADIO_CLIENT_PIB) as PibRadioClient;
    PIBUpdate = PibP;
    MainC.SoftwareInit -> PibP.LocalInit;
***************
*** 328,332 ****
    PibP.PromiscuousModeGet -> PromiscuousModeP; 
    PibP.LocalTime = LocalTime;
!   PibP.Token -> PibRadioClient;
    PibP.RadioOff -> PibRadioClient;
  
--- 330,334 ----
    PibP.PromiscuousModeGet -> PromiscuousModeP; 
    PibP.LocalTime = LocalTime;
!   PibP.RadioToken -> PibRadioClient;
    PibP.RadioOff -> PibRadioClient;
  

--- SimpleRoundRobinTransferArbiterC.nc DELETED ---

--- TransferClientP.nc DELETED ---



More information about the Tinyos-2-commits mailing list