[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/tda5250/mac SpeckMacDP.nc, 1.2, 1.3

akoepke andreaskoepke at users.sourceforge.net
Thu Oct 4 02:42:06 PDT 2007


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

Modified Files:
	SpeckMacDP.nc 
Log Message:
- double check whether something is on the channel in RX (instead of only once)
- debug some stuff


Index: SpeckMacDP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/tda5250/mac/SpeckMacDP.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SpeckMacDP.nc	1 Oct 2007 17:58:07 -0000	1.2
--- SpeckMacDP.nc	4 Oct 2007 09:42:03 -0000	1.3
***************
*** 109,113 ****
          STOP
      } macState_t;
! 
      macState_t macState;
  
--- 109,113 ----
          STOP
      } macState_t;
!     
      macState_t macState;
  
***************
*** 163,176 ****
      };
      
!     /**************** Module Global Variables  *****************/
!     typedef union 
!     {
!         uint32_t op;
!         struct {
!             uint16_t lo;
!             uint16_t hi;
!         };
!     } ui32parts_t;
!     
      /* flags */
      typedef enum {
--- 163,167 ----
      };
      
!     /**************** Module Global Variables  *****************/    
      /* flags */
      typedef enum {
***************
*** 362,372 ****
--- 353,380 ----
              txMacHdr = macHdr;
              setFlag(&flags, MESSAGE_PREPARED);
+             if(macState == SLEEP) {
+                 sdDebug(400);
+             } else {
+                 sdDebug(401);
+             }
+             if(!call Timer.isRunning()) {
+                 sdDebug(402);
+             } else {
+                 sdDebug(403);
+             }
+             if(!isFlagSet(&flags, RESUME_BACKOFF)) {
+                 sdDebug(404);
+             } else {
+                 sdDebug(405);
+             }
              if((macState == SLEEP) && (!call Timer.isRunning()) && (!isFlagSet(&flags, RESUME_BACKOFF))) {
                  if((longRetryCounter == 1) &&
                     (getHeader(msg)->dest != AM_BROADCAST_ADDR)) {
                      call Timer.start((call Random.rand16() >> 3) & ZERO_BACKOFF_MASK);
+                     sdDebug(406);
                  }
                  else {
                      call Timer.start(backoff(longRetryCounter));
+                     sdDebug(407);
                  }
              }
***************
*** 480,486 ****
--- 488,498 ----
              restLaufzeit = call TimeDiff16.computeDelta(call Timer.getAlarm(), call Timer.getNow());
              call Timer.stop();
+             sdDebug(10);
+             sdDebug(restLaufzeit);
              if(restLaufzeit > MIN_BACKOFF_MASK << MAX_LONG_RETRY) {
                  restLaufzeit = call Random.rand16() & ZERO_BACKOFF_MASK;
              }
+             sdDebug(11);
+             sdDebug(restLaufzeit);
              setFlag(&flags, RESUME_BACKOFF);
          }
***************
*** 491,494 ****
--- 503,508 ----
              setFlag(&flags, RESUME_BACKOFF);
              restLaufzeit = backoff(longRetryCounter);
+             sdDebug(20);
+             sdDebug(restLaufzeit);
              updateRetryCounters();
          }
***************
*** 708,711 ****
--- 722,726 ----
                          call Timer.start(restLaufzeit);
                          restLaufzeit = 0;
+                         sdDebug(30);
                      }
                      else {
***************
*** 747,750 ****
--- 762,766 ----
          }
          if(err == SUCCESS) {
+             sdDebug(300);
              post PrepareMsgTask();
          }
