8c2952457
김태훈
응용 프로그램 추가
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#ifndef _I2C_API_LIB_H_
#define _I2C_API_LIB_H_
#define I2C_RETRIES 0x0701 /* number of times a device address */
#define I2C_TIMEOUT 0x0702 /* set timeout - call with int */
#define I2C_SLAVE 0x0703 /* Change slave address */
#define I2C_SLAVE_FORCE 0x0706 /* Change slave address */
#define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */
#define I2C_FUNCS 0x0705 /* Get the adapter functionality */
#define I2C_RDWR 0x0707 /* Combined R/W transfer (one stop only)*/
#define I2C_PEC 0x0708 /* != 0 for SMBus PEC */
#define I2C_SMBUS 0x0720 /* SMBus-level access */
#define I2C_UDELAY 0x0705 /* set delay in microsecs between each */
#define I2C_MDELAY 0x0706 /* millisec delay between written bytes */
#define __u32 unsigned long
#define I2C_NO_ERROR 0000
#define I2C_UNKONW_COMMAND 7001
#define I2C_NOT_FIND_MAJOR 7002
#define I2C_NOT_FIND_BUS 7003
#define I2C_NOT_FIND_DEVICE 7004
#define I2C_READ_DEVICE 7005
#define I2C_WRITE_DEVICE 7006
typedef struct
{
int fd;
char node_fname[128];
} i2c_bus_t;
struct i2c_rdwr_ioctl_data
{
struct i2c_msg *msgs;
__u32 nmsgs;
};
typedef struct
{
int bus;
unsigned int addr;
int size;
unsigned char data[512];
} __attribute__ ((packed)) access_data_t;
extern int i2c_init ( void );
extern int i2c_get_bus_count ( void );
extern int i2c_read_data( access_data_t* access_data );
extern int i2c_write_data( access_data_t* access_data );
#endif
|