RTEMS
Files | Functions
BSP Interrupt Support

Generic BSP Interrupt Support. More...

Files

file  irq-generic.h
 Generic BSP interrupt support API.
 
file  irq-generic.c
 Generic BSP interrupt support implementation.
 
file  irq-lock.c
 BSP interrupt support lock implementation.
 

Functions

static bool bsp_interrupt_is_valid_vector (rtems_vector_number vector)
 Returns true if the interrupt vector with number vector is valid.
 
void bsp_interrupt_handler_default (rtems_vector_number vector)
 Default interrupt handler. More...
 
void bsp_interrupt_initialize (void)
 Initialize BSP interrupt support. More...
 
rtems_status_code bsp_interrupt_facility_initialize (void)
 BSP specific initialization. More...
 
void bsp_interrupt_vector_enable (rtems_vector_number vector)
 Enables the interrupt vector with number vector. More...
 
void bsp_interrupt_vector_disable (rtems_vector_number vector)
 Disables the interrupt vector with number vector. More...
 
static void bsp_interrupt_handler_dispatch (rtems_vector_number vector)
 Sequencially calls all interrupt handlers for the vector number vector. More...
 
bool bsp_interrupt_handler_is_empty (rtems_vector_number vector)
 Is interrupt handler empty. More...
 
static rtems_status_code bsp_interrupt_handler_install (rtems_vector_number vector, const char *info, rtems_option options, rtems_interrupt_handler handler, void *arg)
 Installs an interrupt handler. More...
 
static rtems_status_code bsp_interrupt_handler_remove (rtems_vector_number vector, rtems_interrupt_handler handler, void *arg)
 Removes an interrupt handler. More...
 
static rtems_status_code bsp_interrupt_handler_iterate (rtems_vector_number vector, rtems_interrupt_per_handler_routine routine, void *arg)
 Iterates over all installed interrupt handler of a vector. More...
 

Detailed Description

Generic BSP Interrupt Support.

The BSP interrupt support manages a sequence of interrupt vector numbers ranging from BSP_INTERRUPT_VECTOR_MIN to BSP_INTERRUPT_VECTOR_MAX including the end points. It provides methods to install, remove and dispatch interrupt handlers for each vector number. It implements parts of the RTEMS interrupt manager.

The entry points to a list of interrupt handlers are stored in a table (= handler table).

You have to configure the BSP interrupt support in the <bsp/irq.h> file for each BSP. For a minimum configuration you have to provide BSP_INTERRUPT_VECTOR_MIN and BSP_INTERRUPT_VECTOR_MAX.

For boards with small memory requirements you can define BSP_INTERRUPT_USE_INDEX_TABLE. With an enabled index table the handler table will be accessed via a small index table. You can define the size of the handler table with BSP_INTERRUPT_HANDLER_TABLE_SIZE.

Normally new list entries are allocated from the heap. You may define BSP_INTERRUPT_NO_HEAP_USAGE, if you do not want to use the heap. For this option you have to define BSP_INTERRUPT_USE_INDEX_TABLE as well.

You have to provide some special routines in your BSP (follow the links for the details):

The following now deprecated functions are provided for backward compatibility:

Function Documentation

◆ bsp_interrupt_facility_initialize()

rtems_status_code bsp_interrupt_facility_initialize ( void  )

BSP specific initialization.

This routine will be called form bsp_interrupt_initialize() and shall do the following:

Returns
On success RTEMS_SUCCESSFUL shall be returned.

Definition at line 62 of file irq-shared.c.

◆ bsp_interrupt_handler_default()

void bsp_interrupt_handler_default ( rtems_vector_number  vector)

Default interrupt handler.

This routine will be called from bsp_interrupt_handler_dispatch() with the current vector number vector when the handler list for this vector is empty or the vector number is out of range.

Note
This function must cope with arbitrary vector numbers vector.

Definition at line 21 of file irq-default-handler.c.

◆ bsp_interrupt_handler_dispatch()

