qemu-devel
[Top][All Lists]
Advanced

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

[PATCH 2/8] hw/gpio/avr_gpio: Add migration VMstate


From: Heecheol Yang
Subject: [PATCH 2/8] hw/gpio/avr_gpio: Add migration VMstate
Date: Mon, 12 Sep 2022 20:21:00 +0900

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210313165445.2113938-5-f4bug@amsat.org>
Reviewed-by: Michael Rolnik <mrolnik@gmail.com>
Signed-off-by: Heecheol Yang <heecheol.yang@outlook.com>
---
 hw/gpio/avr_gpio.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/hw/gpio/avr_gpio.c b/hw/gpio/avr_gpio.c
index cdb574ef0d..da34009dae 100644
--- a/hw/gpio/avr_gpio.c
+++ b/hw/gpio/avr_gpio.c
@@ -25,6 +25,7 @@
 #include "hw/irq.h"
 #include "hw/gpio/avr_gpio.h"
 #include "hw/qdev-properties.h"
+#include "migration/vmstate.h"
 
 static void avr_gpio_reset(DeviceState *dev)
 {
@@ -100,6 +101,18 @@ static const MemoryRegionOps avr_gpio_ops = {
     .endianness = DEVICE_NATIVE_ENDIAN,
 };
 
+static const VMStateDescription avr_gpio_vmstate = {
+    .name = "avr-gpio",
+    .version_id = 0,
+    .minimum_version_id = 0,
+    .fields = (VMStateField[]) {
+        VMSTATE_UINT8(reg.pin, AVRGPIOState),
+        VMSTATE_UINT8(reg.ddr, AVRGPIOState),
+        VMSTATE_UINT8(reg.port, AVRGPIOState),
+        VMSTATE_END_OF_LIST(),
+    },
+};
+
 static void avr_gpio_init(Object *obj)
 {
     AVRGPIOState *s = AVR_GPIO(obj);
@@ -120,6 +133,7 @@ static void avr_gpio_class_init(ObjectClass *klass, void 
*data)
 
     dc->reset = avr_gpio_reset;
     dc->realize = avr_gpio_realize;
+    dc->vmsd = &avr_gpio_vmstate;
 }
 
 static const TypeInfo avr_gpio_info = {
-- 
2.34.1




reply via email to

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