[Tinyos-beta-commits] CVS: tinyos-1.x/beta/SystemCore/MementoMori PacketTypes.h, NONE, 1.1 AggressiveSendControl.nc, 1.1, 1.2 AggressiveSendM.nc, 1.3, 1.4 CompressedSet.h, 1.4, 1.5 ExptM.nc, 1.2, 1.3 RollCallC.nc, 1.4, 1.5 RollCallM.nc, 1.5, 1.6 failureSched.h, 1.1, 1.2

Stan Rost stanrost at users.sourceforge.net
Thu Oct 14 07:42:54 PDT 2004


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

Modified Files:
	AggressiveSendControl.nc AggressiveSendM.nc CompressedSet.h 
	ExptM.nc RollCallC.nc RollCallM.nc failureSched.h 
Added Files:
	PacketTypes.h 
Log Message:
- RollCallM
  - Now preventing stale liveness information
    from contaminating the network
  - Improved stats accounting
  - Padding the live set size to 1 (if originally 0) 
    to make SerialForwarder happy
- Abstracted packet types into headers, Java counterparts
- AggressiveSendControl:
  - Added callback to allow retransmission accounting



--- NEW FILE: PacketTypes.h ---
#ifndef _SR_PKTTYPES__
#define _SR_PKTTYPES__

#include "CompressedSet.h"

typedef struct RosterMsg {
  // Round of this communication
  uint16_t round;
  
  // Set of nodes that we consider alive
  Set alive;
} RosterMsg;

#endif

Index: AggressiveSendControl.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/AggressiveSendControl.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AggressiveSendControl.nc	20 Sep 2004 16:44:36 -0000	1.1
--- AggressiveSendControl.nc	14 Oct 2004 14:42:51 -0000	1.2
***************
*** 3,5 ****
--- 3,6 ----
    command void setRetries(uint8_t numRetries);
  
+   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.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** AggressiveSendM.nc	12 Oct 2004 01:01:22 -0000	1.3
--- AggressiveSendM.nc	14 Oct 2004 14:42:51 -0000	1.4
***************
*** 42,46 ****
  
  
! #define AGGRESSIVE_INIT_RETRIES 3
  
    uint8_t maxRetries = AGGRESSIVE_INIT_RETRIES;
--- 42,46 ----
  
  
! #define AGGRESSIVE_INIT_RETRIES 0
  
    uint8_t maxRetries = AGGRESSIVE_INIT_RETRIES;
***************
*** 236,239 ****
--- 236,241 ----
        // call Leds.redToggle();
  
+       signal AggressiveSendControl.transmitted(msg);
+ 
        if (retriesLeft == 0) {
  

Index: CompressedSet.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/CompressedSet.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CompressedSet.h	12 Oct 2004 01:01:23 -0000	1.4
--- CompressedSet.h	14 Oct 2004 14:42:51 -0000	1.5
***************
*** 74,78 ****
    uint8_t data[0];
    
! } Set;
  
  void printBits(uint8_t n) {
--- 74,78 ----
    uint8_t data[0];
    
! } __attribute__ ((packed)) Set;
  
  void printBits(uint8_t n) {
***************
*** 227,231 ****
  
    for (i = 0; i < 8; i++) {
!     cnt += ((n & bitCheck) != 0 ? 1: 0);
      bitCheck <<=1;
    }
--- 227,233 ----
  
    for (i = 0; i < 8; i++) {
!     if (n & bitCheck)
!       cnt++;
! 
      bitCheck <<=1;
    }
***************
*** 365,373 ****
  uint8_t sizeOfSet(Set *s) {
    if (s->compressed)
!     // Size of index, nubmer of bytes and header
!     return (s->len + s->len * 8 / 2 + 1);
    else
      // Number of bytes, and header
!     return (s->len + 1);
  }
  
--- 367,375 ----
  uint8_t sizeOfSet(Set *s) {
    if (s->compressed)
!     // Size of the index, number of bytes and header
!     return (s->len + s->len * 8 / 2 + sizeof(Set));
    else
      // Number of bytes, and header
!     return (s->len + sizeof(Set));
  }
  

Index: ExptM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/ExptM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ExptM.nc	12 Oct 2004 01:01:23 -0000	1.2
--- ExptM.nc	14 Oct 2004 14:42:51 -0000	1.3
***************
*** 38,41 ****
--- 38,43 ----
      interface Timer;
  
+     interface Leds;
+ 
  #if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
      interface CC1000Control as CC1KControl;
***************
*** 60,67 ****
--- 62,73 ----
    uint8_t liveRoster[MAX_LIVE_BITMAP_BYTES];
  
+   uint16_t timeOut = 0xFFFF;
+ 
    command result_t StdControl.init() {
      uint16_t i;
      Set *liveRSet;
  
+     call Leds.init();
+ 
      liveRSet = initSet(liveRoster, MAX_LIVE_BITMAP_BYTES);
  
***************
*** 82,92 ****
  	dbg(DBG_USR1, "EX My timeout is %u\n", timeOutSched[i][1]);
  
! 	call Timer.start(TIMER_ONE_SHOT,
! 			 timeOutSched[i][1] * 1024);
        }
  	
      }
  