static void bsp_interrupt_handler_dispatch ( rtems_vector_number  vector)
inlinestatic

Sequencially calls all interrupt handlers for the vector number vector.

If the vector number is out of range or the handler list is empty bsp_interrupt_handler_default() will be called with argument vector.

You can call this function within every context which can be disabled via rtems_interrupt_disable().

Definition at line 259 of file irq-generic.h.

◆ bsp_interrupt_handler_install()

static rtems_status_code bsp_interrupt_handler_install ( rtems_vector_number  vector,
const char *  info,
rtems_option  options,
rtems_interrupt_handler  handler,
void *  arg 
)
static

Installs an interrupt handler.

Returns
In addition to the standard status codes this function returns:
  • If the BSP interrupt support is not initialized RTEMS_INTERNAL_ERROR will be returned.
  • If not enough memory for a new handler is available RTEMS_NO_MEMORY will be returned
See also
rtems_interrupt_handler_install()

Definition at line 193 of file irq-generic.c.

◆ bsp_interrupt_handler_is_empty()

bool bsp_interrupt_handler_is_empty ( rtems_vector_number  vector)

Is interrupt handler empty.

This routine returns true if the handler is empty and has not been initialised else false is returned. The interrupt lock is not used so this call can be used from within interrupts.

Returns
If empty true shall be returned else false is returned.

Definition at line 549 of file irq-generic.c.

◆ bsp_interrupt_handler_iterate()

static rtems_status_code bsp_interrupt_handler_iterate ( rtems_vector_number  vector,
rtems_interrupt_per_handler_routine  routine,
void *  arg 
)
static

Iterates over all installed interrupt handler of a vector.

Returns
In addition to the standard status codes this function returns RTEMS_INTERNAL_ERROR if the BSP interrupt support is not initialized.
See also
rtems_interrupt_handler_iterate().

Definition at line 480 of file irq-generic.c.

◆ bsp_interrupt_handler_remove()

static rtems_status_code bsp_interrupt_handler_remove ( rtems_vector_number  vector,
rtems_interrupt_handler  handler,
void *  arg 
)
static

Removes an interrupt handler.

Returns
In addition to the standard status codes this function returns RTEMS_INTERNAL_ERROR if the BSP interrupt support is not initialized.
See also
rtems_interrupt_handler_remove().

Definition at line 358 of file irq-generic.c.

◆ bsp_interrupt_initialize()

void bsp_interrupt_initialize ( void  )

Initialize BSP interrupt support.

You must call this function before you can install, remove and dispatch interrupt handlers. There is no protection against concurrent initialization. This function must be called at most once. The BSP specific bsp_interrupt_facility_initialize() function will be called after all internals are initialized. If the BSP specific initialization fails, then this is a fatal error. The fatal error source is RTEMS_FATAL_SOURCE_BSP and the fatal error code is BSP_FATAL_INTERRUPT_INITIALIZATION.

Definition at line 161 of file irq-generic.c.

◆ bsp_interrupt_vector_disable()

void bsp_interrupt_vector_disable ( rtems_vector_number  vector)

Disables the interrupt vector with number vector.

This function shall disable the vector at the corresponding facility (in most cases the interrupt controller). It will be called then the last handler is removed for the vector in bsp_interrupt_handler_remove() for example.

Note
The implementation should use bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector)) to valdiate the vector number.
You must not install or remove an interrupt handler in this function. This may result in a deadlock.

Definition at line 74 of file irq-shared.c.

◆ bsp_interrupt_vector_enable()

void bsp_interrupt_vector_enable ( rtems_vector_number  vector)

Enables the interrupt vector with number vector.

This function shall enable the vector at the corresponding facility (in most cases the interrupt controller). It will be called then the first handler is installed for the vector in bsp_interrupt_handler_install() for example.

Note
The implementation should use bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector)) to valdiate the vector number.
You must not install or remove an interrupt handler in this function. This may result in a deadlock.

Definition at line 67 of file irq-shared.c.