Interrupt support. More...
Functions | |
void | CallHandler (IRQ_HANDLER *irh) |
Call a registered interrupt handler. | |
int | NutRegisterIrqHandler (IRQ_HANDLER *irq, void(*handler)(void *), void *arg) |
Register an interrupt handler. | |
int | NutIrqEnable (IRQ_HANDLER *irq) |
Enable a specified interrupt. | |
int | NutIrqDisable (IRQ_HANDLER *irq) |
Disable a specified interrupt. | |
int | NutIrqSetPriority (IRQ_HANDLER *irq, int level) |
Modify the priority level of an interrupt. | |
int | NutIrqSetMode (IRQ_HANDLER *irq, int mode) |
Modify the interrupt mode. |
Interrupt support.
Note, that it is not required to register interrupts with Nut/OS. Actually, this will route interrupts through the kernel, which results in performance degradation.
If fast interrupt processing is required, drivers as well as applications should consider using native interrupt handlers. Your compiler documentation is the right source to check how this can be done.
void CallHandler | ( | IRQ_HANDLER * | irh | ) |
Call a registered interrupt handler.
References IRQ_HANDLER::ir_arg, and IRQ_HANDLER::ir_handler.
Referenced by IrqHandler().
int NutRegisterIrqHandler | ( | IRQ_HANDLER * | irq, |
void(*)(void *) | handler, | ||
void * | arg | ||
) |
Register an interrupt handler.
This function is typically called by device drivers, but applications may also implement their local interrupt handlers.
irq | Interrupt to be associated with this handler. |
handler | This routine will be called by Nut/OS, when the specified interrupt occurs. |
arg | Argument to be passed to the interrupt handler. |
References IRQ_HANDLER::ir_arg, IRQ_HANDLER::ir_ctl, IRQ_HANDLER::ir_handler, NULL, NUT_IRQCTL_INIT, and rc.
Referenced by AceInit(), ADCInit(), AhdlcAt91Init(), AhdlcAvrInit(), At91Spi0Init(), At91SpiBusNodeInit(), AtCanInit(), Avr32Spi0Init(), Avr32SpiBusNodeInit(), AvrSpiBus0NodeInit(), DmInit(), EmacInit(), FeederThread(), GpioRegisterIrqHandler(), IDEInit(), LancInit(), Lpc177x_8x_MciInit(), Lpc17xxEmacInit(), NicInit(), NplRegisterIrqHandler(), NutRegisterCanBus(), NutRegisterTimer(), NutRegisterTwiBus(), Sc16is752UsartDeinit(), Sc16is752UsartInit(), SJAInit(), UartAvrInit(), VsPlayerInit(), and wlandrv_Init().
int NutIrqEnable | ( | IRQ_HANDLER * | irq | ) |
Enable a specified interrupt.
irq | Interrupt to enable. |
References IRQ_HANDLER::ir_ctl, NULL, NUT_IRQCTL_ENABLE, and rc.
Referenced by ADCInit(), AhdlcAt91Open(), At91Spi0Init(), At91SpiBusNodeInit(), Avr32Spi0Init(), Avr32SpiBusNodeInit(), EmacRxThread(), FeederThread(), GenCharSize(), GpioRegisterIrqHandler(), Lpc177x_8x_MciInit(), Lpc17xxEmacRxThread(), NicRxLanc(), NplRegisterIrqHandler(), NutRegisterCanBus(), NutRegisterTimer(), NutRegisterTwiBus(), Sc16is752UsartInit(), and VsPlayerInterrupts().
int NutIrqDisable | ( | IRQ_HANDLER * | irq | ) |
Disable a specified interrupt.
irq | Interrupt to disable. |
References IRQ_HANDLER::ir_ctl, NULL, NUT_IRQCTL_DISABLE, and rc.
Referenced by GenCharSize(), NutDestroyTwiBus(), and VsPlayerInterrupts().
int NutIrqSetPriority | ( | IRQ_HANDLER * | irq, |
int | level | ||
) |
Modify the priority level of an interrupt.
The function returns the old priority, which makes it easy to temporarily switch to another priority and later set back the old one.
irq | Interrupt to modify. |
level | New priority level. |
References IRQ_HANDLER::ir_ctl, NUT_IRQCTL_GETPRIO, NUT_IRQCTL_SETPRIO, and rc.
Referenced by NutRegisterCanBus(), NutRegisterTimer(), and NutRegisterTwiBus().
int NutIrqSetMode | ( | IRQ_HANDLER * | irq, |
int | mode | ||
) |
Modify the interrupt mode.
The function returns the old mode, which makes it easy to temporarily switch to another mode and later set back the old one.
irq | Interrupt to modify. |
mode | New interrupt mode:
|
References IRQ_HANDLER::ir_ctl, NUT_IRQCTL_GETMODE, NUT_IRQCTL_SETMODE, NUT_IRQMODE_NONE, and rc.
Referenced by FeederThread(), NicRxLanc(), NplRegisterIrqHandler(), NutRegisterTwiBus(), Sc16is752UsartInit(), and VsPlayerInit().