tests: kernel: interrupt: Clean up dynamic_isr test
This commit cleans up the dynamic ISR test and adds a documentation comment for it. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
parent
06e3e40c0c
commit
6820fdf0fb
1 changed files with 19 additions and 18 deletions
|
@ -6,25 +6,26 @@
|
|||
|
||||
#include <ztest.h>
|
||||
|
||||
#if defined(CONFIG_DYNAMIC_INTERRUPTS) && defined(CONFIG_GEN_SW_ISR_TABLE)
|
||||
extern struct _isr_table_entry __sw_isr_table _sw_isr_table[];
|
||||
extern void z_irq_spurious(void *unused);
|
||||
|
||||
/* Simple whitebox test of dynamic interrupt handlers as implemented
|
||||
* by the GEN_SW_ISR feature.
|
||||
*/
|
||||
#if (defined(CONFIG_DYNAMIC_INTERRUPTS) \
|
||||
&& defined(CONFIG_GEN_SW_ISR_TABLE))
|
||||
#define DYNTEST 1
|
||||
#endif
|
||||
|
||||
#ifdef DYNTEST
|
||||
static void dyn_isr(void *arg)
|
||||
{
|
||||
ARG_UNUSED(arg);
|
||||
}
|
||||
|
||||
extern struct _isr_table_entry __sw_isr_table _sw_isr_table[];
|
||||
|
||||
static void do_isr_dynamic(void)
|
||||
/**
|
||||
* @brief Test dynamic ISR installation
|
||||
*
|
||||
* @ingroup kernel_interrupt_tests
|
||||
*
|
||||
* This routine locates an unused entry in the software ISR table, installs a
|
||||
* dynamic ISR to the unused entry by calling the `arch_irq_connect_dynamic`
|
||||
* function, and verifies that the ISR is successfully installed by checking
|
||||
* the software ISR table entry.
|
||||
*/
|
||||
void test_isr_dynamic(void)
|
||||
{
|
||||
int i;
|
||||
void *argval;
|
||||
|
@ -38,6 +39,9 @@ static void do_isr_dynamic(void)
|
|||
zassert_true(_sw_isr_table[i].isr == z_irq_spurious,
|
||||
"could not find slot for dynamic isr");
|
||||
|
||||
printk("installing dynamic ISR for IRQ %d\n",
|
||||
CONFIG_GEN_IRQ_START_VECTOR + i);
|
||||
|
||||
argval = &i;
|
||||
arch_irq_connect_dynamic(i + CONFIG_GEN_IRQ_START_VECTOR, 0, dyn_isr,
|
||||
argval, 0);
|
||||
|
@ -46,13 +50,10 @@ static void do_isr_dynamic(void)
|
|||
_sw_isr_table[i].arg == argval,
|
||||
"dynamic isr did not install successfully");
|
||||
}
|
||||
#endif /* DYNTEST */
|
||||
|
||||
#else
|
||||
/* Skip the dynamic interrupt test for the platforms that do not support it */
|
||||
void test_isr_dynamic(void)
|
||||
{
|
||||
#ifdef DYNTEST
|
||||
do_isr_dynamic();
|
||||
#else
|
||||
ztest_test_skip();
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_DYNAMIC_INTERRUPTS && CONFIG_GEN_SW_ISR_TABLE */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue