root/i2c/trunk/kernel/i2c-algo-biths.h @ 3750

Revision 3750, 3.0 KB (checked in by kmalkki, 10 years ago)

(Kyösti) Moved code sections from .h to .c as there was no reason to

keep them inlined.

Fix protocol byte dump. Compile bit-level protocol dump in by default.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* ------------------------------------------------------------------------- */
2/* i2c-algo-biths.h i2c driver algorithms for faster bit-shift adapters      */
3/* ------------------------------------------------------------------------- */
4/*   Copyright (C) 1995-99 Simon G. Vogl
5
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
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                */
19/* ------------------------------------------------------------------------- */
20
21/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
22   Frodo Looijaard <frodol@dds.nl> */
23
24/* $Id$ */
25
26#ifndef I2C_ALGO_BITHS_H
27#define I2C_ALGO_BITHS_H 1
28
29#include "i2c.h"
30#include <linux/sched.h>
31
32#if 1
33#define _HS_ATTR_
34#else
35#define _HS_ATTR_ __attribute__ ((regparm (2)))
36#endif
37
38#ifdef _HW_NO_INLINE_
39#define _HW_ATTR_ __attribute__ ((regparm (2)))
40#else
41#define _HW_ATTR_ inline
42#endif
43
44/* --- Defines for bit-adapters --------------------------------------- */
45/*
46 * This struct contains the hw-dependent functions of bit-style adapters to
47 * manipulate the line states, and to init any hw-specific features. This is
48 * only used if you have more than one hw-type of adapter running.
49 */
50struct i2c_algo_biths_data {
51        void *hw_data;          /* private data for lowlevel routines */
52        int hw_state;
53        void (*setscl)(void *hw_data, int hw_state) _HS_ATTR_ ;
54        void (*setsda)(void *hw_data, int hw_state) _HS_ATTR_ ;
55        int (*getscl) (void *hw_data) _HS_ATTR_ ;
56        int (*getsda) (void *hw_data) _HS_ATTR_ ;
57
58        void (*setstate)(struct i2c_algo_biths_data *adap) _HS_ATTR_ ;
59        void (*set_timer)(struct i2c_algo_biths_data *adap) _HS_ATTR_ ;
60        void (*run_timer)(struct i2c_algo_biths_data *adap) _HS_ATTR_ ;
61
62        short ctrl;
63        short errors;
64        char shiftreg;
65
66        /* local settings */
67        unsigned long bclock;
68        unsigned long xloops;   /* 1/4 clock-cycle time in x86 TSC ticks */
69                                /* i.e. bus clock is 250*0x10c6 / xloops kHz */
70
71        int timeout;            /* in jiffies */
72        char *name;             /* replicate i2c_adapter->name */
73        char *dstr;             /* protocol debug string */
74};
75
76#define I2C_BIT_ADAP_MAX        16
77
78#define _HS_SCL         0x0001
79#define _HS_SDA         0x0002
80#define _HS_SDA_FREE    0x0004  /* client has SDA control */
81#define _HS_STD_MODE    0x0008  /* drop speed to 100kHz */
82#define _HS_DBL_DT      0x0010  /* T_sclhi is twice longer */
83
84#define _HS_NAK         0x0001
85#define _HS_TIMEOUT     0x0002
86#define _HS_SDA_ARB     0x0004
87#define _HS_HW_FAIL     0x0008
88
89int i2c_biths_add_bus(struct i2c_adapter *);
90int i2c_biths_del_bus(struct i2c_adapter *);
91
92#endif /* I2C_ALGO_BITHS_H */
Note: See TracBrowser for help on using the browser.