[Tinyos-beta-commits] CVS: tinyos-1.x/beta/SystemCore/MementoMori
PacketTypes.h, NONE, 1.1.2.1 AggressiveSendControl.nc, 1.1,
1.1.4.1 AggressiveSendM.nc, 1.2, 1.2.2.1 CommonParams.h, 1.1,
1.1.2.1 CompressedSet.h, 1.3, 1.3.2.1 ExptM.nc, 1.1,
1.1.2.1 ResultPacket.h, 1.1, 1.1.2.1 RollCallC.nc, 1.3,
1.3.2.1 RollCallM.nc, 1.4, 1.4.2.1 genRoster.sh, 1.1, 1.1.2.1
Kristin Wright
kristinwright at users.sourceforge.net
Thu Nov 11 05:45:01 PST 2004
Update of /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8305/beta/SystemCore/MementoMori
Modified Files:
Tag: tos-1-1-8-candidate
AggressiveSendControl.nc AggressiveSendM.nc CommonParams.h
CompressedSet.h ExptM.nc ResultPacket.h RollCallC.nc
RollCallM.nc genRoster.sh
Added Files:
Tag: tos-1-1-8-candidate
PacketTypes.h
Log Message:
merge with trunk using the tos-1-1-8-postbugfix trunk snapshot
--- 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.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** AggressiveSendControl.nc 20 Sep 2004 16:44:36 -0000 1.1
--- AggressiveSendControl.nc 11 Nov 2004 13:43:25 -0000 1.1.4.1
***************
*** 2,5 ****
--- 2,10 ----
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.2
retrieving revision 1.2.2.1
diff -C2 -d -r1.2 -r1.2.2.1
*** AggressiveSendM.nc 8 Oct 2004 20:50:19 -0000 1.2
--- AggressiveSendM.nc 11 Nov 2004 13:43:25 -0000 1.2.2.1
***************
*** 1,9 ****
--- 1,16 ----
module AggressiveSendM {
provides {
+ interface StdControl;
+
interface SendMsg[uint8_t id];
interface AggressiveSendControl;
+
}
uses {
+ #if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
+ interface MacControl;
+ #endif
+
interface Leds;
***************
*** 42,48 ****
! #define AGGRESSIVE_INIT_RETRIES 3
uint8_t maxRetries = AGGRESSIVE_INIT_RETRIES;
// Data essage being set, currently
--- 49,56 ----
! #define AGGRESSIVE_INIT_RETRIES 2
uint8_t maxRetries = AGGRESSIVE_INIT_RETRIES;
+ uint8_t maxBcastRetries = 0;
// Data essage being set, currently
***************
*** 51,54 ****
--- 59,63 ----
void printPacket(TOS_MsgPtr msg) {
+ #ifdef PLATFORM_PC
MsgStub *stub = getStub(msg);
***************
*** 56,62 ****
--- 65,73 ----
dbg_clear(DBG_USR2, "[%p:%d:%u:%p]",
msg, msg->type, stub->retriesLeft, stub->next);
+ #endif
}
void printQueue() {
+ #ifdef PLATFORM_PC
TOS_MsgPtr head = headFifoQ;
***************
*** 78,109 ****
}
dbg_clear(DBG_USR2, "\n");
}
! task void doSend() {
! dbg(DBG_USR1, "doSend()\n");
! printQueue();
! // If we are currently not sending any message,
! // popo another one from the queue
! if (_msg == NULL) {
! if (headFifoQ == NULL)
! return;
! else {
! MsgStub *stub = getStub(headFifoQ);
! _msg = headFifoQ;
! retriesLeft = stub->retriesLeft;
! headFifoQ = stub->next;
! }
! }
- // Msg is all set
- call SendExt.send[_msg->type](_msg->addr,
- _msg->length,
- _msg);
- }
command void AggressiveSendControl.setRetries(uint8_t numRetries) {
--- 89,163 ----
}
dbg_clear(DBG_USR2, "\n");
+ #endif
}
! bool sendInvoked = FALSE;
! void doSend() {
!
! dbg(DBG_USR1, "doSend()\n");
! printQueue();
!
! // If we are currently not sending any message,
! // popo another one from the queue
! if (_msg == NULL) {
! if (headFifoQ == NULL)
! return;
! else {
! MsgStub *stub = getStub(headFifoQ);
!
! _msg = headFifoQ;
! retriesLeft = stub->retriesLeft;
!
! headFifoQ = stub->next;
! }
! }
!
! // Msg is all set
! if (call SendExt.send[_msg->type](_msg->addr,
! _msg->length,
! _msg) == SUCCESS) {
! call Leds.greenToggle();
! } else {
! call Leds.redToggle();
! }
!
! }
!
! task void invokeSend() {
! sendInvoked = FALSE;
! doSend();
! }
!
! void postponeSend() {
! if (!sendInvoked) {
! sendInvoked = TRUE;
!
! if ((post invokeSend()) == FAIL)
! sendInvoked = FALSE;
! }
! }
! command result_t StdControl.init() {
! return SUCCESS;
! }
! command result_t StdControl.start() {
!
! #if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
! atomic {
! call MacControl.enableAck();
! }
! #endif
!
! return SUCCESS;
! }
!
! command result_t StdControl.stop() {
! return SUCCESS;
! }
command void AggressiveSendControl.setRetries(uint8_t numRetries) {
***************
*** 111,114 ****
--- 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,
***************
*** 119,122 ****
--- 185,190 ----
TOS_MsgPtr cur = headFifoQ;
+ call Leds.yellowToggle();
+
if (msg == _msg)
return FAIL;
***************
*** 130,135 ****
}
- call Leds.yellowToggle();
-
stub = getStub(msg);
--- 198,201 ----
***************
*** 142,146 ****
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
***************
*** 159,163 ****
}
! post doSend();
return SUCCESS;
--- 229,233 ----
}
! doSend();
return SUCCESS;
***************
*** 168,172 ****
_msg = NULL;
! post doSend();
return signal SendMsg.sendDone[id](msg, success);
--- 238,242 ----
_msg = NULL;
! doSend();
return signal SendMsg.sendDone[id](msg, success);
***************
*** 195,214 ****
if (msg != _msg) {
// Another process finished, we should now try
! post doSend();
! call Leds.greenToggle();
dbg(DBG_USR1, "*** ANOTHER: type %d\n", id);
return signal SendMsg.sendDone[id](msg, success);
} else if (msg->addr == TOS_UART_ADDR) {
dbg(DBG_USR1, "*** RETRIES RESET: UART\n");
return finish(id, msg, success);
!
} else if (msg->addr == TOS_BCAST_ADDR ||
!msg->ack) {
! call Leds.redToggle();
if (retriesLeft == 0) {
--- 265,290 ----
if (msg != _msg) {
// Another process finished, we should now try
! doSend();
! // call Leds.greenToggle();
dbg(DBG_USR1, "*** ANOTHER: type %d\n", id);
return signal SendMsg.sendDone[id](msg, success);
+ } else if (success == FAIL) {
+ postponeSend();
+
+ return SUCCESS;
} else if (msg->addr == TOS_UART_ADDR) {
dbg(DBG_USR1, "*** RETRIES RESET: UART\n");
return finish(id, msg, success);
!
} else if (msg->addr == TOS_BCAST_ADDR ||
!msg->ack) {
! // call Leds.redToggle();
!
! signal AggressiveSendControl.transmitted(msg);
if (retriesLeft == 0) {
***************
*** 221,225 ****
--retriesLeft;
! post doSend();
return SUCCESS;
--- 297,301 ----
--retriesLeft;
! doSend();
return SUCCESS;
***************
*** 229,232 ****
--- 305,310 ----
dbg(DBG_USR1, "*** SUCCESS AT %d RETRIES\n", maxRetries - retriesLeft);
+ signal AggressiveSendControl.transmitted(msg);
+
return finish(id, msg, success);
}
Index: CommonParams.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/CommonParams.h,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -C2 -d -r1.1 -r1.1.2.1
*** CommonParams.h 8 Oct 2004 20:50:19 -0000 1.1
--- CommonParams.h 11 Nov 2004 13:43:25 -0000 1.1.2.1
***************
*** 2,5 ****
--- 2,6 ----
#define _SR_COMMON__
+ #include "CompressedSet.h"
enum {
***************
*** 8,19 ****
// and wait for at most his long
! MAX_ROUND_WAIT = 3096,
// but, actually, for MAX_ROUND_WAIT - WAIT_PER_LEVEL * treeLevel...
! WAIT_PER_LEVEL = 310,
// 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
--- 9,20 ----
// 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.3
retrieving revision 1.3.2.1
diff -C2 -d -r1.3 -r1.3.2.1
*** CompressedSet.h 8 Oct 2004 20:50:19 -0000 1.3
--- CompressedSet.h 11 Nov 2004 13:43:25 -0000 1.3.2.1
***************
*** 50,54 ****
uint8_t aRun:4;
uint8_t bRun:4;
!
} __attribute__ ((packed)) LitRun;
--- 50,54 ----
uint8_t aRun:4;
uint8_t bRun:4;
!
} __attribute__ ((packed)) LitRun;
[...1597 lines suppressed...]
!
!
! void printBits(uint8_t n) {
! }
!
! void printSetBits(Set *s) {
}
+ void printSet(Set *s) {
+ }
+
+ void testSets() {
+
+ }
+
+ #endif
+
+
#endif
Index: ExptM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/ExptM.nc,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -C2 -d -r1.1 -r1.1.2.1
*** ExptM.nc 8 Oct 2004 20:50:19 -0000 1.1
--- ExptM.nc 11 Nov 2004 13:43:25 -0000 1.1.2.1
***************
*** 34,41 ****
uses {
- interface PowerArbiter;
-
interface Timer;
#if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
interface CC1000Control as CC1KControl;
--- 34,41 ----
uses {
interface Timer;
+ interface Leds;
+
#if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
interface CC1000Control as CC1KControl;
***************
*** 60,67 ****
--- 60,71 ----
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,106 ****
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);
// Set the radio power
#ifdef PLATFORM_MICA2
#warning "Setting RADIO POWER..."
call CC1KControl.SetRFPower(RADIO_POWER);
- #endif
! return SUCCESS;
! }
! command result_t StdControl.start() {
- call PowerArbiter.useResource(PWR_RADIO);
return SUCCESS;
--- 86,115 ----
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);
+ return SUCCESS;
+ }
+
+ command result_t StdControl.start() {
+
// Set the radio power
#ifdef PLATFORM_MICA2
#warning "Setting RADIO POWER..."
call CC1KControl.SetRFPower(RADIO_POWER);
! #endif
! if (timeOut != 0xFFFF)
! call Timer.start(TIMER_ONE_SHOT,
! (uint32_t)timeOut * (uint32_t)1024);
return SUCCESS;
***************
*** 113,116 ****
--- 122,127 ----
command Set *Roster.getRoster() {
return (Set *)liveRoster;
+
+ return NULL;
}
***************
*** 119,123 ****
dbg(DBG_USR1, "EX Node DED\n\n\n");
! call PowerArbiter.releaseResource(PWR_RADIO);
return SUCCESS;
--- 130,142 ----
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: ResultPacket.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/ResultPacket.h,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -C2 -d -r1.1 -r1.1.2.1
*** ResultPacket.h 8 Oct 2004 20:50:19 -0000 1.1
--- ResultPacket.h 11 Nov 2004 13:43:25 -0000 1.1.2.1
***************
*** 8,37 ****
// This one really only counts
// at the root
! //2
uint16_t numFailedNodes;
// Amount number of bytes sent
! //6
uint32_t bytesSent;
// Number of rounds played so far
! // 8
uint16_t numRounds;
// Parent at the current iteration
! // 10
uint16_t parentAddr;
! // Number of full updates sent
! // 12
! uint16_t numFullUpd;
! // -"- discovery updates sent
! // 14
! uint16_t numDiscUpd;
! // -"- failure updates sent
! // 16
! uint16_t numFailUpd;
} ResultPkt;
--- 8,37 ----
// This one really only counts
// at the root
! //0
uint16_t numFailedNodes;
// Amount number of bytes sent
! //2
uint32_t bytesSent;
// Number of rounds played so far
! // 6
uint16_t numRounds;
// Parent at the current iteration
! // 8
uint16_t parentAddr;
! // Depth within the tree
! // 10
! uint8_t treeLevel;
! // Number of late arrivals (i.e. desynchronized)
! // 12
! uint8_t numLate;
! // Number of full updates sent
! // 13
! uint16_t numFullUpd;
} ResultPkt;
Index: RollCallC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/RollCallC.nc,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -C2 -d -r1.3 -r1.3.2.1
*** RollCallC.nc 8 Oct 2004 20:50:19 -0000 1.3
--- RollCallC.nc 11 Nov 2004 13:43:25 -0000 1.3.2.1
***************
*** 12,25 ****
}
implementation {
! components PowerArbiterC, EpochSchedulerC,
TimerC, GenericCommPromiscuous as Comm,
! RollCallM, UsefulTimeC, RandomLFSR,
! AggressiveSendM, LedsC, NoLeds,
#if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
! CC1000ControlM,
#endif
! ExptM;
StdControl = Comm;
--- 12,38 ----
}
implementation {
!
! #define AGGR_SEND
!
! components
! PowerArbiterC,
! EpochSchedulerC,
TimerC, GenericCommPromiscuous as Comm,
! RollCallM,
! UsefulTimeC,
! RandomLFSR,
!
! #ifdef AGGR_SEND
! AggressiveSendM,
! #elif defined(QD_SEND)
! QueuedSend,
! #endif
#if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
! CC1000RadioC,
#endif
! ExptM,
! LedsC, NoLeds;
StdControl = Comm;
***************
*** 29,34 ****
StdControl = ExptM;
#if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
! StdControl = CC1000ControlM;
#endif
--- 42,55 ----
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
***************
*** 36,39 ****
--- 57,61 ----
RollCallM.Time -> UsefulTimeC;
+ RollCallM.TimeSetListener -> UsefulTimeC;
RollCallM.RouteControl = RouteControl;
***************
*** 41,75 ****
RollCallM.ReceiveReport -> Comm.ReceiveMsg[ROLLCALL_AM];
! RollCallM.AggressiveSendControl -> AggressiveSendM;
RollCallM.SendReport -> AggressiveSendM.SendMsg[ROLLCALL_AM];
RollCallM.SendStats -> AggressiveSendM.SendMsg[ROLLCALL_STATS_REP_AM];
AggressiveSendM.SendExt -> Comm.SendMsg;
!
! AggressiveSendM.Leds -> LedsC;
!
! /*
RollCallM.SendReport -> Comm.SendMsg[ROLLCALL_AM];
RollCallM.SendStats -> Comm.SendMsg[ROLLCALL_STATS_REP_AM];
! */
RollCallM.EpochScheduler ->
EpochSchedulerC.EpochScheduler[unique("EpochScheduler")];
RollCallM.PowerArbiter ->
PowerArbiterC.PowerArbiter[unique("PowerArbiter")];
!
RollCallM.Random -> RandomLFSR;
RollCallM.Timer -> TimerC.Timer[unique("Timer")];
! RollCallM.Leds -> NoLeds;
RollCallM.Roster -> ExptM.Roster;
! ExptM.PowerArbiter ->
! PowerArbiterC.PowerArbiter[unique("PowerArbiter")];
ExptM.Timer -> TimerC.Timer[unique("Timer")];
#if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
! ExptM.CC1KControl -> CC1000ControlM;
#endif
}
--- 63,102 ----
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];
AggressiveSendM.SendExt -> Comm.SendMsg;
!
! AggressiveSendM.Leds -> NoLeds;
! #else
RollCallM.SendReport -> Comm.SendMsg[ROLLCALL_AM];
RollCallM.SendStats -> Comm.SendMsg[ROLLCALL_STATS_REP_AM];
! #endif
RollCallM.EpochScheduler ->
EpochSchedulerC.EpochScheduler[unique("EpochScheduler")];
+
+
RollCallM.PowerArbiter ->
PowerArbiterC.PowerArbiter[unique("PowerArbiter")];
!
RollCallM.Random -> RandomLFSR;
RollCallM.Timer -> TimerC.Timer[unique("Timer")];
! RollCallM.Leds -> LedsC;
RollCallM.Roster -> ExptM.Roster;
! ExptM.Leds -> LedsC;
ExptM.Timer -> TimerC.Timer[unique("Timer")];
#if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
! ExptM.CC1KControl -> CC1000RadioC;
#endif
}
Index: RollCallM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/RollCallM.nc,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -C2 -d -r1.4 -r1.4.2.1
*** RollCallM.nc 8 Oct 2004 20:50:19 -0000 1.4
--- RollCallM.nc 11 Nov 2004 13:43:26 -0000 1.4.2.1
***************
*** 3,6 ****
--- 3,8 ----
includes TimeSync;
includes ResultPacket;
+ includes TimeStamp;
+ includes PacketTypes;
includes CommonParams;
***************
*** 16,20 ****
interface ReceiveMsg as ReceiveReport;
! interface AggressiveSendControl;
interface EpochScheduler;
--- 18,22 ----
interface ReceiveMsg as ReceiveReport;
! interface AggressiveSendControl as AggSendCtl;
interface EpochScheduler;
***************
*** 34,37 ****
--- 36,41 ----
interface Roster;
+
+ interface TimeSetListener;
}
}
***************
*** 44,55 ****
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;
--- 48,51 ----
***************
*** 117,124 ****
// 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;
***************
*** 170,223 ****
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) {
! // Stale
!
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);
}
event void EpochScheduler.epochOver() {
uint8_t curTreeLevel = call RouteControl.getDepth();
--- 167,227 ----
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();
+
}
event void EpochScheduler.epochOver() {
+
uint8_t curTreeLevel = call RouteControl.getDepth();
***************
*** 251,256 ****
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);
}
***************
*** 263,273 ****
// Variables for the compression of the bitmap
! uint8_t projLen, idxLen;
! dbg(DBG_USR3, "^^ Round %u over, reporting these as alive to %u\n",
! rollCallRound,
call RouteControl.getParent());
printSet(aliveSet);
!
// Submit the report
aliveMsg->round = rollCallRound;
--- 267,282 ----
// Variables for the compression of the bitmap
! 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);
!
// Submit the report
aliveMsg->round = rollCallRound;
***************
*** 278,285 ****
--- 287,299 ----
if (preprocessSet(aliveSet, &projLen, &idxLen)) {
+
+ // call Leds.redToggle();
// Compress the set
compressSet(aliveSet, &aliveMsg->alive, idxLen);
} else {
+
+ // call Leds.greenToggle();
+
// Copy the set
copySet(&aliveMsg->alive, aliveSet);
***************
*** 287,343 ****
} else {
// Report just the dead nodes
copySet(&aliveMsg->alive, call Roster.getRoster());
!
! subtractSet(&aliveMsg->alive, aliveSet);
dbg(DBG_USR3, "~~ Gateway node reports these have died\n");
printSet(&aliveMsg->alive);
! statsPkt->numFailedNodes = setLength(&aliveMsg->alive);
}
-
dbg(DBG_USR3, "neighbor message SIZE OF ALIVE SET = %u\n",
! sizeOfSet(aliveSet));
{
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(RosterMsg) - sizeof(Set) +
! sizeOfSet(&aliveMsg->alive),
&rollCallMsg) == FAIL) {
- call Leds.redToggle();
-
dbg(DBG_USR3, "^^ send FAILED to SHIP!\n");
!
! if (sendRetries > MAX_SEND_RETRIES) {
! sendRetries = 0;
!
! finishRound();
! } else {
! sendRetries++;
!
! call Timer.start(TIMER_ONE_SHOT,
! WAIT_PER_LEVEL);
! }
} else {
dbg(DBG_USR3, "^^ send SHIPPED successfully!\n");
}
}
--- 301,372 ----
} else {
// Report just the dead nodes
+
copySet(&aliveMsg->alive, call Roster.getRoster());
! subtractSets(&aliveMsg->alive, aliveSet);
dbg(DBG_USR3, "~~ Gateway node reports these have died\n");
printSet(&aliveMsg->alive);
! statsPkt->numFailedNodes += setLength(&aliveMsg->alive);
}
dbg(DBG_USR3, "neighbor message SIZE OF ALIVE SET = %u\n",
! projLen);
{
uint16_t tgtAddr = TOS_BCAST_ADDR;
+ uint16_t pktSize;
+ uint8_t saveBcastRetries;
! 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) +
! projLen;
! }
!
! 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,
! sizeof(RosterMsg),
! sizeof(Set),
sizeOfSet(&aliveMsg->alive),
+ (aliveMsg->alive.compressed ? "COMPRESSED" : "UNCOMPRESSED"),
call RouteControl.getParent(),
(call RouteControl.getDepth() == 0 ? "-------\n" : "\n"));
! printSetBits(&aliveMsg->alive);
!
dbg(DBG_USR3, "^^ SHIPPING!!!\n");
+
if (call SendReport.send(tgtAddr,
! pktSize,
&rollCallMsg) == FAIL) {
dbg(DBG_USR3, "^^ send FAILED to SHIP!\n");
!
} else {
+ call Leds.greenToggle();
+
dbg(DBG_USR3, "^^ send SHIPPED successfully!\n");
}
+
+ if (tgtAddr == TOS_BCAST_ADDR) {
+ call AggSendCtl.setBcastRetries(saveBcastRetries);
+ }
}
***************
*** 352,362 ****
if (status == SUCCESS) {
! statsPkt->bytesSent = 5 + msg->length;
!
! statsPkt->numFullUpd = 1;
! call Leds.greenToggle();
! } else
! call Leds.redToggle();
finishRound();
--- 381,392 ----
if (status == SUCCESS) {
!
! // call Leds.greenToggle();
! } else {
!
! // call Leds.redToggle();
!
! }
finishRound();
***************
*** 370,373 ****
--- 400,407 ----
sendReport();
+ // Increment the round number to prevent contamination
+ // (Will be reset next round)
+ roundOver = TRUE;
+
switchLiveSet();
***************
*** 403,406 ****
--- 437,441 ----
statsPkt->parentAddr = call RouteControl.getParent();
+ statsPkt->treeLevel = call RouteControl.getDepth();
dbg(DBG_USR1,
***************
*** 415,418 ****
--- 450,454 ----
sizeof(ResultPkt),
&statsMsg);
+
}
***************
*** 420,426 ****
--- 456,476 ----
result_t status) {
+ // Zero the stats
+ if (status == SUCCESS)
+ memset(statsPkt, 0, sizeof(ResultPkt));
+
return SUCCESS;
}
+ 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();
+ }
}
Index: genRoster.sh
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/genRoster.sh,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -C2 -d -r1.1 -r1.1.2.1
*** genRoster.sh 8 Oct 2004 20:50:19 -0000 1.1
--- genRoster.sh 11 Nov 2004 13:43:26 -0000 1.1.2.1
***************
*** 1,3 ****
#!/bin/bash
! mysql -B -N -h 127.0.0.1 -P 3306 -u stanrost -pstanr -e "select moteid from auth.motes where active !=0 and platform != 'cricket'" | awk 'BEGIN { print "#define TIME_OUT_SCHED \\" } { print "{" $0 ", 0xFFFF} \\"} END {print "{ 0xFFFF, 0xFFFF }"}' > failureSched.h
--- 1,3 ----
#!/bin/bash
! mysql -B -N -h 127.0.0.1 -P 3306 -u stanrost -pstanr -e "select moteid from auth.motes where active !=0 and platform != 'cricket'" | awk 'BEGIN { print "#define TIME_OUT_SCHED \\" } { print "{" $0 ", 0xFFFF}, \\"} END {print "{ 0xFFFF, 0xFFFF }"}' > failureSched.h
More information about the Tinyos-beta-commits
mailing list