[Tinyos-beta-commits] CVS: tinyos-1.x/beta/SystemCore/MementoMori AggressiveSendControl.nc, 1.2, 1.3 AggressiveSendM.nc, 1.5, 1.6 CommonParams.h, 1.2, 1.3 CompressedSet.h, 1.6, 1.7 RollCallC.nc, 1.6, 1.7 RollCallM.nc, 1.7, 1.8

Stan Rost stanrost at users.sourceforge.net
Wed Oct 27 17:08:58 PDT 2004


Update of /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30228

Modified Files:
	AggressiveSendControl.nc AggressiveSendM.nc CommonParams.h 
	CompressedSet.h RollCallC.nc RollCallM.nc 
Log Message:
- Rewired everything to use my AggressiveSend

  IMPORTANT Note:  To use MementoMori, MintRoute should
  be rewired to use AggressiveSend. 

  The rumours are true.  MintRoute/QueuedSend malfunctions severely.

  TO THE INTERESTED PUBLIC:

  Need a retransmission queue?  Use AggressiveSend.  It works very well,
  uses just about 2 bytes of static memory, and gives one just enough
  control.

- AggressiveSend
  - Added the facility to control the number of transmissions for broadcast
- TestMMDetector
  - Now, timing authority comes _strictly_ from the routing parent, and
    no other nodes.  An optimization would be to synch to higher levels
    of the tree opportunistically, but that means +1 byte in the timing 
    beacon (for tree level).


Index: AggressiveSendControl.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/AggressiveSendControl.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AggressiveSendControl.nc	14 Oct 2004 14:42:51 -0000	1.2
--- AggressiveSendControl.nc	28 Oct 2004 00:08:46 -0000	1.3
***************
*** 2,5 ****
--- 2,9 ----
  
    command void setRetries(uint8_t numRetries);
+   command uint8_t getRetries();
+   
+   command void setBcastRetries(uint8_t numRetries);
+   command uint8_t getBcastRetries();
  
    event void transmitted(TOS_MsgPtr msg);

Index: AggressiveSendM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/AggressiveSendM.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** AggressiveSendM.nc	21 Oct 2004 20:35:51 -0000	1.5
--- AggressiveSendM.nc	28 Oct 2004 00:08:53 -0000	1.6
***************
*** 52,55 ****
--- 52,56 ----
  
    uint8_t maxRetries = AGGRESSIVE_INIT_RETRIES;
+   uint8_t maxBcastRetries = 0;
  
    // Data essage being set, currently
***************
*** 164,167 ****
--- 165,180 ----
    }
  
