mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
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>
This commit is contained in:
parent
c4f00daa5b
commit
732c919cf0
5 changed files with 67 additions and 34 deletions
|
@ -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 */
|
||||
I2CAdapter *omap_i2c_create(QTestState *qts, uint64_t addr);
|
||||
/* i2c-omap.c */
|
||||
typedef struct OMAPI2C {
|
||||
I2CAdapter parent;
|
||||
|
||||
/* libi2c-imx.c */
|
||||
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;
|
||||
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue