[Tinyos-beta-commits] CVS: tinyos-1.x/beta/SystemCore/MementoMori
AggressiveSendM.nc, 1.2, 1.3 CommonParams.h, 1.1,
1.2 CompressedSet.h, 1.3, 1.4 ExptM.nc, 1.1, 1.2 RollCallC.nc,
1.3, 1.4 RollCallM.nc, 1.4, 1.5 genRoster.sh, 1.1, 1.2
Stan Rost
stanrost at users.sourceforge.net
Mon Oct 11 18:01:28 PDT 2004
Update of /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17329
Modified Files:
AggressiveSendM.nc CommonParams.h CompressedSet.h ExptM.nc
RollCallC.nc RollCallM.nc genRoster.sh
Log Message:
- Fixed two major bugs:
- CC1KControl.StdControl should not be wired to Main.StdControl (kills the radio)
- A rather nasty memory bug in set subtraction
- Modified:
- AggressiveSendM is *the* new and improved queued send
- Some tweaking of ExptM.nc
- Next:
- More debugging on the motes
- Front-end via SerialForwarder
Index: AggressiveSendM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/AggressiveSendM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AggressiveSendM.nc 8 Oct 2004 20:50:19 -0000 1.2
--- AggressiveSendM.nc 12 Oct 2004 01:01:22 -0000 1.3
***************
*** 80,85 ****
}
! task void doSend() {
dbg(DBG_USR1, "doSend()\n");
printQueue();
--- 80,87 ----
}
! bool sendInvoked = FALSE;
+ void doSend() {
+
dbg(DBG_USR1, "doSend()\n");
printQueue();
***************
*** 101,110 ****
// Msg is all set
! call SendExt.send[_msg->type](_msg->addr,
! _msg->length,
! _msg);
}
command void AggressiveSendControl.setRetries(uint8_t numRetries) {
maxRetries = numRetries;
--- 103,130 ----
// 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 void AggressiveSendControl.setRetries(uint8_t numRetries) {
maxRetries = numRetries;
***************
*** 119,122 ****
--- 139,144 ----
TOS_MsgPtr cur = headFifoQ;
+ call Leds.yellowToggle();
+
if (msg == _msg)
return FAIL;
***************
*** 130,135 ****
}
- call Leds.yellowToggle();
-
stub = getStub(msg);
--- 152,155 ----
***************
*** 159,163 ****
}
! post doSend();
return SUCCESS;
--- 179,183 ----
}
! doSend();
return SUCCESS;
***************
*** 168,172 ****
_msg = NULL;
! post doSend();
return signal SendMsg.sendDone[id](msg, success);
--- 188,192 ----
_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) {
--- 215,238 ----
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();
if (retriesLeft == 0) {
***************
*** 221,225 ****
--retriesLeft;
! post doSend();
return SUCCESS;
--- 245,249 ----
--retriesLeft;
! doSend();
return SUCCESS;
Index: CommonParams.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/CommonParams.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** CommonParams.h 8 Oct 2004 20:50:19 -0000 1.1
--- CommonParams.h 12 Oct 2004 01:01:23 -0000 1.2
***************
*** 2,15 ****
#define _SR_COMMON__
enum {
// Nodes awaken every ROLLCALL_PERIOD...
! ROLLCALL_PERIOD = 30 * 1024,
// 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
--- 2,16 ----
#define _SR_COMMON__
+ #include "CompressedSet.h"
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
Index: CompressedSet.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/CompressedSet.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** CompressedSet.h 8 Oct 2004 20:50:19 -0000 1.3
--- CompressedSet.h 12 Oct 2004 01:01:23 -0000 1.4
***************
*** 91,94 ****
--- 91,95 ----
void printSetBits(Set *s) {
+ #if defined(PLATFORM_PC)
uint8_t i;
***************
*** 122,129 ****
--- 123,132 ----
dbg_clear(DBG_USR1, "\n");
}
+ #endif
}
void printSet(Set *s) {
+ #if defined(PLATFORM_PC)
uint8_t i, j, k =0;
***************
*** 144,147 ****
--- 147,151 ----
dbg_clear(DBG_USR1, "\n");
}
+ #endif
}
***************
*** 149,153 ****
void subtractSet(Set *s1,
Set *s2) {
! uint8_t i, maxLen;
if (s1 == NULL ||
--- 153,157 ----
void subtractSet(Set *s1,
Set *s2) {
! uint8_t i;
if (s1 == NULL ||
***************
*** 155,164 ****
return;
! maxLen = s1->len;
! s1->len = 0;
- for (i = 0; i < maxLen; i++) {
- if ((s1->data[i] &= ~(s2->data[i])) != 0)
- s1->len = i+1;
}
--- 159,181 ----
return;
! if (s1->len > s2->len) {
! // Length of s1 really does not change
!
! for (i = 0; i < s2->len; i++) {
! s1->data[i] &= ~(s2->data[i]);
! }
!
! } else {
! // Length of s1 might change
! uint8_t minLen;
!
! minLen = s1->len;
! s1->len = 0;
!
! for (i = 0; i < minLen; i++) {
! if ((s1->data[i] &= ~(s2->data[i])) != 0)
! s1->len = i+1;
! }
}
***************
*** 351,355 ****
return (s->len + s->len * 8 / 2 + 1);
else
! // Number of bytes and header
return (s->len + 1);
}
--- 368,372 ----
return (s->len + s->len * 8 / 2 + 1);
else
! // Number of bytes, and header
return (s->len + 1);
}
Index: ExptM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/ExptM.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ExptM.nc 8 Oct 2004 20:50:19 -0000 1.1
--- ExptM.nc 12 Oct 2004 01:01:23 -0000 1.2
***************
*** 91,94 ****
--- 91,99 ----
printSet(liveRSet);
+ return SUCCESS;
+ }
+
+ command result_t StdControl.start() {
+
// Set the radio power
#ifdef PLATFORM_MICA2
***************
*** 97,105 ****
#endif
- return SUCCESS;
- }
-
- command result_t StdControl.start() {
-
call PowerArbiter.useResource(PWR_RADIO);
--- 102,105 ----
***************
*** 113,116 ****
--- 113,118 ----
command Set *Roster.getRoster() {
return (Set *)liveRoster;
+
+ return NULL;
}
Index: RollCallC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/RollCallC.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** RollCallC.nc 8 Oct 2004 20:50:19 -0000 1.3
--- RollCallC.nc 12 Oct 2004 01:01:23 -0000 1.4
***************
*** 12,19 ****
}
implementation {
! components PowerArbiterC, EpochSchedulerC,
TimerC, GenericCommPromiscuous as Comm,
! RollCallM, UsefulTimeC, RandomLFSR,
! AggressiveSendM, LedsC, NoLeds,
#if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
--- 12,25 ----
}
implementation {
! components
! PowerArbiterC,
! EpochSchedulerC,
TimerC, GenericCommPromiscuous as Comm,
! RollCallM,
! UsefulTimeC,
! RandomLFSR,
! AggressiveSendM,
!
! // QueuedSend,
#if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
***************
*** 21,25 ****
#endif
! ExptM;
StdControl = Comm;
--- 27,32 ----
#endif
! ExptM,
! LedsC, NoLeds;
StdControl = Comm;
***************
*** 27,34 ****
StdControl = TimerC;
StdControl = RollCallM;
StdControl = ExptM;
#if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
! StdControl = CC1000ControlM;
#endif
--- 34,42 ----
StdControl = TimerC;
StdControl = RollCallM;
+ // StdControl = QueuedSend;
StdControl = ExptM;
#if defined(PLATFORM_MICA2) || defined(PLATFORM_MICA2DOT)
! // StdControl = CC1000ControlM;
#endif
***************
*** 41,66 ****
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;
--- 49,81 ----
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];
AggressiveSendM.SendExt -> Comm.SendMsg;
!
! AggressiveSendM.Leds -> NoLeds;
!
/*
! 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 -> LedsC;
RollCallM.Roster -> ExptM.Roster;
Index: RollCallM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/RollCallM.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** RollCallM.nc 8 Oct 2004 20:50:19 -0000 1.4
--- RollCallM.nc 12 Oct 2004 01:01:23 -0000 1.5
***************
*** 3,6 ****
--- 3,7 ----
includes TimeSync;
includes ResultPacket;
+ includes TimeStamp;
includes CommonParams;
***************
*** 140,144 ****
}
command result_t StdControl.start() {
!
// Init the round timing
call EpochScheduler.addSchedule(ROLLCALL_PERIOD,
--- 141,145 ----
}
command result_t StdControl.start() {
!
// Init the round timing
call EpochScheduler.addSchedule(ROLLCALL_PERIOD,
***************
*** 211,223 ****
// 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();
--- 212,223 ----
// 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();
***************
*** 269,273 ****
call RouteControl.getParent());
printSet(aliveSet);
!
// Submit the report
aliveMsg->round = rollCallRound;
--- 269,273 ----
call RouteControl.getParent());
printSet(aliveSet);
!
// Submit the report
aliveMsg->round = rollCallRound;
***************
*** 275,285 ****
--- 275,292 ----
// XXX: Projected length might exceed
// the size of the packet
+
+ // XXXXXXXXXXXXXX
if (!isGateway) {
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);
***************
*** 296,300 ****
statsPkt->numFailedNodes = setLength(&aliveMsg->alive);
}
-
dbg(DBG_USR3, "neighbor message SIZE OF ALIVE SET = %u\n",
--- 303,306 ----
***************
*** 319,330 ****
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;
--- 325,339 ----
dbg(DBG_USR3, "^^ SHIPPING!!!\n");
+
if (call SendReport.send(tgtAddr,
! sizeof(uint16_t) +
sizeOfSet(&aliveMsg->alive),
! &rollCallMsg) == FAIL) {
+
dbg(DBG_USR3, "^^ send FAILED to SHIP!\n");
!
! call Leds.redToggle();
!
if (sendRetries > MAX_SEND_RETRIES) {
sendRetries = 0;
***************
*** 332,335 ****
--- 341,345 ----
finishRound();
} else {
+
sendRetries++;
***************
*** 338,341 ****
--- 348,353 ----
}
} else {
+ call Leds.greenToggle();
+
dbg(DBG_USR3, "^^ send SHIPPED successfully!\n");
}
***************
*** 355,362 ****
statsPkt->numFullUpd = 1;
! call Leds.greenToggle();
! } else
! call Leds.redToggle();
finishRound();
--- 367,378 ----
statsPkt->numFullUpd = 1;
+
+ // call Leds.greenToggle();
! } else {
!
! // call Leds.redToggle();
!
! }
finishRound();
***************
*** 412,418 ****
statsPkt->numFullUpd);
! call SendStats.send(TOS_UART_ADDR,
! sizeof(ResultPkt),
! &statsMsg);
}
--- 428,438 ----
statsPkt->numFullUpd);
! if (call SendStats.send(TOS_UART_ADDR,
! sizeof(ResultPkt),
! &statsMsg) == SUCCESS) {
! // call Leds.greenToggle();
! } else {
! // call Leds.redToggle();
! }
}
Index: genRoster.sh
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/genRoster.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** genRoster.sh 8 Oct 2004 20:50:19 -0000 1.1
--- genRoster.sh 12 Oct 2004 01:01:23 -0000 1.2
***************
*** 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