Deleted Added
full compact
iiconf.h (38775) iiconf.h (40782)
1/*-
2 * Copyright (c) 1998 Nicolas Souchu
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1998 Nicolas Souchu
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id: iiconf.h,v 1.1.1.10 1998/08/13 17:10:43 son Exp $
26 * $Id: iiconf.h,v 1.1.1.1 1998/09/03 20:51:50 nsouch Exp $
27 */
28#ifndef __IICONF_H
29#define __IICONF_H
30
31#include <sys/queue.h>
32
33#define IICPRI PZERO+8 /* XXX sleep/wakeup queue priority */
34

--- 19 unchanged lines hidden (view full) ---

54/*
55 * i2c speed
56 */
57#define IIC_UNKNOWN 0x0
58#define IIC_SLOW 0x1
59#define IIC_FAST 0x2
60#define IIC_FASTEST 0x3
61
27 */
28#ifndef __IICONF_H
29#define __IICONF_H
30
31#include <sys/queue.h>
32
33#define IICPRI PZERO+8 /* XXX sleep/wakeup queue priority */
34

--- 19 unchanged lines hidden (view full) ---

54/*
55 * i2c speed
56 */
57#define IIC_UNKNOWN 0x0
58#define IIC_SLOW 0x1
59#define IIC_FAST 0x2
60#define IIC_FASTEST 0x3
61
62#define IIC_LAST_READ 0x1
63
62/*
64/*
65 * callback index
66 */
67#define IIC_REQUEST_BUS 0x1
68#define IIC_RELEASE_BUS 0x2
69
70/*
63 * interrupt events
64 */
65#define INTR_GENERAL 0x1 /* general call received */
66#define INTR_START 0x2 /* the I2C interface is addressed */
67#define INTR_STOP 0x3 /* stop condition received */
68#define INTR_RECEIVE 0x4 /* character received */
69#define INTR_TRANSMIT 0x5 /* character to transmit */
70#define INTR_ERROR 0x6 /* error */

--- 5 unchanged lines hidden (view full) ---

76#define IIC_NOERR 0x0 /* no error occured */
77#define IIC_EBUSERR 0x1 /* bus error */
78#define IIC_ENOACK 0x2 /* ack not received until timeout */
79#define IIC_ETIMEOUT 0x3 /* timeout */
80#define IIC_EBUSBSY 0x4 /* bus busy */
81#define IIC_ESTATUS 0x5 /* status error */
82#define IIC_EUNDERFLOW 0x6 /* slave ready for more data */
83#define IIC_EOVERFLOW 0x7 /* too much data */
71 * interrupt events
72 */
73#define INTR_GENERAL 0x1 /* general call received */
74#define INTR_START 0x2 /* the I2C interface is addressed */
75#define INTR_STOP 0x3 /* stop condition received */
76#define INTR_RECEIVE 0x4 /* character received */
77#define INTR_TRANSMIT 0x5 /* character to transmit */
78#define INTR_ERROR 0x6 /* error */

--- 5 unchanged lines hidden (view full) ---

84#define IIC_NOERR 0x0 /* no error occured */
85#define IIC_EBUSERR 0x1 /* bus error */
86#define IIC_ENOACK 0x2 /* ack not received until timeout */
87#define IIC_ETIMEOUT 0x3 /* timeout */
88#define IIC_EBUSBSY 0x4 /* bus busy */
89#define IIC_ESTATUS 0x5 /* status error */
90#define IIC_EUNDERFLOW 0x6 /* slave ready for more data */
91#define IIC_EOVERFLOW 0x7 /* too much data */
92#define IIC_ENOTSUPP 0x8 /* request not supported */
93#define IIC_ENOADDR 0x9 /* no address assigned to the interface */
84
85/*
86 * ivars codes
87 */
88#define IICBUS_IVAR_ADDR 0x1 /* I2C address of the device */
89
90extern int iicbus_request_bus(device_t, device_t, int);
91extern int iicbus_release_bus(device_t, device_t);
92extern device_t iicbus_alloc_bus(device_t);
93
94extern void iicbus_intr(device_t, int, char *);
95
94
95/*
96 * ivars codes
97 */
98#define IICBUS_IVAR_ADDR 0x1 /* I2C address of the device */
99
100extern int iicbus_request_bus(device_t, device_t, int);
101extern int iicbus_release_bus(device_t, device_t);
102extern device_t iicbus_alloc_bus(device_t);
103
104extern void iicbus_intr(device_t, int, char *);
105
96#define iicbus_repeated_start(bus,slave) \
97 (IICBUS_REPEATED_START(device_get_parent(bus), slave))
98#define iicbus_start(bus,slave) \
99 (IICBUS_START(device_get_parent(bus), slave))
106extern int iicbus_null_repeated_start(device_t, u_char);
107extern int iicbus_null_callback(device_t, int, caddr_t);
108
109#define iicbus_repeated_start(bus,slave,timeout) \
110 (IICBUS_REPEATED_START(device_get_parent(bus), slave, timeout))
111#define iicbus_start(bus,slave,timeout) \
112 (IICBUS_START(device_get_parent(bus), slave, timeout))
100#define iicbus_stop(bus) \
101 (IICBUS_STOP(device_get_parent(bus)))
113#define iicbus_stop(bus) \
114 (IICBUS_STOP(device_get_parent(bus)))
102#define iicbus_reset(bus,speed) \
103 (IICBUS_RESET(device_get_parent(bus), speed))
104#define iicbus_write(bus,buf,len,sent) \
105 (IICBUS_WRITE(device_get_parent(bus), buf, len, sent))
106#define iicbus_read(bus,buf,len,sent) \
107 (IICBUS_READ(device_get_parent(bus), buf, len, sent))
115#define iicbus_reset(bus,speed,addr,oldaddr) \
116 (IICBUS_RESET(device_get_parent(bus), speed, addr, oldaddr))
117#define iicbus_write(bus,buf,len,sent,timeout) \
118 (IICBUS_WRITE(device_get_parent(bus), buf, len, sent, timeout))
119#define iicbus_read(bus,buf,len,sent,last,delay) \
120 (IICBUS_READ(device_get_parent(bus), buf, len, sent, last, delay))
108
109extern int iicbus_block_write(device_t, u_char, char *, int, int *);
110extern int iicbus_block_read(device_t, u_char, char *, int, int *);
111
112extern u_char iicbus_get_addr(device_t);
121
122extern int iicbus_block_write(device_t, u_char, char *, int, int *);
123extern int iicbus_block_read(device_t, u_char, char *, int, int *);
124
125extern u_char iicbus_get_addr(device_t);
113extern u_char iicbus_get_own_address(device_t);
114
115#endif
126
127#endif