irq: multilevel: add APIs with level as argument

Add APIs that accept an additional `level` argument, and use
that to call the respective functions. In some cases this can
reduce code complexity, especially when the level isn't known
at build time.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
This commit is contained in:
Yong Cong Sin 2024-01-26 12:45:40 +08:00 committed by Johan Hedberg
commit dcaf217336
2 changed files with 77 additions and 0 deletions

View file

@ -415,14 +415,20 @@ static void test_multi_level_bit_masks_fn(uint32_t irq1, uint32_t irq2, uint32_t
if (has_l2) {
zassert_equal(hwirq2, irq_from_level_2(irqn));
zassert_equal(hwirq2, irq_from_level(irqn, 2));
zassert_equal((hwirq2 + 1) << l2_shift, irq_to_level_2(hwirq2));
zassert_equal((hwirq2 + 1) << l2_shift, irq_to_level(hwirq2, 2));
zassert_equal(hwirq1, irq_parent_level_2(irqn));
zassert_equal(hwirq1, irq_parent_level(irqn, 2));
}
if (has_l3) {
zassert_equal(hwirq3, irq_from_level_3(irqn));
zassert_equal(hwirq3, irq_from_level(irqn, 3));
zassert_equal((hwirq3 + 1) << l3_shift, irq_to_level_3(hwirq3));
zassert_equal((hwirq3 + 1) << l3_shift, irq_to_level(hwirq3, 3));
zassert_equal(hwirq2 + 1, irq_parent_level_3(irqn));
zassert_equal(hwirq2 + 1, irq_parent_level(irqn, 3));
}
if (has_l3) {