***************
*** 786,789 ****
--- 802,806 ----
          if(macState <= CCA_ACK) {
              if(macState == CCA) {
+                 sdDebug(100);
                  computeBackoff();
  #ifdef SPECKMAC_PERFORMANCE
***************
*** 794,797 ****
--- 811,815 ----
                  macState = RX_P;
              } else {
+                 sdDebug(500);
                  macState = RX_ACK_P;
              }
***************
*** 889,893 ****
              if(error == SUCCESS) {
                  if(ackIsForMe(msg)) {
!                     // sdDebug(202);
                      storeStrength(msg);
                      getMetadata(txBufPtr)->ack = WAS_ACKED;
--- 907,911 ----
              if(error == SUCCESS) {
                  if(ackIsForMe(msg)) {
!                     sdDebug(510);
                      storeStrength(msg);
                      getMetadata(txBufPtr)->ack = WAS_ACKED;
***************
*** 899,903 ****
                  }
                  else {
!                     // sdDebug(203);
                      updateLongRetryCounters(); // this will eventually schedule the right backoff
                      macState = SLEEP;          // so much traffic is going on -- take a nap
--- 917,921 ----
                  }
                  else {
!                     sdDebug(511);
                      updateLongRetryCounters(); // this will eventually schedule the right backoff
                      macState = SLEEP;          // so much traffic is going on -- take a nap
***************
*** 908,916 ****
              else {
                  if(call Timer.isRunning()) {
!                     // sdDebug(204);
                      action = RX_ACK;
                  }
                  else {
!                     // sdDebug(205);
                      updateLongRetryCounters();
                      action = RX;
--- 926,934 ----
              else {
                  if(call Timer.isRunning()) {
!                     sdDebug(512);
                      action = RX_ACK;
                  }
                  else {
!                     sdDebug(513);
                      updateLongRetryCounters();
                      action = RX;
***************
*** 938,946 ****
              macState = SLEEP;
              if(isFlagSet(&flags, RESUME_BACKOFF)) {
!                 if(nav > restLaufzeit) restLaufzeit += nav;
              }
              else {
                  setFlag(&flags, RESUME_BACKOFF);
                  restLaufzeit = call Random.rand16() & ZERO_BACKOFF_MASK;
              }
              setSleepMode();
--- 956,972 ----
              macState = SLEEP;
              if(isFlagSet(&flags, RESUME_BACKOFF)) {
!                 if(nav > restLaufzeit) {
!                     sdDebug(40);
!                     sdDebug(restLaufzeit);
!                     restLaufzeit += nav;
!                 }
!                 sdDebug(41);
!                 sdDebug(restLaufzeit);
              }
              else {
                  setFlag(&flags, RESUME_BACKOFF);
                  restLaufzeit = call Random.rand16() & ZERO_BACKOFF_MASK;
+                 sdDebug(42);
+                 sdDebug(restLaufzeit);
              }
              setSleepMode();
***************
*** 1014,1017 ****
--- 1040,1044 ----
          if((macState == RX) || (macState == CCA) || (macState == CCA_ACK)) {
              if(macState == CCA) {
+                 sdDebug(101);
                  computeBackoff();
  #ifdef SPECKMAC_PERFORMANCE
***************
*** 1030,1035 ****
          if(macState == RX) {
              // sdDebug(240);
!             macState = SLEEP;
!             setSleepMode();
          }
          else if(macState == CCA) {
--- 1057,1068 ----
          if(macState == RX) {
              // sdDebug(240);
!             checkCounter++;
!             if(checkCounter < 2) {
!                 call Timer.start(DATA_DETECT_TIME);
!                 requestAdc();
!             } else {
!                 macState = SLEEP;
!                 setSleepMode();
!             }
          }
          else if(macState == CCA) {
***************
*** 1096,1099 ****
--- 1129,1133 ----
                       call Timer.start(restLaufzeit);
                       restLaufzeit = 0;
+                      sdDebug(50);
                   }
                   else {
***************
*** 1122,1125 ****
--- 1156,1160 ----
          if((macState == SLEEP) && (!isFlagSet(&flags, SWITCHING))) {
              clearFlag(&flags, ACTION_DETECTED);
+             sdDebug(200);
              interruptBackoffTimer();
              macState = RX;



More information about the Tinyos-2-commits mailing list