Revision aa941b94 hw/max111x.c
b/hw/max111x.c | ||
---|---|---|
89 | 89 |
qemu_irq_raise(s->interrupt); |
90 | 90 |
} |
91 | 91 |
|
92 |
static void max111x_save(QEMUFile *f, void *opaque) |
|
93 |
{ |
|
94 |
struct max111x_s *s = (struct max111x_s *) opaque; |
|
95 |
int i; |
|
96 |
|
|
97 |
qemu_put_8s(f, &s->tb1); |
|
98 |
qemu_put_8s(f, &s->rb2); |
|
99 |
qemu_put_8s(f, &s->rb3); |
|
100 |
qemu_put_be32(f, s->inputs); |
|
101 |
qemu_put_be32(f, s->com); |
|
102 |
for (i = 0; i < s->inputs; i ++) |
|
103 |
qemu_put_byte(f, s->input[i]); |
|
104 |
} |
|
105 |
|
|
106 |
static int max111x_load(QEMUFile *f, void *opaque, int version_id) |
|
107 |
{ |
|
108 |
struct max111x_s *s = (struct max111x_s *) opaque; |
|
109 |
int i; |
|
110 |
|
|
111 |
qemu_get_8s(f, &s->tb1); |
|
112 |
qemu_get_8s(f, &s->rb2); |
|
113 |
qemu_get_8s(f, &s->rb3); |
|
114 |
if (s->inputs != qemu_get_be32(f)) |
|
115 |
return -EINVAL; |
|
116 |
s->com = qemu_get_be32(f); |
|
117 |
for (i = 0; i < s->inputs; i ++) |
|
118 |
s->input[i] = qemu_get_byte(f); |
|
119 |
|
|
120 |
return 0; |
|
121 |
} |
|
122 |
|
|
123 |
static int max111x_iid = 0; |
|
124 |
|
|
92 | 125 |
static struct max111x_s *max111x_init(qemu_irq cb) |
93 | 126 |
{ |
94 | 127 |
struct max111x_s *s; |
... | ... | |
108 | 141 |
s->input[6] = 0x90; |
109 | 142 |
s->input[7] = 0x80; |
110 | 143 |
s->com = 0; |
144 |
|
|
145 |
register_savevm("max111x", max111x_iid ++, 0, |
|
146 |
max111x_save, max111x_load, s); |
|
147 |
|
|
111 | 148 |
return s; |
112 | 149 |
} |
113 | 150 |
|
Also available in: Unified diff