[Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/TestPowerManager
Makefile, NONE, 1.1.4.2 MyComponentC.nc, NONE,
1.1.4.2 MyComponentP.nc, NONE, 1.1.4.2 README.txt, NONE,
1.1.4.2 TestPowerManagerAppC.nc, NONE,
1.1.4.2 TestPowerManagerC.nc, NONE, 1.1.4.2
Kevin Klues
klueska at users.sourceforge.net
Mon May 15 11:30:59 PDT 2006
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/system FcfsArbiterC.nc,
1.1.2.12, NONE FcfsPriorityArbiterC.nc, 1.1.2.8,
NONE NoArbiterC.nc, 1.1.2.3, NONE RoundRobinArbiterC.nc,
1.1.2.13, NONE
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/RadioStress Makefile,
NONE, 1.1.4.2 RadioStress.h, NONE, 1.1.4.2 RadioStressAppC.nc,
NONE, 1.1.4.2 RadioStressC.nc, NONE, 1.1.4.2 gdb-file, NONE, 1.1.4.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/apps/tests/TestPowerManager
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv16954/apps/tests/TestPowerManager
Added Files:
Tag: tos-2-resource-pm-eval-cand
Makefile MyComponentC.nc MyComponentP.nc README.txt
TestPowerManagerAppC.nc TestPowerManagerC.nc
Log Message:
Changes to powe rmanager tests to reflect changes to pwoer managers
--- NEW FILE: Makefile ---
COMPONENT=TestPowerManagerAppC
OPTFLAGS = -O0
PFLAGS += -I%T/lib/oski -I%T/lib/power
include $(MAKERULES)
--- NEW FILE: MyComponentC.nc ---
/*
* "Copyright (c) 2005 Washington University in St. Louis.
* 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 WASHINGTON UNIVERSITY IN ST. LOUIS 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 WASHINGTON
* UNIVERSITY IN ST. LOUIS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* WASHINGTON UNIVERSITY IN ST. LOUIS 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 WASHINGTON UNIVERSITY IN ST. LOUIS HAS NO
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS."
*
*/
/**
* Please refer to TEP 115 for more information about the components
* this application is used to test.
*
* This component is used to create a "dummy" non-virtualized component for use
* with the TestPowerManager component. It can be powered on and off through any
* of the AsyncStdControl, StdControl, and SplitControl interfaces.
*
* @author Kevin Klues <klueska at cs.wustl.edu>
* @version $Revision: 1.1.4.2 $
* @date $Date: 2006/05/15 18:30:57 $
*/
#define MYCOMPONENT_RESOURCE "MyComponent.Resource"
configuration MyComponentC{
provides {
interface Init;
interface Resource[uint8_t];
}
}
implementation {
components MyComponentP, LedsC,
new TimerMilliC() as StartTimer, new TimerMilliC() as StopTimer,
new FcfsArbiterC(MYCOMPONENT_RESOURCE) as Arbiter,
// new AsyncStdControlPowerManagerC() as PowerManager;
// new AsyncStdControlDeferredPowerManagerC(750) as PowerManager;
// new StdControlPowerManagerC() as PowerManager;
// new StdControlDeferredPowerManagerC(750) as PowerManager;
// new SplitControlPowerManagerC() as PowerManager;
new SplitControlDeferredPowerManagerC(750) as PowerManager;
Init = PowerManager;
Resource = Arbiter;
// PowerManager.AsyncStdControl -> MyComponentP.AsyncStdControl;
// PowerManager.StdControl -> MyComponentP.StdControl;
PowerManager.SplitControl -> MyComponentP.SplitControl;
PowerManager.ResourceController -> Arbiter.ResourceController;
PowerManager.ArbiterInfo -> Arbiter.ArbiterInfo;
MyComponentP.Leds -> LedsC;
MyComponentP.StartTimer -> StartTimer;
MyComponentP.StopTimer -> StopTimer;
}
--- NEW FILE: MyComponentP.nc ---
/*
* "Copyright (c) 2005 Washington University in St. Louis.
* 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 WASHINGTON UNIVERSITY IN ST. LOUIS 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 WASHINGTON
* UNIVERSITY IN ST. LOUIS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* WASHINGTON UNIVERSITY IN ST. LOUIS 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 WASHINGTON UNIVERSITY IN ST. LOUIS HAS NO
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS."
*
*/
/**
* Please refer to TEP 115 for more information about the components
* this application is used to test.
*
* This component is used to create a "dummy" non-virtualized component for use
* with the TestPowerManager component. It can be powered on and off through any
* of the AsyncStdControl, StdControl, and SplitControl interfaces.
*
* @author Kevin Klues <klueska at cs.wustl.edu>
* @version $Revision: 1.1.4.2 $
* @date $Date: 2006/05/15 18:30:57 $
*/
module MyComponentP {
provides {
interface SplitControl;
interface StdControl;
interface AsyncStdControl;
}
uses {
interface Leds;
interface Timer<TMilli> as StartTimer;
interface Timer<TMilli> as StopTimer;
}
}
implementation {
#define START_DELAY 10
#define STOP_DELAY 10
command error_t SplitControl.start() {
call StartTimer.startOneShot(START_DELAY);
return SUCCESS;
}
event void StartTimer.fired() {
call Leds.led0On();
signal SplitControl.startDone(SUCCESS);
}
command error_t SplitControl.stop() {
call StopTimer.startOneShot(STOP_DELAY);
return SUCCESS;
}
event void StopTimer.fired() {
call Leds.led0Off();
signal SplitControl.stopDone(SUCCESS);
}
command error_t StdControl.start() {
call Leds.led0On();
return SUCCESS;
}
command error_t StdControl.stop() {
call Leds.led0Off();
return SUCCESS;
}
async command error_t AsyncStdControl.start() {
call Leds.led0On();
return SUCCESS;
}
async command error_t AsyncStdControl.stop() {
call Leds.led0Off();
return SUCCESS;
}
default event void SplitControl.startDone(error_t error) {}
default event void SplitControl.stopDone(error_t error) {}
}
--- NEW FILE: README.txt ---
README for TestPowerManager
Author/Contact: tinyos-help at millennium.berkeley.edu
@author Kevin Klues <klueska at cs.wustl.edu>
Description:
Please refer to TEP 115 for more information about the components
this application is used to test.
This application tests the functionality of the various non-mcu power
management components that are used with non-virtualized devices.
Different policies can be tested by making a simple wiring change
in the "MyComponentsC" configuration. This component is used
to simulate a non-virtualized device that has a set of resource users
that need to share it. An arbiter component is used to control
access to the resource, and one of the 6 default power management
policies can be chosen to perform shutdown of the device whenever
it is no longer in use. Depending on the power management policy
chosen, power down of the device will occur through either the
AsyncStdControl, StdControl, or SplitControl interfaces and will
occur at different times. The application itself simply wires to
"MyComponentC" and is unaware of the power management policy being
used by it.
Two resource users are created by the application to share the
"MyComponent" resource. They each hold the device for a specific
amount of time and then release it. There is some delay between
when the first user releases the resource and when the second one
requests it. Since the resource uses one of the default power
management polices, we expect the device to be automatically shutdown
whenever both resource users do not require use of the resource.
Different shutdown times will occur, however, depeneding on which
power mangament policy is under test. The various leds are used to
indicate which resource user currently has control of the resource,
and whether the "MyComponent" device is currently powered on or not.
-- Led0 0n -> MyComponent" powered on
-- Led0 0ff -> MyComponent" powered off
-- Led1 0n -> Resource 0 controls "MyComponent" resource
-- Led1 0ff -> Resource 0 does not control "MyComponent" resource
-- Led2 0n -> Resource 1 controls "MyComponent" resource
-- Led2 0ff -> Resource 1 does not control "MyComponent" resource
This application demonstrates, therefore, not only how one would use
one of the provided power management polices to control the power
states of a non-virtualized device, but also how to wire everything
together.
Tools:
None.
Known bugs/limitations:
None.
--- NEW FILE: TestPowerManagerAppC.nc ---
/*
* "Copyright (c) 2005 Washington University in St. Louis.
* 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 WASHINGTON UNIVERSITY IN ST. LOUIS 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 WASHINGTON
* UNIVERSITY IN ST. LOUIS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* WASHINGTON UNIVERSITY IN ST. LOUIS 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 WASHINGTON UNIVERSITY IN ST. LOUIS HAS NO
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS."
*
*/
/**
* Please refer to TEP 115 for more information about the components
* this application is used to test.
*
* This application is used to test the functionality of the non mcu power
* management component for non-virtualized devices. Changes to
* <code>MyComponentC</code> allow one to choose between different Power
* Management policies.
*
* @author Kevin Klues <klueska at cs.wustl.edu>
* @version $Revision: 1.1.4.2 $
* @date $Date: 2006/05/15 18:30:57 $
*/
configuration TestPowerManagerAppC{
}
implementation {
components MainC, TestPowerManagerC, MyComponentC, LedsC, new TimerMilliC();
TestPowerManagerC -> MainC.Boot;
MainC.SoftwareInit -> MyComponentC;
TestPowerManagerC.TimerMilli -> TimerMilliC;
TestPowerManagerC.Resource0 -> MyComponentC.Resource[unique("MyComponent.Resource")];
TestPowerManagerC.Resource1 -> MyComponentC.Resource[unique("MyComponent.Resource")];
TestPowerManagerC.Leds -> LedsC;
}
--- NEW FILE: TestPowerManagerC.nc ---
/*
* "Copyright (c) 2005 Washington University in St. Louis.
* 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 WASHINGTON UNIVERSITY IN ST. LOUIS 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 WASHINGTON
* UNIVERSITY IN ST. LOUIS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* WASHINGTON UNIVERSITY IN ST. LOUIS 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 WASHINGTON UNIVERSITY IN ST. LOUIS HAS NO
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS."
*
*/
/**
* Please refer to TEP 115 for more information about the components
* this application is used to test.
*
* This application is used to test the functionality of the non mcu power
* management component for non-virtualized devices. Changes to
* <code>MyComponentC</code> allow one to choose between different Power
* Management policies.
*
* @author Kevin Klues <klueska at cs.wustl.edu>
* @version $Revision: 1.1.4.2 $
* @date $Date: 2006/05/15 18:30:57 $
*/
#include "Timer.h"
module TestPowerManagerC {
uses {
interface Boot;
interface Leds;
interface Resource as Resource0;
interface Resource as Resource1;
interface Timer<TMilli> as TimerMilli;
}
}
implementation {
#define HOLD_PERIOD 500
#define WAIT_PERIOD 1000
uint8_t whoHasIt;
uint8_t waiting;
//All resources try to gain access
event void Boot.booted() {
call Resource0.request();
waiting = FALSE;
}
//If granted the resource, turn on an LED
event void Resource0.granted() {
whoHasIt = 0;
call Leds.led1On();
call TimerMilli.startOneShot(HOLD_PERIOD);
}
event void Resource1.granted() {
whoHasIt = 1;
call Leds.led2On();
call TimerMilli.startOneShot(HOLD_PERIOD);
}
event void TimerMilli.fired() {
if(waiting == TRUE) {
waiting = FALSE;
if(whoHasIt == 0)
call Resource1.request();
if(whoHasIt == 1)
call Resource0.request();
}
else {
if(whoHasIt == 0) {
call Leds.led1Off();
call Resource0.release();
}
if(whoHasIt == 1) {
call Leds.led2Off();
call Resource1.release();
}
waiting = TRUE;
call TimerMilli.startOneShot(WAIT_PERIOD);
}
}
}
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/system FcfsArbiterC.nc,
1.1.2.12, NONE FcfsPriorityArbiterC.nc, 1.1.2.8,
NONE NoArbiterC.nc, 1.1.2.3, NONE RoundRobinArbiterC.nc,
1.1.2.13, NONE
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/RadioStress Makefile,
NONE, 1.1.4.2 RadioStress.h, NONE, 1.1.4.2 RadioStressAppC.nc,
NONE, 1.1.4.2 RadioStressC.nc, NONE, 1.1.4.2 gdb-file, NONE, 1.1.4.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list