[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 8/9] escc: re-use escc_reset_chn() for hard and soft reset
From: |
Mark Cave-Ayland |
Subject: |
[PATCH v2 8/9] escc: re-use escc_reset_chn() for hard and soft reset |
Date: |
Thu, 2 Sep 2021 11:22:04 +0100 |
This removes duplication of the internal device state initialisation from all
of device reset, soft reset and hard reset.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/char/escc.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/hw/char/escc.c b/hw/char/escc.c
index c6b477ef78..29fcdcb625 100644
--- a/hw/char/escc.c
+++ b/hw/char/escc.c
@@ -291,7 +291,8 @@ static void escc_reset_chn(ESCCChannelState *s)
static void escc_soft_reset_chn(ESCCChannelState *s)
{
- s->reg = 0;
+ escc_reset_chn(s);
+
s->wregs[W_CMD] = 0;
s->wregs[W_INTR] &= ~(INTR_INTALL | INTR_TXINT | INTR_RXINT1ST |
INTR_RXINTALL | INTR_WTDMA_EN | INTR_WTDMA_RQ);
@@ -318,17 +319,12 @@ static void escc_soft_reset_chn(ESCCChannelState *s)
s->rregs[R_SPEC] |= SPEC_BITS8;
s->rregs[R_INTR] = 0;
s->rregs[R_MISC] &= ~MISC_2CLKMISS;
-
- s->rx = s->tx = 0;
- s->rxint = s->txint = 0;
- s->rxint_under_svc = s->txint_under_svc = 0;
- s->e0_mode = s->led_mode = s->caps_lock_mode = s->num_lock_mode = 0;
- clear_queue(s);
}
static void escc_hard_reset_chn(ESCCChannelState *s)
{
- s->reg = 0;
+ escc_reset_chn(s);
+
s->wregs[W_CMD] = 0;
s->wregs[W_INTR] &= ~(INTR_INTALL | INTR_TXINT | INTR_RXINT1ST |
INTR_RXINTALL | INTR_WTDMA_EN | INTR_WTDMA_RQ);
@@ -357,12 +353,6 @@ static void escc_hard_reset_chn(ESCCChannelState *s)
s->rregs[R_SPEC] |= SPEC_BITS8;
s->rregs[R_INTR] = 0;
s->rregs[R_MISC] &= ~MISC_2CLKMISS;
-
- s->rx = s->tx = 0;
- s->rxint = s->txint = 0;
- s->rxint_under_svc = s->txint_under_svc = 0;
- s->e0_mode = s->led_mode = s->caps_lock_mode = s->num_lock_mode = 0;
- clear_queue(s);
}
static void escc_reset(DeviceState *d)
--
2.20.1
- [PATCH v2 2/9] escc: reset register values to zero in escc_reset(), (continued)
[PATCH v2 5/9] escc: implement soft reset as described in the datasheet, Mark Cave-Ayland, 2021/09/02
[PATCH v2 6/9] escc: implement hard reset as described in the datasheet, Mark Cave-Ayland, 2021/09/02
[PATCH v2 7/9] escc: remove register changes from escc_reset_chn(), Mark Cave-Ayland, 2021/09/02
[PATCH v2 8/9] escc: re-use escc_reset_chn() for hard and soft reset,
Mark Cave-Ayland <=
[PATCH v2 9/9] escc: fix STATUS_SYNC bit in R_STATUS register, Mark Cave-Ayland, 2021/09/02