2 Copyright © 2010, The AROS Development Team. All rights reserved.
7 #include "nouveau_intern.h"
8 #include "nouveau_i2c.h"
10 #include <aros/symbolsets.h>
11 #include <aros/debug.h>
12 #include <proto/exec.h>
13 #include <proto/utility.h>
14 #include <proto/oop.h>
16 #undef HiddI2CNouveauAttrBase
17 #define HiddI2CNouveauAttrBase (SD(cl)->i2cNouveauAttrBase)
19 OOP_Object
* METHOD(NouveauI2C
, Root
, New
)
21 o
= (OOP_Object
*)OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
25 struct HIDDNouveauI2CData
* i2cdata
= OOP_INST_DATA(cl
, o
);
27 i2cdata
->i2c_chan
= GetTagData(aHidd_I2C_Nouveau_Chan
, (IPTR
)0, msg
->attrList
);
29 if (i2cdata
->i2c_chan
== (IPTR
)0)
31 /* Fail creation of driver is nouveau_i2c_chan was not passed */
32 OOP_MethodID disp_mid
= OOP_GetMethodID((STRPTR
)IID_Root
, moRoot_Dispose
);
33 OOP_CoerceMethod(cl
, o
, (OOP_Msg
) &disp_mid
);
41 void METHOD(NouveauI2C
, Hidd_I2C
, PutBits
)
43 struct HIDDNouveauI2CData
* i2cdata
= OOP_INST_DATA(cl
, o
);
44 struct nouveau_i2c_chan
* i2c_chan
= (struct nouveau_i2c_chan
*)i2cdata
->i2c_chan
;
46 i2c_chan
->bit
.setsda(i2c_chan
, msg
->sda
);
47 i2c_chan
->bit
.setscl(i2c_chan
, msg
->scl
);
50 void METHOD(NouveauI2C
, Hidd_I2C
, GetBits
)
52 struct HIDDNouveauI2CData
* i2cdata
= OOP_INST_DATA(cl
, o
);
53 struct nouveau_i2c_chan
* i2c_chan
= (struct nouveau_i2c_chan
*)i2cdata
->i2c_chan
;
55 *msg
->sda
= i2c_chan
->bit
.getsda(i2c_chan
);
56 *msg
->scl
= i2c_chan
->bit
.getscl(i2c_chan
);
59 ADD2LIBS((STRPTR
)"i2c.hidd", 0, static struct Library
*, I2CBase
);