[Tinyos-2-commits]
CVS: tinyos-2.x-contrib/tunit/tests/tinyos-2.x/tos/chips/cc2420/TestInUseRxDutyCycle
Makefile, NONE, 1.1 TestRadioC.nc, NONE, 1.1 TestRadioP.nc,
NONE, 1.1 suite.properties, NONE, 1.1
David Moss
mossmoss at users.sourceforge.net
Sat Jul 21 22:31:47 PDT 2007
- Previous message: [Tinyos-2-commits]
CVS: tinyos-2.x-contrib/tunit/tests/tinyos-2.x/tos/chips/cc2420/TestHwAcks
Makefile, NONE, 1.1 TestTunitC.nc, NONE, 1.1 TestTunitP.nc,
NONE, 1.1 suite.properties, NONE, 1.1
- Next message: [Tinyos-2-commits]
CVS: tinyos-2.x-contrib/tunit/tests/tinyos-2.x/tos/chips/cc2420/TestInUseTxDutyCycle
Makefile, NONE, 1.1 TestRadioC.nc, NONE, 1.1 TestRadioP.nc,
NONE, 1.1 suite.properties, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x-contrib/tunit/tests/tinyos-2.x/tos/chips/cc2420/TestInUseRxDutyCycle
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19699/TestInUseRxDutyCycle
Added Files:
Makefile TestRadioC.nc TestRadioP.nc suite.properties
Log Message:
Moved from a flat directory structure to a project-oriented directory structure
--- NEW FILE: Makefile ---
COMPONENT=TestRadioC
include $(MAKERULES)
--- NEW FILE: TestRadioC.nc ---
#include "TestCase.h"
/**
* @author David Moss
*/
configuration TestRadioC {
}
implementation {
components
new TestCaseC() as TestInUseDutyCycleC;
components TestRadioP,
ActiveMessageC,
new AMSenderC(4),
new AMReceiverC(4),
new TimerMilliC(),
new StateC(),
LedsC;
TestRadioP.SetUpOneTime -> TestInUseDutyCycleC.SetUpOneTime;
TestRadioP.SetUp -> TestInUseDutyCycleC.SetUp;
TestRadioP.TearDownOneTime -> TestInUseDutyCycleC.TearDownOneTime;
TestRadioP.TestInUseDutyCycle -> TestInUseDutyCycleC;
TestRadioP.SplitControl -> ActiveMessageC;
TestRadioP.AMSend -> AMSenderC;
TestRadioP.Receive -> AMReceiverC;
TestRadioP.PacketAcknowledgements -> ActiveMessageC;
TestRadioP.Timer -> TimerMilliC;
TestRadioP.State -> StateC;
TestRadioP.Leds -> LedsC;
}
--- NEW FILE: TestRadioP.nc ---
#include "TestCase.h"
/**
* @author David Moss
*/
module TestRadioP {
uses {
interface TestControl as SetUpOneTime;
interface TestControl as SetUp;
interface TestControl as TearDownOneTime;
interface TestCase as TestInUseDutyCycle;
interface SplitControl;
interface AMSend;
interface Receive;
interface PacketAcknowledgements;
interface Timer<TMilli>;
interface State;
interface Leds;
}
}
implementation {
uint16_t successfulReceiveCycles;
bool justStarted;
message_t myMsg;
/** TRUE if the radio is on */
bool on;
enum {
S_IDLE,
S_SETUPONETIME,
S_TESTINUSEDUTYCYCLE,
S_TEARDOWNONETIME,
};
enum {
RADIO_POWER_CYCLES = 100,
};
/***************** Prototypes ****************/
task void sendMsg();
/***************** SetUp Events ****************/
event void SetUpOneTime.run() {
justStarted = FALSE;
call State.forceState(S_SETUPONETIME);
call PacketAcknowledgements.requestAck(&myMsg);
if(call SplitControl.start() != SUCCESS) {
call State.toIdle();
call SetUpOneTime.done();
}
}
event void SetUp.run() {
call SetUp.done();
}
event void TearDownOneTime.run() {
call State.forceState(S_TEARDOWNONETIME);
if(call SplitControl.stop() != SUCCESS) {
call TearDownOneTime.done();
}
}
/***************** Tests ****************/
/**
* Make sure the receiver doesn't lock up if we continuously send messages
* and duty cycle it at the same time. The test really begins when the
* receiver gets the first message. The transmitter gets the run event
* to start transmitting.
*/
event void TestInUseDutyCycle.run() {
post sendMsg();
}
/***************** SplitControl Events ****************/
event void SplitControl.startDone(error_t error) {
if(call State.getState() == S_SETUPONETIME) {
call State.toIdle();
call SetUpOneTime.done();
}
call Leds.led2On();
justStarted = TRUE;
on = TRUE;
}
event void SplitControl.stopDone(error_t error) {
if(call State.isState(S_TEARDOWNONETIME)) {
call TearDownOneTime.done();
}
call Leds.led1Off();
call Leds.led2Off();
on = FALSE;
}
/***************** AMSend Events ****************/
event void AMSend.sendDone(message_t *msg, error_t error) {
call Leds.led1Toggle();
post sendMsg();
}
/***************** Receive Events ****************/
event message_t *Receive.receive(message_t *msg, void *payload, uint8_t len) {
if(call State.requestState(S_TESTINUSEDUTYCYCLE) == SUCCESS) {
// Test just started, enable our duty cycling timer
call Timer.startPeriodic(128);
}
call Leds.led1Toggle();
if(justStarted) {
justStarted = FALSE;
successfulReceiveCycles++;
}
if(successfulReceiveCycles > RADIO_POWER_CYCLES) {
call Timer.stop();
call SplitControl.stop();
assertSuccess();
call TestInUseDutyCycle.done();
}
return msg;
}
/***************** Timer Events ****************/
event void Timer.fired() {
if(on) {
call SplitControl.stop();
} else {
call SplitControl.start();
}
}
/***************** Tasks ****************/
task void sendMsg() {
if(call AMSend.send(1, &myMsg, TOSH_DATA_LENGTH) != SUCCESS) {
post sendMsg();
}
}
}
--- NEW FILE: suite.properties ---
/**
* Valid keywords are:
* @author <optional author(s)> (multiple)
* @testname <optional testname> (once)
* @description <optional, multiline description> (once)
* @extra <any build/install extras> (multiple)
* @ignore <single target> (multiple)
* @only <single target> (multiple)
* @minnodes <# nodes> (once)
* @maxnodes <# nodes> (once)
* @exactnodes <# of exact nodes> (once)
* @mintargets <# of minimum targets for heterogeneous network testing> (once)
* @timeout <timeout duration of the test in minutes, default is 1 min.>
* @skip (once)
*/
@testname Test Radio Duty Cycling Reception
@author David Moss
@description Verify we can constantly receive while duty cycling
@exactnodes 2
@ignore mica2
@ignore mica2dot
- Previous message: [Tinyos-2-commits]
CVS: tinyos-2.x-contrib/tunit/tests/tinyos-2.x/tos/chips/cc2420/TestHwAcks
Makefile, NONE, 1.1 TestTunitC.nc, NONE, 1.1 TestTunitP.nc,
NONE, 1.1 suite.properties, NONE, 1.1
- Next message: [Tinyos-2-commits]
CVS: tinyos-2.x-contrib/tunit/tests/tinyos-2.x/tos/chips/cc2420/TestInUseTxDutyCycle
Makefile, NONE, 1.1 TestRadioC.nc, NONE, 1.1 TestRadioP.nc,
NONE, 1.1 suite.properties, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list