summary refs log tree commit diff stats
path: root/tests/libqos/i2c.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-03-18 13:48:23 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2019-06-03 14:03:02 +0200
commitc0825c63cfae0d4af1f1f91867c42e609f3ed13c (patch)
treedb8d1f421d002e0490db979aee276c320a0c3a64 /tests/libqos/i2c.c
parent732c919cf04c0aaf1b092238e8b84cdb7adf657a (diff)
downloadfocaccia-qemu-c0825c63cfae0d4af1f1f91867c42e609f3ed13c.tar.gz
focaccia-qemu-c0825c63cfae0d4af1f1f91867c42e609f3ed13c.zip
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 <pbonzini@redhat.com>
Diffstat (limited to 'tests/libqos/i2c.c')
-rw-r--r--tests/libqos/i2c.c8
1 files changed, 8 insertions, 0 deletions
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;
+}