ref: 65bf18d655db88faed69fdbc13a342500cef328a
dir: /v1/9/i2c.diff/
diff 90a08cf1fda8eaf4afe98f74a7572fb36b7ef369 uncommitted --- a/sys/src/9/bcm64/dat.h +++ b/sys/src/9/bcm64/dat.h @@ -15,6 +15,7 @@ typedef struct Conf Conf; typedef struct Confmem Confmem; typedef struct FPsave FPsave; +typedef struct I2Cdev I2Cdev; typedef struct PFPU PFPU; typedef struct ISAConf ISAConf; typedef struct Label Label; @@ -34,6 +35,7 @@ typedef uvlong Tval; typedef void KMap; + #pragma incomplete Pcidev #pragma incomplete Ureg @@ -110,6 +112,12 @@ ulong hz; /* processor cycle freq */ ulong mhz; int monitor; /* flag */ +}; + +struct I2Cdev { + int salen; + int addr; + int tenbit; }; /* --- a/sys/src/9/bcm64/fns.h +++ b/sys/src/9/bcm64/fns.h @@ -133,6 +133,11 @@ extern int gpiogetevent(uint); extern void gpiomeminit(void); +/* i2c */ +extern void i2csetup(int); +extern long i2crecv(I2Cdev*, void*, long, ulong); +extern long i2csend(I2Cdev*, void*, long, ulong); + /* arch */ extern void archreboot(void); extern char *cputype2name(char*, int); --- a/sys/src/9/bcm64/pi3 +++ b/sys/src/9/bcm64/pi3 @@ -18,6 +18,8 @@ mouse mouse uart gpio gpio gpio + i2c i2c + rtc7940x i2c sd usb dtracy