[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/tda5250/mac CsmaMacC.nc, 1.1.2.10, 1.1.2.11 CsmaMacP.nc, 1.1.2.11, 1.1.2.12

Philipp Huppertz phihup at users.sourceforge.net
Wed Oct 11 08:48:32 PDT 2006


Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv22607/tos/chips/tda5250/mac

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	CsmaMacC.nc CsmaMacP.nc 
Log Message:
- the results of another mac debug session....

Index: CsmaMacC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac/CsmaMacC.nc,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -C2 -d -r1.1.2.10 -r1.1.2.11
*** CsmaMacC.nc	12 Sep 2006 12:16:31 -0000	1.1.2.10
--- CsmaMacC.nc	11 Oct 2006 15:48:30 -0000	1.1.2.11
***************
*** 36,40 ****
   */
  
! // #define MAC_DEBUG
  configuration CsmaMacC {
    provides {
--- 36,40 ----
   */
  
!  #define MAC_DEBUG
  configuration CsmaMacC {
    provides {

Index: CsmaMacP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac/CsmaMacP.nc,v
retrieving revision 1.1.2.11
retrieving revision 1.1.2.12
diff -C2 -d -r1.1.2.11 -r1.1.2.12
*** CsmaMacP.nc	12 Sep 2006 12:16:31 -0000	1.1.2.11
--- CsmaMacP.nc	11 Oct 2006 15:48:30 -0000	1.1.2.12
***************
*** 43,47 ****
  */
  
! // #define MACM_DEBUG                 // debug...
  module CsmaMacP {
      provides {
--- 43,47 ----
  */
  
! #define MACM_DEBUG                 // debug...
  module CsmaMacP {
      provides {
***************
*** 113,117 ****
      /* state vars & defs */
      typedef enum {
-         SW_CCA,          // switch to CCA
          CCA,             // clear channel assessment
          CCA_ACK,
--- 113,116 ----
***************
*** 133,137 ****
          RSSI_STABLE = 1,
          RESUME_BACKOFF = 2,
!         CANCEL_SEND = 4
      } flags_t;
  
--- 132,137 ----
          RSSI_STABLE = 1,
          RESUME_BACKOFF = 2,
!         CANCEL_SEND = 4,
!         CCA_PENDING = 8
      } flags_t;
  
***************
*** 151,155 ****
      
      uint16_t slotMask;
-     int16_t rssiValue;
      uint16_t restLaufzeit;
  
--- 151,154 ----
***************
*** 251,256 ****
          macState_t ms;
          atomic ms = macState;
!         if((ms > CCA)  && (ms != INIT) && call RssiAdcResource.isOwner()) {
!             call RssiAdcResource.release();
          }
      }
--- 250,260 ----
          macState_t ms;
          atomic ms = macState;
!         if(isFlagSet(&flags, CCA_PENDING)) {
!           post ReleaseAdcTask(); 
!         }
!         else {
!         	if((ms > CCA)  && (ms != INIT) && call RssiAdcResource.isOwner()) {
!           	  call RssiAdcResource.release();
!         	}	
          }
      }
***************
*** 272,276 ****
              post SetRxModeTask();
          }
!         if((macState == SW_CCA) || (macState == INIT)) requestAdc();
      }
      
--- 276,284 ----
              post SetRxModeTask();
          }
!         if(macState == INIT) {
!           requestAdc();
!         } else {
!           post ReleaseAdcTask();
!         }
      }
      
***************
*** 279,283 ****
              if((macState == SW_RX) ||
                 (macState == SW_RX_ACK) ||
-                (macState == SW_CCA) ||
                 (macState == INIT)) setRxMode();
          }
--- 287,290 ----
***************
*** 498,501 ****
--- 505,509 ----
              call UartPhyControl.setNumPreambles(MIN_PREAMBLE_BYTES);
          }
+         post ReleaseAdcTask();
          signal SplitControl.startDone(SUCCESS);
      }