+   command uint8_t AggressiveSendControl.getRetries() {
+     return maxRetries;
+   }
+ 
+   command void AggressiveSendControl.setBcastRetries(uint8_t numRetries) {
+     maxBcastRetries = numRetries;
+   }
+ 
+   command uint8_t AggressiveSendControl.getBcastRetries() {
+     return maxBcastRetries;
+   }
+ 
    command result_t SendMsg.send[uint8_t id](uint16_t addr,
  					    uint8_t length,
***************
*** 195,199 ****
  
      stub->next = NULL;
!     stub->retriesLeft = maxRetries;
  
      // Enqueue to tail
--- 208,216 ----
  
      stub->next = NULL;
! 
!     if (addr == TOS_BCAST_ADDR)
!       stub->retriesLeft = maxBcastRetries;
!     else
!       stub->retriesLeft = maxRetries;
  
      // Enqueue to tail

Index: CommonParams.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/CommonParams.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CommonParams.h	12 Oct 2004 01:01:23 -0000	1.2
--- CommonParams.h	28 Oct 2004 00:08:53 -0000	1.3
***************
*** 6,20 ****
  enum {
    // Nodes awaken every ROLLCALL_PERIOD...
!   ROLLCALL_PERIOD = 30 * 991,
  
    // and wait for at most his long
!   MAX_ROUND_WAIT = 3 * 991,
  
    // but, actually, for MAX_ROUND_WAIT - WAIT_PER_LEVEL * treeLevel...
!   WAIT_PER_LEVEL = 3 * 99,
  
    // before sending their reports, spread out randomly
    // over this interval
!   STAGGER_INTERVAL = (WAIT_PER_LEVEL / 2),
  
    // The buffer which stores the bitmap is at most this long
--- 6,20 ----
  enum {
    // Nodes awaken every ROLLCALL_PERIOD...
!   ROLLCALL_PERIOD = 30 * 1024,
  
    // and wait for at most his long
!   MAX_ROUND_WAIT = 5 * 1024,
  
    // but, actually, for MAX_ROUND_WAIT - WAIT_PER_LEVEL * treeLevel...
!   WAIT_PER_LEVEL = 5 * 103,
  
    // before sending their reports, spread out randomly
    // over this interval
!   STAGGER_INTERVAL = 103,
  
    // The buffer which stores the bitmap is at most this long

Index: CompressedSet.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/CompressedSet.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** CompressedSet.h	21 Oct 2004 20:35:52 -0000	1.6
--- CompressedSet.h	28 Oct 2004 00:08:53 -0000	1.7
***************
*** 1127,1131 ****
      dbg(DBG_USR1, "Set is NULL\n");
    } else {
!     dbg_clear(DBG_USR1, "Set (comp=%d, len=%d): ",
  	   s->compressed,
  	   s->len);
--- 1127,1131 ----
      dbg(DBG_USR1, "Set is NULL\n");
    } else {
!     dbg(DBG_USR1, "Set (comp=%d, len=%d): ",
  	   s->compressed,
  	   s->len);

Index: RollCallC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/RollCallC.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** RollCallC.nc	21 Oct 2004 20:35:52 -0000	1.6
--- RollCallC.nc	28 Oct 2004 00:08:54 -0000	1.7
***************
*** 12,15 ****
--- 12,18 ----
  }
  implementation {
+ 
+ #define AGGR_SEND
+ 
    components 
      PowerArbiterC,
***************
*** 19,25 ****
      UsefulTimeC, 
      RandomLFSR,
-     AggressiveSendM, 
  
!     // QueuedSend,
  
  #if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
--- 22,31 ----
      UsefulTimeC, 
      RandomLFSR,
  
! #ifdef AGGR_SEND
!     AggressiveSendM, 
! #elif defined(QD_SEND)
!     QueuedSend,
! #endif
  
  #if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
***************
*** 34,50 ****
    StdControl = TimerC;
    StdControl = RollCallM;
-   //  StdControl = QueuedSend;
  
    StdControl = AggressiveSendM;
  
-   StdControl = ExptM;
  #if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
- 
    AggressiveSendM.MacControl -> CC1000RadioC.MacControl;
  #endif
  
    HeartBeatHandler = RollCallM.HeartBeatHandler;
  
    RollCallM.Time -> UsefulTimeC;
  
    RollCallM.RouteControl = RouteControl;
--- 40,61 ----
    StdControl = TimerC;
    StdControl = RollCallM;
  
+   StdControl = ExptM;
+ 
+ #ifdef AGGR_SEND
    StdControl = AggressiveSendM;
  
  #if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
    AggressiveSendM.MacControl -> CC1000RadioC.MacControl;
  #endif
  
+ #elif defined(QD_SEND)
+   StdControl = QueuedSend;
+ #endif
+ 
    HeartBeatHandler = RollCallM.HeartBeatHandler;
  
    RollCallM.Time -> UsefulTimeC;
+   RollCallM.TimeSetListener -> UsefulTimeC;
  
    RollCallM.RouteControl = RouteControl;
***************
*** 52,61 ****
    RollCallM.ReceiveReport -> Comm.ReceiveMsg[ROLLCALL_AM];
  
!   /*
!     RollCallM.SendReport -> QueuedSend.SendMsg[ROLLCALL_AM];
!     RollCallM.SendStats -> QueuedSend.SendMsg[ROLLCALL_STATS_REP_AM];
!   */
!   
!   RollCallM.AggressiveSendControl -> AggressiveSendM;
    RollCallM.SendReport -> AggressiveSendM.SendMsg[ROLLCALL_AM];
    RollCallM.SendStats -> AggressiveSendM.SendMsg[ROLLCALL_STATS_REP_AM];
--- 63,72 ----
    RollCallM.ReceiveReport -> Comm.ReceiveMsg[ROLLCALL_AM];
  
! 
! #ifdef QD_SEND
!   RollCallM.SendReport -> QueuedSend.SendMsg[ROLLCALL_AM];
!   RollCallM.SendStats -> QueuedSend.SendMsg[ROLLCALL_STATS_REP_AM];  
! #elif defined(AGGR_SEND)
!   RollCallM.AggSendCtl -> AggressiveSendM.AggressiveSendControl;
    RollCallM.SendReport -> AggressiveSendM.SendMsg[ROLLCALL_AM];
    RollCallM.SendStats -> AggressiveSendM.SendMsg[ROLLCALL_STATS_REP_AM];
***************
*** 63,71 ****
    
    AggressiveSendM.Leds -> NoLeds;    
!   
!   /*
!     RollCallM.SendReport -> Comm.SendMsg[ROLLCALL_AM];
!     RollCallM.SendStats -> Comm.SendMsg[ROLLCALL_STATS_REP_AM];
!   */
  
    RollCallM.EpochScheduler -> 
--- 74,81 ----
    
    AggressiveSendM.Leds -> NoLeds;    
! #else
!   RollCallM.SendReport -> Comm.SendMsg[ROLLCALL_AM];
!   RollCallM.SendStats -> Comm.SendMsg[ROLLCALL_STATS_REP_AM];
! #endif
  
    RollCallM.EpochScheduler -> 

Index: RollCallM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/RollCallM.nc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** RollCallM.nc	21 Oct 2004 20:35:52 -0000	1.7
--- RollCallM.nc	28 Oct 2004 00:08:54 -0000	1.8
***************
*** 18,22 ****
      interface ReceiveMsg as ReceiveReport;
  
!     interface AggressiveSendControl;
  
      interface EpochScheduler;
--- 18,22 ----
      interface ReceiveMsg as ReceiveReport;
  
!     interface AggressiveSendControl as AggSendCtl;
  
      interface EpochScheduler;
***************
*** 36,39 ****
--- 36,41 ----
  
      interface Roster;
+ 
+     interface TimeSetListener; 
    }
  }
***************
*** 111,118 ****
    // scheduling
    uint8_t treeLevel = 0xFF;
  
    TOS_Msg rollCallMsg;
-   // Try to send again if busy
-   uint8_t sendRetries = 0;
  
    TOS_Msg statsMsg;
--- 113,121 ----
    // scheduling
    uint8_t treeLevel = 0xFF;
+   
+   // Has the round come to completion?
+   bool roundOver = TRUE;
  
    TOS_Msg rollCallMsg;
  
    TOS_Msg statsMsg;
***************
*** 164,219 ****
      Set *newSet = initSet(buf2, MAX_LIVE_BITMAP_BYTES);
  
-     /*
-      * Uncomment to reject packets to others
- 
-      if (msg->addr == TOS_LOCAL_ADDRESS)
-      return msg;
- 
-      *
-      */
- 
      // Add -1 here to allow aggregates of two rounds
!     if (aMsg->round != rollCallRound) {
! 	if (msg->addr == TOS_LOCAL_ADDRESS) {
! 
! 	  if (aMsg->round < rollCallRound - 1) {
! 	    statsPkt->numLate++;
! 
! 	    return msg;
! 	  } 
! 	  // else we allow it to continue
! 	} else 
! 	  return msg;
! 
      }
! 
      dbg(DBG_USR3, "^^ Node reports set:\n", 
  	call RouteControl.getSender(msg));
      printSetBits(&aMsg->alive);
! 
      decompressSet(&aMsg->alive, newSet);
! 
      dbg(DBG_USR3, "^^ A node reports these are alive:\n");
      printSet(newSet);
      printSetBits(newSet);
! 
      unionSets(aliveSet, newSet);
! 
      dbg(DBG_USR3, "^^ After union my set is:\n");
      printSet(aliveSet);
      printSetBits(aliveSet);
! 
      return msg;
    }
  
