[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 2/6] qtest: factor out qtest_install_gpio_out_intercept
From: |
Chris Laplante |
Subject: |
[PATCH v2 2/6] qtest: factor out qtest_install_gpio_out_intercept |
Date: |
Wed, 26 Jul 2023 03:31:59 +0000 |
Signed-off-by: Chris Laplante <chris@laplante.io>
---
softmmu/qtest.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/softmmu/qtest.c b/softmmu/qtest.c
index f8d764b719..1c92e5a6a3 100644
--- a/softmmu/qtest.c
+++ b/softmmu/qtest.c
@@ -365,6 +365,15 @@ void qtest_set_command_cb(bool (*pc_cb)(CharBackend *chr,
gchar **words))
process_command_cb = pc_cb;
}
+static void qtest_install_gpio_out_intercept(DeviceState *dev, const char
*name, int n)
+{
+ qemu_irq *disconnected = g_new0(qemu_irq, 1);
+ qemu_irq icpt = qemu_allocate_irq(qtest_irq_handler,
+ disconnected, n);
+
+ *disconnected = qdev_intercept_gpio_out(dev, icpt,name, n);
+}
+
static void qtest_process_command(CharBackend *chr, gchar **words)
{
const gchar *command;
@@ -415,12 +424,7 @@ static void qtest_process_command(CharBackend *chr, gchar
**words)
if (words[0][14] == 'o') {
int i;
for (i = 0; i < ngl->num_out; ++i) {
- qemu_irq *disconnected = g_new0(qemu_irq, 1);
- qemu_irq icpt = qemu_allocate_irq(qtest_irq_handler,
- disconnected, i);
-
- *disconnected = qdev_intercept_gpio_out(dev, icpt,
- ngl->name, i);
+ qtest_install_gpio_out_intercept(dev, ngl->name, i);
}
} else {
qemu_irq_intercept_in(ngl->in, qtest_irq_handler,
--
2.41.0
- [PATCH v2 0/6] Add nRF51 DETECT signal with test, Chris Laplante, 2023/07/25
- [PATCH v2 5/6] qtest: irq_intercept_[out/in]: return FAIL if no intercepts are installed, Chris Laplante, 2023/07/25
- [PATCH v2 4/6] qtest: bail from irq_intercept_in if name is specified, Chris Laplante, 2023/07/25
- [PATCH v2 6/6] qtest: microbit-test: add tests for nRF51 DETECT, Chris Laplante, 2023/07/25
- Re: [PATCH v2 0/6] Add nRF51 DETECT signal with test, Peter Maydell, 2023/07/27