1 /*
2  * adapted from different kernel headers
3  * "this is the current way of doing things."-Greg K-H
4  *
5  * everything copied from linux kernel 2.6.10 source
6  */
7 
8 #ifndef _DIB_I2C_H
9 #define _DIB_I2C_H
10 
11 #ifdef __FreeBSD__
12 #define __u8 uint8_t
13 #define __u16 uint16_t
14 #define __u32 uint32_t
15 #define __u64 uint64_t
16 #define __s16 int16_t
17 #define __s32 int32_t
18 #endif
19 
20 /* from <linux/i2c.h> */
21 #define I2C_SLAVE       0x0703
22 #define I2C_SLAVE_FORCE 0x0706
23 #define I2C_TENBIT      0x0704
24 #define I2C_PEC         0x0708
25 #define I2C_RETRIES     0x0701
26 #define I2C_TIMEOUT     0x0702
27 
28 #define I2C_FUNCS       0x0705
29 #define I2C_RDWR        0x0707
30 #define I2C_SMBUS       0x0720
31 
32 struct i2c_msg {
33 	__u16 addr;
34 	__u16 flags;
35 #define I2C_M_RD            0x0001
36 #define I2C_M_TEN           0x0010
37 #define I2C_M_NOSTART       0x4000
38 #define I2C_M_REV_DIR_ADDR  0x2000
39 #define I2C_M_IGNORE_NAK    0x1000
40 #define I2C_M_NO_RD_ACK     0x0800
41 	__u16 len;
42 	__u8 *buf;
43 };
44 
45 /* from <linux/i2c-dev.h> */
46 struct i2c_rdwr_ioctl_data {
47 	struct i2c_msg *msgs;
48 	__u32 nmsgs;
49 };
50 
51 #endif
52