Revision bcbe8068 hw/i2c.c
b/hw/i2c.c | ||
---|---|---|
142 | 142 |
dev->info->event(dev, I2C_NACK); |
143 | 143 |
} |
144 | 144 |
|
145 |
void i2c_slave_save(QEMUFile *f, i2c_slave *dev) |
|
146 |
{ |
|
147 |
qemu_put_8s(f, &dev->address); |
|
148 |
} |
|
149 |
|
|
150 |
void i2c_slave_load(QEMUFile *f, i2c_slave *dev) |
|
145 |
static int i2c_slave_post_load(void *opaque, int version_id) |
|
151 | 146 |
{ |
147 |
i2c_slave *dev = opaque; |
|
152 | 148 |
i2c_bus *bus; |
153 | 149 |
bus = FROM_QBUS(i2c_bus, qdev_get_parent_bus(&dev->qdev)); |
154 |
qemu_get_8s(f, &dev->address); |
|
155 | 150 |
if (bus->saved_address == dev->address) { |
156 | 151 |
bus->current_dev = dev; |
157 | 152 |
} |
153 |
return 0; |
|
154 |
} |
|
155 |
|
|
156 |
static const VMStateDescription vmstate_i2c_slave = { |
|
157 |
.name = "i2c_slave", |
|
158 |
.version_id = 1, |
|
159 |
.minimum_version_id = 1, |
|
160 |
.minimum_version_id_old = 1, |
|
161 |
.post_load = i2c_slave_post_load, |
|
162 |
.fields = (VMStateField []) { |
|
163 |
VMSTATE_UINT8(address, i2c_slave), |
|
164 |
VMSTATE_END_OF_LIST() |
|
165 |
} |
|
166 |
}; |
|
167 |
|
|
168 |
void i2c_slave_save(QEMUFile *f, i2c_slave *dev) |
|
169 |
{ |
|
170 |
vmstate_save_state(f, &vmstate_i2c_slave, dev); |
|
171 |
} |
|
172 |
|
|
173 |
void i2c_slave_load(QEMUFile *f, i2c_slave *dev) |
|
174 |
{ |
|
175 |
vmstate_load_state(f, &vmstate_i2c_slave, dev, |
|
176 |
vmstate_i2c_slave.version_id); |
|
158 | 177 |
} |
159 | 178 |
|
160 | 179 |
static int i2c_slave_qdev_init(DeviceState *dev, DeviceInfo *base) |
Also available in: Unified diff