Xenomai API  2.6.5
Interrupt Management Services
Collaboration diagram for Interrupt Management Services:

Macros

#define rtdm_irq_get_arg(irq_handle, type)   ((type *)irq_handle->cookie)
 Retrieve IRQ handler argument. More...
 

Typedefs

typedef int(* rtdm_irq_handler_t) (rtdm_irq_t *irq_handle)
 Interrupt handler. More...
 

Functions

int rtdm_irq_request (rtdm_irq_t *irq_handle, unsigned int irq_no, rtdm_irq_handler_t handler, unsigned long flags, const char *device_name, void *arg)
 Register an interrupt handler. More...
 
int rtdm_irq_free (rtdm_irq_t *irq_handle)
 Release an interrupt handler. More...
 
int rtdm_irq_enable (rtdm_irq_t *irq_handle)
 Enable interrupt line. More...
 
int rtdm_irq_disable (rtdm_irq_t *irq_handle)
 Disable interrupt line. More...
 

RTDM_IRQTYPE_xxx

Interrupt registrations flags

#define RTDM_IRQTYPE_SHARED   XN_ISR_SHARED
 Enable IRQ-sharing with other real-time drivers.
 
#define RTDM_IRQTYPE_EDGE   XN_ISR_EDGE
 Mark IRQ as edge-triggered, relevant for correct handling of shared edge-triggered IRQs.
 

RTDM_IRQ_xxx

Return flags of interrupt handlers

#define RTDM_IRQ_NONE   XN_ISR_NONE
 Unhandled interrupt.
 
#define RTDM_IRQ_HANDLED   XN_ISR_HANDLED
 Denote handled interrupt.
 

Detailed Description

Macro Definition Documentation

#define rtdm_irq_get_arg (   irq_handle,
  type 
)    ((type *)irq_handle->cookie)

Retrieve IRQ handler argument.

Parameters
irq_handleIRQ handle
typeType of the pointer to return
Returns
The argument pointer registered on rtdm_irq_request() is returned, type-casted to the specified type.

Environments:

This service can be called from:

  • Interrupt service routine

Rescheduling: never.

Typedef Documentation

typedef int(* rtdm_irq_handler_t) (rtdm_irq_t *irq_handle)

Interrupt handler.

Parameters
[in]irq_handleIRQ handle as returned by rtdm_irq_request()
Returns
0 or a combination of RTDM_IRQ_xxx flags

Function Documentation

int rtdm_irq_disable ( rtdm_irq_t *  irq_handle)

Disable interrupt line.

Parameters
[in,out]irq_handleIRQ handle as returned by rtdm_irq_request()
Returns
0 on success, otherwise negative error code
Note
This service is for exceptional use only. Drivers should always prefer interrupt masking at device level (via corresponding control registers etc.) over masking at line level. Keep in mind that the latter is incompatible with IRQ line sharing and can also be more costly as interrupt controller access requires broader synchronization. Also, certain IRQ types may not allow the invocation over RT and interrupt contexts. The caller is responsible for excluding such conflicts.

Environments:

This service can be called from:

  • Kernel module initialization/cleanup code
  • Interrupt service routine
  • Kernel-based task
  • User-space task (RT, non-RT)

Rescheduling: never.

int rtdm_irq_enable ( rtdm_irq_t *  irq_handle)

Enable interrupt line.

Parameters
[in,out]irq_handleIRQ handle as returned by rtdm_irq_request()
Returns
0 on success, otherwise negative error code
Note
This service is for exceptional use only. Drivers should always prefer interrupt masking at device level (via corresponding control registers etc.) over masking at line level. Keep in mind that the latter is incompatible with IRQ line sharing and can also be more costly as interrupt controller access requires broader synchronization. Also, certain IRQ types may not allow the invocation over RT and interrupt contexts. The caller is responsible for excluding such conflicts.

Environments:

This service can be called from:

  • Kernel module initialization/cleanup code
  • Interrupt service routine
  • Kernel-based task
  • User-space task (RT, non-RT)

Rescheduling: possible.

int rtdm_irq_free ( rtdm_irq_t *  irq_handle)

Release an interrupt handler.

Parameters
[in,out]irq_handleIRQ handle as returned by rtdm_irq_request()
Returns
0 on success, otherwise negative error code
Note
The caller is responsible for shutting down the IRQ source at device level before invoking this service. In turn, rtdm_irq_free ensures that any pending event on the given IRQ line is fully processed on return from this service.

Environments:

This service can be called from:

  • Kernel module initialization/cleanup code
  • User-space task (non-RT)

Rescheduling: never.

int rtdm_irq_request ( rtdm_irq_t *  irq_handle,
unsigned int  irq_no,
rtdm_irq_handler_t  handler,
unsigned long  flags,
const char *  device_name,
void *  arg 
)

Register an interrupt handler.

This function registers the provided handler with an IRQ line and enables the line.

Parameters
[in,out]irq_handleIRQ handle
[in]irq_noLine number of the addressed IRQ
[in]handlerInterrupt handler
[in]flagsRegistration flags, see RTDM_IRQTYPE_xxx for details
[in]device_nameDevice name to show up in real-time IRQ lists
[in]argPointer to be passed to the interrupt handler on invocation
Returns
0 on success, otherwise:
  • -EINVAL is returned if an invalid parameter was passed.
  • -EBUSY is returned if the specified IRQ line is already in use.

Environments:

This service can be called from:

  • Kernel module initialization/cleanup code
  • User-space task (non-RT)

Rescheduling: never.

References xnintr_attach(), xnintr_detach(), xnintr_enable(), and xnintr_init().