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 QI2CAddress QI2CAddress;
30 typedef struct QI2CDevice QI2CDevice;
33 * For now, all devices are simple enough that there is no need for
34 * them to define their own constructor and get_driver functions.
35 * Therefore, QOSGraphObject is included directly in QI2CDevice;
36 * the tests expect to get a QI2CDevice rather than doing something
37 * like obj->get_driver("i2c-device").
39 * In fact there is no i2c-device interface even, because there are
40 * no generic I2C tests).
47 void *i2c_device_create(void *i2c_bus, QGuestAllocator *alloc, void *addr);
48 void add_qi2c_address(QOSGraphEdgeOptions *opts, QI2CAddress *addr);
50 void i2c_send(QI2CDevice *dev, const uint8_t *buf, uint16_t len);
51 void i2c_recv(QI2CDevice *dev, uint8_t *buf, uint16_t len);
53 void i2c_read_block(QI2CDevice *dev, uint8_t reg,
54 uint8_t *buf, uint16_t len);
55 void i2c_write_block(QI2CDevice *dev, uint8_t reg,
56 const uint8_t *buf, uint16_t len);
57 uint8_t i2c_get8(QI2CDevice *dev, uint8_t reg);
58 uint16_t i2c_get16(QI2CDevice *dev, uint8_t reg);
59 void i2c_set8(QI2CDevice *dev, uint8_t reg, uint8_t value);
60 void i2c_set16(QI2CDevice *dev, uint8_t reg, uint16_t value);
63 typedef struct OMAPI2C {
70 void omap_i2c_init(OMAPI2C *s, QTestState *qts, uint64_t addr);
73 typedef struct IMXI2C {
80 void imx_i2c_init(IMXI2C *s, QTestState *qts, uint64_t addr);