]>
git.proxmox.com Git - mirror_qemu.git/blob - tests/libqos/i2c.h
4 * Copyright (c) 2012 Andreas Färber
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
13 #include "libqos/qgraph.h"
15 typedef struct I2CAdapter I2CAdapter
;
17 void (*send
)(I2CAdapter
*adapter
, uint8_t addr
,
18 const uint8_t *buf
, uint16_t len
);
19 void (*recv
)(I2CAdapter
*adapter
, uint8_t addr
,
20 uint8_t *buf
, uint16_t len
);
25 typedef struct QI2CDevice QI2CDevice
;
28 * For now, all devices are simple enough that there is no need for
29 * them to define their own constructor and get_driver functions.
30 * Therefore, QOSGraphObject is included directly in QI2CDevice;
31 * the tests expect to get a QI2CDevice rather than doing something
32 * like obj->get_driver("i2c-device").
34 * In fact there is no i2c-device interface even, because there are
35 * no generic I2C tests).
41 void *i2c_device_create(void *i2c_bus
, QGuestAllocator
*alloc
, void *addr
);
43 void i2c_send(I2CAdapter
*i2c
, uint8_t addr
,
44 const uint8_t *buf
, uint16_t len
);
45 void i2c_recv(I2CAdapter
*i2c
, uint8_t addr
,
46 uint8_t *buf
, uint16_t len
);
48 void i2c_read_block(I2CAdapter
*i2c
, uint8_t addr
, uint8_t reg
,
49 uint8_t *buf
, uint16_t len
);
50 void i2c_write_block(I2CAdapter
*i2c
, uint8_t addr
, uint8_t reg
,
51 const uint8_t *buf
, uint16_t len
);
52 uint8_t i2c_get8(I2CAdapter
*i2c
, uint8_t addr
, uint8_t reg
);
53 uint16_t i2c_get16(I2CAdapter
*i2c
, uint8_t addr
, uint8_t reg
);
54 void i2c_set8(I2CAdapter
*i2c
, uint8_t addr
, uint8_t reg
,
56 void i2c_set16(I2CAdapter
*i2c
, uint8_t addr
, uint8_t reg
,
60 typedef struct OMAPI2C
{
67 void omap_i2c_init(OMAPI2C
*s
, QTestState
*qts
, uint64_t addr
);
70 typedef struct IMXI2C
{
77 void imx_i2c_init(IMXI2C
*s
, QTestState
*qts
, uint64_t addr
);
78 I2CAdapter
*imx_i2c_create(QTestState
*qts
, uint64_t addr
);
79 void imx_i2c_free(I2CAdapter
*i2c
);