Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /* -------------------------------------------------------------------- */
0003 /* i2c-pcf8584.h: PCF 8584 global defines               */
0004 /* -------------------------------------------------------------------- */
0005 /*   Copyright (C) 1996 Simon G. Vogl
0006                    1999 Hans Berglund
0007 
0008  */
0009 /* -------------------------------------------------------------------- */
0010 
0011 /* With some changes from Frodo Looijaard <frodol@dds.nl> */
0012 
0013 #ifndef I2C_PCF8584_H
0014 #define I2C_PCF8584_H 1
0015 
0016 /* ----- Control register bits ---------------------------------------- */
0017 #define I2C_PCF_PIN 0x80
0018 #define I2C_PCF_ESO 0x40
0019 #define I2C_PCF_ES1 0x20
0020 #define I2C_PCF_ES2 0x10
0021 #define I2C_PCF_ENI 0x08
0022 #define I2C_PCF_STA 0x04
0023 #define I2C_PCF_STO 0x02
0024 #define I2C_PCF_ACK 0x01
0025 
0026 #define I2C_PCF_START    (I2C_PCF_PIN | I2C_PCF_ESO | I2C_PCF_STA | I2C_PCF_ACK)
0027 #define I2C_PCF_STOP     (I2C_PCF_PIN | I2C_PCF_ESO | I2C_PCF_STO | I2C_PCF_ACK)
0028 #define I2C_PCF_REPSTART (              I2C_PCF_ESO | I2C_PCF_STA | I2C_PCF_ACK)
0029 #define I2C_PCF_IDLE     (I2C_PCF_PIN | I2C_PCF_ESO               | I2C_PCF_ACK)
0030 
0031 /* ----- Status register bits ----------------------------------------- */
0032 /*#define I2C_PCF_PIN  0x80    as above*/
0033 
0034 #define I2C_PCF_INI 0x40   /* 1 if not initialized */
0035 #define I2C_PCF_STS 0x20
0036 #define I2C_PCF_BER 0x10
0037 #define I2C_PCF_AD0 0x08
0038 #define I2C_PCF_LRB 0x08
0039 #define I2C_PCF_AAS 0x04
0040 #define I2C_PCF_LAB 0x02
0041 #define I2C_PCF_BB  0x01
0042 
0043 /* ----- Chip clock frequencies --------------------------------------- */
0044 #define I2C_PCF_CLK3    0x00
0045 #define I2C_PCF_CLK443  0x10
0046 #define I2C_PCF_CLK6    0x14
0047 #define I2C_PCF_CLK 0x18
0048 #define I2C_PCF_CLK12   0x1c
0049 
0050 /* ----- transmission frequencies ------------------------------------- */
0051 #define I2C_PCF_TRNS90 0x00 /*  90 kHz */
0052 #define I2C_PCF_TRNS45 0x01 /*  45 kHz */
0053 #define I2C_PCF_TRNS11 0x02 /*  11 kHz */
0054 #define I2C_PCF_TRNS15 0x03 /* 1.5 kHz */
0055 
0056 
0057 /* ----- Access to internal registers according to ES1,ES2 ------------ */
0058 /* they are mapped to the data port ( a0 = 0 )              */
0059 /* available when ESO == 0 :                        */
0060 
0061 #define I2C_PCF_OWNADR  0
0062 #define I2C_PCF_INTREG  I2C_PCF_ES2
0063 #define I2C_PCF_CLKREG  I2C_PCF_ES1
0064 
0065 #endif /* I2C_PCF8584_H */