!     dbg(DBG_USR1, "EX In the end, the roster of network nodes is:\n");
      printSet(liveRSet);
  
--- 88,99 ----
  	dbg(DBG_USR1, "EX My timeout is %u\n", timeOutSched[i][1]);
  
! 	timeOut = timeOutSched[i][1];
        }
  	
      }
  
!     dbg(DBG_USR1, 
! 	"EX In the end, the roster (len=%d) of network nodes is:\n",
! 	liveRSet->len);
      printSet(liveRSet);
  
***************
*** 103,106 ****
--- 110,118 ----
  
      call PowerArbiter.useResource(PWR_RADIO);
+ 
+     if (timeOut != 0xFFFF)
+       call Timer.start(TIMER_ONE_SHOT,
+ 		       (uint32_t)timeOut * (uint32_t)1024);
+ 
    
      return SUCCESS;
***************
*** 121,125 ****
      dbg(DBG_USR1, "EX Node DED\n\n\n");
  
!     call PowerArbiter.releaseResource(PWR_RADIO);
  
      return SUCCESS;
--- 133,145 ----
      dbg(DBG_USR1, "EX Node DED\n\n\n");
  
!     call Leds.redOn();
! 
! #if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
! 
!     // Crash the mote
! 
!     __asm volatile ("cli");
!     for (;;);
! #endif
  
      return SUCCESS;

Index: RollCallC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/RollCallC.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** RollCallC.nc	12 Oct 2004 01:01:23 -0000	1.4
--- RollCallC.nc	14 Oct 2004 14:42:51 -0000	1.5
***************
*** 81,84 ****
--- 81,85 ----
    RollCallM.Roster -> ExptM.Roster;
  
+   ExptM.Leds -> LedsC;
    ExptM.PowerArbiter ->
      PowerArbiterC.PowerArbiter[unique("PowerArbiter")];

Index: RollCallM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/RollCallM.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** RollCallM.nc	12 Oct 2004 01:01:23 -0000	1.5
--- RollCallM.nc	14 Oct 2004 14:42:51 -0000	1.6
***************
*** 4,7 ****
--- 4,8 ----
  includes ResultPacket;
  includes TimeStamp;
+ includes PacketTypes;
  
  includes CommonParams;
***************
*** 45,56 ****
    void sendReport();
  
-   typedef struct {
-     // Round of this communication
-     uint16_t round;
- 
-     // Set of nodes that we consider alive
-     Set alive;
-   } RosterMsg;
- 
    uint32_t rollCallRound = 0;
  
--- 46,49 ----
***************
*** 275,280 ****
      // XXX: Projected length might exceed
      // the size of the packet
- 
-     // XXXXXXXXXXXXXX
      if (!isGateway) {
  
--- 268,271 ----
***************
*** 294,299 ****
      } else {
        // Report just the dead nodes
        copySet(&aliveMsg->alive, call Roster.getRoster());
- 
        subtractSet(&aliveMsg->alive, aliveSet);
  
--- 285,290 ----
      } else {
        // Report just the dead nodes
+       
        copySet(&aliveMsg->alive, call Roster.getRoster());
        subtractSet(&aliveMsg->alive, aliveSet);
  
***************
*** 301,305 ****
        printSet(&aliveMsg->alive);
  
!       statsPkt->numFailedNodes = setLength(&aliveMsg->alive);
      }
      
--- 292,296 ----
        printSet(&aliveMsg->alive);
  
!       statsPkt->numFailedNodes += setLength(&aliveMsg->alive);
      }
      
