On 29/12/23 17:47, Inès Varhol wrote:
Acked-by: Alistair Francis <alistair.fran...@wdc.com>
Signed-off-by: Arnaud Minier <arnaud.min...@telecom-paris.fr>
Signed-off-by: Inès Varhol <ines.var...@telecom-paris.fr>
---
tests/qtest/meson.build | 3 +-
tests/qtest/stm32l4x5_syscfg-test.c | 408 ++++++++++++++++++++++++++++
2 files changed, 410 insertions(+), 1 deletion(-)
create mode 100644 tests/qtest/stm32l4x5_syscfg-test.c
Helper suggestion to ease readability:
static void syscfg_set_irq(int num, int level)
{
qtest_set_irq_in(global_qtest, "/machine/soc/syscfg",
NULL, num, level);
}
When the SoC is parented to the machine, this patch needs:
-- >8 --
diff --git a/tests/qtest/stm32l4x5_syscfg-test.c
b/tests/qtest/stm32l4x5_syscfg-test.c
index 3edd13b222..272ba91055 100644
--- a/tests/qtest/stm32l4x5_syscfg-test.c
+++ b/tests/qtest/stm32l4x5_syscfg-test.c
@@ -240,3 +240,3 @@ static void test_interrupt(void)
*/
- qtest_irq_intercept_in(global_qtest,
"/machine/unattached/device[0]/exti");
+ qtest_irq_intercept_in(global_qtest, "/machine/soc/exti");
/* Enable interrupt on rising edge of GPIO PA[0] */
@@ -245,4 +245,3 @@ static void test_interrupt(void)
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 0, 1);
+ qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 0, 1);
@@ -254,4 +253,3 @@ static void test_interrupt(void)
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 15, 1);
+ qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 15, 1);
@@ -264,4 +262,3 @@ static void test_interrupt(void)
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 17, 1);
+ qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 17, 1);
@@ -271,8 +268,5 @@ static void test_interrupt(void)
syscfg_writel(SYSCFG_EXTICR1, 0x00000000);
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 0, 0);
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 15, 0);
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 17, 0);
+ qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 0, 0);
+ qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 15, 0);
+ qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 17, 0);
}
@@ -285,3 +279,3 @@ static void test_irq_pin_multiplexer(void)
- qtest_irq_intercept_in(global_qtest,
"/machine/unattached/device[0]/exti");
+ qtest_irq_intercept_in(global_qtest, "/machine/soc/exti");
@@ -291,4 +285,3 @@ static void test_irq_pin_multiplexer(void)
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 0, 1);
+ qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 0, 1);
@@ -299,4 +292,3 @@ static void test_irq_pin_multiplexer(void)
/* Clean the test */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 0, 0);
+ qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 0, 0);
@@ -306,4 +298,3 @@ static void test_irq_pin_multiplexer(void)
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 15, 1);
+ qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 15, 1);
@@ -314,4 +305,3 @@ static void test_irq_pin_multiplexer(void)
/* Clean the test */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 15, 0);
+ qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 15, 0);
}
@@ -324,3 +314,3 @@ static void test_irq_gpio_multiplexer(void)
- qtest_irq_intercept_in(global_qtest,
"/machine/unattached/device[0]/exti");
+ qtest_irq_intercept_in(global_qtest, "/machine/soc/exti");
@@ -331,4 +321,3 @@ static void test_irq_gpio_multiplexer(void)
/* Check that setting rising pin GPIOA[0] generates an irq */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 0, 1);
+ qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 0, 1);
@@ -337,8 +326,6 @@ static void test_irq_gpio_multiplexer(void)
/* Clean the test */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 0, 0);
+ qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 0, 0);
/* Check that setting rising pin GPIOB[0] doesn't generate an irq */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 16, 1);
+ qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 16, 1);
@@ -347,4 +334,3 @@ static void test_irq_gpio_multiplexer(void)
/* Clean the test */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 16, 0);
+ qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 16, 0);
@@ -356,4 +342,3 @@ static void test_irq_gpio_multiplexer(void)
/* Check that setting rising pin GPIOA[0] doesn't generate an irq */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 0, 1);
+ qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 0, 1);
@@ -362,8 +347,6 @@ static void test_irq_gpio_multiplexer(void)
/* Clean the test */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 0, 0);
+ qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 0, 0);
/* Check that setting rising pin GPIOB[0] generates an irq */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 16, 1);
+ qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 16, 1);
@@ -372,4 +355,3 @@ static void test_irq_gpio_multiplexer(void)
/* Clean the test */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 16, 0);
+ qtest_set_irq_in(global_qtest, "/machine/soc/syscfg", NULL, 16, 0);
syscfg_writel(SYSCFG_EXTICR1, 0x00000000);
---
With the helper included (since I tested it):
-- >8 --
diff --git a/tests/qtest/stm32l4x5_syscfg-test.c
b/tests/qtest/stm32l4x5_syscfg-test.c
index 3edd13b222..19a5f83ebe 100644
--- a/tests/qtest/stm32l4x5_syscfg-test.c
+++ b/tests/qtest/stm32l4x5_syscfg-test.c
@@ -47,2 +47,8 @@ static void exti_writel(unsigned int offset, uint32_t
value)
+static void syscfg_set_irq(int num, int level)
+{
+ qtest_set_irq_in(global_qtest, "/machine/soc/syscfg",
+ NULL, num, level);
+}
+
static void system_reset(void)
@@ -240,3 +246,3 @@ static void test_interrupt(void)
*/
- qtest_irq_intercept_in(global_qtest,
"/machine/unattached/device[0]/exti");
+ qtest_irq_intercept_in(global_qtest, "/machine/soc/exti");
/* Enable interrupt on rising edge of GPIO PA[0] */
@@ -245,4 +251,3 @@ static void test_interrupt(void)
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 0, 1);
+ syscfg_set_irq(0, 1);
@@ -254,4 +259,3 @@ static void test_interrupt(void)
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 15, 1);
+ syscfg_set_irq(15, 1);
@@ -264,4 +268,3 @@ static void test_interrupt(void)
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 17, 1);
+ syscfg_set_irq(17, 1);
@@ -271,8 +274,5 @@ static void test_interrupt(void)
syscfg_writel(SYSCFG_EXTICR1, 0x00000000);
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 0, 0);
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 15, 0);
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 17, 0);
+ syscfg_set_irq(0, 0);
+ syscfg_set_irq(15, 0);
+ syscfg_set_irq(17, 0);
}
@@ -285,3 +285,3 @@ static void test_irq_pin_multiplexer(void)
- qtest_irq_intercept_in(global_qtest,
"/machine/unattached/device[0]/exti");
+ qtest_irq_intercept_in(global_qtest, "/machine/soc/exti");
@@ -291,4 +291,3 @@ static void test_irq_pin_multiplexer(void)
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 0, 1);
+ syscfg_set_irq(0, 1);
@@ -299,4 +298,3 @@ static void test_irq_pin_multiplexer(void)
/* Clean the test */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 0, 0);
+ syscfg_set_irq(0, 0);
@@ -306,4 +304,3 @@ static void test_irq_pin_multiplexer(void)
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 15, 1);
+ syscfg_set_irq(15, 1);
@@ -314,4 +311,3 @@ static void test_irq_pin_multiplexer(void)
/* Clean the test */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 15, 0);
+ syscfg_set_irq(15, 0);
}
@@ -324,3 +320,3 @@ static void test_irq_gpio_multiplexer(void)
- qtest_irq_intercept_in(global_qtest,
"/machine/unattached/device[0]/exti");
+ qtest_irq_intercept_in(global_qtest, "/machine/soc/exti");
@@ -331,4 +327,3 @@ static void test_irq_gpio_multiplexer(void)
/* Check that setting rising pin GPIOA[0] generates an irq */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 0, 1);
+ syscfg_set_irq(0, 1);
@@ -337,8 +332,6 @@ static void test_irq_gpio_multiplexer(void)
/* Clean the test */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 0, 0);
+ syscfg_set_irq(0, 0);
/* Check that setting rising pin GPIOB[0] doesn't generate an irq */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 16, 1);
+ syscfg_set_irq(16, 1);
@@ -347,4 +340,3 @@ static void test_irq_gpio_multiplexer(void)
/* Clean the test */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 16, 0);
+ syscfg_set_irq(16, 0);
@@ -356,4 +348,3 @@ static void test_irq_gpio_multiplexer(void)
/* Check that setting rising pin GPIOA[0] doesn't generate an irq */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 0, 1);
+ syscfg_set_irq(0, 1);
@@ -362,8 +353,6 @@ static void test_irq_gpio_multiplexer(void)
/* Clean the test */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 0, 0);
+ syscfg_set_irq(0, 0);
/* Check that setting rising pin GPIOB[0] generates an irq */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 16, 1);
+ syscfg_set_irq(16, 1);
@@ -372,4 +361,3 @@ static void test_irq_gpio_multiplexer(void)
/* Clean the test */
- qtest_set_irq_in(global_qtest, "/machine/unattached/device[0]/syscfg",
- NULL, 16, 0);
+ syscfg_set_irq(16, 0);
syscfg_writel(SYSCFG_EXTICR1, 0x00000000);
---
Tested-by: Philippe Mathieu-Daudé <phi...@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org>
Regards,
Phil.