[Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/TestTrickleTimer
Driver.c, NONE, 1.1.4.2 Makefile, NONE,
1.1.4.2 Makefile.Driver, NONE, 1.1.4.2 TestTrickleC.nc, NONE,
1.1.4.2 TestTrickleTimerAppC.nc, NONE,
1.1.4.2 TestTrickleTimerAppP.nc, NONE,
1.1.4.2 TestTrickleTimerC.nc, NONE, 1.1.4.2 test.py, NONE, 1.1.4.2
Kevin Klues
klueska at users.sourceforge.net
Mon May 15 11:35:27 PDT 2006
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/TestTreeRouting
Makefile, NONE, 1.1.4.2 Makefile.driver, NONE, 1.1.4.2 README,
NONE, 1.1.4.2 TestTreeRoutingC.nc, NONE,
1.1.4.2 TestTreeRoutingP.nc, NONE, 1.1.4.2 test.cc, NONE,
1.1.4.2 test.py, NONE, 1.1.4.2 topo.txt, NONE, 1.1.4.2
- Next message: [Tinyos-2-commits]
CVS: tinyos-2.x/apps/tests/eyesIFX/Radio/TestBasicMac
Makefile, NONE, 1.2.2.2 TestBasicMacC.nc, NONE,
1.2.2.2 TestBasicMacP.nc, NONE, 1.1.4.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/apps/tests/TestTrickleTimer
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv18756/apps/tests/TestTrickleTimer
Added Files:
Tag: tos-2-resource-pm-eval-cand
Driver.c Makefile Makefile.Driver TestTrickleC.nc
TestTrickleTimerAppC.nc TestTrickleTimerAppP.nc
TestTrickleTimerC.nc test.py
Log Message:
Merging the development branch with the resource/power management evaluation branch. After this merge all files except those already commited should be identical.
--- NEW FILE: Driver.c ---
#include <tossim.h>
int main() {
nesc_app_t na;
na.numVariables = 1;
na.variableNames = (char**)malloc(sizeof(char*));
na.variableTypes = (char**)malloc(sizeof(char*));
na.variableArray = (int*)malloc(sizeof(int));
na.variableNames[0] = "TestSerialC.arrayTest";
na.variableTypes[0] = "int";
na.variableArray[0] = 1;
Tossim* t = new Tossim(&na);
t->init();
// t->addChannel("BlinkC", fdopen(1, "w"));
// t->addChannel("HplAtm128CompareC", fdopen(1, "w"));
//t->addChannel("HplCounter0C", fdopen(1, "w"));
//t->addChannel("Atm128AlarmC", fdopen(1, "w"));
//t->addChannel("TransformAlarmCounterC", fdopen(1, "w"));
//t->addChannel("Scheduler", fdopen(1, "w"));
//t->addChannel("Trickle", fdopen(1, "w"));
t->addChannel("TestTrickle", fdopen(1, "w"));
t->addChannel("TrickleTimes", fdopen(1, "w"));
for (int i = 0; i < 1; i++) {
printf("Mote %i at %i\n", i, 500 * i + 1);
Mote* m = t->getNode(i);
m->bootAtTime(500 * i + 1);
}
for (int i = 0; i < 5000; i++) {
t->runNextEvent();
}
int x = 2;
for (int i = 0; i < 5000; i++) {
t->runNextEvent();
}
// Mote* m = t->getNode(2);
//Variable* v = m->getVariable("TestSerialC.arrayTest");
// variable_string_t s = v->getData();
//printf ("TestSerialC.arrayTest: %s %s\n", s.type, s.isArray? "[]":"");
}
--- NEW FILE: Makefile ---
COMPONENT=TestTrickleTimerAppC
CFLAGS += -I%T/lib/oski -I%T/lib/net -I.
include $(MAKERULES)
--- NEW FILE: Makefile.Driver ---
all:
make micaz sim
g++ -g -c -o Driver.o Driver.c -I../../../tos/lib/tossim/ -Lbuild/micaz -L.
g++ -o Driver Driver.o build/micaz/sim.o build/micaz/tossim.o
--- NEW FILE: TestTrickleC.nc ---
// $Id: TestTrickleC.nc,v 1.1.4.2 2006/05/15 18:35:25 klueska Exp $
/*
* "Copyright (c) 2006 Stanford University. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose, without fee, and without written
* agreement is hereby granted, provided that the above copyright
* notice, the following two paragraphs and the author appear in all
* copies of this software.
*
* IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF STANFORD UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* STANFORD UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
* PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND STANFORD UNIVERSITY
* HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
* ENHANCEMENTS, OR MODIFICATIONS."
*/
/*
* Test of the trickle timers.
* @author Philip Levis
* @date Jan 7 2006
*/
#include <TestTrickle.h>
configuration TestTrickleC {
provides interface TrickleTimer[uint8_t];
}
implementation {
components new TrickleTimerMilliC(1, 120, 2, uniqueCount(UQ_TEST_TRICKLE));
TrickleTimer = TrickleTimerMilliC;
}
--- NEW FILE: TestTrickleTimerAppC.nc ---
// $Id: TestTrickleTimerAppC.nc,v 1.1.4.2 2006/05/15 18:35:25 klueska Exp $
/*
* "Copyright (c) 2006 Stanford University. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose, without fee, and without written
* agreement is hereby granted, provided that the above copyright
* notice, the following two paragraphs and the author appear in all
* copies of this software.
*
* IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF STANFORD UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* STANFORD UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
* PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND STANFORD UNIVERSITY
* HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
* ENHANCEMENTS, OR MODIFICATIONS."
*/
/*
* Test of the trickle timers.
* @author Philip Levis
* @date Jan 7 2006
*/
configuration TestTrickleTimerAppC {
}
implementation {
components TestTrickleTimerAppP, MainC, RandomC;
components new TestTrickleTimerC() as TimerA;
components new TestTrickleTimerC() as TimerB;
components new TestTrickleTimerC() as TimerC;
components new TestTrickleTimerC() as TimerD;
components new TimerMilliC();
components new BitVectorC(1) as PendingVector;
components new BitVectorC(1) as ChangeVector;
// Timer.Timer -> TimerMilliC;
//Timer.Random -> RandomC;
//Timer.Changed -> ChangeVector;
//Timer.Pending -> PendingVector;
MainC.SoftwareInit -> TestTrickleTimerAppP;
TestTrickleTimerAppP.Boot -> MainC.Boot;
TestTrickleTimerAppP.TimerA -> TimerA;
TestTrickleTimerAppP.TimerB -> TimerB;
TestTrickleTimerAppP.TimerC -> TimerC;
TestTrickleTimerAppP.TimerD -> TimerD;
}
--- NEW FILE: TestTrickleTimerAppP.nc ---
// $Id: TestTrickleTimerAppP.nc,v 1.1.4.2 2006/05/15 18:35:25 klueska Exp $
/*
* "Copyright (c) 2006 Stanford University. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose, without fee, and without written
* agreement is hereby granted, provided that the above copyright
* notice, the following two paragraphs and the author appear in all
* copies of this software.
*
* IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF STANFORD UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* STANFORD UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
* PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND STANFORD UNIVERSITY
* HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
* ENHANCEMENTS, OR MODIFICATIONS."
*/
/*
* Test of the trickle timers.
* @author Philip Levis
* @date Jan 7 2006
*/
module TestTrickleTimerAppP {
provides interface Init;
uses {
interface Boot;
interface TrickleTimer as TimerA;
interface TrickleTimer as TimerB;
interface TrickleTimer as TimerC;
interface TrickleTimer as TimerD;
}
}
implementation {
bool a = 0;
bool b = 0;
bool c = 0;
bool d = 0;
command error_t Init.init() {return SUCCESS;}
event void Boot.booted() {
a = 1;
call TimerA.reset();
call TimerA.start();
}
event void TimerA.fired() {
dbg("TestTrickle", " Timer A fired at %s\n", sim_time_string());
if (!b) {
call TimerB.reset();
call TimerB.start();
b = 1;
}
}
event void TimerB.fired() {
dbg("TestTrickle", " Timer B fired at %s\n", sim_time_string());
if (!c) {
call TimerC.reset();
call TimerC.start();
b = 1;
}
}
event void TimerC.fired() {
dbg("TestTrickle", " Timer C fired at %s\n", sim_time_string());
if (!d) {
call TimerD.reset();
call TimerD.start();
b = 1;
}
}
uint8_t i = 0;
event void TimerD.fired() {
dbg("TestTrickle", "Timer D fired at %s\n", sim_time_string());
i++;
i = i % 3;
switch (i) {
case 0:
// call TimerA.reset();
break;
case 1:
// call TimerB.reset();
break;
case 2:
call TimerC.reset();
break;
case 3:
call TimerD.reset();
break;
}
}
}
--- NEW FILE: TestTrickleTimerC.nc ---
// $Id: TestTrickleTimerC.nc,v 1.1.4.2 2006/05/15 18:35:25 klueska Exp $
/*
* "Copyright (c) 2006 Stanford University. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose, without fee, and without written
* agreement is hereby granted, provided that the above copyright
* notice, the following two paragraphs and the author appear in all
* copies of this software.
*
* IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF STANFORD UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* STANFORD UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
* PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND STANFORD UNIVERSITY
* HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
* ENHANCEMENTS, OR MODIFICATIONS."
*/
/*
* Test of the trickle timers.
* @author Philip Levis
* @date Jan 7 2006
*/
#include <TestTrickle.h>
generic configuration TestTrickleTimerC() {
provides interface TrickleTimer;
}
implementation {
components TestTrickleC;
TrickleTimer = TestTrickleC.TrickleTimer[unique(UQ_TEST_TRICKLE)];
}
--- NEW FILE: test.py ---
from TOSSIM import *
import sys
t = Tossim([]);
t.init()
t.addChannel("Trickle", sys.stdout);
for i in range(0, 10):
m = t.getNode(i)
m.bootAtTime(i * 5023211 + 10002322)
for i in range(0, 100):
t.runNextEvent()
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/TestTreeRouting
Makefile, NONE, 1.1.4.2 Makefile.driver, NONE, 1.1.4.2 README,
NONE, 1.1.4.2 TestTreeRoutingC.nc, NONE,
1.1.4.2 TestTreeRoutingP.nc, NONE, 1.1.4.2 test.cc, NONE,
1.1.4.2 test.py, NONE, 1.1.4.2 topo.txt, NONE, 1.1.4.2
- Next message: [Tinyos-2-commits]
CVS: tinyos-2.x/apps/tests/eyesIFX/Radio/TestBasicMac
Makefile, NONE, 1.2.2.2 TestBasicMacC.nc, NONE,
1.2.2.2 TestBasicMacP.nc, NONE, 1.1.4.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list