i2c: rename i2c_slave -> I2CSlave

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Anthony Liguori 2011-12-04 20:28:27 -06:00
parent cd6c4cf28b
commit 9e07bdf816
15 changed files with 91 additions and 89 deletions

View File

@ -13,7 +13,7 @@
#include "i2c.h"
typedef struct {
i2c_slave i2c;
I2CSlave i2c;
time_t offset;
struct tm now;
uint8_t nvram[56];
@ -21,7 +21,7 @@ typedef struct {
int addr_byte;
} DS1338State;
static void ds1338_event(i2c_slave *i2c, enum i2c_event event)
static void ds1338_event(I2CSlave *i2c, enum i2c_event event)
{
DS1338State *s = FROM_I2C_SLAVE(DS1338State, i2c);
@ -51,7 +51,7 @@ static void ds1338_event(i2c_slave *i2c, enum i2c_event event)
}
}
static int ds1338_recv(i2c_slave *i2c)
static int ds1338_recv(I2CSlave *i2c)
{
DS1338State *s = FROM_I2C_SLAVE(DS1338State, i2c);
uint8_t res;
@ -61,7 +61,7 @@ static int ds1338_recv(i2c_slave *i2c)
return res;
}
static int ds1338_send(i2c_slave *i2c, uint8_t data)
static int ds1338_send(I2CSlave *i2c, uint8_t data)
{
DS1338State *s = FROM_I2C_SLAVE(DS1338State, i2c);
if (s->addr_byte) {
@ -113,7 +113,7 @@ static int ds1338_send(i2c_slave *i2c, uint8_t data)
return 0;
}
static int ds1338_init(i2c_slave *i2c)
static int ds1338_init(I2CSlave *i2c)
{
return 0;
}

View File

@ -12,8 +12,8 @@
struct i2c_bus
{
BusState qbus;
i2c_slave *current_dev;
i2c_slave *dev;
I2CSlave *current_dev;
I2CSlave *dev;
uint8_t saved_address;
};
@ -21,7 +21,7 @@ static struct BusInfo i2c_bus_info = {
.name = "I2C",
.size = sizeof(i2c_bus),
.props = (Property[]) {
DEFINE_PROP_UINT8("address", struct i2c_slave, address, 0),
DEFINE_PROP_UINT8("address", struct I2CSlave, address, 0),
DEFINE_PROP_END_OF_LIST(),
}
};
@ -66,7 +66,7 @@ i2c_bus *i2c_init_bus(DeviceState *parent, const char *name)
return bus;
}
void i2c_set_slave_address(i2c_slave *dev, uint8_t address)
void i2c_set_slave_address(I2CSlave *dev, uint8_t address)
{
dev->address = address;
}
@ -82,10 +82,10 @@ int i2c_bus_busy(i2c_bus *bus)
int i2c_start_transfer(i2c_bus *bus, uint8_t address, int recv)
{
DeviceState *qdev;
i2c_slave *slave = NULL;
I2CSlave *slave = NULL;
QTAILQ_FOREACH(qdev, &bus->qbus.children, sibling) {
i2c_slave *candidate = I2C_SLAVE_FROM_QDEV(qdev);
I2CSlave *candidate = I2C_SLAVE_FROM_QDEV(qdev);
if (candidate->address == address) {
slave = candidate;
break;
@ -104,7 +104,7 @@ int i2c_start_transfer(i2c_bus *bus, uint8_t address, int recv)
void i2c_end_transfer(i2c_bus *bus)
{
i2c_slave *dev = bus->current_dev;
I2CSlave *dev = bus->current_dev;
if (!dev)
return;
@ -116,7 +116,7 @@ void i2c_end_transfer(i2c_bus *bus)
int i2c_send(i2c_bus *bus, uint8_t data)
{
i2c_slave *dev = bus->current_dev;
I2CSlave *dev = bus->current_dev;
if (!dev)
return -1;
@ -126,7 +126,7 @@ int i2c_send(i2c_bus *bus, uint8_t data)
int i2c_recv(i2c_bus *bus)
{
i2c_slave *dev = bus->current_dev;
I2CSlave *dev = bus->current_dev;
if (!dev)
return -1;
@ -136,7 +136,7 @@ int i2c_recv(i2c_bus *bus)
void i2c_nack(i2c_bus *bus)
{
i2c_slave *dev = bus->current_dev;
I2CSlave *dev = bus->current_dev;
if (!dev)
return;
@ -146,7 +146,7 @@ void i2c_nack(i2c_bus *bus)
static int i2c_slave_post_load(void *opaque, int version_id)
{
i2c_slave *dev = opaque;
I2CSlave *dev = opaque;
i2c_bus *bus;
bus = FROM_QBUS(i2c_bus, qdev_get_parent_bus(&dev->qdev));
if (bus->saved_address == dev->address) {
@ -156,13 +156,13 @@ static int i2c_slave_post_load(void *opaque, int version_id)
}
const VMStateDescription vmstate_i2c_slave = {
.name = "i2c_slave",
.name = "I2CSlave",
.version_id = 1,
.minimum_version_id = 1,
.minimum_version_id_old = 1,
.post_load = i2c_slave_post_load,
.fields = (VMStateField []) {
VMSTATE_UINT8(address, i2c_slave),
VMSTATE_UINT8(address, I2CSlave),
VMSTATE_END_OF_LIST()
}
};
@ -170,7 +170,7 @@ const VMStateDescription vmstate_i2c_slave = {
static int i2c_slave_qdev_init(DeviceState *dev, DeviceInfo *base)
{
I2CSlaveInfo *info = container_of(base, I2CSlaveInfo, qdev);
i2c_slave *s = I2C_SLAVE_FROM_QDEV(dev);
I2CSlave *s = I2C_SLAVE_FROM_QDEV(dev);
s->info = info;
@ -179,7 +179,7 @@ static int i2c_slave_qdev_init(DeviceState *dev, DeviceInfo *base)
void i2c_register_slave(I2CSlaveInfo *info)
{
assert(info->qdev.size >= sizeof(i2c_slave));
assert(info->qdev.size >= sizeof(I2CSlave));
info->qdev.init = i2c_slave_qdev_init;
info->qdev.bus_info = &i2c_bus_info;
qdev_register(&info->qdev);

View File

@ -15,14 +15,16 @@ enum i2c_event {
I2C_NACK /* Masker NACKed a receive byte. */
};
/* Master to slave. */
typedef int (*i2c_send_cb)(i2c_slave *s, uint8_t data);
/* Slave to master. */
typedef int (*i2c_recv_cb)(i2c_slave *s);
/* Notify the slave of a bus state change. */
typedef void (*i2c_event_cb)(i2c_slave *s, enum i2c_event event);
typedef struct I2CSlave I2CSlave;
typedef int (*i2c_slave_initfn)(i2c_slave *dev);
/* Master to slave. */
typedef int (*i2c_send_cb)(I2CSlave *s, uint8_t data);
/* Slave to master. */
typedef int (*i2c_recv_cb)(I2CSlave *s);
/* Notify the slave of a bus state change. */
typedef void (*i2c_event_cb)(I2CSlave *s, enum i2c_event event);
typedef int (*i2c_slave_initfn)(I2CSlave *dev);
typedef struct {
DeviceInfo qdev;
@ -34,7 +36,7 @@ typedef struct {
i2c_send_cb send;
} I2CSlaveInfo;
struct i2c_slave
struct I2CSlave
{
DeviceState qdev;
I2CSlaveInfo *info;
@ -44,7 +46,7 @@ struct i2c_slave
};
i2c_bus *i2c_init_bus(DeviceState *parent, const char *name);
void i2c_set_slave_address(i2c_slave *dev, uint8_t address);
void i2c_set_slave_address(I2CSlave *dev, uint8_t address);
int i2c_bus_busy(i2c_bus *bus);
int i2c_start_transfer(i2c_bus *bus, uint8_t address, int recv);
void i2c_end_transfer(i2c_bus *bus);
@ -52,7 +54,7 @@ void i2c_nack(i2c_bus *bus);
int i2c_send(i2c_bus *bus, uint8_t data);
int i2c_recv(i2c_bus *bus);
#define I2C_SLAVE_FROM_QDEV(dev) DO_UPCAST(i2c_slave, qdev, dev)
#define I2C_SLAVE_FROM_QDEV(dev) DO_UPCAST(I2CSlave, qdev, dev)
#define FROM_I2C_SLAVE(type, dev) DO_UPCAST(type, i2c, dev)
void i2c_register_slave(I2CSlaveInfo *type);
@ -69,7 +71,7 @@ void wm8750_dac_commit(void *opaque);
void wm8750_set_bclk_in(void *opaque, int new_hz);
/* tmp105.c */
void tmp105_set(i2c_slave *i2c, int temp);
void tmp105_set(I2CSlave *i2c, int temp);
/* lm832x.c */
void lm832x_key_event(DeviceState *dev, int key, int state);
@ -78,10 +80,10 @@ extern const VMStateDescription vmstate_i2c_slave;
#define VMSTATE_I2C_SLAVE(_field, _state) { \
.name = (stringify(_field)), \
.size = sizeof(i2c_slave), \
.size = sizeof(I2CSlave), \
.vmsd = &vmstate_i2c_slave, \
.flags = VMS_STRUCT, \
.offset = vmstate_offset_value(_state, _field, i2c_slave), \
.offset = vmstate_offset_value(_state, _field, I2CSlave), \
}
#endif

View File

@ -24,7 +24,7 @@
#include "console.h"
typedef struct {
i2c_slave i2c;
I2CSlave i2c;
uint8_t i2c_dir;
uint8_t i2c_cycle;
uint8_t reg;
@ -378,7 +378,7 @@ static void lm_kbd_write(LM823KbdState *s, int reg, int byte, uint8_t value)
}
}
static void lm_i2c_event(i2c_slave *i2c, enum i2c_event event)
static void lm_i2c_event(I2CSlave *i2c, enum i2c_event event)
{
LM823KbdState *s = FROM_I2C_SLAVE(LM823KbdState, i2c);
@ -394,14 +394,14 @@ static void lm_i2c_event(i2c_slave *i2c, enum i2c_event event)
}
}
static int lm_i2c_rx(i2c_slave *i2c)
static int lm_i2c_rx(I2CSlave *i2c)
{
LM823KbdState *s = FROM_I2C_SLAVE(LM823KbdState, i2c);
return lm_kbd_read(s, s->reg, s->i2c_cycle ++);
}
static int lm_i2c_tx(i2c_slave *i2c, uint8_t data)
static int lm_i2c_tx(I2CSlave *i2c, uint8_t data)
{
LM823KbdState *s = (LM823KbdState *) i2c;
@ -458,7 +458,7 @@ static const VMStateDescription vmstate_lm_kbd = {
};
static int lm8323_init(i2c_slave *i2c)
static int lm8323_init(I2CSlave *i2c)
{
LM823KbdState *s = FROM_I2C_SLAVE(LM823KbdState, i2c);

View File

@ -10,7 +10,7 @@
#include "i2c.h"
typedef struct {
i2c_slave i2c;
I2CSlave i2c;
int i2c_command_byte;
int len;
@ -33,7 +33,7 @@ static void max7310_reset(DeviceState *dev)
s->command = 0x00;
}
static int max7310_rx(i2c_slave *i2c)
static int max7310_rx(I2CSlave *i2c)
{
MAX7310State *s = (MAX7310State *) i2c;
@ -68,7 +68,7 @@ static int max7310_rx(i2c_slave *i2c)
return 0xff;
}
static int max7310_tx(i2c_slave *i2c, uint8_t data)
static int max7310_tx(I2CSlave *i2c, uint8_t data)
{
MAX7310State *s = (MAX7310State *) i2c;
uint8_t diff;
@ -123,7 +123,7 @@ static int max7310_tx(i2c_slave *i2c, uint8_t data)
return 0;
}
static void max7310_event(i2c_slave *i2c, enum i2c_event event)
static void max7310_event(I2CSlave *i2c, enum i2c_event event)
{
MAX7310State *s = (MAX7310State *) i2c;
s->len = 0;
@ -175,7 +175,7 @@ static void max7310_gpio_set(void *opaque, int line, int level)
/* MAX7310 is SMBus-compatible (can be used with only SMBus protocols),
* but also accepts sequences that are not SMBus so return an I2C device. */
static int max7310_init(i2c_slave *i2c)
static int max7310_init(I2CSlave *i2c)
{
MAX7310State *s = FROM_I2C_SLAVE(MAX7310State, i2c);

View File

@ -1243,7 +1243,7 @@ static SysBusDeviceInfo pxa2xx_rtc_sysbus_info = {
/* I2C Interface */
typedef struct {
i2c_slave i2c;
I2CSlave i2c;
PXA2xxI2CState *host;
} PXA2xxI2CSlaveState;
@ -1279,7 +1279,7 @@ static void pxa2xx_i2c_update(PXA2xxI2CState *s)
}
/* These are only stubs now. */
static void pxa2xx_i2c_event(i2c_slave *i2c, enum i2c_event event)
static void pxa2xx_i2c_event(I2CSlave *i2c, enum i2c_event event)
{
PXA2xxI2CSlaveState *slave = FROM_I2C_SLAVE(PXA2xxI2CSlaveState, i2c);
PXA2xxI2CState *s = slave->host;
@ -1303,7 +1303,7 @@ static void pxa2xx_i2c_event(i2c_slave *i2c, enum i2c_event event)
pxa2xx_i2c_update(s);
}
static int pxa2xx_i2c_rx(i2c_slave *i2c)
static int pxa2xx_i2c_rx(I2CSlave *i2c)
{
PXA2xxI2CSlaveState *slave = FROM_I2C_SLAVE(PXA2xxI2CSlaveState, i2c);
PXA2xxI2CState *s = slave->host;
@ -1318,7 +1318,7 @@ static int pxa2xx_i2c_rx(i2c_slave *i2c)
return s->data;
}
static int pxa2xx_i2c_tx(i2c_slave *i2c, uint8_t data)
static int pxa2xx_i2c_tx(I2CSlave *i2c, uint8_t data)
{
PXA2xxI2CSlaveState *slave = FROM_I2C_SLAVE(PXA2xxI2CSlaveState, i2c);
PXA2xxI2CState *s = slave->host;
@ -1466,7 +1466,7 @@ static const VMStateDescription vmstate_pxa2xx_i2c = {
}
};
static int pxa2xx_i2c_slave_init(i2c_slave *i2c)
static int pxa2xx_i2c_slave_init(I2CSlave *i2c)
{
/* Nothing to do. */
return 0;

View File

@ -65,7 +65,7 @@ static void smbus_do_write(SMBusDevice *dev)
}
}
static void smbus_i2c_event(i2c_slave *s, enum i2c_event event)
static void smbus_i2c_event(I2CSlave *s, enum i2c_event event)
{
SMBusDevice *dev = FROM_I2C_SLAVE(SMBusDevice, s);
@ -148,7 +148,7 @@ static void smbus_i2c_event(i2c_slave *s, enum i2c_event event)
}
}
static int smbus_i2c_recv(i2c_slave *s)
static int smbus_i2c_recv(I2CSlave *s)
{
SMBusDeviceInfo *t = container_of(s->info, SMBusDeviceInfo, i2c);
SMBusDevice *dev = FROM_I2C_SLAVE(SMBusDevice, s);
@ -182,7 +182,7 @@ static int smbus_i2c_recv(i2c_slave *s)
return ret;
}
static int smbus_i2c_send(i2c_slave *s, uint8_t data)
static int smbus_i2c_send(I2CSlave *s, uint8_t data)
{
SMBusDevice *dev = FROM_I2C_SLAVE(SMBusDevice, s);
@ -198,7 +198,7 @@ static int smbus_i2c_send(i2c_slave *s, uint8_t data)
return 0;
}
static int smbus_device_init(i2c_slave *i2c)
static int smbus_device_init(I2CSlave *i2c)
{
SMBusDeviceInfo *t = container_of(i2c->info, SMBusDeviceInfo, i2c);
SMBusDevice *dev = FROM_I2C_SLAVE(SMBusDevice, i2c);

View File

@ -26,7 +26,7 @@
struct SMBusDevice {
/* The SMBus protocol is implemented on top of I2C. */
i2c_slave i2c;
I2CSlave i2c;
/* Remaining fields for internal use only. */
int mode;

View File

@ -717,7 +717,7 @@ static void spitz_microdrive_attach(PXA2xxState *cpu, int slot)
static void spitz_wm8750_addr(void *opaque, int line, int level)
{
i2c_slave *wm = (i2c_slave *) opaque;
I2CSlave *wm = (I2CSlave *) opaque;
if (level)
i2c_set_slave_address(wm, SPITZ_WM_ADDRH);
else

View File

@ -42,7 +42,7 @@ enum ssd0303_cmd {
};
typedef struct {
i2c_slave i2c;
I2CSlave i2c;
DisplayState *ds;
int row;
int col;
@ -57,13 +57,13 @@ typedef struct {
uint8_t framebuffer[132*8];
} ssd0303_state;
static int ssd0303_recv(i2c_slave *i2c)
static int ssd0303_recv(I2CSlave *i2c)
{
BADF("Reads not implemented\n");
return -1;
}
static int ssd0303_send(i2c_slave *i2c, uint8_t data)
static int ssd0303_send(I2CSlave *i2c, uint8_t data)
{
ssd0303_state *s = (ssd0303_state *)i2c;
enum ssd0303_cmd old_cmd_state;
@ -173,7 +173,7 @@ static int ssd0303_send(i2c_slave *i2c, uint8_t data)
return 0;
}
static void ssd0303_event(i2c_slave *i2c, enum i2c_event event)
static void ssd0303_event(I2CSlave *i2c, enum i2c_event event)
{
ssd0303_state *s = (ssd0303_state *)i2c;
switch (event) {
@ -283,7 +283,7 @@ static const VMStateDescription vmstate_ssd0303 = {
}
};
static int ssd0303_init(i2c_slave *i2c)
static int ssd0303_init(I2CSlave *i2c)
{
ssd0303_state *s = FROM_I2C_SLAVE(ssd0303_state, i2c);

View File

@ -22,7 +22,7 @@
#include "i2c.h"
typedef struct {
i2c_slave i2c;
I2CSlave i2c;
uint8_t len;
uint8_t buf[2];
qemu_irq pin;
@ -65,7 +65,7 @@ static void tmp105_alarm_update(TMP105State *s)
}
/* Units are 0.001 centigrades relative to 0 C. */
void tmp105_set(i2c_slave *i2c, int temp)
void tmp105_set(I2CSlave *i2c, int temp)
{
TMP105State *s = (TMP105State *) i2c;
@ -138,7 +138,7 @@ static void tmp105_write(TMP105State *s)
}
}
static int tmp105_rx(i2c_slave *i2c)
static int tmp105_rx(I2CSlave *i2c)
{
TMP105State *s = (TMP105State *) i2c;
@ -148,7 +148,7 @@ static int tmp105_rx(i2c_slave *i2c)
return 0xff;
}
static int tmp105_tx(i2c_slave *i2c, uint8_t data)
static int tmp105_tx(I2CSlave *i2c, uint8_t data)
{
TMP105State *s = (TMP105State *) i2c;
@ -163,7 +163,7 @@ static int tmp105_tx(i2c_slave *i2c, uint8_t data)
return 0;
}
static void tmp105_event(i2c_slave *i2c, enum i2c_event event)
static void tmp105_event(I2CSlave *i2c, enum i2c_event event)
{
TMP105State *s = (TMP105State *) i2c;
@ -202,7 +202,7 @@ static const VMStateDescription vmstate_tmp105 = {
}
};
static void tmp105_reset(i2c_slave *i2c)
static void tmp105_reset(I2CSlave *i2c)
{
TMP105State *s = (TMP105State *) i2c;
@ -215,7 +215,7 @@ static void tmp105_reset(i2c_slave *i2c)
tmp105_interrupt_update(s);
}
static int tmp105_init(i2c_slave *i2c)
static int tmp105_init(I2CSlave *i2c)
{
TMP105State *s = FROM_I2C_SLAVE(TMP105State, i2c);

View File

@ -133,12 +133,12 @@ static int tosa_ssp_init(SSISlave *dev)
}
typedef struct {
i2c_slave i2c;
I2CSlave i2c;
int len;
char buf[3];
} TosaDACState;
static int tosa_dac_send(i2c_slave *i2c, uint8_t data)
static int tosa_dac_send(I2CSlave *i2c, uint8_t data)
{
TosaDACState *s = FROM_I2C_SLAVE(TosaDACState, i2c);
s->buf[s->len] = data;
@ -157,7 +157,7 @@ static int tosa_dac_send(i2c_slave *i2c, uint8_t data)
return 0;
}
static void tosa_dac_event(i2c_slave *i2c, enum i2c_event event)
static void tosa_dac_event(I2CSlave *i2c, enum i2c_event event)
{
TosaDACState *s = FROM_I2C_SLAVE(TosaDACState, i2c);
s->len = 0;
@ -180,13 +180,13 @@ static void tosa_dac_event(i2c_slave *i2c, enum i2c_event event)
}
}
static int tosa_dac_recv(i2c_slave *s)
static int tosa_dac_recv(I2CSlave *s)
{
printf("%s: recv not supported!!!\n", __FUNCTION__);
return -1;
}
static int tosa_dac_init(i2c_slave *i2c)
static int tosa_dac_init(I2CSlave *i2c)
{
/* Nothing to do. */
return 0;

View File

@ -27,7 +27,7 @@
#define VERBOSE 1
typedef struct {
i2c_slave i2c;
I2CSlave i2c;
int firstbyte;
uint8_t reg;
@ -126,7 +126,7 @@ static void menelaus_rtc_hz(void *opaque)
menelaus_update(s);
}
static void menelaus_reset(i2c_slave *i2c)
static void menelaus_reset(I2CSlave *i2c)
{
MenelausState *s = (MenelausState *) i2c;
s->reg = 0x00;
@ -709,7 +709,7 @@ static void menelaus_write(void *opaque, uint8_t addr, uint8_t value)
}
}
static void menelaus_event(i2c_slave *i2c, enum i2c_event event)
static void menelaus_event(I2CSlave *i2c, enum i2c_event event)
{
MenelausState *s = (MenelausState *) i2c;
@ -717,7 +717,7 @@ static void menelaus_event(i2c_slave *i2c, enum i2c_event event)
s->firstbyte = 1;
}
static int menelaus_tx(i2c_slave *i2c, uint8_t data)
static int menelaus_tx(I2CSlave *i2c, uint8_t data)
{
MenelausState *s = (MenelausState *) i2c;
/* Interpret register address byte */
@ -730,7 +730,7 @@ static int menelaus_tx(i2c_slave *i2c, uint8_t data)
return 0;
}
static int menelaus_rx(i2c_slave *i2c)
static int menelaus_rx(I2CSlave *i2c)
{
MenelausState *s = (MenelausState *) i2c;
@ -842,7 +842,7 @@ static const VMStateDescription vmstate_menelaus = {
}
};
static int twl92230_init(i2c_slave *i2c)
static int twl92230_init(I2CSlave *i2c)
{
MenelausState *s = FROM_I2C_SLAVE(MenelausState, i2c);

View File

@ -24,7 +24,7 @@ typedef struct {
} WMRate;
typedef struct {
i2c_slave i2c;
I2CSlave i2c;
uint8_t i2c_data[2];
int i2c_len;
QEMUSoundCard card;
@ -254,7 +254,7 @@ static void wm8750_clk_update(WM8750State *s, int ext)
}
}
static void wm8750_reset(i2c_slave *i2c)
static void wm8750_reset(I2CSlave *i2c)
{
WM8750State *s = (WM8750State *) i2c;
s->rate = &wm_rate_table[0];
@ -297,7 +297,7 @@ static void wm8750_reset(i2c_slave *i2c)
s->i2c_len = 0;
}
static void wm8750_event(i2c_slave *i2c, enum i2c_event event)
static void wm8750_event(I2CSlave *i2c, enum i2c_event event)
{
WM8750State *s = (WM8750State *) i2c;
@ -354,7 +354,7 @@ static void wm8750_event(i2c_slave *i2c, enum i2c_event event)
#define WM8750_ROUT2V 0x29
#define WM8750_MOUTV 0x2a
static int wm8750_tx(i2c_slave *i2c, uint8_t data)
static int wm8750_tx(I2CSlave *i2c, uint8_t data)
{
WM8750State *s = (WM8750State *) i2c;
uint8_t cmd;
@ -554,7 +554,7 @@ static int wm8750_tx(i2c_slave *i2c, uint8_t data)
return 0;
}
static int wm8750_rx(i2c_slave *i2c)
static int wm8750_rx(I2CSlave *i2c)
{
return 0x00;
}
@ -609,7 +609,7 @@ static const VMStateDescription vmstate_wm8750 = {
}
};
static int wm8750_init(i2c_slave *i2c)
static int wm8750_init(I2CSlave *i2c)
{
WM8750State *s = FROM_I2C_SLAVE(WM8750State, i2c);
@ -620,7 +620,7 @@ static int wm8750_init(i2c_slave *i2c)
}
#if 0
static void wm8750_fini(i2c_slave *i2c)
static void wm8750_fini(I2CSlave *i2c)
{
WM8750State *s = (WM8750State *) i2c;
wm8750_reset(&s->i2c);

10
hw/z2.c
View File

@ -190,12 +190,12 @@ static DeviceInfo zipit_lcd_info = {
};
typedef struct {
i2c_slave i2c;
I2CSlave i2c;
int len;
uint8_t buf[3];
} AER915State;
static int aer915_send(i2c_slave *i2c, uint8_t data)
static int aer915_send(I2CSlave *i2c, uint8_t data)
{
AER915State *s = FROM_I2C_SLAVE(AER915State, i2c);
s->buf[s->len] = data;
@ -213,7 +213,7 @@ static int aer915_send(i2c_slave *i2c, uint8_t data)
return 0;
}
static void aer915_event(i2c_slave *i2c, enum i2c_event event)
static void aer915_event(I2CSlave *i2c, enum i2c_event event)
{
AER915State *s = FROM_I2C_SLAVE(AER915State, i2c);
switch (event) {
@ -232,7 +232,7 @@ static void aer915_event(i2c_slave *i2c, enum i2c_event event)
}
}
static int aer915_recv(i2c_slave *slave)
static int aer915_recv(I2CSlave *slave)
{
int retval = 0x00;
AER915State *s = FROM_I2C_SLAVE(AER915State, slave);
@ -255,7 +255,7 @@ static int aer915_recv(i2c_slave *slave)
return retval;
}
static int aer915_init(i2c_slave *i2c)
static int aer915_init(I2CSlave *i2c)
{
/* Nothing to do. */
return 0;