!   event void EpochScheduler.beginEpoch() {
      TimeStamp ts;
  
-     call Leds.yellowOn();
- 
      //    call PowerArbiter.useResource(PWR_RADIO);
!     tos2timeStamp(call Time.get(), ts);
  
      rollCallRound = timeStampDiv32(ts, ROLLCALL_PERIOD);
    }
  
--- 167,222 ----
      Set *newSet = initSet(buf2, MAX_LIVE_BITMAP_BYTES);
  
      // Add -1 here to allow aggregates of two rounds
!     if (aMsg->round != rollCallRound ||
! 	roundOver) {
!       if (msg->addr == TOS_LOCAL_ADDRESS) {
! 	  statsPkt->numLate++;
!       } 
!       return msg;
      }
!   
      dbg(DBG_USR3, "^^ Node reports set:\n", 
  	call RouteControl.getSender(msg));
      printSetBits(&aMsg->alive);
!     
      decompressSet(&aMsg->alive, newSet);
!     
      dbg(DBG_USR3, "^^ A node reports these are alive:\n");
      printSet(newSet);
      printSetBits(newSet);
!     
      unionSets(aliveSet, newSet);
!     
      dbg(DBG_USR3, "^^ After union my set is:\n");
      printSet(aliveSet);
      printSetBits(aliveSet);
!     
      return msg;
    }
  
!   void updateRollCallRound() {
!     tos_time_t t;
      TimeStamp ts;
  
      //    call PowerArbiter.useResource(PWR_RADIO);
!     t = call Time.get();
!     tos2timeStamp(t, ts);
  
      rollCallRound = timeStampDiv32(ts, ROLLCALL_PERIOD);
+ 
+     dbg(DBG_USR1, 
+ 	"Round  = (%u,%u) divided by %u\n",
+ 	t.low32, t.high32, ROLLCALL_PERIOD);
+ 	
+   }
+ 
+   event void EpochScheduler.beginEpoch() {
+ 
+     roundOver = FALSE;
+ 
+     updateRollCallRound();
+ 
+     call Leds.yellowOn();
+ 
    }
  
