Rv: Re: [Tinyos-help] Interrupts and async events question
Adam
shiyuan69 at gmail.com
Thu Sep 7 17:12:29 PDT 2006
>From app.c, Timer is special because TinyOS actually post a task from clock
hardware interupt.
static inline void TimerM$AlarmCompare$fired(void)
{
TimerM$post_checkShortTimers();
}
static inline void TimerM$post_checkShortTimers(void)
{
{ __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
{
if (!TimerM$m_posted_checkShortTimers)
{
if (TOS_post(TimerM$checkShortTimers)) {
TimerM$m_posted_checkShortTimers = TRUE;
}
}
}
#line 196
__nesc_atomic_end(__nesc_atomic); }
}
This is a different context.
Anyway, I am happy to see the rule is clarified: async and atomic will run
until completion without any interupt.
-----Original Message-----
From: tinyos-help-bounces at Millennium.Berkeley.EDU
[mailto:tinyos-help-bounces at Millennium.Berkeley.EDU] On Behalf Of Philip
Levis
Sent: Thursday, September 07, 2006 1:44 PM
To: jose m
Cc: tinyos-help at Millennium.Berkeley.EDU
Subject: Re: Rv: Re: [Tinyos-help] Interrupts and async events question
On Sep 7, 2006, at 1:03 PM, jose m wrote:
>
> I'm not asking how to avoid the async nature of interrupts. My
> question is, when an interrupt routine is called, if the all the
> interrupts continue masked until every async event, function or
> command called from the current interrupt routine is finished.
>
In practice, some interrupt handlers are reentrant; that is, they do not
disable interrupts during their execution. Some are atomic. For example, the
I2C interrupt on the atmega128 MUST have interrupts disabled when it
executes, or the system will crash (issuing the interrupt does not clear the
interrupt). In contrast, Timers 1, 2, and 3 are not atomic: they allow other
interrupts to occur while the execute. nesC's race condition detection knows
the difference.
The way to tell whether a given handler is atomic or not is to just look at
its declaration:
AVR_NONATOMIC_HANDLER(SIG_OUTPUT_COMPARE1A) {
vs.
AVR_ATOMIC_HANDLER(SIG_OUTPUT_COMPARE0) {
The MSP430 uses an older declaration naming (borrowed from 1.x):
// The signal attribute has opposite meaning in msp430-gcc than in avr-gcc
#define TOSH_SIGNAL(signame) \ void sig_##signame() __attribute__((interrupt
(signame), wakeup, C))
// TOSH_INTERRUPT allows nested interrupts #define TOSH_INTERRUPT(signame) \
void isr_##signame() __attribute__((interrupt (signame), signal, wakeup, C))
Phil
_______________________________________________
Tinyos-help mailing list
Tinyos-help at Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
More information about the Tinyos-help
mailing list