2 Copyright © 2010-2011, The AROS Development Team. All rights reserved.
8 #include <aros/debug.h>
9 #include <aros/symbolsets.h>
10 #include <aros/debug.h>
11 #include <proto/exec.h>
17 #include "intelG45_intern.h"
18 #include "intelG45_regs.h"
20 void METHOD(INTELI2C
, Hidd_I2C
, PutBits
)
22 struct g45staticdata
*sd
= SD(cl
);
27 val
= G45_GPIO_CLOCK_DIR_MASK
| G45_GPIO_CLOCK_DIR_VAL
;
28 /* update SCL value */
29 val
|= G45_GPIO_CLOCK_DATA_MASK
;
31 val
|= G45_GPIO_DATA_DIR_MASK
| G45_GPIO_DATA_DIR_VAL
;
32 /* update SDA value */
33 val
|= G45_GPIO_DATA_MASK
;
37 val
|= G45_GPIO_CLOCK_DATA_VAL
;
39 val
|= G45_GPIO_DATA_VAL
;
43 val
|= G45_GPIO_CLOCK_DIR_MASK
;
45 val
|= G45_GPIO_CLOCK_DIR_MASK
| G45_GPIO_CLOCK_DIR_VAL
| G45_GPIO_CLOCK_DATA_MASK
;
48 val
|= G45_GPIO_DATA_DIR_MASK
;
50 val
|= G45_GPIO_DATA_DIR_MASK
| G45_GPIO_DATA_DIR_VAL
| G45_GPIO_DATA_MASK
;
52 //D(bug("[GMA_I2C] Put: %08x -> %08x\n", val, sd->Card.MMIO + G45_GPIOA));
54 writel(val
, sd
->Card
.MMIO
+ sd
->DDCPort
);
55 val
= readl(sd
->Card
.MMIO
+ sd
->DDCPort
);
58 void METHOD(INTELI2C
, Hidd_I2C
, GetBits
)
60 struct g45staticdata
*sd
= SD(cl
);
63 /* release SCL and SDA lines */
64 // writel(/*G45_GPIO_CLOCK_DIR_MASK |*/ G45_GPIO_DATA_DIR_MASK, sd->Card.MMIO + G45_GPIOA);
65 // writel(0, sd->Card.MMIO + G45_GPIOA);
67 val
= readl(sd
->Card
.MMIO
+ sd
->DDCPort
);
69 //D(bug("[GMA_I2C] Get: %08x <- %08x\n", val, sd->Card.MMIO + G45_GPIOA));
70 *msg
->scl
= (val
& G45_GPIO_CLOCK_DATA_IN
) != 0;
71 *msg
->sda
= (val
& G45_GPIO_DATA_IN
) != 0;
75 static const struct OOP_MethodDescr INTELI2C_Hidd_I2C_descr
[] =
77 {(OOP_MethodFunc
)INTELI2C__Hidd_I2C__PutBits
, moHidd_I2C_PutBits
},
78 {(OOP_MethodFunc
)INTELI2C__Hidd_I2C__GetBits
, moHidd_I2C_GetBits
},
81 #define NUM_INTELI2C_Hidd_I2C_METHODS 2
83 const struct OOP_InterfaceDescr INTELI2C_ifdescr
[] =
85 {INTELI2C_Hidd_I2C_descr
, IID_Hidd_I2C
, NUM_INTELI2C_Hidd_I2C_METHODS
},
89 ADD2LIBS((STRPTR
)"i2c.hidd", 0, static struct Library
*, I2CBase
);