Interrupt management.
[Xenomai nucleus.]


Detailed Description

Interrupt management.


Files

file  intr.c
 Interrupt management.

Functions

int xnintr_init (xnintr_t *intr, unsigned irq, xnisr_t isr, xnflags_t flags)
 Initialize an interrupt object.
int xnintr_destroy (xnintr_t *intr)
 Destroy an interrupt object.
int xnintr_attach (xnintr_t *intr, void *cookie)
 Attach an interrupt object.
int xnintr_detach (xnintr_t *intr)
 Detach an interrupt object.
int xnintr_enable (xnintr_t *intr)
 Enable an interrupt object.
int xnintr_disable (xnintr_t *intr)
 Disable an interrupt object.


Function Documentation

int xnintr_attach xnintr_t *  intr,
void *  cookie
 

Attach an interrupt object.

Attach an interrupt object previously initialized by xnintr_init(). After this operation is completed, all IRQs received from the corresponding interrupt channel are directed to the object's ISR.

Parameters:
intr The descriptor address of the interrupt object to attach.
cookie A user-defined opaque value which is stored into the interrupt object descriptor for further retrieval by the ISR/ISR handlers.
Returns:
0 is returned on success. Otherwise, -EINVAL is returned if a low-level error occurred while attaching the interrupt. -EBUSY is specifically returned if the interrupt object was already attached.
Side-effect: This routine does not call the rescheduling procedure.

Context: This routine must be called on behalf of a thread.

int xnintr_destroy xnintr_t *  intr  ) 
 

Destroy an interrupt object.

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

Parameters:
intr The descriptor address of the interrupt object to destroy.
Returns:
0 is returned on success. Otherwise, -EBUSY is returned if an error occurred while detaching the interrupt (see xnintr_detach()).
Side-effect: This routine does not call the rescheduling procedure.

Context: This routine must be called on behalf of a thread.

int xnintr_detach xnintr_t *  intr  ) 
 

Detach an interrupt object.

Detach an interrupt object previously attached by xnintr_attach(). After this operation is completed, no more IRQs are directed to the object's ISR, but the interrupt object itself remains valid. A detached interrupt object can be attached again by a subsequent call to xnintr_attach().

Parameters:
intr The descriptor address of the interrupt object to detach.
Returns:
0 is returned on success. Otherwise, -EINVAL is returned if a low-level error occurred while detaching the interrupt. Detaching a non-attached interrupt object leads to a null-effect and returns 0.
Side-effect: This routine does not call the rescheduling procedure.

Context: This routine must be called on behalf of a thread.

int xnintr_disable xnintr_t *  intr  ) 
 

Disable an interrupt object.

Disables the hardware interrupt line associated with an interrupt object. This operation invalidates further interrupt requests from the given source until the IRQ line is re-enabled anew.

Parameters:
intr The descriptor address of the interrupt object to disable.
Returns:
0 is returned on success. Otherwise, -EINVAL is returned if a low-level error occurred while disabling the interrupt.
Side-effect: This routine does not call the rescheduling procedure.

Context: This routine must be called on behalf of a thread.

int xnintr_enable xnintr_t *  intr  ) 
 

Enable an interrupt object.

Enables the hardware interrupt line associated with an interrupt object. Over real-time control layers which mask and acknowledge IRQs, this operation is necessary to revalidate the interrupt channel so that more interrupts can be notified.

Parameters:
intr The descriptor address of the interrupt object to enable.
Returns:
0 is returned on success. Otherwise, -EINVAL is returned if a low-level error occurred while enabling the interrupt.
Side-effect: This routine does not call the rescheduling procedure.

Context: This routine must be called on behalf of a thread.

int xnintr_init xnintr_t *  intr,
unsigned  irq,
xnisr_t  isr,
xnflags_t  flags
 

Initialize an interrupt object.

Associates an interrupt object with an IRQ line.

When an interrupt occurs from the given irq line, the ISR is fired in order to deal with the hardware event. The interrupt service code may call any non-suspensive service from the nucleus.

Upon receipt of an IRQ, the ISR is immediately called on behalf of the interrupted stack context. The status value returned by the ISR is then checked for the following bits:

  • XN_ISR_ENABLE asks the nucleus to re-enable the IRQ line. Over some real-time control layers which mask and acknowledge IRQs, this operation is necessary to revalidate the interrupt channel so that more interrupts can be notified. The presence of such bit in the ISR's return code causes Xenomai to ask the real-time control layer to re-enable the interrupt.

  • XN_ISR_CHAINED tells the nucleus to require the real-time control layer to forward the IRQ. For instance, this would cause the Adeos control layer to propagate the interrupt down the interrupt pipeline to other Adeos domains, such as Linux. This is the regular way to share interrupts between Xenomai and the host system.

Parameters:
intr The address of a interrupt object descriptor Xenomai will use to store the object-specific data. This descriptor must always be valid while the object is active therefore it must be allocated in permanent memory.
irq The hardware interrupt channel associated with the interrupt object. This value is architecture-dependent. An interrupt object must then be attached to the hardware interrupt vector using the xnintr_attach() service for the associated IRQs to be directed to this object.
isr The address of a valid low-level interrupt service routine if this parameter is non-zero. This handler will be called each time the corresponding IRQ is delivered on behalf of an interrupt context. When called, the ISR is passed the descriptor address of the interrupt object.
flags A set of creation flags affecting the operation. Since no flags are currently defined, zero should be passed for this parameter.
Returns:
No error condition being defined, 0 is always returned.
Side-effect: This routine does not call the rescheduling procedure.

Context: This routine must be called on behalf of a thread.


Generated on Mon Aug 30 13:58:39 2004 for RTAI API by doxygen 1.3.8