ads1115 analog-to-digital 4-channel added
[i2c-telemetry.git] / smbus.h
1 /*
2     smbus.h - SMBus level access helper functions
3
4     Copyright (C) 1995-97 Simon G. Vogl
5     Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl>
6
7     This program is free software; you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by
9     the Free Software Foundation; either version 2 of the License, or
10     (at your option) any later version.
11
12     This program is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.
16
17     You should have received a copy of the GNU General Public License
18     along with this program; if not, write to the Free Software
19     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20     MA 02110-1301 USA.
21 */
22
23 #ifndef LIB_I2C_SMBUS_H
24 #define LIB_I2C_SMBUS_H
25
26 #include <linux/types.h>
27 #include <linux/i2c.h>
28
29 extern __s32 i2c_smbus_access(int file, char read_write, __u8 command,
30                               int size, union i2c_smbus_data *data);
31
32 extern __s32 i2c_smbus_write_quick(int file, __u8 value);
33 extern __s32 i2c_smbus_read_byte(int file);
34 extern __s32 i2c_smbus_write_byte(int file, __u8 value);
35 extern __s32 i2c_smbus_read_byte_data(int file, __u8 command);
36 extern __s32 i2c_smbus_write_byte_data(int file, __u8 command, __u8 value);
37 extern __s32 i2c_smbus_read_word_data(int file, __u8 command);
38 extern __s32 i2c_smbus_write_word_data(int file, __u8 command, __u16 value);
39 extern __s32 i2c_smbus_process_call(int file, __u8 command, __u16 value);
40
41 /* Returns the number of read bytes */
42 extern __s32 i2c_smbus_read_block_data(int file, __u8 command, __u8 *values);
43 extern __s32 i2c_smbus_write_block_data(int file, __u8 command, __u8 length,
44                                         const __u8 *values);
45
46 /* Returns the number of read bytes */
47 /* Until kernel 2.6.22, the length is hardcoded to 32 bytes. If you
48    ask for less than 32 bytes, your code will only work with kernels
49    2.6.23 and later. */
50 extern __s32 i2c_smbus_read_i2c_block_data(int file, __u8 command, __u8 length,
51                                            __u8 *values);
52 extern __s32 i2c_smbus_write_i2c_block_data(int file, __u8 command, __u8 length,
53                                             const __u8 *values);
54
55 /* Returns the number of read bytes */
56 extern __s32 i2c_smbus_block_process_call(int file, __u8 command, __u8 length,
57                                           __u8 *values);
58
59 #endif /* LIB_I2C_SMBUS_H */