From c0825c63cfae0d4af1f1f91867c42e609f3ed13c Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 18 Mar 2019 13:48:23 +0100 Subject: libqos: convert I2C to qgraph Create an i2c-bus interface, corresponding to the I2CAdapter struct. Wrap IMXI2C and OMAPI2C with a QOSGraphObject, and add the get_driver function to retrieve the I2CAdapter. The conversion is still not complete; for simplicity, i2c_recv and i2c_send (along with their wrappers) still take an adapter/address pair. Fixing that would be complicated until the tests are converted to qgraph, so it is left for after the conversion. Signed-off-by: Paolo Bonzini --- tests/libqos/i2c.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/libqos/i2c.c') diff --git a/tests/libqos/i2c.c b/tests/libqos/i2c.c index daf9a96617..8117d13170 100644 --- a/tests/libqos/i2c.c +++ b/tests/libqos/i2c.c @@ -68,3 +68,11 @@ void i2c_set16(I2CAdapter *i2c, uint8_t addr, uint8_t reg, data[1] = value & 255; i2c_write_block(i2c, addr, reg, data, sizeof(data)); } + +void *i2c_device_create(void *i2c_bus, QGuestAllocator *alloc, void *addr) +{ + QI2CDevice *i2cdev = g_new0(QI2CDevice, 1); + + i2cdev->bus = i2c_bus; + return &i2cdev->obj; +} -- cgit 1.4.1