[En-Nut-Discussion] Cortex ih_xxx_interuptY code duplication, continued

Ulrich Prinz ulrich.prinz at googlemail.com
Fri Jul 27 15:17:22 CEST 2012


2012/7/26 Uwe Bonnes <bon at elektron.ikp.physik.tu-darmstadt.de>:
>>>>>> "Ole" == Ole Reinhardt <ole.reinhardt at embedded-it.de> writes:
> ...
>     Ole> What about the same approach Linux goes?
>     Ole> You can register as much IRQ handlers to one IRQ as you like. Every
>     Ole> handler now has to return if it handled the IRQ or not. As long as
>     Ole> the IRQ was not handled the next handler will be called.
>     Ole> This way we would have to handle a linked list of IRQ handlers for
>     Ole> each IRQ. In most cases this will end up in just a single call
>     Ole> which does not add (much) cycles to the IRQ handling at all.
> Sounds good.

I agree, that really sounds good.

The former function pointer could point to a struct that points to a
function plus a struct of his own type.
Then just run through all concatenated structs until you get a NULL.

Did that for the LEDs and key driver in nutos. Only thing is to
strictly take care that the last struct has always set the next
pointer to 0.

/* fault check for irq is pointer and not has an empty caller function*/
while ( irq, irq->fkt) {
  if ( (irq->fkt)(par) ) {
    /* break as function handled the irq (ret != 0) */
    irq = irq->next;


More information about the En-Nut-Discussion mailing list