![]() |
Files | |
file | irq-generic.c |
Source file for generic BSP interrupt support. | |
file | irq-config.h |
BSP interrupt support configuration. | |
file | irq-generic.h |
Header file for generic BSP interrupt support. | |
Defines | |
#define | BSP_INTERRUPT_VECTOR_MIN |
Minimum vector number. | |
#define | BSP_INTERRUPT_VECTOR_MAX |
Maximum vector number. | |
#define | BSP_INTERRUPT_USE_INDEX_TABLE |
Enables the index table. | |
#define | BSP_INTERRUPT_NO_HEAP_USAGE |
Disables usage of the heap. | |
#define | BSP_INTERRUPT_HANDLER_TABLE_SIZE |
Size of the handler table. | |
Typedefs | |
typedef uint8_t | bsp_interrupt_handler_index_type |
Integer type capable to index the complete handler table. | |
Functions | |
rtems_status_code | bsp_interrupt_handler_install (rtems_vector_number vector, rtems_interrupt_handler handler, void *arg, rtems_boolean shared) |
Installs an interrupt handler. | |
rtems_status_code | bsp_interrupt_handler_remove (rtems_vector_number vector, rtems_interrupt_handler handler) |
Removes an interrupt handler. | |
static int | bsp_interrupt_is_valid_vector (rtems_vector_number vector) |
Returns non-zero if the interrupt vector with number vector is valid. | |
void | bsp_interrupt_handler_default (rtems_vector_number vector) |
Default interrupt handler. | |
rtems_status_code | bsp_interrupt_initialize () |
Initialize BSP interrupt support. | |
rtems_status_code | bsp_interrupt_facility_initialize () |
BSP specific initialization. | |
rtems_status_code | bsp_interrupt_vector_enable (rtems_vector_number vector) |
Enables the interrupt vector with number vector. | |
rtems_status_code | bsp_interrupt_vector_disable (rtems_vector_number vector) |
Disables the interrupt vector with number vector. | |
static void | bsp_interrupt_handler_dispatch (rtems_vector_number vector) |
Sequencially calls all interrupt handlers for the vector number vector. |
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-config.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. You must provide a data type for the index table (bsp_interrupt_handler_index_type). It must be an integer type big enough to index the complete handler table.
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:
#define BSP_INTERRUPT_HANDLER_TABLE_SIZE |
Size of the handler table.
Definition at line 65 of file irq-config.h.
Referenced by bsp_interrupt_allocate_handler_index(), bsp_interrupt_initialize(), bsp_interrupt_is_initialized(), and bsp_interrupt_set_initialized().
#define BSP_INTERRUPT_NO_HEAP_USAGE |
Disables usage of the heap.
If you define this, you have to define BSP_INTERRUPT_USE_INDEX_TABLE as well.
Definition at line 58 of file irq-config.h.
#define BSP_INTERRUPT_USE_INDEX_TABLE |
Enables the index table.
If you enable the index table, you should define a size for the handler table (BSP_INTERRUPT_HANDLER_TABLE_SIZE) and must provide an integer type capable to index the complete handler table (bsp_interrupt_handler_index_type).
Definition at line 50 of file irq-config.h.
#define BSP_INTERRUPT_VECTOR_MAX |
Maximum vector number.
Definition at line 40 of file irq-config.h.
Referenced by bsp_interrupt_is_valid_vector().
#define BSP_INTERRUPT_VECTOR_MIN |
Minimum vector number.
Definition at line 35 of file irq-config.h.
Referenced by bsp_interrupt_handler_index(), and bsp_interrupt_is_valid_vector().
typedef uint8_t bsp_interrupt_handler_index_type |
Integer type capable to index the complete handler table.
Definition at line 70 of file irq-config.h.
rtems_status_code bsp_interrupt_facility_initialize | ( | ) |
BSP specific initialization.
This routine will be called form bsp_interrupt_initialize() and shall do the following:
Definition at line 127 of file irq.c.
References mpc55xx_external_exception_handler().
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.
static void bsp_interrupt_handler_dispatch | ( | rtems_vector_number | vector | ) | [inline, static] |
Sequencially calls all interrupt handlers for the vector number vector.
If the vector number vector 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 222 of file irq-generic.h.
References struct_bsp_interrupt_handler_entry::arg, bsp_interrupt_handler_default(), bsp_interrupt_handler_index(), bsp_interrupt_is_empty_handler_entry(), bsp_interrupt_is_valid_vector(), struct_bsp_interrupt_handler_entry::handler, and struct_bsp_interrupt_handler_entry::next.
Referenced by mpc55xx_external_exception_handler().
rtems_status_code bsp_interrupt_handler_install | ( | rtems_vector_number | vector, | |
rtems_interrupt_handler | handler, | |||
void * | arg, | |||
rtems_boolean | shared | |||
) |
Installs an interrupt handler.
Definition at line 202 of file irq-generic.c.
References struct_bsp_interrupt_handler_entry::arg, bsp_interrupt_allocate_handler_entry(), bsp_interrupt_allocate_handler_index(), bsp_interrupt_handler_index(), bsp_interrupt_is_empty_handler_entry(), bsp_interrupt_is_handler_unique(), bsp_interrupt_is_initialized(), bsp_interrupt_is_valid_vector(), bsp_interrupt_lock(), bsp_interrupt_set_handler_unique(), bsp_interrupt_unlock(), bsp_interrupt_vector_enable(), struct_bsp_interrupt_handler_entry::handler, and struct_bsp_interrupt_handler_entry::next.
rtems_status_code bsp_interrupt_handler_remove | ( | rtems_vector_number | vector, | |
rtems_interrupt_handler | handler | |||
) |
Removes an interrupt handler.
Definition at line 332 of file irq-generic.c.
References bsp_interrupt_clear_handler_entry(), bsp_interrupt_free_handler_entry(), bsp_interrupt_handler_index(), bsp_interrupt_is_initialized(), bsp_interrupt_is_valid_vector(), bsp_interrupt_lock(), bsp_interrupt_unlock(), bsp_interrupt_vector_disable(), struct_bsp_interrupt_handler_entry::handler, and struct_bsp_interrupt_handler_entry::next.
rtems_status_code bsp_interrupt_initialize | ( | ) |
Initialize BSP interrupt support.
You must call this function before you can install, remove and dispatch interrupt handlers. The BSP specific bsp_interrupt_facility_initialize() function will be called after all internals are initialized. Initialization is complete if everything was successful.
Definition at line 149 of file irq-generic.c.
References bsp_interrupt_clear_handler_entry(), bsp_interrupt_facility_initialize(), BSP_INTERRUPT_HANDLER_TABLE_SIZE, bsp_interrupt_is_initialized(), bsp_interrupt_lock(), bsp_interrupt_set_initialized(), and bsp_interrupt_unlock().
static int bsp_interrupt_is_valid_vector | ( | rtems_vector_number | vector | ) | [inline, static] |
Returns non-zero if the interrupt vector with number vector is valid.
Definition at line 136 of file irq-generic.h.
References BSP_INTERRUPT_VECTOR_MAX, and BSP_INTERRUPT_VECTOR_MIN.
Referenced by bsp_interrupt_handler_dispatch(), bsp_interrupt_handler_install(), and bsp_interrupt_handler_remove().
rtems_status_code 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 a vector out of range this function shall do nothing except returning RTEMS_SUCCESSFUL.
Definition at line 155 of file irq.c.
References mpc55xx_intc_set_priority().
rtems_status_code 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 a vector out of range this function shall do nothing except returning RTEMS_SUCCESSFUL.
Definition at line 146 of file irq.c.
References mpc55xx_intc_set_priority().