Nut/OS  4.10.3
API Reference
Interrupt Management

Interrupt support. More...

Collaboration diagram for Interrupt Management:

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.

Detailed Description

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.


Function Documentation

void CallHandler ( IRQ_HANDLER irh)

Call a registered interrupt handler.

Definition at line 74 of file ihndlr.c.

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.

Parameters:
irqInterrupt to be associated with this handler.
handlerThis routine will be called by Nut/OS, when the specified interrupt occurs.
argArgument to be passed to the interrupt handler.
Returns:
0 on success, -1 otherwise.

Definition at line 98 of file ihndlr.c.

References IRQ_HANDLER::ir_arg, IRQ_HANDLER::ir_ctl, IRQ_HANDLER::ir_handler, and NUT_IRQCTL_INIT.

Referenced by AceInit(), ADCInit(), AhdlcAt91Init(), AhdlcAvrInit(), At91Spi0Init(), At91SpiBusNodeInit(), AtCanInit(), Avr32Spi0Init(), Avr32SpiBusNodeInit(), AvrSpiBus0NodeInit(), DmInit(), EmacInit(), FeederThread(), GpioRegisterIrqHandler(), IDEInit(), LancInit(), NicInit(), NplRegisterIrqHandler(), NutRegisterTimer(), Sc16is752UsartDeinit(), Sc16is752UsartInit(), SJAInit(), TwInit(), UartAvrInit(), VsPlayerInit(), and wlandrv_Init().

int NutIrqEnable ( IRQ_HANDLER irq)
int NutIrqDisable ( IRQ_HANDLER irq)

Disable a specified interrupt.

Parameters:
irqInterrupt to disable.
Returns:
0 on success, -1 otherwise.

Definition at line 138 of file ihndlr.c.

References IRQ_HANDLER::ir_ctl, and NUT_IRQCTL_DISABLE.

Referenced by GenCharSize(), Tlv320SwitchMode(), 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.

Note:
Not all targets support dynamic interrupt prioritization. Check the hardware data sheet for valid levels.
Parameters:
irqInterrupt to modify.
levelNew priority level.
Returns:
Old priority level or -1 in case of an error.

Definition at line 163 of file ihndlr.c.

References IRQ_HANDLER::ir_ctl, NUT_IRQCTL_GETPRIO, and NUT_IRQCTL_SETPRIO.

Referenced by NutRegisterTimer().

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.

Note:
Not all targets support all modes. Check the hardware data sheet for valid levels.
Parameters:
irqInterrupt to modify.
modeNew interrupt mode:
  • NUT_IRQMODE_NONE No change. Used to query current mode.
  • NUT_IRQMODE_LOWLEVEL Low level sensitive.
  • NUT_IRQMODE_HIGHLEVEL High level sensitive.
  • NUT_IRQMODE_FALLINGEDGE Negative edge triggered.
  • NUT_IRQMODE_RISINGEDGE Positive edge triggered.
  • NUT_IRQMODE_EDGE Triggers on any edge or active internal edge.
  • NUT_IRQMODE_LEVEL Triggers on level change or active internal level.
Returns:
Old mode or -1 in case of an error.

Definition at line 201 of file ihndlr.c.

References IRQ_HANDLER::ir_ctl, NUT_IRQCTL_GETMODE, NUT_IRQCTL_SETMODE, and NUT_IRQMODE_NONE.

Referenced by FeederThread(), NicRxLanc(), NplRegisterIrqHandler(), Sc16is752UsartInit(), TwInit(), and VsPlayerInit().