[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/mac/tkn154 AssociateP.nc, 1.5, 1.6 DispatchSlottedCsmaP.nc, 1.5, 1.6 DispatchUnslottedCsmaP.nc, 1.7, 1.8 TKN154BeaconEnabledP.nc, 1.5, 1.6

Jan-Hinrich Hauer janhauer at users.sourceforge.net
Tue May 5 09:56:14 PDT 2009


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

Modified Files:
	AssociateP.nc DispatchSlottedCsmaP.nc 
	DispatchUnslottedCsmaP.nc TKN154BeaconEnabledP.nc 
Log Message:
- fixed an issue with indirect transmissions (timeout wasn't set correctly)
- added some debug output

Index: AssociateP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/AssociateP.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** AssociateP.nc	4 Mar 2009 18:31:12 -0000	1.5
--- AssociateP.nc	5 May 2009 16:56:12 -0000	1.6
***************
*** 176,179 ****
--- 176,180 ----
        return;
      // have not received an AssociationResponse yet, poll the coordinator now
+     dbg_serial("AssociationP", "Polling the coordinator for an AssociationResponse now...\n");
      if (m_coordAddrMode == ADDR_MODE_SHORT_ADDRESS)
        *((nxle_uint16_t*) &coordAddress) = call MLME_GET.macCoordShortAddress();
***************
*** 185,188 ****
--- 186,190 ----
        m_assocRespStatus = IEEE154_TRANSACTION_OVERFLOW;
        signal DataRequest.pollDone();
+       dbg_serial("AssociationP", "Poll failed (locally)...\n");
      }
    }

Index: DispatchSlottedCsmaP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/DispatchSlottedCsmaP.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** DispatchSlottedCsmaP.nc	4 May 2009 09:40:36 -0000	1.5
--- DispatchSlottedCsmaP.nc	5 May 2009 16:56:12 -0000	1.6
***************
*** 72,77 ****
      interface Alarm<TSymbolIEEE802154,uint32_t> as CapEndAlarm;
      interface Alarm<TSymbolIEEE802154,uint32_t> as BLEAlarm;
!     interface Alarm<TSymbolIEEE802154,uint32_t> as IndirectTxWaitAlarm;
!     interface Alarm<TSymbolIEEE802154,uint32_t> as BroadcastAlarm;
      interface TransferableResource as RadioToken;
      interface SuperframeStructure; 
--- 72,76 ----
      interface Alarm<TSymbolIEEE802154,uint32_t> as CapEndAlarm;
      interface Alarm<TSymbolIEEE802154,uint32_t> as BLEAlarm;
!     interface Alarm<TSymbolIEEE802154,uint32_t> as RxWaitAlarm;
      interface TransferableResource as RadioToken;
      interface SuperframeStructure; 
***************
*** 139,143 ****
    /* function / task prototypes */
    void stopAllAlarms();
!   next_state_t tryReceive(rx_alarm_t alarmType);
    next_state_t tryTransmit();
    next_state_t trySwitchOff();
--- 138,142 ----
    /* function / task prototypes */
    void stopAllAlarms();
!   next_state_t tryReceive();
    next_state_t tryTransmit();
    next_state_t trySwitchOff();
***************
*** 182,185 ****
--- 181,185 ----
        signalTxBroadcastDone(m_bcastFrame, IEEE154_TRANSACTION_OVERFLOW);
      m_currentFrame = m_lastFrame = m_bcastFrame = NULL;
+     m_macMaxFrameTotalWaitTime = call MLME_GET.macMaxFrameTotalWaitTime();
      stopAllAlarms();
      return SUCCESS;
***************
*** 314,321 ****
    {
      call CapEndAlarm.stop();
!     if (DEVICE_ROLE) {
!       call IndirectTxWaitAlarm.stop();
!       call BroadcastAlarm.stop();
!     }
      call BLEAlarm.stop();
    }
--- 314,319 ----
    {
      call CapEndAlarm.stop();
!     if (DEVICE_ROLE)
!       call RxWaitAlarm.stop();
      call BLEAlarm.stop();
    }
***************
*** 355,359 ****
            stopAllAlarms();  // may still fire, but is locked through isOwner()
            if (DEVICE_ROLE && m_indirectTxPending)
