[Tinyos-devel] SplitControl

Philip Levis pal at eecs.berkeley.edu
Thu Jan 6 15:10:43 PST 2005


On Jan 6, 2005, at 1:36 PM, Joe Polastre wrote:

> That's the intended use.
>
> If a call is outstanding, init, start, or stop should return FAIL.

OK. Sounds good.

After a bit of discussion with David G. and Phil B., I have another 
question: is it appropriate to have init() be split-phase?

The issue is that when init() is called, the component has no assurance 
that anything else is initialized, and almost certainly nothing is 
actually running yet. The theoretical reason why init() is split phase 
is that it might take a while for something (e.g., hardware) to 
initialize, and the component can let other things go on while this is 
happening.

The problem is that because nothing else is actually running, the only 
way it can provide a split phase interface is through a direct post; it 
can't, for example, schedule a timer in 30ms to post the task, as the 
Timer isn't running yet. But the posted task could run very soon, so 
there's no assurance of a significant amount of time elapsing. The 
component could use a post loop, but at that point why not just make 
init synchronous and block on certain pieces of hardware 
initialization? The idea that hardware might issue an interrupt to 
denote initDone() is kind of nice, but that has fundamental issues in 
that interrupts are not enabled in the boot sequence.

David G.'s proposal, which I agree with, is that SplitControl -- or 
some other similarly named interface that replaces it -- should have a 
synchronous init and split-phase start and stops:

interface SplitControl {
   command error_t init();
   command error_t start();
   command error_t stop();
   event void startDone(error_t err);
   event void stopDone(error_t err);
}

Thoughts?

Phil

-------

"We shall not cease from exploration
And the end of all our exploring
Will be to arrive where we started
And know the place for the first time."

- T. S. Eliot,  'Little Gidding'



More information about the Tinyos-devel mailing list