Skip to content

Commit 539d301

Browse files
Andrew Boienashif
authored andcommitted
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 <[email protected]>
1 parent 7bac15f commit 539d301

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

arch/common/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ zephyr_cc_option(-ffunction-sections -fdata-sections)
55
zephyr_sources_ifdef(
66
CONFIG_GEN_ISR_TABLES
77
isr_tables.c
8+
sw_isr_common.c
89
)
910

1011
zephyr_sources_ifdef(

arch/common/sw_isr_common.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2018 Intel Corporation.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <sw_isr_table.h>
8+
#include <arch/cpu.h>
9+
#include <misc/__assert.h>
10+
/*
11+
* Common code for arches that use software ISR tables (CONFIG_GEN_ISR_TABLES)
12+
*/
13+
14+
#ifdef CONFIG_DYNAMIC_INTERRUPTS
15+
void z_isr_install(unsigned int irq, void (*routine)(void *), void *param)
16+
{
17+
unsigned int table_idx = irq - CONFIG_GEN_IRQ_START_VECTOR;
18+
19+
__ASSERT(!irq_is_enabled(irq), "IRQ %d is enabled", irq);
20+
21+
/* If dynamic IRQs are enabled, then the _sw_isr_table is in RAM and
22+
* can be modified
23+
*/
24+
_sw_isr_table[table_idx].arg = param;
25+
_sw_isr_table[table_idx].isr = routine;
26+
}
27+
#endif /* CONFIG_DYNAMIC_INTERRUPTS */

include/sw_isr_table.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ struct _isr_list {
7171

7272
#define IRQ_TABLE_SIZE (CONFIG_NUM_IRQS - CONFIG_GEN_IRQ_START_VECTOR)
7373

74+
#ifdef CONFIG_DYNAMIC_INTERRUPTS
75+
void z_isr_install(unsigned int irq, void (*routine)(void *), void *param);
76+
#endif
77+
7478
#endif /* _ASMLANGUAGE */
7579

7680
#ifdef __cplusplus

0 commit comments

Comments
 (0)