[Tinyos Core WG] SchedulerBasic

Martin Leopold leopold at diku.dk
Mon Feb 5 17:17:09 PST 2007


Hi All.
Turns out that I was missing something obvious (RTFM).. My McuSleep now
enables and disables interrupts as described in TEP112.

On Mon, 2007-02-05 at 16:47 -0800, Martin Leopold wrote:
> Hi All.
> I seem to be having a problem with a simple test program (for my cc2430
> platform). I don't have any tasks and I echo a char back over the UART
> in interrupt context. If I loop forever in say in Boot.booted all is
> dandy, but if I let the system boot all the way, I don't seem to get to
> my interrupt handler.
> 
> If I'm not mistaken, what happens after the system boots is, that it
> ends up in the taskLoop (below). If I'm reading this correctly then my
> system will loop here forever with no help of recovery since interrupts
> are off. 
> 
> Am I missing something obvious here or what? To me this doesn't seem
> right - sleep is called with interrupts off and there is no way to post
> a new task from an interrupt.
> 
> 
> command void Scheduler.taskLoop() {
> ...
>  atomic {
>    while ((nextTask = popTask()) == NO_TASK)    {
>       call McuSleep.sleep();
>    }
>  }
> 
> If I look at the old "TOSH_run_next_task" from 1.x interrupts would be
> turned on in between calls to __nesc_atomic_sleep():
> 
>   void TOSH_run_task() {
>     for (;;) TOSH_run_next_task();
>   }
> 
>   bool TOSH_run_next_task () {
>     ...
>     fInterruptFlags = __nesc_atomic_start();
>      ...
>     __nesc_atomic_end(fInterruptFlags);
>     ...
>     func();
>     return 1;
>   }
> 
-- 
Regards Martin Leopold.
Dept. of Computer Science, University of Copenhagen
http://www.diku.dk/~leopold





More information about the Tinyos-2.0wg mailing list