AW: [En-Nut-Discussion] NutRegisterIrqHandler() twice?
Przemyslaw Rudy
prudy at audiotech.pl
Mon Oct 24 10:04:58 CEST 2005
Hi,
You are definitely right regarding processor usage/task switch issues.
But please consider the following:
The device driver init usually registers an interrupt handler for
external interrupt line per one device. What about registering more
devices on one interrupt line? To achieve this there are two ways:
1. handle multiple devices by the first registered common(!) handler,
then he body of the interrupt handler is:
---------
for (all devices )
{
/* read/write hardware */
/* wake up user space by posting an event */
}
---------
2. having a possibility to create a list of handlers called from within
an interrupt one by one, without the context change between them, in
this case the body of handler would be as usual:
---------
/* read/write hardware */
/* wake up user space by posting an event */
---------
except that the for() per each device would be executed in the layer
above, so by the OS handler caller.
What we can gain from the second solution is that totally different
drivers (thus different handlers and different hardware) can share the
same interrupt line, which is not possible in the first case.
Regards
Przemek
Oliver Schulz wrote:
> Hi Przemek,
>
> why to have more than one interrupt handler for one interrupt? Keep in mind, that you are working with microcontrollers (-> small code size), most times you need low latency to execute the handler, so chaining the handler isn't very smart.
>
> In Nut/OS for each device you have one device driver with its interrupt handler. The device drivers are used to separate the hardware dependent code for a device from the "normal" user program.
>
> So I cannot see why to have interrupt chaining...
>
> Regards,
> Oliver.
>
> -----Ursprüngliche Nachricht-----
> Von: en-nut-discussion-bounces at egnite.de [mailto:en-nut-discussion-bounces at egnite.de] Im Auftrag von Przemyslaw Rudy
> Gesendet: Sonntag, 23. Oktober 2005 17:27
> An: Ethernut User Chat (English)
> Betreff: Re: [En-Nut-Discussion] NutRegisterIrqHandler() twice?
>
> Well, I have just looked into the sources, no questions then and sorry
> for my ignorance.
>
> But for the future, would not be nice to have something like
> NutAttachIrqHandler(), to have a queue of handlers?
>
>
> Użytkownik Przemyslaw Rudy napisał:
>
>>Hi
>>
>
>
>>Can I do this?:
>>
>
>
>>NutRegisterIrqHandler(&SIG_INTERRUPT6, handler1, NULL)
>>NutRegisterIrqHandler(&SIG_INTERRUPT6, handler2, NULL)
>>
>
>
>>So registering two different interrupt handlers to the same irq
>>expecting they are called one by one by the event?
>>
>
>
>>Or handlers are "the handlers" thus only one can be assigned?
>>
>
>
>>Regards
>>Przemek
>>
>
>
>>_______________________________________________
>>En-Nut-Discussion mailing list
>>En-Nut-Discussion at egnite.de
>>http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>>
>
>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>
>
> _________________________________________________________________________
> +++ Posthorn-Kuvertierhüllen.Schnell.Zuverlässig. +++
> +++ Die Marke macht den Unterschied. +++
>
> +++ Fordern Sie dazu den neuen Katalog an. +++
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>
More information about the En-Nut-Discussion
mailing list