From: "Inès Varhol" <ines.varhol@telecom-paris.fr>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org,
"Arnaud Minier" <arnaud.minier@telecom-paris.fr>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Inès Varhol" <ines.varhol@telecom-paris.fr>
Subject: [PATCH 2/3] hw/misc: In STM32L4x5 EXTI, handle direct line interrupts
Date: Sun, 12 May 2024 12:19:41 +0200 [thread overview]
Message-ID: <20240512102013.211127-3-ines.varhol@telecom-paris.fr> (raw)
In-Reply-To: <20240512102013.211127-1-ines.varhol@telecom-paris.fr>
The previous implementation for EXTI interrupts only handled
"configurable" interrupts, like those originating from STM32L4x5 SYSCFG
(the only device currently connected to the EXTI up until now).
In order to connect STM32L4x5 USART to the EXTI, this commit adds
handling for direct interrupts (interrupts without configurable edge),
as well as a comment that will be useful to connect other devices to the
EXTI.
Signed-off-by: Inès Varhol <ines.varhol@telecom-paris.fr>
---
hw/misc/stm32l4x5_exti.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/hw/misc/stm32l4x5_exti.c b/hw/misc/stm32l4x5_exti.c
index eebefc6cd3..1817bbdad2 100644
--- a/hw/misc/stm32l4x5_exti.c
+++ b/hw/misc/stm32l4x5_exti.c
@@ -106,6 +106,27 @@ static void stm32l4x5_exti_set_irq(void *opaque, int irq, int level)
return;
}
+ /* In case of a direct line interrupt */
+ if (extract32(exti_romask[bank], irq, 1)) {
+ if (level) {
+ qemu_irq_raise(s->irq[oirq]);
+ } else {
+ qemu_irq_lower(s->irq[oirq]);
+ }
+ return;
+ }
+
+ /*
+ * In case of a configurable interrupt
+ *
+ * Note that while the real EXTI uses edge detection to tell
+ * apart a line rising (the level changes from 0 to 1) and a line
+ * staying high (the level was 1 and is set to 1), the current
+ * implementation relies on the fact that this handler will only
+ * be called when there's a level change. That means that the
+ * devices creating a configurable interrupt (like STM32L4x5 GPIO)
+ * have to set their IRQs only on a change.
+ */
if (((1 << irq) & s->rtsr[bank]) && level) {
/* Rising Edge */
s->pr[bank] |= 1 << irq;
@@ -116,7 +137,7 @@ static void stm32l4x5_exti_set_irq(void *opaque, int irq, int level)
qemu_irq_pulse(s->irq[oirq]);
}
/*
- * In the following situations :
+ * In the following situations (for configurable interrupts) :
* - falling edge but rising trigger selected
* - rising edge but falling trigger selected
* - no trigger selected
--
2.43.2
next prev parent reply other threads:[~2024-05-12 10:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-12 10:19 [PATCH 0/3] Connect STM32L4x5 USART devices to the EXTI Inès Varhol
2024-05-12 10:19 ` [PATCH 1/3] hw/misc: In STM32L4x5 EXTI, consolidate 2 constants Inès Varhol
2024-05-20 14:30 ` Peter Maydell
2024-05-12 10:19 ` Inès Varhol [this message]
2024-05-20 14:30 ` [PATCH 2/3] hw/misc: In STM32L4x5 EXTI, handle direct line interrupts Peter Maydell
2024-05-12 10:19 ` [PATCH 3/3] hw/arm: In STM32L4x5 SOC, connect USART devices to EXTI Inès Varhol
2024-05-20 14:31 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240512102013.211127-3-ines.varhol@telecom-paris.fr \
--to=ines.varhol@telecom-paris.fr \
--cc=arnaud.minier@telecom-paris.fr \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).