arch: common: add function for updating IRQ table

This will be called by arch-specific implementations of
_arch_irq_connect_dynamic()

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2018-10-31 16:18:34 -07:00 committed by Anas Nashif
commit 539d3011d3
3 changed files with 32 additions and 0 deletions

View file

@ -5,6 +5,7 @@ zephyr_cc_option(-ffunction-sections -fdata-sections)
zephyr_sources_ifdef( zephyr_sources_ifdef(
CONFIG_GEN_ISR_TABLES CONFIG_GEN_ISR_TABLES
isr_tables.c isr_tables.c
sw_isr_common.c
) )
zephyr_sources_ifdef( zephyr_sources_ifdef(

View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 2018 Intel Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <sw_isr_table.h>
#include <arch/cpu.h>
#include <misc/__assert.h>
/*
* Common code for arches that use software ISR tables (CONFIG_GEN_ISR_TABLES)
*/
#ifdef CONFIG_DYNAMIC_INTERRUPTS
void z_isr_install(unsigned int irq, void (*routine)(void *), void *param)
{
unsigned int table_idx = irq - CONFIG_GEN_IRQ_START_VECTOR;
__ASSERT(!irq_is_enabled(irq), "IRQ %d is enabled", irq);
/* If dynamic IRQs are enabled, then the _sw_isr_table is in RAM and
* can be modified
*/
_sw_isr_table[table_idx].arg = param;
_sw_isr_table[table_idx].isr = routine;
}
#endif /* CONFIG_DYNAMIC_INTERRUPTS */

View file

@ -71,6 +71,10 @@ struct _isr_list {
#define IRQ_TABLE_SIZE (CONFIG_NUM_IRQS - CONFIG_GEN_IRQ_START_VECTOR) #define IRQ_TABLE_SIZE (CONFIG_NUM_IRQS - CONFIG_GEN_IRQ_START_VECTOR)
#ifdef CONFIG_DYNAMIC_INTERRUPTS
void z_isr_install(unsigned int irq, void (*routine)(void *), void *param);
#endif
#endif /* _ASMLANGUAGE */ #endif /* _ASMLANGUAGE */
#ifdef __cplusplus #ifdef __cplusplus