qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH for-2.13 2/5] hw/dma/i8257: Define I8257_CHANNEL_COU


From: Philippe Mathieu-Daudé
Subject: [Qemu-devel] [PATCH for-2.13 2/5] hw/dma/i8257: Define I8257_CHANNEL_COUNT
Date: Mon, 26 Mar 2018 12:34:38 -0300

The 8257 has 4 DMA channels, reflect that to denote than when 8 channels
are used, this is not a single 8257 (but probably two cascaded).

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
 include/hw/dma/i8257.h | 4 +++-
 hw/dma/i8257.c         | 6 +++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/hw/dma/i8257.h b/include/hw/dma/i8257.h
index 2cab50bb6c..3053f18797 100644
--- a/include/hw/dma/i8257.h
+++ b/include/hw/dma/i8257.h
@@ -7,6 +7,8 @@
 
 #define TYPE_I8257 "i8257"
 
+#define I8257_CHANNEL_COUNT 4
+
 typedef struct I8257Regs {
     int now[2];
     uint16_t base[2];
@@ -33,7 +35,7 @@ typedef struct I8257State {
     uint8_t command;
     uint8_t mask;
     uint8_t flip_flop;
-    I8257Regs regs[4];
+    I8257Regs regs[I8257_CHANNEL_COUNT];
     MemoryRegion channel_io;
     MemoryRegion cont_io;
 
diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c
index 52675e97c9..df030f934c 100644
--- a/hw/dma/i8257.c
+++ b/hw/dma/i8257.c
@@ -361,7 +361,7 @@ static void i8257_dma_run(void *opaque)
         d->running = 1;
     }
 
-    for (ichan = 0; ichan < 4; ichan++) {
+    for (ichan = 0; ichan < I8257_CHANNEL_COUNT; ichan++) {
         int mask;
 
         mask = 1 << ichan;
@@ -536,8 +536,8 @@ static const VMStateDescription vmstate_i8257 = {
         VMSTATE_UINT8(mask, I8257State),
         VMSTATE_UINT8(flip_flop, I8257State),
         VMSTATE_INT32(dshift, I8257State),
-        VMSTATE_STRUCT_ARRAY(regs, I8257State, 4, 1, vmstate_i8257_regs,
-                             I8257Regs),
+        VMSTATE_STRUCT_ARRAY(regs, I8257State, I8257_CHANNEL_COUNT, 1,
+                             vmstate_i8257_regs, I8257Regs),
         VMSTATE_END_OF_LIST()
     }
 };
-- 
2.16.3




reply via email to

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