***************
*** 558,567 ****
          atomic  {
              setFlag(&flags, RSSI_STABLE);
!             if(macState == SW_CCA)  {
!                 macState = CCA;
!                 signalMacState();
!                 call Timer.start(DATA_DETECT_TIME);
!             }
!             else if(macState == INIT) {
                  storeOldState(11);
                  if(call RssiAdcResource.isOwner()) {
--- 566,570 ----
          atomic  {
              setFlag(&flags, RSSI_STABLE);
!             if(macState == INIT) {
                  storeOldState(11);
                  if(call RssiAdcResource.isOwner()) {
***************
*** 593,599 ****
                  signalMacState();
              }
-             else if(macState == SW_CCA) {
-                 storeOldState(23);
-             }
              else if(macState == INIT) {
                  storeOldState(24);
--- 596,599 ----
***************
*** 683,696 ****
          if(macState <= RX_ACK) {
              storeOldState(60);
-             rssiValue = 0xFFFF;
              interruptBackoffTimer();
              if(macState == CCA) computeBackoff();
          }
          if(macState <= RX) {
!             storeOldState(61);
              macState = RX_P;
              signalMacState();
          }
          else if(macState <= RX_ACK) {
              storeOldState(62);
              macState = RX_ACK_P;
--- 683,697 ----
          if(macState <= RX_ACK) {
              storeOldState(60);
              interruptBackoffTimer();
              if(macState == CCA) computeBackoff();
          }
          if(macState <= RX) {
!           post ReleaseAdcTask();  
!           storeOldState(61);
              macState = RX_P;
              signalMacState();
          }
          else if(macState <= RX_ACK) {
+             post ReleaseAdcTask();
              storeOldState(62);
              macState = RX_ACK_P;
***************
*** 701,706 ****
          }
          else {
!             storeOldState(64);
!             signalFailure(4);
          } 
      }
--- 702,708 ----
          }
          else {
!           post ReleaseAdcTask();  
!           storeOldState(64);
!           signalFailure(4);	
          } 
      }
***************
*** 717,721 ****
                  if(msgIsForMe(msg)) {
                      if(!isCnt) {
!                         if(rssiValue != INVALID_SNR) (getMetadata(m))->strength = rssiValue;
                          if(isNewMsg(m)) {
                              m = signal MacReceive.receiveDone(msg);
--- 719,723 ----
                  if(msgIsForMe(msg)) {
                      if(!isCnt) {
!                         (getMetadata(m))->strength = 10;
                          if(isNewMsg(m)) {
                              m = signal MacReceive.receiveDone(msg);
***************
*** 745,751 ****
                  if(ackIsForMe(msg)) {
                      storeOldState(92);
!                     if(rssiValue != INVALID_SNR) {
!                         (getMetadata(txBufPtr))->strength = rssiValue;
!                     }
                      (getMetadata(txBufPtr))->ack = WAS_ACKED;
                      signalSendDone(SUCCESS);
--- 747,751 ----
                  if(ackIsForMe(msg)) {
                      storeOldState(92);
!                     (getMetadata(txBufPtr))->strength = 10;
                      (getMetadata(txBufPtr))->ack = WAS_ACKED;
                      signalSendDone(SUCCESS);
***************
*** 782,791 ****
          }
          else if(action == RX_ACK) {
-             post ReleaseAdcTask();
              macState = RX_ACK;
              signalMacState();
          }
          else if(action == RX) {
-             post ReleaseAdcTask();
              macState = RX;
              signalMacState();
--- 782,789 ----
***************
*** 887,890 ****
--- 885,890 ----
                      checkOnIdle();
                  }
+             } else {
+               setFlag(&flags, CCA_PENDING);
              }
          }
***************
*** 923,932 ****
  
      async event void ChannelMonitor.channelBusy() {
!         storeOldState(120);
          checkOnBusy();
      }
  
      async event void ChannelMonitor.channelIdle() {
!         storeOldState(121);
          checkOnIdle();
      }
--- 923,934 ----
  
      async event void ChannelMonitor.channelBusy() {
!       clearFlag(&flags, CCA_PENDING);  
!       storeOldState(120);
          checkOnBusy();
      }
  
      async event void ChannelMonitor.channelIdle() {
!       clearFlag(&flags, CCA_PENDING);  
!       storeOldState(121);
          checkOnIdle();
      }
***************
*** 948,952 ****
      
      async event void ChannelMonitorData.getSnrDone(int16_t data) {
-         atomic if(macState == RX_P) rssiValue = data;
      }
  
--- 950,953 ----
***************
*** 961,965 ****
      /***** abused TimeStamping events **************************/
      async event void RadioTimeStamping.receivedSFD( uint16_t time ) {
-         if(call RssiAdcResource.isOwner()) call ChannelMonitorData.getSnr();
          if(macState == RX_P) call ChannelMonitor.rxSuccess();
      }
--- 962,965 ----



More information about the Tinyos-2-commits mailing list