***************
*** 309,332 ****
      {
        uint16_t tgtAddr = TOS_BCAST_ADDR;
        
!       dbg(DBG_USR3, "^^ level %d READY TO SHIP %d bytes to parent: %u%s", 
  	  call RouteControl.getDepth(),
! 	  sizeof(RosterMsg) - sizeof(Set) +
  	  sizeOfSet(&aliveMsg->alive),
  	  call RouteControl.getParent(),
  	  (call RouteControl.getDepth() == 0 ? "-------\n" : "\n"));
        printSet(&aliveMsg->alive);
        
-       if (isGateway)
- 	tgtAddr = TOS_UART_ADDR;
-       else
- 	tgtAddr = call RouteControl.getParent();
-       
        dbg(DBG_USR3, "^^ SHIPPING!!!\n");
  
        
        if (call SendReport.send(tgtAddr,
! 			       sizeof(uint16_t) +
! 			       sizeOfSet(&aliveMsg->alive),
  			       &rollCallMsg) == FAIL) {		
  		
--- 300,336 ----
      {
        uint16_t tgtAddr = TOS_BCAST_ADDR;
+       uint16_t pktSize;
        
!       if (isGateway) {
! 	tgtAddr = TOS_UART_ADDR;
! 
! 	// The padding is to fix the weird issue with how 
! 	// mig-generated handlers process empty, zero-size
! 	// packets
! 	pktSize = sizeof(RosterMsg) - sizeof(Set) +
! 	  sizeOfSet(&aliveMsg->alive) + (aliveMsg->alive.len == 0 ? 1 : 0);
! 
!       } else {
! 	tgtAddr = call RouteControl.getParent();
! 	pktSize = sizeof(RosterMsg) - sizeof(Set) +
! 	  sizeOfSet(&aliveMsg->alive);
!       }
! 
!       dbg(DBG_USR3, "^^ level %d READY TO SHIP %d bytes (%d - %d + %d) (%s) to parent: %u%s", 
  	  call RouteControl.getDepth(),
! 	  pktSize,
! 	  sizeof(RosterMsg),
! 	  sizeof(Set),
  	  sizeOfSet(&aliveMsg->alive),
+ 	  (aliveMsg->alive.compressed ? "COMPRESSED" : "UNCOMPRESSED"),
  	  call RouteControl.getParent(),
  	  (call RouteControl.getDepth() == 0 ? "-------\n" : "\n"));
        printSet(&aliveMsg->alive);
        
        dbg(DBG_USR3, "^^ SHIPPING!!!\n");
  
        
        if (call SendReport.send(tgtAddr,
! 			       pktSize,
  			       &rollCallMsg) == FAIL) {		
  		
***************
*** 334,338 ****
  	dbg(DBG_USR3, "^^ send FAILED to SHIP!\n");
  
! 	call Leds.redToggle();
  
  	if (sendRetries > MAX_SEND_RETRIES) {
--- 338,342 ----
  	dbg(DBG_USR3, "^^ send FAILED to SHIP!\n");
  
! 	//	call Leds.redToggle();
  
  	if (sendRetries > MAX_SEND_RETRIES) {
***************
*** 364,370 ****
  
      if (status == SUCCESS) { 
-       statsPkt->bytesSent = 5 + msg->length;
-       
-       statsPkt->numFullUpd = 1;
  
        //      call Leds.greenToggle();
--- 368,371 ----
***************
*** 386,389 ****
--- 387,394 ----
      sendReport();
  
+     // Increment the round number to prevent contamination
+     // (Will be reset next round)
+     rollCallRound++;
+ 
      switchLiveSet();
  
***************
*** 428,438 ****
  	statsPkt->numFullUpd);
  
!     if (call SendStats.send(TOS_UART_ADDR,
! 			    sizeof(ResultPkt),
! 			    &statsMsg) == SUCCESS) {
!       //      call Leds.greenToggle();
!     } else {
!       //      call Leds.redToggle();
!     }
    }
  
--- 433,440 ----
  	statsPkt->numFullUpd);
  
!     call SendStats.send(TOS_UART_ADDR,
! 			sizeof(ResultPkt),
! 			&statsMsg);
! 
    }
  
***************
*** 440,446 ****
--- 442,456 ----
  				    result_t status) {
  
+     // Zero the stats
+     if (status == SUCCESS)
+       memset(statsPkt, 0, sizeof(ResultPkt));
+ 
      return SUCCESS;
    }
  
+   event void AggressiveSendControl.transmitted(TOS_MsgPtr msg) {
+     statsPkt->numFullUpd += 1;
+     statsPkt->bytesSent += msg->length;
+   }
  
  }

Index: failureSched.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/failureSched.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** failureSched.h	8 Oct 2004 20:50:19 -0000	1.1
--- failureSched.h	14 Oct 2004 14:42:51 -0000	1.2
***************
*** 26,30 ****
  {31, 0xFFFF}, \
  {32, 0xFFFF}, \
! {33, 0xFFFF}, \
  {34, 0xFFFF}, \
  {35, 0xFFFF}, \
--- 26,30 ----
  {31, 0xFFFF}, \
  {32, 0xFFFF}, \
! {33, 300}, \
  {34, 0xFFFF}, \
  {35, 0xFFFF}, \
***************
*** 37,45 ****
  {47, 0xFFFF}, \
  {48, 0xFFFF}, \
- {49, 0xFFFF}, \
  {50, 0xFFFF}, \
  {51, 0xFFFF}, \
  {53, 0xFFFF}, \
- {52, 0xFFFF}, \
  {56, 0xFFFF}, \
  { 0xFFFF, 0xFFFF }
--- 37,43 ----



More information about the Tinyos-beta-commits mailing list