aboutsummaryrefslogtreecommitdiff
path: root/tests/libqos/i2c.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-03-18 17:12:25 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2019-06-03 14:03:02 +0200
commit732c919cf04c0aaf1b092238e8b84cdb7adf657a (patch)
tree6b43291940e84e3c850e48d6987ca08c67c4d309 /tests/libqos/i2c.h
parentc4f00daa5b390a74f13a271e7237e173c527bbce (diff)
libqos: split I2CAdapter initialization and allocation
Provide *_init functions that populate an I2CAdapter struct without allocating one, and make the existing *_create functions wrap them. Because in the new setup *_create might return a pointer inside the IMXI2C or OMAPI2C struct, create companion *_free functions to go back to the outer pointer. All this is temporary until allocation will be handled entirely by qgraph. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tests/libqos/i2c.h')
-rw-r--r--tests/libqos/i2c.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/libqos/i2c.h b/tests/libqos/i2c.h
index a462114597..877d2ab0e8 100644
--- a/tests/libqos/i2c.h
+++ b/tests/libqos/i2c.h
@@ -39,10 +39,26 @@ void i2c_set8(I2CAdapter *i2c, uint8_t addr, uint8_t reg,
void i2c_set16(I2CAdapter *i2c, uint8_t addr, uint8_t reg,
uint16_t value);
-/* libi2c-omap.c */
+/* i2c-omap.c */
+typedef struct OMAPI2C {
+ I2CAdapter parent;
+
+ uint64_t addr;
+} OMAPI2C;
+
+void omap_i2c_init(OMAPI2C *s, QTestState *qts, uint64_t addr);
I2CAdapter *omap_i2c_create(QTestState *qts, uint64_t addr);
+void omap_i2c_free(I2CAdapter *i2c);
+
+/* i2c-imx.c */
+typedef struct IMXI2C {
+ I2CAdapter parent;
+
+ uint64_t addr;
+} IMXI2C;
-/* libi2c-imx.c */
+void imx_i2c_init(IMXI2C *s, QTestState *qts, uint64_t addr);
I2CAdapter *imx_i2c_create(QTestState *qts, uint64_t addr);
+void imx_i2c_free(I2CAdapter *i2c);
#endif