From 71d1acd41d2de193730a44284b16ddd7eddea738 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 1 Dec 2022 10:49:38 +0100 Subject: bsps/irq: Rename handler in dispatch table The name handler table was a bit misleading after the last rework. Rename it to distach table. Update the documentation accordingly. Update #4769. --- bsps/include/bsp/irq-generic.h | 68 +++++++++++++++---------------- bsps/powerpc/mpc55xxevb/include/bsp/irq.h | 2 +- bsps/riscv/riscv/include/tm27.h | 4 +- bsps/shared/irq/irq-entry-remove.c | 6 +-- bsps/shared/irq/irq-generic.c | 32 +++++++-------- bsps/shared/irq/irq-handler-iterate.c | 4 +- 6 files changed, 57 insertions(+), 59 deletions(-) (limited to 'bsps') diff --git a/bsps/include/bsp/irq-generic.h b/bsps/include/bsp/irq-generic.h index f605da9803..4a3dd75e7d 100644 --- a/bsps/include/bsp/irq-generic.h +++ b/bsps/include/bsp/irq-generic.h @@ -62,12 +62,12 @@ extern "C" { #error "BSP_INTERRUPT_VECTOR_COUNT shall be defined" #endif -#if defined(BSP_INTERRUPT_USE_INDEX_TABLE) && !defined(BSP_INTERRUPT_HANDLER_TABLE_SIZE) - #error "if you define BSP_INTERRUPT_USE_INDEX_TABLE, you have to define BSP_INTERRUPT_HANDLER_TABLE_SIZE etc. as well" +#if defined(BSP_INTERRUPT_USE_INDEX_TABLE) && !defined(BSP_INTERRUPT_DISPATCH_TABLE_SIZE) + #error "if you define BSP_INTERRUPT_USE_INDEX_TABLE, you have to define BSP_INTERRUPT_DISPATCH_TABLE_SIZE etc. as well" #endif -#ifndef BSP_INTERRUPT_HANDLER_TABLE_SIZE - #define BSP_INTERRUPT_HANDLER_TABLE_SIZE BSP_INTERRUPT_VECTOR_COUNT +#ifndef BSP_INTERRUPT_DISPATCH_TABLE_SIZE + #define BSP_INTERRUPT_DISPATCH_TABLE_SIZE BSP_INTERRUPT_VECTOR_COUNT #endif #define bsp_interrupt_assert(e) _Assert(e) @@ -76,25 +76,25 @@ extern "C" { * @brief Each member of this table references the first installed entry at the * corresponding interrupt vector or is NULL. */ -extern rtems_interrupt_entry *bsp_interrupt_handler_table[]; +extern rtems_interrupt_entry *bsp_interrupt_dispatch_table[]; #ifdef BSP_INTERRUPT_USE_INDEX_TABLE - #if BSP_INTERRUPT_HANDLER_TABLE_SIZE < 0x100 - typedef uint8_t bsp_interrupt_handler_index_type; - #elif BSP_INTERRUPT_HANDLER_TABLE_SIZE < 0x10000 - typedef uint16_t bsp_interrupt_handler_index_type; + #if BSP_INTERRUPT_DISPATCH_TABLE_SIZE < 0x100 + typedef uint8_t bsp_interrupt_dispatch_index_type; + #elif BSP_INTERRUPT_DISPATCH_TABLE_SIZE < 0x10000 + typedef uint16_t bsp_interrupt_dispatch_index_type; #else - typedef uint32_t bsp_interrupt_handler_index_type; + typedef uint32_t bsp_interrupt_dispatch_index_type; #endif - extern bsp_interrupt_handler_index_type bsp_interrupt_handler_index_table []; + extern bsp_interrupt_dispatch_index_type bsp_interrupt_dispatch_index_table []; #endif -static inline rtems_vector_number bsp_interrupt_handler_index( +static inline rtems_vector_number bsp_interrupt_dispatch_index( rtems_vector_number vector ) { #ifdef BSP_INTERRUPT_USE_INDEX_TABLE - return bsp_interrupt_handler_index_table [vector]; + return bsp_interrupt_dispatch_index_table [vector]; #else return vector; #endif @@ -109,23 +109,21 @@ static inline rtems_vector_number bsp_interrupt_handler_index( * * The BSP interrupt support manages a sequence of interrupt vector numbers * greater than or equal to zero and less than @ref BSP_INTERRUPT_VECTOR_COUNT - * It provides methods to - * @ref bsp_interrupt_handler_install() "install", - * @ref bsp_interrupt_handler_remove() "remove" and - * @ref bsp_interrupt_handler_dispatch() "dispatch" interrupt handlers for each + * It provides methods to install, remove, and @ref + * bsp_interrupt_handler_dispatch() "dispatch" interrupt entries 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). + * The entry points to a list of interrupt entries are stored in a table + * (= dispatch table). * * You have to configure the BSP interrupt support in the file * for each BSP. For a minimum configuration you have to provide * @ref BSP_INTERRUPT_VECTOR_COUNT. * * For boards with small memory requirements you can define - * @ref 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 @ref BSP_INTERRUPT_HANDLER_TABLE_SIZE. + * @ref BSP_INTERRUPT_USE_INDEX_TABLE. With an enabled index table the + * dispatch table will be accessed via a small index table. You can define the + * size of the dispatch table with @ref BSP_INTERRUPT_DISPATCH_TABLE_SIZE. * * You have to provide some special routines in your BSP (follow the links for * the details): @@ -180,7 +178,7 @@ void bsp_interrupt_handler_default(rtems_vector_number vector); * @brief Initialize BSP interrupt support. * * You must call this function before you can install, remove and dispatch - * interrupt handlers. There is no protection against concurrent + * interrupt entries. 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, @@ -249,8 +247,8 @@ rtems_status_code bsp_interrupt_vector_is_enabled( * @brief Enables the interrupt 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. + * cases the interrupt controller). It will be called then the first entry + * is installed for the vector in rtems_interrupt_entry_install() for example. * * @note The implementation should use * bsp_interrupt_assert( bsp_interrupt_is_valid_vector( vector ) ) to validate @@ -270,7 +268,7 @@ rtems_status_code bsp_interrupt_vector_enable( rtems_vector_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 + * entry is removed for the vector in rtems_interrupt_entry_remove() for * example. * * @note The implementation should use @@ -429,10 +427,10 @@ static inline rtems_interrupt_entry *bsp_interrupt_entry_load_first( { rtems_vector_number index; - index = bsp_interrupt_handler_index( vector ); + index = bsp_interrupt_dispatch_index( vector ); return bsp_interrupt_entry_load_acquire( - &bsp_interrupt_handler_table[ index ] + &bsp_interrupt_dispatch_table[ index ] ); } @@ -463,8 +461,8 @@ static inline void bsp_interrupt_dispatch_entries( * This function does not validate the vector number. If the vector number is * out of range, then the behaviour is undefined. * - * The function assumes that no handlers are installed at the vector. In this - * case, no operation is performed. + * The function assumes that no interrupt entries are installed at the vector. + * In this case, no operation is performed. * * In uniprocessor configurations, you can call this function within every * context which can be disabled via rtems_interrupt_local_disable(). @@ -521,9 +519,9 @@ static inline void bsp_interrupt_handler_dispatch_unchecked( /** * @brief Sequentially calls all interrupt handlers installed at the vector. * - * If the vector number is out of range or the handler list is empty - * bsp_interrupt_handler_default() will be called with the vector number as - * argument. + * If the vector number is out of range or the interrupt entry list is empty, + * then bsp_interrupt_handler_default() will be called with the vector number + * as argument. * * In uniprocessor configurations, you can call this function within every * context which can be disabled via rtems_interrupt_local_disable(). @@ -604,7 +602,7 @@ void bsp_interrupt_entry_remove( * * If the bit associated with a vector is set, then the entry is unique, * otherwise it may be shared. If the bit with index - * #BSP_INTERRUPT_HANDLER_TABLE_SIZE is set, then the interrupt support is + * #BSP_INTERRUPT_DISPATCH_TABLE_SIZE is set, then the interrupt support is * initialized, otherwise it is not initialized. */ extern uint8_t bsp_interrupt_handler_unique_table[]; @@ -662,7 +660,7 @@ static inline void bsp_interrupt_set_handler_unique( */ static inline bool bsp_interrupt_is_initialized( void ) { - return bsp_interrupt_is_handler_unique( BSP_INTERRUPT_HANDLER_TABLE_SIZE ); + return bsp_interrupt_is_handler_unique( BSP_INTERRUPT_DISPATCH_TABLE_SIZE ); } #ifdef __cplusplus diff --git a/bsps/powerpc/mpc55xxevb/include/bsp/irq.h b/bsps/powerpc/mpc55xxevb/include/bsp/irq.h index ae2d20f7bd..1bedd3a65a 100644 --- a/bsps/powerpc/mpc55xxevb/include/bsp/irq.h +++ b/bsps/powerpc/mpc55xxevb/include/bsp/irq.h @@ -492,7 +492,7 @@ rtems_status_code mpc55xx_intc_clear_software_irq(rtems_vector_number vector); #define BSP_INTERRUPT_VECTOR_COUNT (MPC55XX_IRQ_MAX + 1) -#ifdef BSP_INTERRUPT_HANDLER_TABLE_SIZE +#ifdef BSP_INTERRUPT_DISPATCH_TABLE_SIZE #define BSP_INTERRUPT_USE_INDEX_TABLE #endif diff --git a/bsps/riscv/riscv/include/tm27.h b/bsps/riscv/riscv/include/tm27.h index 3e092214e5..1226fc8667 100644 --- a/bsps/riscv/riscv/include/tm27.h +++ b/bsps/riscv/riscv/include/tm27.h @@ -123,9 +123,9 @@ static inline void Lower_tm27_intr( void ) */ irq = RISCV_INTERRUPT_VECTOR_SOFTWARE; - if ( bsp_interrupt_handler_table[ irq ] == NULL ) { + if ( bsp_interrupt_dispatch_table[ irq ] == NULL ) { _Assert( riscv_tm27_can_use_mtime ); - bsp_interrupt_handler_table[ irq ] = &riscv_tm27_interrupt_entry; + bsp_interrupt_dispatch_table[ irq ] = &riscv_tm27_interrupt_entry; (void) rtems_interrupt_vector_enable( irq ); } diff --git a/bsps/shared/irq/irq-entry-remove.c b/bsps/shared/irq/irq-entry-remove.c index 3e5fd33fbe..e970b80455 100644 --- a/bsps/shared/irq/irq-entry-remove.c +++ b/bsps/shared/irq/irq-entry-remove.c @@ -46,8 +46,8 @@ void bsp_interrupt_entry_remove( rtems_interrupt_entry *first; rtems_interrupt_entry *entry_next; - index = bsp_interrupt_handler_index( vector ); - first = bsp_interrupt_handler_table[ index ]; + index = bsp_interrupt_dispatch_index( vector ); + first = bsp_interrupt_dispatch_table[ index ]; entry_next = entry->next; if ( entry == first && entry_next == NULL ) { @@ -60,7 +60,7 @@ void bsp_interrupt_entry_remove( #endif bsp_interrupt_set_handler_unique( index, false ); #if defined(BSP_INTERRUPT_USE_INDEX_TABLE) - bsp_interrupt_handler_index_table[ vector ] = 0; + bsp_interrupt_dispatch_index_table[ vector ] = 0; #endif } diff --git a/bsps/shared/irq/irq-generic.c b/bsps/shared/irq/irq-generic.c index dac1ca4209..ffd820730e 100644 --- a/bsps/shared/irq/irq-generic.c +++ b/bsps/shared/irq/irq-generic.c @@ -42,20 +42,20 @@ #include #ifdef BSP_INTERRUPT_USE_INDEX_TABLE - bsp_interrupt_handler_index_type bsp_interrupt_handler_index_table + bsp_interrupt_dispatch_index_type bsp_interrupt_dispatch_index_table [BSP_INTERRUPT_VECTOR_COUNT]; #endif rtems_interrupt_entry * -bsp_interrupt_handler_table[ BSP_INTERRUPT_HANDLER_TABLE_SIZE ]; +bsp_interrupt_dispatch_table[ BSP_INTERRUPT_DISPATCH_TABLE_SIZE ]; /* The last entry indicates if everything is initialized */ uint8_t bsp_interrupt_handler_unique_table - [ ( BSP_INTERRUPT_HANDLER_TABLE_SIZE + 7 + 1 ) / 8 ]; + [ ( BSP_INTERRUPT_DISPATCH_TABLE_SIZE + 7 + 1 ) / 8 ]; static inline void bsp_interrupt_set_initialized(void) { - bsp_interrupt_set_handler_unique(BSP_INTERRUPT_HANDLER_TABLE_SIZE, true); + bsp_interrupt_set_handler_unique(BSP_INTERRUPT_DISPATCH_TABLE_SIZE, true); } #if defined(BSP_INTERRUPT_USE_INDEX_TABLE) @@ -66,8 +66,8 @@ static inline rtems_vector_number bsp_interrupt_allocate_handler_index( rtems_vector_number i; /* The first entry will remain empty */ - for ( i = 1; i < BSP_INTERRUPT_HANDLER_TABLE_SIZE; ++i ) { - if ( bsp_interrupt_handler_table[ i ] == NULL ) { + for ( i = 1; i < BSP_INTERRUPT_DISPATCH_TABLE_SIZE; ++i ) { + if ( bsp_interrupt_dispatch_table[ i ] == NULL ) { break; } } @@ -91,8 +91,8 @@ void bsp_interrupt_spurious( rtems_vector_number vector ) * In order to get the last written pointer value to the first entry, we have * to carry out an atomic read-modify-write operation. */ - ptr = (Atomic_Uintptr *) &bsp_interrupt_handler_table[ - bsp_interrupt_handler_index( vector ) + ptr = (Atomic_Uintptr *) &bsp_interrupt_dispatch_table[ + bsp_interrupt_dispatch_index( vector ) ]; first = (rtems_interrupt_entry *) _Atomic_Fetch_add_uintptr( ptr, 0, ATOMIC_ORDER_ACQUIRE ); @@ -142,9 +142,9 @@ rtems_interrupt_entry *bsp_interrupt_entry_find( rtems_interrupt_entry *entry; bsp_interrupt_assert( bsp_interrupt_is_valid_vector( vector ) ); - index = bsp_interrupt_handler_index( vector ); - *previous_next = &bsp_interrupt_handler_table[ index ]; - entry = bsp_interrupt_handler_table[ index ]; + index = bsp_interrupt_dispatch_index( vector ); + *previous_next = &bsp_interrupt_dispatch_table[ index ]; + entry = bsp_interrupt_dispatch_table[ index ]; while ( entry != NULL ) { if ( entry->handler == routine && entry->arg == arg ) { @@ -175,7 +175,7 @@ static rtems_status_code bsp_interrupt_entry_install_first( #ifdef BSP_INTERRUPT_USE_INDEX_TABLE index = bsp_interrupt_allocate_handler_index( vector ); - if ( index == BSP_INTERRUPT_HANDLER_TABLE_SIZE ) { + if ( index == BSP_INTERRUPT_DISPATCH_TABLE_SIZE ) { /* Handler table is full */ return RTEMS_NO_MEMORY; } @@ -184,10 +184,10 @@ static rtems_status_code bsp_interrupt_entry_install_first( #endif #ifdef BSP_INTERRUPT_USE_INDEX_TABLE - bsp_interrupt_handler_index_table[ vector ] = index; + bsp_interrupt_dispatch_index_table[ vector ] = index; #endif bsp_interrupt_entry_store_release( - &bsp_interrupt_handler_table[ index ], + &bsp_interrupt_dispatch_table[ index ], entry ); @@ -219,8 +219,8 @@ static rtems_status_code bsp_interrupt_entry_install( return RTEMS_INVALID_NUMBER; } - index = bsp_interrupt_handler_index( vector ); - first = bsp_interrupt_handler_table[ index ]; + index = bsp_interrupt_dispatch_index( vector ); + first = bsp_interrupt_dispatch_table[ index ]; if ( first == NULL ) { return bsp_interrupt_entry_install_first( vector, options, entry ); diff --git a/bsps/shared/irq/irq-handler-iterate.c b/bsps/shared/irq/irq-handler-iterate.c index 8bb29191fd..0aa890e6fd 100644 --- a/bsps/shared/irq/irq-handler-iterate.c +++ b/bsps/shared/irq/irq-handler-iterate.c @@ -56,10 +56,10 @@ rtems_status_code rtems_interrupt_handler_iterate( return sc; } - index = bsp_interrupt_handler_index( vector ); + index = bsp_interrupt_dispatch_index( vector ); options = bsp_interrupt_is_handler_unique( index ) ? RTEMS_INTERRUPT_UNIQUE : RTEMS_INTERRUPT_SHARED; - entry = bsp_interrupt_handler_table[ index ]; + entry = bsp_interrupt_dispatch_table[ index ]; while ( entry != NULL ) { ( *routine )( arg, entry->info, options, entry->handler, entry->arg ); -- cgit v1.2.3