!             signal IndirectTxWaitAlarm.fired();
            m_broadcastRxPending = FALSE;
            if (COORD_ROLE && m_bcastFrame) {
--- 353,357 ----
            stopAllAlarms();  // may still fire, but is locked through isOwner()
            if (DEVICE_ROLE && m_indirectTxPending)
!             signal RxWaitAlarm.fired();
            m_broadcastRxPending = FALSE;
            if (COORD_ROLE && m_bcastFrame) {
***************
*** 377,381 ****
          // receive a broadcast from coordinator
          dbg_push_state(2);
!         next = tryReceive(BROADCAST_ALARM);
        } else if (COORD_ROLE && m_bcastFrame) {
          dbg_push_state(2);
--- 375,379 ----
          // receive a broadcast from coordinator
          dbg_push_state(2);
!         next = tryReceive();
        } else if (COORD_ROLE && m_bcastFrame) {
          dbg_push_state(2);
***************
*** 387,391 ****
        else if (DEVICE_ROLE && m_indirectTxPending) {
          dbg_push_state(3);
!         next = tryReceive(INDIRECT_TX_ALARM);
        }
  
--- 385,389 ----
        else if (DEVICE_ROLE && m_indirectTxPending) {
          dbg_push_state(3);
!         next = tryReceive();
        }
  
***************
*** 423,427 ****
        else if (COORD_ROLE || call IsRxEnableActive.getNow() || macRxOnWhenIdle) {
          dbg_push_state(7);
!         next = tryReceive(NO_ALARM);
          if (next == DO_NOTHING) {
            // if there was an active MLME_RX_ENABLE.request then we'll
--- 421,425 ----
        else if (COORD_ROLE || call IsRxEnableActive.getNow() || macRxOnWhenIdle) {
          dbg_push_state(7);
!         next = tryReceive();
          if (next == DO_NOTHING) {
            // if there was an active MLME_RX_ENABLE.request then we'll
***************
*** 486,490 ****
    }
  
!   next_state_t tryReceive(rx_alarm_t alarmType)
    {
      next_state_t next;
--- 484,488 ----
    }
  
!   next_state_t tryReceive()
    {
      next_state_t next;
***************
*** 495,504 ****
      else {
        call RadioRx.enableRx(0, 0);
-       switch (alarmType)
-       {
-         case INDIRECT_TX_ALARM: call IndirectTxWaitAlarm.start(m_macMaxFrameTotalWaitTime); break;
-         case BROADCAST_ALARM: call BroadcastAlarm.start(m_macMaxFrameTotalWaitTime); break;
-         case NO_ALARM: break;
-       }
        next = WAIT_FOR_RXDONE;
      }
--- 493,496 ----
***************
*** 516,521 ****
    }
  
!   async event void RadioOff.offDone() { m_lock = FALSE; updateState();}
!   async event void RadioRx.enableRxDone() { m_lock = FALSE; updateState();}
  
    async event void CapEndAlarm.fired() { 
--- 508,524 ----
    }
  
!   async event void RadioOff.offDone() 
!   { 
!     m_lock = FALSE; 
!     updateState();
!   }
! 
!   async event void RadioRx.enableRxDone() 
!   { 
!     if (DEVICE_ROLE && (m_indirectTxPending || m_broadcastRxPending))
!       call RxWaitAlarm.start(m_macMaxFrameTotalWaitTime);
!     m_lock = FALSE; 
!     updateState();
!   }
  
    async event void CapEndAlarm.fired() { 
***************
*** 525,529 ****
    async event void BLEAlarm.fired() { updateState();}
    event void RxEnableStateChange.notify(bool whatever) { updateState();}
-   async event void BroadcastAlarm.fired() { m_broadcastRxPending = FALSE; updateState();}
    event void PIBUpdateMacRxOnWhenIdle.notify( const void* val ) {
      atomic macRxOnWhenIdle = *((ieee154_macRxOnWhenIdle_t*) val);
--- 528,531 ----
***************
*** 531,542 ****
    }
  
!   async event void IndirectTxWaitAlarm.fired() 
    { 
!     atomic {
!       if (m_indirectTxPending) {
!         m_indirectTxPending = FALSE; 
!         post signalTxDoneTask(); 
        }
-     }
    }
  
--- 533,548 ----
    }
  
!   async event void RxWaitAlarm.fired() 
    { 
!     if (DEVICE_ROLE && (m_indirectTxPending || m_broadcastRxPending))
!       atomic {
!         if (m_indirectTxPending) {
!           m_indirectTxPending = FALSE; 
!           post signalTxDoneTask(); 
!         } else if (m_broadcastRxPending) {
!           m_broadcastRxPending = FALSE;
!           updateState();
!         }
        }
    }
  
***************
*** 651,666 ****
          (uint32_t) mhr[MHR_INDEX_SEQNO], (uint32_t) frameType);
      atomic {
!       if (DEVICE_ROLE && m_indirectTxPending) {
          message_t* frameBuf;
!         call IndirectTxWaitAlarm.stop();
!         // TODO: check!
!         //if (frame->payloadLen)
!           // is this frame from our coordinator? hmm... we cannot say/ with
!           // certainty, because we might only know either the  coordinator
!           // extended or short address (and the frame could/ have been sent
!           // with the other addressing mode) ??
          m_txStatus = IEEE154_SUCCESS;
!         frameBuf = signal FrameExtracted.received[frameType](frame, m_lastFrame);
!         signal IndirectTxWaitAlarm.fired();
          return frameBuf;
        } else
--- 657,674 ----
          (uint32_t) mhr[MHR_INDEX_SEQNO], (uint32_t) frameType);
      atomic {
!       if (DEVICE_ROLE && (m_indirectTxPending || m_broadcastRxPending)) {
          message_t* frameBuf;
!         call RxWaitAlarm.stop();
!         // TODO: check the following: 
!         // is this frame from our coordinator? hmm... we cannot say/ with
!         // certainty, because we might only know either the  coordinator
!         // extended or short address (and the frame could/ have been sent
!         // with the other addressing mode) ??
          m_txStatus = IEEE154_SUCCESS;
!         if (m_indirectTxPending)
!           frameBuf = signal FrameExtracted.received[frameType](frame, m_lastFrame); // indirect tx from coord
!         else
!           frameBuf = signal FrameRx.received[frameType](frame); // broadcast from coordinator
!         signal RxWaitAlarm.fired();
          return frameBuf;
        } else
***************
*** 721,732 ****
    default async command bool IsRxEnableActive.getNow() {return FALSE;}
  
!   default async command void IndirectTxWaitAlarm.start(uint32_t dt) {ASSERT(0);}
!   default async command void IndirectTxWaitAlarm.stop() {ASSERT(0);}
!   default async command void IndirectTxWaitAlarm.startAt(uint32_t t0, uint32_t dt) {ASSERT(0);}
    
-   default async command void BroadcastAlarm.start(uint32_t dt) {ASSERT(0);}
-   default async command void BroadcastAlarm.stop() {ASSERT(0);}
-   default async command void BroadcastAlarm.startAt(uint32_t t0, uint32_t dt) {ASSERT(0);}
- 
    default async command bool SuperframeStructure.isBroadcastPending() { return FALSE;}
    default async event void BroadcastTx.transmitNowDone(ieee154_txframe_t *frame, ieee154_status_t status) {}
--- 729,736 ----
    default async command bool IsRxEnableActive.getNow() {return FALSE;}
  
!   default async command void RxWaitAlarm.start(uint32_t dt) {ASSERT(0);}
!   default async command void RxWaitAlarm.stop() {ASSERT(0);}
!   default async command void RxWaitAlarm.startAt(uint32_t t0, uint32_t dt) {ASSERT(0);}
    
    default async command bool SuperframeStructure.isBroadcastPending() { return FALSE;}
    default async event void BroadcastTx.transmitNowDone(ieee154_txframe_t *frame, ieee154_status_t status) {}

Index: DispatchUnslottedCsmaP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/DispatchUnslottedCsmaP.nc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** DispatchUnslottedCsmaP.nc	4 May 2009 09:40:36 -0000	1.7
--- DispatchUnslottedCsmaP.nc	5 May 2009 16:56:12 -0000	1.8
***************
*** 98,102 ****
    norace ieee154_txframe_t *m_currentFrame;
    norace ieee154_txframe_t *m_lastFrame;
!   norace ieee154_macRxOnWhenIdle_t macRxOnWhenIdle;
  
    /* variables for the unslotted CSMA-CA */
--- 98,102 ----
    norace ieee154_txframe_t *m_currentFrame;
    norace ieee154_txframe_t *m_lastFrame;
!   norace ieee154_macRxOnWhenIdle_t m_macRxOnWhenIdle;
  
    /* variables for the unslotted CSMA-CA */
***************
*** 109,116 ****
    norace uint32_t m_transactionTime;
    norace bool m_indirectTxPending = FALSE;
-   norace ieee154_macMaxFrameTotalWaitTime_t m_macMaxFrameTotalWaitTime;
  
    /* function / task prototypes */
!   next_state_t tryReceive(bool startIndirectTxTimer);
    next_state_t tryTransmit();
    next_state_t trySwitchOff();
--- 109,115 ----
    norace uint32_t m_transactionTime;
    norace bool m_indirectTxPending = FALSE;
  
    /* function / task prototypes */
!   next_state_t tryReceive();
    next_state_t tryTransmit();
    next_state_t trySwitchOff();
***************
*** 228,232 ****
      // else 
      //  m_transactionTime += call MLME_GET.macMinSIFSPeriod(); 
-     m_macMaxFrameTotalWaitTime = call MLME_GET.macMaxFrameTotalWaitTime();
      m_currentFrame = frame;
    }
--- 227,230 ----
***************
*** 257,261 ****
        // and are we now waiting for a frame from the coordinator?
        if (m_indirectTxPending) {
!         next = tryReceive(TRUE);
        }
  
--- 255,259 ----
        // and are we now waiting for a frame from the coordinator?
        if (m_indirectTxPending) {
!         next = tryReceive();
        }
  
***************
*** 278,283 ****
  
        // Check 4: should we be in receive mode?
!       else if (call IsRxEnableActive.getNow() || macRxOnWhenIdle) {
!         next = tryReceive(FALSE);
          if (next == DO_NOTHING) {
            // if there was an active MLME_RX_ENABLE.request then we'll
--- 276,281 ----
  
        // Check 4: should we be in receive mode?
!       else if (call IsRxEnableActive.getNow() || m_macRxOnWhenIdle) {
!         next = tryReceive();
          if (next == DO_NOTHING) {
            // if there was an active MLME_RX_ENABLE.request then we'll
***************
*** 330,334 ****
    }
  
!   next_state_t tryReceive(bool startIndirectTxTimer)
    {
      next_state_t next;
--- 328,332 ----
    }
  
!   next_state_t tryReceive()
    {
      next_state_t next;
***************
*** 339,344 ****
      else {
        call RadioRx.enableRx(0, 0);
-       if (startIndirectTxTimer)
-         post startIndirectTxTimerTask();
        next = WAIT_FOR_RXDONE;
      }
--- 337,340 ----
***************
*** 356,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) { 
      if (!call RadioToken.isOwner())
        call RadioToken.request();
--- 352,371 ----
    }
  
!   async event void RadioOff.offDone() 
!   { 
!     m_lock = FALSE; 
!     updateState();
!   }
! 
!   async event void RadioRx.enableRxDone() 
!   { 
!     if (m_indirectTxPending) // indirect transmission, now waiting for data
!       post startIndirectTxTimerTask();
!     m_lock = FALSE; 
!     updateState();
!   }
! 
!   event void RxEnableStateChange.notify(bool whatever) 
!   { 
      if (!call RadioToken.isOwner())
        call RadioToken.request();
***************
*** 364,369 ****
        updateState();
    }
!   event void PIBUpdateMacRxOnWhenIdle.notify( const void* val ) {
!     atomic macRxOnWhenIdle = *((ieee154_macRxOnWhenIdle_t*) val);
      signal RxEnableStateChange.notify(TRUE);
    }
--- 373,380 ----
        updateState();
    }
! 
!   event void PIBUpdateMacRxOnWhenIdle.notify( const void* val ) 
!   {
!     atomic m_macRxOnWhenIdle = *((ieee154_macRxOnWhenIdle_t*) val);
      signal RxEnableStateChange.notify(TRUE);
    }
***************
*** 381,385 ****
    task void startIndirectTxTimerTask()
    {
!     call IndirectTxWaitTimer.startOneShot(m_macMaxFrameTotalWaitTime); 
    }
  
--- 392,396 ----
    task void startIndirectTxTimerTask()
    {
!     call IndirectTxWaitTimer.startOneShot(call MLME_GET.macMaxFrameTotalWaitTime()); 
    }
  

Index: TKN154BeaconEnabledP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/TKN154BeaconEnabledP.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** TKN154BeaconEnabledP.nc	4 May 2009 09:40:36 -0000	1.5
--- TKN154BeaconEnabledP.nc	5 May 2009 16:56:12 -0000	1.6
***************
*** 96,100 ****
      interface Alarm<TSymbolIEEE802154,uint32_t> as Alarm10;
      interface Alarm<TSymbolIEEE802154,uint32_t> as Alarm11;
-     interface Alarm<TSymbolIEEE802154,uint32_t> as Alarm12;
  
      interface Timer<TSymbolIEEE802154> as Timer1;
--- 96,99 ----
***************
*** 403,408 ****
    DeviceCap.CapEndAlarm = Alarm3;
    DeviceCap.BLEAlarm = Alarm4;
!   DeviceCap.IndirectTxWaitAlarm = Alarm5;
!   DeviceCap.BroadcastAlarm = Alarm6;
    DeviceCap.RadioToken -> DeviceCapRadioClient;
    DeviceCap.SuperframeStructure -> BeaconSynchronizeP.IncomingSF;
--- 402,406 ----
    DeviceCap.CapEndAlarm = Alarm3;
    DeviceCap.BLEAlarm = Alarm4;
!   DeviceCap.RxWaitAlarm = Alarm5;
    DeviceCap.RadioToken -> DeviceCapRadioClient;
    DeviceCap.SuperframeStructure -> BeaconSynchronizeP.IncomingSF;
***************
*** 430,435 ****
               new BackupP(ieee154_cap_frame_backup_t);
    PibP.DispatchReset -> CoordCap;
!   CoordCap.CapEndAlarm = Alarm7;
!   CoordCap.BLEAlarm = Alarm8;
    CoordCap.RadioToken -> CoordCapRadioClient;
    CoordCap.SuperframeStructure -> BeaconTransmitP.OutgoingSF;
--- 428,433 ----
               new BackupP(ieee154_cap_frame_backup_t);
    PibP.DispatchReset -> CoordCap;
!   CoordCap.CapEndAlarm = Alarm6;
!   CoordCap.BLEAlarm = Alarm7;
    CoordCap.RadioToken -> CoordCapRadioClient;
    CoordCap.SuperframeStructure -> BeaconTransmitP.OutgoingSF;
***************
*** 459,464 ****
    DeviceCfp.RadioToken -> DeviceCfpRadioClient;
    DeviceCfp.IncomingSF -> BeaconSynchronizeP.IncomingSF; 
!   DeviceCfp.CfpSlotAlarm = Alarm9;
!   DeviceCfp.CfpEndAlarm = Alarm10;
    DeviceCfp.RadioTx -> DeviceCfpRadioClient;
    DeviceCfp.RadioRx -> DeviceCfpRadioClient;
--- 457,462 ----
    DeviceCfp.RadioToken -> DeviceCfpRadioClient;
    DeviceCfp.IncomingSF -> BeaconSynchronizeP.IncomingSF; 
!   DeviceCfp.CfpSlotAlarm = Alarm8;
!   DeviceCfp.CfpEndAlarm = Alarm9;
    DeviceCfp.RadioTx -> DeviceCfpRadioClient;
    DeviceCfp.RadioRx -> DeviceCfpRadioClient;
***************
*** 473,478 ****
    CoordCfp.RadioToken -> CoordCfpRadioClient;
    CoordCfp.OutgoingSF -> BeaconTransmitP.OutgoingSF; 
!   CoordCfp.CfpSlotAlarm = Alarm11;
!   CoordCfp.CfpEndAlarm = Alarm12;
    CoordCfp.RadioTx -> CoordCfpRadioClient;
    CoordCfp.RadioRx -> CoordCfpRadioClient;
--- 471,476 ----
    CoordCfp.RadioToken -> CoordCfpRadioClient;
    CoordCfp.OutgoingSF -> BeaconTransmitP.OutgoingSF; 
!   CoordCfp.CfpSlotAlarm = Alarm10;
!   CoordCfp.CfpEndAlarm = Alarm11;
    CoordCfp.RadioTx -> CoordCfpRadioClient;
    CoordCfp.RadioRx -> CoordCfpRadioClient;



More information about the Tinyos-2-commits mailing list