On 2 March 2012 11:35, Igor Mitsyanko<address@hidden> wrote:
Create 9 exynos4210 i2c interfaces.
Signed-off-by: Igor Mitsyanko<address@hidden>
+#define EXYNOS4_I2C(obj) \
+OBJECT_CHECK(Exynos4210I2CState, (obj), TYPE_EXYNOS4_I2C)
+#define EXYNOS4_I2C_SLAVE(obj) \
+OBJECT_CHECK(Exynos4210I2CSlave, (obj), TYPE_EXYNOS4_I2C_SLAVE)
Can you indent the second and subsequent lines of multi-line
macro definitions, please?
+enum {
+ idle,
+ start_bit_received,
+ sending_data,
+ receiving_data
+};
+
+struct Exynos4210I2CSlave {
+ I2CSlave i2c;
+ Exynos4210I2CState *host;
+ uint32_t status;
+};
I'm confused about the purpose of this class. My (possibly naive)
model of i2c is that there's a controller (in this case TYPE_EXYNOS4_I2C
, with its state in the struct Exynos4210I2CState) which is a subclass
of SysBus or whatever, and then there are i2c slaves, which are
subclasses of TYPE_I2C_SLAVE and communicate with the controller
strictly via the methods provided by the I2C_SLAVE class. But
this seems to be an I2CSlave subclass which has a direct pointer to
the internal state of the controller and very little state of its own.
What's it for?