Xenomai  3.0.8
Interrupt management
Collaboration diagram for Interrupt management:

Functions

void xnintr_destroy (struct xnintr *intr)
 Destroy an interrupt descriptor. More...
 
int xnintr_attach (struct xnintr *intr, void *cookie)
 Attach an interrupt descriptor. More...
 
void xnintr_detach (struct xnintr *intr)
 Detach an interrupt descriptor. More...
 
void xnintr_enable (struct xnintr *intr)
 Enable an interrupt line. More...
 
void xnintr_disable (struct xnintr *intr)
 Disable an interrupt line. More...
 
void xnintr_affinity (struct xnintr *intr, cpumask_t cpumask)
 Set processor affinity of interrupt. More...
 
int xnintr_init (struct xnintr *intr, const char *name, unsigned int irq, xnisr_t isr, xniack_t iack, int flags)
 Initialize an interrupt descriptor. More...
 

Detailed Description

Function Documentation

◆ xnintr_affinity()

void xnintr_affinity ( struct xnintr *  intr,
cpumask_t  cpumask 
)

Set processor affinity of interrupt.

Restricts the IRQ line associated with the interrupt descriptor intr to be received only on processors which bits are set in cpumask.

Parameters
intrThe address of the interrupt descriptor.
cpumaskThe new processor affinity.
Note
Depending on architectures, setting more than one bit in cpumask could be meaningless.
Tags cobalt-core-tags "secondary-only"

◆ xnintr_attach()

int xnintr_attach ( struct xnintr *  intr,
void *  cookie 
)

Attach an interrupt descriptor.

Attach an interrupt descriptor previously initialized by xnintr_init(). This operation registers the descriptor at the interrupt pipeline, but does not enable the interrupt line yet. A call to xnintr_enable() is required to start receiving IRQs from the interrupt line associated to the descriptor.

Parameters
intrThe address of the interrupt descriptor to attach.
cookieA user-defined opaque value which is stored into the descriptor for further retrieval by the interrupt handler.
Returns
0 is returned on success. Otherwise:
  • -EINVAL is returned if an error occurred while attaching the descriptor.
  • -EBUSY is returned if the descriptor was already attached.
Note
The caller must not hold nklock when invoking this service, this would cause deadlocks.
Tags cobalt-core-tags "secondary-only"
Note
Attaching an interrupt descriptor resets the tracked number of IRQ receipts to zero.

◆ xnintr_destroy()

void xnintr_destroy ( struct xnintr *  intr)

Destroy an interrupt descriptor.

Destroys an interrupt descriptor previously initialized by xnintr_init(). The descriptor is automatically detached by a call to xnintr_detach(). No more IRQs will be received through this descriptor after this service has returned.

Parameters
intrThe address of the interrupt descriptor to destroy.
Tags cobalt-core-tags "secondary-only"

References xnintr_detach().

◆ xnintr_detach()

void xnintr_detach ( struct xnintr *  intr)

Detach an interrupt descriptor.

This call unregisters an interrupt descriptor previously attached by xnintr_attach() from the interrupt pipeline. Once detached, the associated interrupt line is disabled, but the descriptor remains valid. The descriptor can be attached anew by a call to xnintr_attach().

Parameters
intrThe address of the interrupt descriptor to detach.
Note
The caller must not hold nklock when invoking this service, this would cause deadlocks.
Tags cobalt-core-tags "secondary-only"

Referenced by xnintr_destroy().

◆ xnintr_disable()

void xnintr_disable ( struct xnintr *  intr)

Disable an interrupt line.

Disables the interrupt line associated with an interrupt descriptor.

Parameters
intrThe address of the interrupt descriptor.
Tags cobalt-core-tags "secondary-only"

◆ xnintr_enable()

void xnintr_enable ( struct xnintr *  intr)

Enable an interrupt line.

Enables the interrupt line associated with an interrupt descriptor.

Parameters
intrThe address of the interrupt descriptor.
Tags cobalt-core-tags "secondary-only"

◆ xnintr_init()

int xnintr_init ( struct xnintr *  intr,
const char *  name,
unsigned int  irq,
xnisr_t  isr,
xniack_t  iack,
int  flags 
)

Initialize an interrupt descriptor.

When an interrupt occurs on the given irq line, the interrupt service routine isr is fired in order to deal with the hardware event. The interrupt handler may call any non-blocking service from the Cobalt core.

Upon receipt of an IRQ, the interrupt handler isr is immediately called on behalf of the interrupted stack context, the rescheduling procedure is locked, and the interrupt line is masked in the system interrupt controller chip. Upon return, the status of the interrupt handler is checked for the following bits:

  • XN_IRQ_HANDLED indicates that the interrupt request was successfully handled.
  • XN_IRQ_NONE indicates the opposite to XN_IRQ_HANDLED, meaning that no interrupt source could be identified for the ongoing request by the handler.

In addition, one of the following bits may be present in the status:

  • XN_IRQ_DISABLE tells the Cobalt core to disable the interrupt line before returning from the interrupt context.
  • XN_IRQ_PROPAGATE propagates the IRQ event down the interrupt pipeline to Linux. Using this flag is strongly discouraged, unless you fully understand the implications of such propagation.
Warning
The handler should not use these bits if it shares the interrupt line with other handlers in the real-time domain. When any of these bits is detected, the interrupt line is left masked.

A count of interrupt receipts is tracked into the interrupt descriptor, and reset to zero each time such descriptor is attached. Since this count could wrap around, it should be used as an indication of interrupt activity only.

Parameters
intrThe address of a descriptor the Cobalt core will use to store the interrupt-specific data.
nameAn ASCII string standing for the symbolic name of the interrupt or NULL.
irqThe IRQ line number associated with the interrupt descriptor. This value is architecture-dependent. An interrupt descriptor must be attached to the system by a call to xnintr_attach() before irq events can be received.
isrThe address of an interrupt handler, which is passed the address of the interrupt descriptor receiving the IRQ.
iackThe address of an optional interrupt acknowledge routine, aimed at replacing the default one. Only very specific situations actually require to override the default setting for this parameter, like having to acknowledge non-standard PIC hardware. iack should return a non-zero value to indicate that the interrupt has been properly acknowledged. If iack is NULL, the default routine will be used instead.
flagsA set of creation flags affecting the operation. The valid flags are:
  • XN_IRQTYPE_SHARED enables IRQ-sharing with other interrupt objects.
  • XN_IRQTYPE_EDGE is an additional flag need to be set together with XN_IRQTYPE_SHARED to enable IRQ-sharing of edge-triggered interrupts.
Returns
0 is returned on success. Otherwise, -EINVAL is returned if irq is not a valid interrupt number.
Tags cobalt-core-tags "secondary-only"

Referenced by xntimer_grab_hardware().