smbus.h 2.4 KB

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