qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 4/6] hw/char/parallel: Export ParallelState


From: BALATON Zoltan
Subject: Re: [PATCH v2 4/6] hw/char/parallel: Export ParallelState
Date: Sun, 21 May 2023 14:43:37 +0200 (CEST)

On Sun, 21 May 2023, Bernhard Beschow wrote:
Exporting ParallelState is a precondition for exporing TYPE_ISA_PARALLEL.

This may need a better commit message. It's not a precondition per coding standards I think just a preference for allowing embedding the device in other devices but otherwise unnecessary. Or at least fix the typo "exporing" -> exporting.

Regards,
BALATON Zoltan

Suggested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
include/hw/char/parallel.h | 44 ++++++++++++++++++++++++++++++++++++++
hw/char/parallel.c         | 42 ------------------------------------
2 files changed, 44 insertions(+), 42 deletions(-)

diff --git a/include/hw/char/parallel.h b/include/hw/char/parallel.h
index 0a23c0f57e..2d4907c1fe 100644
--- a/include/hw/char/parallel.h
+++ b/include/hw/char/parallel.h
@@ -1,9 +1,53 @@
#ifndef HW_PARALLEL_H
#define HW_PARALLEL_H

+#include "exec/ioport.h"
+#include "exec/memory.h"
#include "hw/isa/isa.h"
+#include "hw/irq.h"
+#include "chardev/char-fe.h"
#include "chardev/char.h"

+/*
+ * These are the definitions for the Printer Status Register
+ */
+#define PARA_STS_BUSY   0x80    /* Busy complement */
+#define PARA_STS_ACK    0x40    /* Acknowledge */
+#define PARA_STS_PAPER  0x20    /* Out of paper */
+#define PARA_STS_ONLINE 0x10    /* Online */
+#define PARA_STS_ERROR  0x08    /* Error complement */
+#define PARA_STS_TMOUT  0x01    /* EPP timeout */
+
+/*
+ * These are the definitions for the Printer Control Register
+ */
+#define PARA_CTR_DIR    0x20    /* Direction (1=read, 0=write) */
+#define PARA_CTR_INTEN  0x10    /* IRQ Enable */
+#define PARA_CTR_SELECT 0x08    /* Select In complement */
+#define PARA_CTR_INIT   0x04    /* Initialize Printer complement */
+#define PARA_CTR_AUTOLF 0x02    /* Auto linefeed complement */
+#define PARA_CTR_STROBE 0x01    /* Strobe complement */
+
+#define PARA_CTR_SIGNAL (PARA_CTR_SELECT | PARA_CTR_INIT | PARA_CTR_AUTOLF \
+                         | PARA_CTR_STROBE)
+
+typedef struct ParallelState {
+    MemoryRegion iomem;
+    uint8_t dataw;
+    uint8_t datar;
+    uint8_t status;
+    uint8_t control;
+    qemu_irq irq;
+    int irq_pending;
+    CharBackend chr;
+    int hw_driver;
+    int epp_timeout;
+    uint32_t last_read_offset; /* For debugging */
+    /* Memory-mapped interface */
+    int it_shift;
+    PortioList portio_list;
+} ParallelState;
+
void parallel_hds_isa_init(ISABus *bus, int n);

bool parallel_mm_init(MemoryRegion *address_space,
diff --git a/hw/char/parallel.c b/hw/char/parallel.c
index af551e7864..522301f43a 100644
--- a/hw/char/parallel.c
+++ b/hw/char/parallel.c
@@ -27,10 +27,7 @@
#include "qapi/error.h"
#include "qemu/module.h"
#include "chardev/char-parallel.h"
-#include "chardev/char-fe.h"
#include "hw/acpi/acpi_aml_interface.h"
-#include "hw/irq.h"
-#include "hw/isa/isa.h"
#include "hw/qdev-properties.h"
#include "hw/qdev-properties-system.h"
#include "migration/vmstate.h"
@@ -54,45 +51,6 @@
#define PARA_REG_EPP_ADDR 3
#define PARA_REG_EPP_DATA 4

-/*
- * These are the definitions for the Printer Status Register
- */
-#define PARA_STS_BUSY   0x80    /* Busy complement */
-#define PARA_STS_ACK    0x40    /* Acknowledge */
-#define PARA_STS_PAPER  0x20    /* Out of paper */
-#define PARA_STS_ONLINE 0x10    /* Online */
-#define PARA_STS_ERROR  0x08    /* Error complement */
-#define PARA_STS_TMOUT  0x01    /* EPP timeout */
-
-/*
- * These are the definitions for the Printer Control Register
- */
-#define PARA_CTR_DIR    0x20    /* Direction (1=read, 0=write) */
-#define PARA_CTR_INTEN  0x10    /* IRQ Enable */
-#define PARA_CTR_SELECT 0x08    /* Select In complement */
-#define PARA_CTR_INIT   0x04    /* Initialize Printer complement */
-#define PARA_CTR_AUTOLF 0x02    /* Auto linefeed complement */
-#define PARA_CTR_STROBE 0x01    /* Strobe complement */
-
-#define PARA_CTR_SIGNAL 
(PARA_CTR_SELECT|PARA_CTR_INIT|PARA_CTR_AUTOLF|PARA_CTR_STROBE)
-
-typedef struct ParallelState {
-    MemoryRegion iomem;
-    uint8_t dataw;
-    uint8_t datar;
-    uint8_t status;
-    uint8_t control;
-    qemu_irq irq;
-    int irq_pending;
-    CharBackend chr;
-    int hw_driver;
-    int epp_timeout;
-    uint32_t last_read_offset; /* For debugging */
-    /* Memory-mapped interface */
-    int it_shift;
-    PortioList portio_list;
-} ParallelState;
-
#define TYPE_ISA_PARALLEL "isa-parallel"
OBJECT_DECLARE_SIMPLE_TYPE(ISAParallelState, ISA_PARALLEL)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]