Hi,
I find something related to TOSH_SIGNAL:
// 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()
in msp430hardware.h
TOSH_SIGNAL(NMI_VECTOR)
{
volatile int n = IFG1;
if (n & NMIIFG) { signal NMI.fired(); return; }
if (n & OFIFG) { signal OF.fired(); return; }
if (FCTL3 & ACCVIFG) { signal ACCV.fired(); return; }
}
in HplMsp430InterruptNMIP.nc
But I'm still not sure how the hook from an interrupt works. Can you
explain a little bit? Thanks.
On Sun, Jun 6, 2010 at 8:33 PM, Eric Decker <[email protected]> wrote:
> okay, let me try.
>
> On Sun, Jun 6, 2010 at 11:05 AM, Xiaohui Liu <[email protected]> wrote:
>
>> Hi,
>>
>> Can I say event is at higher level while interrupt is at lower level? I
>> guess event handler may be sync if you look at Receive.receive() event.
>>
>
> An interrupt handler typically handles a h/w interrupt. In TinyOS you
> can find where we hook into the interrupt handlers by looking for
> TOSH_SIGNAL.
>
> In TinyOS, modules are interfaced using two mechanisms, commands for call
> in, and signals for call out. Signals are wired to event handlers. This
> is in the context of TinyOS. Other environments will vary.
>
> Commands and event handlers can be labelled as sync or async. Normally,
> one wants to keep everything sync. Life is simpler that way. TinyOS is
> about keeping things simple because less goes wrong that way. Its one of
> the reasons why static allocation is preferred over dynamic (ie. malloc).
> Wild pointers aren't much fun.
>
> However, one clearly needs to be able to signal asynchronous event too.
> Like how do we further connect to TinyOS modules from the interrupt
> handler? To denote that things can be happening in an asynchronous
> fashion, the keyword async word is used.
>
> The toolchain keeps track of the call chain and flags sync labelled
> routines that are callable from async routines because it violates the
> assumptions that make sync level stuff simple.
>
> Hopefully that adds some clarity.
>
>
>
>> Can you help me find an example of interrupt handler in TinyOS? Thank you.
>>
>
> Look for TOSH_SIGNAL. That is how code is hooked into the h/w interrupt
> handler.
>
>
>> On Sat, Jun 5, 2010 at 3:28 PM, Ali Baharev <[email protected]>wrote:
>>
>>> Hi,
>>>
>>> "a callback subroutine in an operating system or device driver "
>>> http://en.wikipedia.org/wiki/Interrupt_handler
>>>
>>>
> When quoting, it helps to quote the whole thing...
>
> "An *interrupt handler*, also known as an *interrupt service routine* (*
> ISR*), is a
> callback<http://en.wikipedia.org/wiki/Callback_(computer_science)> subroutine
> in an operating system <http://en.wikipedia.org/wiki/Operating_system> or
> device
> driver <http://en.wikipedia.org/wiki/Device_driver> whose execution is
> triggered by the reception of an
> interrupt<http://en.wikipedia.org/wiki/Interrupt>.
> Interrupt handlers have a multitude of functions, which vary based on the
> reason the interrupt was generated and the speed at which the Interrupt
> Handler completes its task."
>
> The major difference between an event and an interrupt handler is how the
> event is generated. A h/w event is an interrupt and gets hooked in with
> TOSH_SIGNAL. An event handler is declared using "event void ..." and
> invoked using "signal ..."
>
>
>
>
>> ---
>>>
>>> "an event handler is an asynchronous callback subroutine that handles
>>> inputs received in a program"
>>> http://en.wikipedia.org/wiki/Event_handler
>>>
>>>
> Well that depends. On the context. There are places where that is true.
> However, we are talking about TinyOS. So the above confuses things.
>
>
>
>> Ali
>>>
>>
>>
>>
>> --
>> -Xiaohui Liu
>>
>> _______________________________________________
>> Tinyos-help mailing list
>> [email protected]
>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>>
>
>
>
> --
> Eric B. Decker
> Senior (over 50 :-) Researcher
>
>
>
--
-Xiaohui Liu
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help