[Tinyos-beta-commits] CVS: tinyos-1.x/beta/Drain Drain.h, 1.15,
1.16 DrainC.nc, 1.12, 1.13 DrainLinkEstM.nc, 1.21,
1.22 DrainM.nc, 1.20, 1.21 DrainTestM.nc, 1.1, 1.2
Gilman Tolle
gtolle at users.sourceforge.net
Thu Aug 18 15:27:43 PDT 2005
Update of /cvsroot/tinyos/tinyos-1.x/beta/Drain
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18208
Modified Files:
Drain.h DrainC.nc DrainLinkEstM.nc DrainM.nc DrainTestM.nc
Log Message:
Reorganized the task posting within DrainM, and added a separate timer to recover from task post failure. Aggressively stress tested on telosb, and is much more stable under heavy load.
Index: Drain.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Drain/Drain.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Drain.h 11 Aug 2005 20:19:33 -0000 1.15
--- Drain.h 18 Aug 2005 22:27:41 -0000 1.16
***************
*** 56,59 ****
--- 56,61 ----
DRAIN_INVALID_SLOT = 0xFF,
DRAIN_MAX_CHILDREN = 8,
+ DRAIN_QUEUE_SEND = 1,
+ DRAIN_QUEUE_FWD = 2,
};
Index: DrainC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Drain/DrainC.nc,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** DrainC.nc 14 Jun 2005 18:16:22 -0000 1.12
--- DrainC.nc 18 Aug 2005 22:27:41 -0000 1.13
***************
*** 95,98 ****
--- 95,100 ----
#endif
+ // components CC2420C;
+
#if defined(_CC1KCONST_H)
components CC1000RadioC;
***************
*** 123,126 ****
--- 125,129 ----
DrainM.Timer -> TimerC.Timer[unique("Timer")];
+ DrainM.PostFailTimer -> TimerC.Timer[unique("Timer")];
DrainM.DrainGroup -> DrainGroupManagerM;
Index: DrainLinkEstM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Drain/DrainLinkEstM.nc,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** DrainLinkEstM.nc 28 Jul 2005 20:31:18 -0000 1.21
--- DrainLinkEstM.nc 18 Aug 2005 22:27:41 -0000 1.22
***************
*** 228,232 ****
route->sendWaiting = TRUE;
! sendRoute(route);
return SUCCESS;
--- 228,232 ----
route->sendWaiting = TRUE;
! call Timer.start(TIMER_ONE_SHOT, 10);
return SUCCESS;
***************
*** 591,594 ****
--- 591,595 ----
if (timerRunning) {
+ dbg(DBG_ROUTE, "startTimer() - timer running. Returning.\n");
return;
}
Index: DrainM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Drain/DrainM.nc,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** DrainM.nc 12 Aug 2005 20:07:17 -0000 1.20
--- DrainM.nc 18 Aug 2005 22:27:41 -0000 1.21
***************
*** 66,70 ****
uses {
interface StdControl as SubControl;
!
interface Leds;
--- 66,70 ----
uses {
interface StdControl as SubControl;
!
interface Leds;
***************
*** 77,80 ****
--- 77,82 ----
interface Timer;
+ interface Timer as PostFailTimer;
+
#if defined(_CC2420CONST_H) || defined(_CC1KCONST_H)
interface MacControl;
***************
*** 94,100 ****
uint8_t fwdQueueIn, fwdQueueOut, fwdQueueCount;
bool queuesBusy;
! bool baseAcks;
uint8_t backoff;
--- 96,105 ----
uint8_t fwdQueueIn, fwdQueueOut, fwdQueueCount;
+ uint8_t queueChoice;
+
bool queuesBusy;
+ bool radioBusy;
! bool baseAcks = TRUE;
uint8_t backoff;
***************
*** 128,131 ****
--- 133,141 ----
task void errorBlink();
+ task void enableAck();
+
+ void postService();
+ void postServiceCheck();
+
command result_t StdControl.init() {
initializeBufs();
***************
*** 135,141 ****
void initializeBufs() {
int n;
- /*
for (n=0; n < DRAIN_FWD_QUEUE_SIZE; n++) {
fwdQueue[n] = &fwdBuffers[n];
--- 145,151 ----
void initializeBufs() {
+ /*
int n;
for (n=0; n < DRAIN_FWD_QUEUE_SIZE; n++) {
fwdQueue[n] = &fwdBuffers[n];
***************
*** 221,232 ****
result_t enqueueSend(TOS_MsgPtr pMsg) {
! if (!queuesBusy) {
! if (post QueueServiceTask() == FAIL) {
! sendDrops++;
! return FAIL;
! } else {
! queuesBusy = TRUE;
! }
! }
#if DRAIN_DEBUG_DETAILED
--- 231,235 ----
result_t enqueueSend(TOS_MsgPtr pMsg) {
! postServiceCheck();
#if DRAIN_DEBUG_DETAILED
***************
*** 242,245 ****
--- 245,266 ----
}
+ void postServiceCheck() {
+ if (!queuesBusy) { // && !radioBusy) {
+ postService();
+ queuesBusy = TRUE;
+ }
+ }
+
+ void postService() {
+ if (post QueueServiceTask() == FAIL) {
+ call PostFailTimer.start(TIMER_ONE_SHOT, 10);
+ }
+ }
+
+ event result_t PostFailTimer.fired() {
+ postService();
+ return SUCCESS;
+ }
+
event TOS_MsgPtr LinkReceiveMsg.receive(TOS_MsgPtr pMsg) {
***************
*** 298,311 ****
TOS_MsgPtr enqueueForward(TOS_MsgPtr pMsg) {
! TOS_MsgPtr pNewBuf;
! if (!queuesBusy) {
! if (post QueueServiceTask() == FAIL) {
! forwardDrops++;
! return pMsg;
! } else {
! queuesBusy = TRUE;
! }
! }
#if DRAIN_DEBUG_DETAILED
--- 319,325 ----
TOS_MsgPtr enqueueForward(TOS_MsgPtr pMsg) {
! TOS_MsgPtr pNewBuf = pMsg;
! postServiceCheck();
#if DRAIN_DEBUG_DETAILED
***************
*** 338,341 ****
--- 352,359 ----
// We've got a message in the send queue.
pMsg = sendQueue[sendQueueOut];
+ if (queueChoice != DRAIN_QUEUE_SEND) {
+ backoff = 0;
+ }
+ queueChoice = DRAIN_QUEUE_SEND;
} else if (fwdQueueCount > 0) {
***************
*** 347,358 ****
// We've got a message in the forward queue.
pMsg = &fwdBuffers[fwdQueueOut];
} else {
#if DRAIN_DEBUG_DETAILED
dbg(DBG_ROUTE, "Drain: queueServiceTask(queuesAllEmpty)\n");
#endif
- queuesBusy = FALSE;
return;
}
--- 365,381 ----
// We've got a message in the forward queue.
pMsg = &fwdBuffers[fwdQueueOut];
+ if (queueChoice != DRAIN_QUEUE_FWD) {
+ backoff = 0;
+ }
+ queueChoice = DRAIN_QUEUE_FWD;
} else {
+ queuesBusy = FALSE;
+
#if DRAIN_DEBUG_DETAILED
dbg(DBG_ROUTE, "Drain: queueServiceTask(queuesAllEmpty)\n");
#endif
return;
}
***************
*** 363,366 ****
--- 386,394 ----
pMsg, pMsg->addr, pMsg->length);
+ if (pMsg->length == 1) {
+ // call Leds.greenOn();
+ dbg(DBG_USR1, "DrainM: LENGTH == 1!!!\n");
+ }
+
if (call LinkSendMsg.send(pMsg->addr, pMsg->length, pMsg) == SUCCESS) {
#if DRAIN_DEBUG_DETAILED
***************
*** 368,371 ****
--- 396,400 ----
#endif
// Wait for the sendDone.
+ radioBusy = TRUE;
} else {
// The radio didn't accept our message.
***************
*** 378,382 ****
event result_t Timer.fired() {
! post QueueServiceTask();
return SUCCESS;
}
--- 407,411 ----
event result_t Timer.fired() {
! postService();
return SUCCESS;
}
***************
*** 392,403 ****
#endif
! if (pMsg != sendQueue[sendQueueOut] &&
pMsg != &fwdBuffers[fwdQueueOut]) {
! // THIS IS A BUG, IF IT HAPPENS.
return SUCCESS;
}
if (!success) {
! post QueueServiceTask();
return SUCCESS;
}
--- 421,441 ----
#endif
! radioBusy = FALSE;
!
! if (queueChoice == DRAIN_QUEUE_SEND &&
! pMsg != sendQueue[sendQueueOut]) {
! // call Leds.greenOn();
! postService();
! return SUCCESS;
! }
!
! if (queueChoice == DRAIN_QUEUE_FWD &&
pMsg != &fwdBuffers[fwdQueueOut]) {
! postService();
return SUCCESS;
}
if (!success) {
! postService();
return SUCCESS;
}
***************
*** 453,457 ****
pMsg, forwardResultVal);
! if (pMsg == sendQueue[sendQueueOut]) {
if (forwardResultVal == SUCCESS) {
--- 491,497 ----
pMsg, forwardResultVal);
! if (queueChoice == DRAIN_QUEUE_SEND) {
!
! pMsg = sendQueue[sendQueueOut];
if (forwardResultVal == SUCCESS) {
***************
*** 462,471 ****
sendQueueCount--;
if (++sendQueueOut >= DRAIN_SEND_QUEUE_SIZE)
sendQueueOut = 0;
! post QueueServiceTask();
! } else if (pMsg == &fwdBuffers[fwdQueueOut]) {
if (forwardResultVal == SUCCESS) {
--- 502,512 ----
sendQueueCount--;
+ sendQueue[sendQueueOut] = 0;
if (++sendQueueOut >= DRAIN_SEND_QUEUE_SIZE)
sendQueueOut = 0;
! } else if (queueChoice == DRAIN_QUEUE_FWD) {
! pMsg = &fwdBuffers[fwdQueueOut];
if (forwardResultVal == SUCCESS) {
***************
*** 477,487 ****
fwdQueueOut = 0;
- post QueueServiceTask();
-
} else {
dbg(DBG_ROUTE, "Drain: ERROR! RECEIVED SEND DONE FOR MESSAGE NOT IN QUEUE (pMsg=0x%x)\n", pMsg);
}
!
return SUCCESS;
}
--- 518,528 ----
fwdQueueOut = 0;
} else {
dbg(DBG_ROUTE, "Drain: ERROR! RECEIVED SEND DONE FOR MESSAGE NOT IN QUEUE (pMsg=0x%x)\n", pMsg);
}
!
! postService();
!
return SUCCESS;
}
Index: DrainTestM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Drain/DrainTestM.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DrainTestM.nc 18 Aug 2005 05:19:37 -0000 1.1
--- DrainTestM.nc 18 Aug 2005 22:27:41 -0000 1.2
***************
*** 36,44 ****
bool sender;
! uint16_t sendPeriod = 1000;
command result_t StdControl.init() { return SUCCESS; }
! command result_t StdControl.start() { return SUCCESS; }
command result_t StdControl.stop() { return SUCCESS; }
--- 36,51 ----
bool sender;
! uint16_t sendPeriod = 4;
command result_t StdControl.init() { return SUCCESS; }
! command result_t StdControl.start() {
! #ifdef PLATFORM_PC
! sender = TRUE;
! call Timer.start(TIMER_ONE_SHOT, sendPeriod);
! #endif
! return SUCCESS;
! }
!
command result_t StdControl.stop() { return SUCCESS; }
***************
*** 74,78 ****
}
! call Leds.redOn();
testMHMsg->seqno = seqno;
--- 81,85 ----
}
! call Leds.yellowOn();
testMHMsg->seqno = seqno;
***************
*** 83,86 ****
--- 90,94 ----
== FAIL) {
msgBufBusy = FALSE;
+ dbg(DBG_USR1, "DrainTestM: network busy!\n");
}
***************
*** 93,101 ****
msg, success);
! if (msg == &msgBuf) {
msgBufBusy = FALSE;
}
! call Leds.redOff();
seqno++;
--- 101,113 ----
msg, success);
! // if (msg == &msgBuf) {
! if (msgBufBusy == TRUE) {
msgBufBusy = FALSE;
+ } else {
+ // call Leds.greenOn();
}
! call Leds.yellowOff();
!
seqno++;
More information about the Tinyos-beta-commits
mailing list