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>
|
#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);
|
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)
|
static void dyn_isr(void *arg)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(arg);
|
ARG_UNUSED(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern struct _isr_table_entry __sw_isr_table _sw_isr_table[];
|
/**
|
||||||
|
* @brief Test dynamic ISR installation
|
||||||
static void do_isr_dynamic(void)
|
*
|
||||||
|
* @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;
|
int i;
|
||||||
void *argval;
|
void *argval;
|
||||||
|
@ -38,6 +39,9 @@ static void do_isr_dynamic(void)
|
||||||
zassert_true(_sw_isr_table[i].isr == z_irq_spurious,
|
zassert_true(_sw_isr_table[i].isr == z_irq_spurious,
|
||||||
"could not find slot for dynamic isr");
|
"could not find slot for dynamic isr");
|
||||||
|
|
||||||
|
printk("installing dynamic ISR for IRQ %d\n",
|
||||||
|
CONFIG_GEN_IRQ_START_VECTOR + i);
|
||||||
|
|
||||||
argval = &i;
|
argval = &i;
|
||||||
arch_irq_connect_dynamic(i + CONFIG_GEN_IRQ_START_VECTOR, 0, dyn_isr,
|
arch_irq_connect_dynamic(i + CONFIG_GEN_IRQ_START_VECTOR, 0, dyn_isr,
|
||||||
argval, 0);
|
argval, 0);
|
||||||
|
@ -46,13 +50,10 @@ static void do_isr_dynamic(void)
|
||||||
_sw_isr_table[i].arg == argval,
|
_sw_isr_table[i].arg == argval,
|
||||||
"dynamic isr did not install successfully");
|
"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)
|
void test_isr_dynamic(void)
|
||||||
{
|
{
|
||||||
#ifdef DYNTEST
|
|
||||||
do_isr_dynamic();
|
|
||||||
#else
|
|
||||||
ztest_test_skip();
|
ztest_test_skip();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_DYNAMIC_INTERRUPTS && CONFIG_GEN_SW_ISR_TABLE */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue