4 /* The QEMU I2C implementation only supports simple transfers that complete
5 immediately. It does not support slave devices that need to be able to
6 defer their response (eg. CPU slave interfaces where the data is supplied
7 by the device driver in response to an interrupt). */
13 I2C_NACK
/* Masker NACKed a receive byte. */
16 typedef struct i2c_slave i2c_slave
;
18 /* Master to slave. */
19 typedef int (*i2c_send_cb
)(i2c_slave
*s
, uint8_t data
);
20 /* Slave to master. */
21 typedef int (*i2c_recv_cb
)(i2c_slave
*s
);
22 /* Notify the slave of a bus state change. */
23 typedef void (*i2c_event_cb
)(i2c_slave
*s
, enum i2c_event event
);
27 /* Callbacks to be set by the device. */
32 /* Remaining fields for internal use by the I2C code. */
37 typedef struct i2c_bus i2c_bus
;
39 i2c_bus
*i2c_init_bus(void);
40 i2c_slave
*i2c_slave_init(i2c_bus
*bus
, int address
, int size
);
41 void i2c_set_slave_address(i2c_slave
*dev
, int address
);
42 int i2c_bus_busy(i2c_bus
*bus
);
43 int i2c_start_transfer(i2c_bus
*bus
, int address
, int recv
);
44 void i2c_end_transfer(i2c_bus
*bus
);
45 void i2c_nack(i2c_bus
*bus
);
46 int i2c_send(i2c_bus
*bus
, uint8_t data
);
47 int i2c_recv(i2c_bus
*bus
);
48 void i2c_bus_save(QEMUFile
*f
, i2c_bus
*bus
);
49 void i2c_bus_load(QEMUFile
*f
, i2c_bus
*bus
);
50 void i2c_slave_save(QEMUFile
*f
, i2c_slave
*dev
);
51 void i2c_slave_load(QEMUFile
*f
, i2c_slave
*dev
);
54 i2c_slave
*max7310_init(i2c_bus
*bus
);
55 void max7310_reset(i2c_slave
*i2c
);
56 qemu_irq
*max7310_gpio_in_get(i2c_slave
*i2c
);
57 void max7310_gpio_out_set(i2c_slave
*i2c
, int line
, qemu_irq handler
);
60 i2c_slave
*wm8750_init(i2c_bus
*bus
, AudioState
*audio
);
61 void wm8750_reset(i2c_slave
*i2c
);
62 void wm8750_data_req_set(i2c_slave
*i2c
,
63 void (*data_req
)(void *, int, int), void *opaque
);
64 void wm8750_dac_dat(void *opaque
, uint32_t sample
);
65 uint32_t wm8750_adc_dat(void *opaque
);