Hi Frederico,

If you haven't, you should read Philip Levis' excellent TinyOS Programming 
guide, here:
http://csl.stanford.edu/~pal/pubs/tinyos-programming.pdf
Section 4.1 covers split phase operations.

On Monday 07 May 2007 13:54, Federico Spadini wrote:
> 1)      Am I allowed to have a return XXX at the end of an event? If so who
> does this value get returned to?

Events, as defined in interface definitions, identify the return value for an 
event.  Most events return void, but look at Receive.receive() for an example 
of one that doesn't.  The code signalling the event gets the return code. The 
event is just like a call-back function.

> a.       If so, is it bad programming practice to leave this out?

If there is a mismatch in return values, you'll get an error when you build 
the code.

> 2)      Am I allowed to call two events i.e.:
>  event void Timer0.fired() {
>     call ReadBroadband.read();
>     call ReadIR.read();
>   }

If your question is "Am I allowed to call to commands", then yes.  Events are 
not called, but signalled.

> If so, does the "call" drill all the way down to the actual function which
> initiates a read immediately, or is there an event queue separate from the
> task queue?

There is no event queue, so an implementation of Read.read() must initiate the 
read immediately.  But that first step may be several steps removed from 
actually acquiring the read data.  For example, read may call to another 
split-phase operation to acquire a resource.

> Which is executed at the end of the event? 
> Do these events execute in order?

I don't understand these questions.

> 3)      Can events pre-empt other events? If I have just been put in my
> ReadBroadband.readDone and I receive another even how is this handled? What
> happens if I receive an event during an interrupt handler (or async event)?

An event running in task context can be preempted by an event running in async 
context.  Events cannot run in async context unless they have the "async" 
keyword in their definition.  I believe you can safely consider async context 
in TinyOS to be equivalent to the uC's interrupt context.

Hope this helps,
Steve
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to