[Tinyos-help] async/sync events preemption

Philip Levis pal at cs.stanford.edu
Wed Jul 5 09:43:24 PDT 2006


On Jul 5, 2006, at 2:24 AM, Frigging wrote:

> Hi,
>
> by the way I'm interesting about tinyos 2.x
>
> you've had wrote:
> "Interrupts, however, can preempt tasks. All code that an interrupt  
> handler
> calls must be async. The hardware takes care of pushing some  
> context on the
> stack, and the compiler takes care of spilling registers to memory.  
> The
> question of when interrupts can be handled or not (interrupt  
> preemption,
> etc.) depends on 2 things: the chip architecture and whether the  
> code has
> disabled interrupts or adjusted the interrupt priority level."
>
> but this means that asyc function could preempt an other async  
> function?
> However if an interrupt handler can call only async function, maybe  
> it's
> possible (if the chip architecture and whether the code has not  
> disabled
> interrupts or adjusted the interrupt priority level) preempt an  
> other async
> function. I think so, because I read your paper "TinyOS  
> Programming" at page
> 39, and I understand that since "In this example, c can  
> (theoretically)
> preempt a ...", for me this means that async function can preempt  
> task and
> async function. While sync function is running (no-blocking), are  
> interrupts
> disabled? or is there a interrupts queue?
>
> In tinyos 2.x where is interrupt priority level handled ?

You're asking about hardware at this point, rather than TinyOS.

Some interrupt handlers have interrupts disabled during their  
execution (e.g., the I2C/two-wire interrupt on the atm128 basically  
requires they be disabled in order to work properly). Others keep  
interrupts enabled during their execution. IPLs are generally  
hardware, not software, mechanisms. In microcontrollers, priority  
levels generally indicate execution order, but the MCU does not  
support conditional disabling in the way that microprocessors do.

Phil


More information about the Tinyos-help mailing list