***************
*** 252,257 ****
  
      call Timer.start(TIMER_ONE_SHOT,
! 		     (TOS_LOCAL_ADDRESS * (uint32_t)STAGGER_INTERVAL) / 
! 		     (uint32_t)MAX_NODES);
    }
  
--- 255,260 ----
  
      call Timer.start(TIMER_ONE_SHOT,
!     		     (TOS_LOCAL_ADDRESS * (uint32_t)STAGGER_INTERVAL) / 
!     		     (uint32_t)MAX_NODES);
    }
  
***************
*** 266,271 ****
      uint16_t projLen, idxLen;
  
!     dbg(DBG_USR3, "^^ Round %u over, reporting these as alive to %u\n", 
! 	rollCallRound,
  	call RouteControl.getParent());
      printSet(aliveSet);
--- 269,279 ----
      uint16_t projLen, idxLen;
  
!     tos_time_t ts;
! 
!     ts = call Time.get();
! 
!     dbg(DBG_USR3, 
! 	"^^ Round %u over (time=%u,%u), reporting these as alive to %u\n", 
! 	rollCallRound,ts.low32, ts.high32,
  	call RouteControl.getParent());
      printSet(aliveSet);
***************
*** 309,312 ****
--- 317,321 ----
        uint16_t tgtAddr = TOS_BCAST_ADDR;
        uint16_t pktSize;
+       uint8_t saveBcastRetries;
        
        if (isGateway) {
***************
*** 325,329 ****
        }
  
!       dbg(DBG_USR3, "^^ level %d READY TO SHIP %d bytes (%d - %d + %d) (%s) to parent: %u%s", 
  	  call RouteControl.getDepth(),
  	  pktSize,
--- 334,345 ----
        }
  
!       if (tgtAddr == TOS_BCAST_ADDR) {
! 	saveBcastRetries = call AggSendCtl.getBcastRetries();
! 
! 	call AggSendCtl.setBcastRetries(call AggSendCtl.getRetries());
!       }
! 
!       dbg(DBG_USR3, 
! 	  "^^ level %d READY TO SHIP %d bytes (%d - %d + %d) (%s) to parent: %u%s", 
  	  call RouteControl.getDepth(),
  	  pktSize,
***************
*** 341,362 ****
        if (call SendReport.send(tgtAddr,
  			       pktSize,
! 			       &rollCallMsg) == FAIL) {		
! 		
! 
  	dbg(DBG_USR3, "^^ send FAILED to SHIP!\n");
  
- 	//	call Leds.redToggle();
- 
- 	if (sendRetries > MAX_SEND_RETRIES) {
- 	  sendRetries = 0;
- 	  
- 	  finishRound();
- 	} else {
- 
- 	  sendRetries++;
- 	  
- 	  call Timer.start(TIMER_ONE_SHOT,
- 			   WAIT_PER_LEVEL);
- 	}
        } else {
  	call Leds.greenToggle();
--- 357,363 ----
        if (call SendReport.send(tgtAddr,
  			       pktSize,
! 			       &rollCallMsg) == FAIL) {
  	dbg(DBG_USR3, "^^ send FAILED to SHIP!\n");
  
        } else {
  	call Leds.greenToggle();
***************
*** 364,367 ****
--- 365,372 ----
  	dbg(DBG_USR3, "^^ send SHIPPED successfully!\n");	
        }
+ 
+       if (tgtAddr == TOS_BCAST_ADDR) {
+ 	call AggSendCtl.setBcastRetries(saveBcastRetries);
+       }
        
      }
***************
*** 397,401 ****
      // Increment the round number to prevent contamination
      // (Will be reset next round)
!     rollCallRound++;
  
      switchLiveSet();
--- 402,406 ----
      // Increment the round number to prevent contamination
      // (Will be reset next round)
!     roundOver = TRUE;
  
      switchLiveSet();
***************
*** 458,464 ****
    }
  
!   event void AggressiveSendControl.transmitted(TOS_MsgPtr msg) {
!     statsPkt->numFullUpd += 1;
!     statsPkt->bytesSent += msg->length;
    }
  
--- 463,475 ----
    }
  
!   event void AggSendCtl.transmitted(TOS_MsgPtr msg) {
!     if (msg->type == ROLLCALL_AM) {
!       statsPkt->numFullUpd += 1;
!       statsPkt->bytesSent += msg->length;
!     }
!   }
! 
!   event void TimeSetListener.timeAdjusted(int64_t msTicks) {
!     updateRollCallRound();
    }
  



More information about the Tinyos-beta-commits mailing list