Re: [Tinyos-help] Limited number of timers?

2008-07-31 Thread Paul Stickney
I must be evil.
I have used VirtualizeTimerC, wired to a new TimerMilliC as the source, IIRC.
It worked nice for parameterization.

HTH,
Paul
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] Limited number of timers?

2008-07-31 Thread Nicola Wegner
2008/7/31 Paul Stickney [EMAIL PROTECTED]:
 I must be evil.
 I have used VirtualizeTimerC, wired to a new TimerMilliC as the source, IIRC.
 It worked nice for parameterization.

 HTH,
 Paul

Yes you seem to be very evil ;)

In my case it worked too. But I did not know if it was necessary for
my usage. In special cases I think you are right.

Nicola
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] Limited number of timers?

2008-07-30 Thread Nicola Wegner
Thank you Eric for the detailed explanation! I did not use
VirtualizeTimerC directly at first. But I tried it because I had some
strange problems with a timer and thought the reason could be that I
use to much timers at a time. Now I know that it has to be another
reason. By now I have found a workaround that works in my case (
http://www.mail-archive.com/tinyos-help@millennium.berkeley.edu/msg22593.html
).

Thanks again

Nicola

2008/7/29 Eric Decker [EMAIL PROTECTED]:


 On Tue, Jul 29, 2008 at 5:52 AM, Nicola Wegner
 [EMAIL PROTECTED] wrote:

 Hi,

 I am not sure if I got it right.

 Close.


 Does it mean that I do not have to
 care about virtual timers because they will be used automatically by
 TinyOS?

 Yes it means tinyos will handle the virtualization for you.


 If this is the case then the following code would create virtual
 timers based on another virtual timer. Right?

 Not quite.  You don't want to reference VirtualizeTimerC directly.  You
 want to use TimerTMilli and let the platform wiring handle the
 virtualization
 for you.
 Take a look at tinyos-2.x/apps/tutorials/BlinkTask/*
 You'll see something like:
 BlinkTaskAppC.nc:
 configuration BlinkTaskAppC
 {
 }
 implementation
 {
   components MainC, BlinkTaskC, LedsC;
   components new TimerMilliC() as Timer0;
   BlinkTaskC - MainC.Boot;
   BlinkTaskC.Timer0 - Timer0;
   BlinkTaskC.Leds - LedsC;
 }

 And in BlinkTaskC.nc:
 module BlinkTaskC
 {
   uses interface TimerTMilli as Timer0;
   uses interface Leds;
   uses interface Boot;
 }
 implementation
 {
   task void toggle()
   {
 call Leds.led0Toggle();
   }
   event void Boot.booted()
   {
 call Timer0.startPeriodic( 1000 );
   }
   event void Timer0.fired()
   {
 post toggle();
   }
 }

 So if you wanted to use three timers you would do something like:
 BlinkTaskC.nc (app)
   uses interface TimerTMilli as Timer0;
   uses interface TimerTMilli as Timer1;
   uses interface TimerTMilli as Timer2;
 And in the wiring:
   components new TimerMilliC() as Timer0;
   components new TimerMilliC() as Timer1;
   components new TimerMilliC() as Timer2;
   BlinkTaskC.Timer0 - Timer0;
   BlinkTaskC.Timer1 - Timer1;
   BlinkTaskC.Timer2 - Timer2;

 Where this wires into the underlying layers is via the system component
 TimerMilliC which eventually
 causes VirtualizeTimerC to hook up to the underlying platform timer
 hardware.
 Take a look at:
 tinyos-2.x/tos/system/TimerMilliC.nc
 tinyos-2.x/tos/system/TimerMilliP.nc
 tinyos-2.x/tos/chips/msp430/timer/HilTimerMilliC.nc (I build for telosb)
 tinyos-2.x/tos/chips/msp430/timer/AlarmMilli32C.nc
 etc.
 To follow what is happening, build BlinkTask as follows:
 cd tinyos-2.x/apps/tutorials/BlinkTask
 make verbose telosb
 It will show which files are being pulled in.
 eric
 make


 components new TimerMilliC() as BaseTimer;
 components new VirtualizeTimerC(TMilli, 5);

 VirtualizeTimerC.TimerFrom - BaseTimer.Timer;
 DbgMessengerP.Timer0 - VirtualizeTimerC.Timer[0];
 DbgMessengerP.Timer1 - VirtualizeTimerC.Timer[1];
 [...]



 Thank you,

 Nicola
 ___
 Tinyos-help mailing list
 Tinyos-help@millennium.berkeley.edu
 https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help



 --
 Eric B. Decker
 Senior (over 50 :-) Researcher
 Autonomous Systems Lab
 Jack Baskin School of Engineering
 UCSC


___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] Limited number of timers?

2008-07-29 Thread Nicola Wegner
Hi,

I am not sure if I got it right. Does it mean that I do not have to
care about virtual timers because they will be used automatically by
TinyOS?

If this is the case then the following code would create virtual
timers based on another virtual timer. Right?

components new TimerMilliC() as BaseTimer;
components new VirtualizeTimerC(TMilli, 5);

VirtualizeTimerC.TimerFrom - BaseTimer.Timer;
DbgMessengerP.Timer0 - VirtualizeTimerC.Timer[0];
DbgMessengerP.Timer1 - VirtualizeTimerC.Timer[1];
[...]

Thank you,

Nicola
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] Limited number of timers?

2008-07-29 Thread Eric Decker
On Tue, Jul 29, 2008 at 5:52 AM, Nicola Wegner [EMAIL PROTECTED]
 wrote:

 Hi,

 I am not sure if I got it right.


Close.


 Does it mean that I do not have to
 care about virtual timers because they will be used automatically by
 TinyOS?


Yes it means tinyos will handle the virtualization for you.


 If this is the case then the following code would create virtual
 timers based on another virtual timer. Right?


Not quite.  You don't want to reference VirtualizeTimerC directly.  You
want to use TimerTMilli and let the platform wiring handle the
virtualization
for you.

Take a look at tinyos-2.x/apps/tutorials/BlinkTask/*

You'll see something like:

BlinkTaskAppC.nc:

configuration BlinkTaskAppC
{
}
implementation
{
  components MainC, BlinkTaskC, LedsC;
  components new TimerMilliC() as Timer0;

  BlinkTaskC - MainC.Boot;
  BlinkTaskC.Timer0 - Timer0;
  BlinkTaskC.Leds - LedsC;
}


And in BlinkTaskC.nc:

module BlinkTaskC
{
  uses interface TimerTMilli as Timer0;
  uses interface Leds;
  uses interface Boot;
}
implementation
{
  task void toggle()
  {
call Leds.led0Toggle();
  }

  event void Boot.booted()
  {
call Timer0.startPeriodic( 1000 );
  }

  event void Timer0.fired()
  {
post toggle();
  }

}


So if you wanted to use three timers you would do something like:

BlinkTaskC.nc (app)
  uses interface TimerTMilli as Timer0;
  uses interface TimerTMilli as Timer1;
  uses interface TimerTMilli as Timer2;

And in the wiring:

  components new TimerMilliC() as Timer0;
  components new TimerMilliC() as Timer1;
  components new TimerMilliC() as Timer2;

  BlinkTaskC.Timer0 - Timer0;
  BlinkTaskC.Timer1 - Timer1;
  BlinkTaskC.Timer2 - Timer2;


Where this wires into the underlying layers is via the system component
TimerMilliC which eventually
causes VirtualizeTimerC to hook up to the underlying platform timer
hardware.

Take a look at:

tinyos-2.x/tos/system/TimerMilliC.nc
tinyos-2.x/tos/system/TimerMilliP.nc
tinyos-2.x/tos/chips/msp430/timer/HilTimerMilliC.nc (I build for telosb)
tinyos-2.x/tos/chips/msp430/timer/AlarmMilli32C.nc
etc.

To follow what is happening, build BlinkTask as follows:

cd tinyos-2.x/apps/tutorials/BlinkTask
make verbose telosb

It will show which files are being pulled in.

eric

make



 components new TimerMilliC() as BaseTimer;
 components new VirtualizeTimerC(TMilli, 5);

 VirtualizeTimerC.TimerFrom - BaseTimer.Timer;
 DbgMessengerP.Timer0 - VirtualizeTimerC.Timer[0];
 DbgMessengerP.Timer1 - VirtualizeTimerC.Timer[1];
 [...]





 Thank you,

 Nicola
 ___
 Tinyos-help mailing list
 Tinyos-help@millennium.berkeley.edu
 https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help




-- 
Eric B. Decker
Senior (over 50 :-) Researcher
Autonomous Systems Lab
Jack Baskin School of Engineering
UCSC
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

[Tinyos-help] Limited number of timers?

2008-07-28 Thread Nicola Wegner
Hi everybody,

just a short question to the micaz platform. Is the number of timers I
can use limited? I read in TEP102 that there are only three compare
registers for each of the 16-bit timers. Does this mean that I can use
only 6 timers at a time? Or does TinyOS provide some kind of
virtualization layer that creates virtual Timers?

Thanks

Nicola
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] Limited number of timers?

2008-07-28 Thread Paul Stickney
For TinyOS 2.x see VirtualizeTimerC.
I believe `new TimerMilliC()`, has the same affect, but allows a
different way to wire.
There is a different between hardware-level HPL/HAL timers and the
exposed software timers in the HIL.

HTH,
Paul

On Mon, Jul 28, 2008 at 1:38 AM, Nicola Wegner
[EMAIL PROTECTED] wrote:
 Hi everybody,

 just a short question to the micaz platform. Is the number of timers I
 can use limited? I read in TEP102 that there are only three compare
 registers for each of the 16-bit timers. Does this mean that I can use
 only 6 timers at a time? Or does TinyOS provide some kind of
 virtualization layer that creates virtual Timers?

 Thanks

 Nicola
 ___
 Tinyos-help mailing list
 Tinyos-help@millennium.berkeley.edu
 https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] Limited number of timers?

2008-07-28 Thread Eric Decker
Hi Nicola and Paul,

VirutalizeTimerC layers 255 independent timers on top of the lower layer
hardware timer resources

The platform wiring takes care of the wiring.  From application code using
something like the following works well:

I have code that uses a timer...

uses interface TimerTMilli as GPSTimer;

usage is like you'd expect.call GPSTimer.startOneShot(dt);

This timer interface is wired into the system via VirtualizeTimerC that then
is wired via platform code to the actual underlying hardware.  The
virtualizer
keeps track of an array of timers and sets the hardware up to fire for the
next
one to go in time.  Virtualize provides for 255 timers.

TEP102 gives the fouundaton but to figure out how exactly it works one needs
to follow the code referenenced in the TEP.

hope this helps.

eric

p.s. Paul what s HTH mean?


On Mon, Jul 28, 2008 at 9:07 AM, Paul Stickney [EMAIL PROTECTED] wrote:

 For TinyOS 2.x see VirtualizeTimerC.
 I believe `new TimerMilliC()`, has the same affect, but allows a
 different way to wire.
 There is a different between hardware-level HPL/HAL timers and the
 exposed software timers in the HIL.

 HTH,
 Paul

 On Mon, Jul 28, 2008 at 1:38 AM, Nicola Wegner
 [EMAIL PROTECTED] wrote:
  Hi everybody,
 
  just a short question to the micaz platform. Is the number of timers I
  can use limited? I read in TEP102 that there are only three compare
  registers for each of the 16-bit timers. Does this mean that I can use
  only 6 timers at a time? Or does TinyOS provide some kind of
  virtualization layer that creates virtual Timers?
 
  Thanks
 
  Nicola
  ___
  Tinyos-help mailing list
  Tinyos-help@millennium.berkeley.edu
  https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
 
 ___
 Tinyos-help mailing list
 Tinyos-help@millennium.berkeley.edu
 https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help




-- 
Eric B. Decker
Senior (over 50 :-) Researcher
Autonomous Systems Lab
Jack Baskin School of Engineering
UCSC
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help