i2c-algo-pcf.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* -------------------------------------------------------------------- */
  2. /* i2c-pcf8584.h: PCF 8584 global defines */
  3. /* -------------------------------------------------------------------- */
  4. /* Copyright (C) 1996 Simon G. Vogl
  5. 1999 Hans Berglund
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  17. MA 02110-1301 USA. */
  18. /* -------------------------------------------------------------------- */
  19. /* With some changes from Frodo Looijaard <frodol@dds.nl> */
  20. #ifndef I2C_PCF8584_H
  21. #define I2C_PCF8584_H 1
  22. /* ----- Control register bits ---------------------------------------- */
  23. #define I2C_PCF_PIN 0x80
  24. #define I2C_PCF_ESO 0x40
  25. #define I2C_PCF_ES1 0x20
  26. #define I2C_PCF_ES2 0x10
  27. #define I2C_PCF_ENI 0x08
  28. #define I2C_PCF_STA 0x04
  29. #define I2C_PCF_STO 0x02
  30. #define I2C_PCF_ACK 0x01
  31. #define I2C_PCF_START (I2C_PCF_PIN | I2C_PCF_ESO | I2C_PCF_STA | I2C_PCF_ACK)
  32. #define I2C_PCF_STOP (I2C_PCF_PIN | I2C_PCF_ESO | I2C_PCF_STO | I2C_PCF_ACK)
  33. #define I2C_PCF_REPSTART ( I2C_PCF_ESO | I2C_PCF_STA | I2C_PCF_ACK)
  34. #define I2C_PCF_IDLE (I2C_PCF_PIN | I2C_PCF_ESO | I2C_PCF_ACK)
  35. /* ----- Status register bits ----------------------------------------- */
  36. /*#define I2C_PCF_PIN 0x80 as above*/
  37. #define I2C_PCF_INI 0x40 /* 1 if not initialized */
  38. #define I2C_PCF_STS 0x20
  39. #define I2C_PCF_BER 0x10
  40. #define I2C_PCF_AD0 0x08
  41. #define I2C_PCF_LRB 0x08
  42. #define I2C_PCF_AAS 0x04
  43. #define I2C_PCF_LAB 0x02
  44. #define I2C_PCF_BB 0x01
  45. /* ----- Chip clock frequencies --------------------------------------- */
  46. #define I2C_PCF_CLK3 0x00
  47. #define I2C_PCF_CLK443 0x10
  48. #define I2C_PCF_CLK6 0x14
  49. #define I2C_PCF_CLK 0x18
  50. #define I2C_PCF_CLK12 0x1c
  51. /* ----- transmission frequencies ------------------------------------- */
  52. #define I2C_PCF_TRNS90 0x00 /* 90 kHz */
  53. #define I2C_PCF_TRNS45 0x01 /* 45 kHz */
  54. #define I2C_PCF_TRNS11 0x02 /* 11 kHz */
  55. #define I2C_PCF_TRNS15 0x03 /* 1.5 kHz */
  56. /* ----- Access to internal registers according to ES1,ES2 ------------ */
  57. /* they are mapped to the data port ( a0 = 0 ) */
  58. /* available when ESO == 0 : */
  59. #define I2C_PCF_OWNADR 0
  60. #define I2C_PCF_INTREG I2C_PCF_ES2
  61. #define I2C_PCF_CLKREG I2C_PCF_ES1
  62. #endif /* I2C_PCF8584_H */